use super::*; use crate::case_result::compare_beacon_state_results_without_caches; use serde_derive::Deserialize; use state_processing::per_block_processing::process_deposits; use types::{BeaconState, Deposit, EthSpec}; #[derive(Debug, Clone, Deserialize)] pub struct OperationsDeposit { pub description: String, #[serde(bound = "E: EthSpec")] pub pre: BeaconState, pub deposit: Deposit, #[serde(bound = "E: EthSpec")] pub post: Option>, } impl YamlDecode for OperationsDeposit { fn yaml_decode(yaml: &String) -> Result { Ok(serde_yaml::from_str(&yaml.as_str()).unwrap()) } } impl Case for OperationsDeposit { fn description(&self) -> String { self.description.clone() } fn result(&self, _case_index: usize) -> Result<(), Error> { let mut state = self.pre.clone(); let deposit = self.deposit.clone(); let mut expected = self.post.clone(); let result = process_deposits(&mut state, &[deposit], &E::spec()); let mut result = result.and_then(|_| Ok(state)); compare_beacon_state_results_without_caches(&mut result, &mut expected) } }