use super::*; use crate::case_result::compare_beacon_state_results_without_caches; use serde_derive::Deserialize; use state_processing::per_epoch_processing::process_final_updates; use types::{BeaconState, EthSpec}; #[derive(Debug, Clone, Deserialize)] #[serde(bound = "E: EthSpec")] pub struct EpochProcessingFinalUpdates { pub description: String, pub pre: BeaconState, pub post: Option>, } impl YamlDecode for EpochProcessingFinalUpdates { fn yaml_decode(yaml: &str) -> Result { Ok(serde_yaml::from_str(yaml).unwrap()) } } impl Case for EpochProcessingFinalUpdates { fn description(&self) -> String { self.description.clone() } fn result(&self, _case_index: usize) -> Result<(), Error> { let mut state = self.pre.clone(); let mut expected = self.post.clone(); let spec = &E::default_spec(); let mut result = (|| { // Processing requires the epoch cache. state.build_all_caches(spec)?; process_final_updates(&mut state, spec).map(|_| state) })(); compare_beacon_state_results_without_caches(&mut result, &mut expected) } }