Avoid building caches during block replay (#783)

Also, make the ExitCache safe.
This commit is contained in:
Michael Sproul
2020-01-09 11:43:11 +11:00
committed by GitHub
parent da95a73605
commit d9e9c17d3b
6 changed files with 69 additions and 27 deletions

View File

@@ -133,8 +133,8 @@ impl<E: EthSpec, T: EpochTransition<E>> Case for EpochProcessing<E, T> {
let spec = &E::default_spec();
let mut result = (|| {
// Processing requires the epoch cache.
state.build_all_caches(spec)?;
// Processing requires the committee caches.
state.build_all_committee_caches(spec)?;
T::run(&mut state, spec).map(|_| state)
})();

View File

@@ -174,8 +174,10 @@ impl<E: EthSpec, O: Operation<E>> Case for Operations<E, O> {
let mut state = self.pre.clone();
let mut expected = self.post.clone();
// Processing requires the epoch cache.
state.build_all_caches(spec).unwrap();
// Processing requires the committee caches.
state
.build_all_committee_caches(spec)
.expect("committee caches OK");
let mut result = self.operation.apply_to(&mut state, spec).map(|()| state);