mirror of
https://github.com/sigp/lighthouse.git
synced 2026-04-17 12:58:31 +00:00
Implement tree states & hierarchical state DB
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
use super::*;
|
||||
use crate::bls_setting::BlsSetting;
|
||||
use crate::case_result::compare_beacon_state_results_without_caches;
|
||||
use crate::case_result::{check_state_diff, compare_beacon_state_results_without_caches};
|
||||
use crate::decode::{ssz_decode_file, ssz_decode_file_with, ssz_decode_state, yaml_decode_file};
|
||||
use crate::testing_spec;
|
||||
use serde_derive::Deserialize;
|
||||
@@ -452,9 +452,8 @@ impl<E: EthSpec, O: Operation<E>> Case for Operations<E, O> {
|
||||
|
||||
fn result(&self, _case_index: usize, fork_name: ForkName) -> Result<(), Error> {
|
||||
let spec = &testing_spec::<E>(fork_name);
|
||||
let mut state = self.pre.clone();
|
||||
let mut expected = self.post.clone();
|
||||
|
||||
let mut pre_state = self.pre.clone();
|
||||
// Processing requires the committee caches.
|
||||
// NOTE: some of the withdrawals tests have 0 active validators, do not try
|
||||
// to build the commitee cache in this case.
|
||||
@@ -462,6 +461,13 @@ impl<E: EthSpec, O: Operation<E>> Case for Operations<E, O> {
|
||||
state.build_all_committee_caches(spec).unwrap();
|
||||
}
|
||||
|
||||
let mut state = pre_state.clone();
|
||||
let mut expected = self.post.clone();
|
||||
|
||||
if let Some(post_state) = expected.as_mut() {
|
||||
post_state.build_all_committee_caches(spec).unwrap();
|
||||
}
|
||||
|
||||
let mut result = self
|
||||
.operation
|
||||
.as_ref()
|
||||
@@ -469,6 +475,7 @@ impl<E: EthSpec, O: Operation<E>> Case for Operations<E, O> {
|
||||
.apply_to(&mut state, spec, self)
|
||||
.map(|()| state);
|
||||
|
||||
check_state_diff(&pre_state, &expected)?;
|
||||
compare_beacon_state_results_without_caches(&mut result, &mut expected)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user