From 89ef043491461237e982bc86ad3717ab64b4e075 Mon Sep 17 00:00:00 2001 From: realbigsean Date: Sun, 12 May 2024 06:53:52 -0400 Subject: [PATCH] add epoch processing new tests --- .../ef_tests/src/cases/epoch_processing.rs | 37 +++++++++++++++++++ testing/ef_tests/tests/tests.rs | 12 ++++++ 2 files changed, 49 insertions(+) diff --git a/testing/ef_tests/src/cases/epoch_processing.rs b/testing/ef_tests/src/cases/epoch_processing.rs index c4c592e4cf..5943e72b57 100644 --- a/testing/ef_tests/src/cases/epoch_processing.rs +++ b/testing/ef_tests/src/cases/epoch_processing.rs @@ -10,6 +10,9 @@ use state_processing::per_epoch_processing::capella::process_historical_summarie use state_processing::per_epoch_processing::effective_balance_updates::{ process_effective_balance_updates, process_effective_balance_updates_slow, }; +use state_processing::per_epoch_processing::single_pass::{ + process_epoch_single_pass, SinglePassConfig, +}; use state_processing::per_epoch_processing::{ altair, base, historical_roots_update::process_historical_roots_update, @@ -53,6 +56,10 @@ pub struct Slashings; #[derive(Debug)] pub struct Eth1DataReset; #[derive(Debug)] +pub struct PendingBalanceDeposits; +#[derive(Debug)] +pub struct PendingConsolidations; +#[derive(Debug)] pub struct EffectiveBalanceUpdates; #[derive(Debug)] pub struct SlashingsReset; @@ -79,6 +86,8 @@ type_name!(RewardsAndPenalties, "rewards_and_penalties"); type_name!(RegistryUpdates, "registry_updates"); type_name!(Slashings, "slashings"); type_name!(Eth1DataReset, "eth1_data_reset"); +type_name!(PendingBalanceDeposits, "pending_balance_deposits"); +type_name!(PendingConsolidations, "pending_consolidations"); type_name!(EffectiveBalanceUpdates, "effective_balance_updates"); type_name!(SlashingsReset, "slashings_reset"); type_name!(RandaoMixesReset, "randao_mixes_reset"); @@ -178,6 +187,34 @@ impl EpochTransition for Eth1DataReset { } } +impl EpochTransition for PendingBalanceDeposits { + fn run(state: &mut BeaconState, spec: &ChainSpec) -> Result<(), EpochProcessingError> { + process_epoch_single_pass( + state, + spec, + SinglePassConfig { + pending_balance_deposits: true, + ..SinglePassConfig::disable_all() + }, + ) + .map(|_| ()) + } +} + +impl EpochTransition for PendingConsolidations { + fn run(state: &mut BeaconState, spec: &ChainSpec) -> Result<(), EpochProcessingError> { + process_epoch_single_pass( + state, + spec, + SinglePassConfig { + pending_consolidations: true, + ..SinglePassConfig::disable_all() + }, + ) + .map(|_| ()) + } +} + impl EpochTransition for EffectiveBalanceUpdates { fn run(state: &mut BeaconState, spec: &ChainSpec) -> Result<(), EpochProcessingError> { if let BeaconState::Base(_) = state { diff --git a/testing/ef_tests/tests/tests.rs b/testing/ef_tests/tests/tests.rs index 1947dd4b41..f9879cdbcf 100644 --- a/testing/ef_tests/tests/tests.rs +++ b/testing/ef_tests/tests/tests.rs @@ -664,6 +664,18 @@ fn epoch_processing_eth1_data_reset() { EpochProcessingHandler::::default().run(); } +#[test] +fn epoch_processing_pending_balance_deposits() { + EpochProcessingHandler::::default().run(); + EpochProcessingHandler::::default().run(); +} + +#[test] +fn epoch_processing_pending_consolidations() { + EpochProcessingHandler::::default().run(); + EpochProcessingHandler::::default().run(); +} + #[test] fn epoch_processing_effective_balance_updates() { EpochProcessingHandler::::default().run();