mirror of
https://github.com/sigp/lighthouse.git
synced 2026-04-18 21:38:31 +00:00
Implement tree hash caching (#584)
* Implement basic tree hash caching * Use spaces to indent top-level Cargo.toml * Optimize BLS tree hash by hashing bytes directly * Implement tree hash caching for validator registry * Persist BeaconState tree hash cache to disk * Address Paul's review comments
This commit is contained in:
@@ -99,7 +99,7 @@ macro_rules! ssz_static_test {
|
||||
($test_name:ident, $typ:ident$(<$generics:tt>)?, SR) => {
|
||||
ssz_static_test!($test_name, SszStaticSRHandler, $typ$(<$generics>)?);
|
||||
};
|
||||
// Non-signed root
|
||||
// Non-signed root, non-tree hash caching
|
||||
($test_name:ident, $typ:ident$(<$generics:tt>)?) => {
|
||||
ssz_static_test!($test_name, SszStaticHandler, $typ$(<$generics>)?);
|
||||
};
|
||||
@@ -122,11 +122,11 @@ macro_rules! ssz_static_test {
|
||||
);
|
||||
};
|
||||
// Base case
|
||||
($test_name:ident, $handler:ident, { $(($typ:ty, $spec:ident)),+ }) => {
|
||||
($test_name:ident, $handler:ident, { $(($($typ:ty),+)),+ }) => {
|
||||
#[test]
|
||||
fn $test_name() {
|
||||
$(
|
||||
$handler::<$typ, $spec>::run();
|
||||
$handler::<$($typ),+>::run();
|
||||
)+
|
||||
}
|
||||
};
|
||||
@@ -134,7 +134,7 @@ macro_rules! ssz_static_test {
|
||||
|
||||
#[cfg(feature = "fake_crypto")]
|
||||
mod ssz_static {
|
||||
use ef_tests::{Handler, SszStaticHandler, SszStaticSRHandler};
|
||||
use ef_tests::{Handler, SszStaticHandler, SszStaticSRHandler, SszStaticTHCHandler};
|
||||
use types::*;
|
||||
|
||||
ssz_static_test!(attestation, Attestation<_>, SR);
|
||||
@@ -147,7 +147,13 @@ mod ssz_static {
|
||||
ssz_static_test!(beacon_block, BeaconBlock<_>, SR);
|
||||
ssz_static_test!(beacon_block_body, BeaconBlockBody<_>);
|
||||
ssz_static_test!(beacon_block_header, BeaconBlockHeader, SR);
|
||||
ssz_static_test!(beacon_state, BeaconState<_>);
|
||||
ssz_static_test!(
|
||||
beacon_state,
|
||||
SszStaticTHCHandler, {
|
||||
(BeaconState<MinimalEthSpec>, BeaconTreeHashCache, MinimalEthSpec),
|
||||
(BeaconState<MainnetEthSpec>, BeaconTreeHashCache, MainnetEthSpec)
|
||||
}
|
||||
);
|
||||
ssz_static_test!(checkpoint, Checkpoint);
|
||||
ssz_static_test!(compact_committee, CompactCommittee<_>);
|
||||
ssz_static_test!(crosslink, Crosslink);
|
||||
|
||||
Reference in New Issue
Block a user