mirror of
https://github.com/sigp/lighthouse.git
synced 2026-04-16 20:39:10 +00:00
add epoch processing new tests
This commit is contained in:
@@ -10,6 +10,9 @@ use state_processing::per_epoch_processing::capella::process_historical_summarie
|
|||||||
use state_processing::per_epoch_processing::effective_balance_updates::{
|
use state_processing::per_epoch_processing::effective_balance_updates::{
|
||||||
process_effective_balance_updates, process_effective_balance_updates_slow,
|
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::{
|
use state_processing::per_epoch_processing::{
|
||||||
altair, base,
|
altair, base,
|
||||||
historical_roots_update::process_historical_roots_update,
|
historical_roots_update::process_historical_roots_update,
|
||||||
@@ -53,6 +56,10 @@ pub struct Slashings;
|
|||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
pub struct Eth1DataReset;
|
pub struct Eth1DataReset;
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
|
pub struct PendingBalanceDeposits;
|
||||||
|
#[derive(Debug)]
|
||||||
|
pub struct PendingConsolidations;
|
||||||
|
#[derive(Debug)]
|
||||||
pub struct EffectiveBalanceUpdates;
|
pub struct EffectiveBalanceUpdates;
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
pub struct SlashingsReset;
|
pub struct SlashingsReset;
|
||||||
@@ -79,6 +86,8 @@ type_name!(RewardsAndPenalties, "rewards_and_penalties");
|
|||||||
type_name!(RegistryUpdates, "registry_updates");
|
type_name!(RegistryUpdates, "registry_updates");
|
||||||
type_name!(Slashings, "slashings");
|
type_name!(Slashings, "slashings");
|
||||||
type_name!(Eth1DataReset, "eth1_data_reset");
|
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!(EffectiveBalanceUpdates, "effective_balance_updates");
|
||||||
type_name!(SlashingsReset, "slashings_reset");
|
type_name!(SlashingsReset, "slashings_reset");
|
||||||
type_name!(RandaoMixesReset, "randao_mixes_reset");
|
type_name!(RandaoMixesReset, "randao_mixes_reset");
|
||||||
@@ -178,6 +187,34 @@ impl<E: EthSpec> EpochTransition<E> for Eth1DataReset {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl<E: EthSpec> EpochTransition<E> for PendingBalanceDeposits {
|
||||||
|
fn run(state: &mut BeaconState<E>, spec: &ChainSpec) -> Result<(), EpochProcessingError> {
|
||||||
|
process_epoch_single_pass(
|
||||||
|
state,
|
||||||
|
spec,
|
||||||
|
SinglePassConfig {
|
||||||
|
pending_balance_deposits: true,
|
||||||
|
..SinglePassConfig::disable_all()
|
||||||
|
},
|
||||||
|
)
|
||||||
|
.map(|_| ())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl<E: EthSpec> EpochTransition<E> for PendingConsolidations {
|
||||||
|
fn run(state: &mut BeaconState<E>, spec: &ChainSpec) -> Result<(), EpochProcessingError> {
|
||||||
|
process_epoch_single_pass(
|
||||||
|
state,
|
||||||
|
spec,
|
||||||
|
SinglePassConfig {
|
||||||
|
pending_consolidations: true,
|
||||||
|
..SinglePassConfig::disable_all()
|
||||||
|
},
|
||||||
|
)
|
||||||
|
.map(|_| ())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
impl<E: EthSpec> EpochTransition<E> for EffectiveBalanceUpdates {
|
impl<E: EthSpec> EpochTransition<E> for EffectiveBalanceUpdates {
|
||||||
fn run(state: &mut BeaconState<E>, spec: &ChainSpec) -> Result<(), EpochProcessingError> {
|
fn run(state: &mut BeaconState<E>, spec: &ChainSpec) -> Result<(), EpochProcessingError> {
|
||||||
if let BeaconState::Base(_) = state {
|
if let BeaconState::Base(_) = state {
|
||||||
|
|||||||
@@ -664,6 +664,18 @@ fn epoch_processing_eth1_data_reset() {
|
|||||||
EpochProcessingHandler::<MainnetEthSpec, Eth1DataReset>::default().run();
|
EpochProcessingHandler::<MainnetEthSpec, Eth1DataReset>::default().run();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn epoch_processing_pending_balance_deposits() {
|
||||||
|
EpochProcessingHandler::<MinimalEthSpec, PendingBalanceDeposits>::default().run();
|
||||||
|
EpochProcessingHandler::<MainnetEthSpec, PendingBalanceDeposits>::default().run();
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn epoch_processing_pending_consolidations() {
|
||||||
|
EpochProcessingHandler::<MinimalEthSpec, PendingConsolidations>::default().run();
|
||||||
|
EpochProcessingHandler::<MainnetEthSpec, PendingConsolidations>::default().run();
|
||||||
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn epoch_processing_effective_balance_updates() {
|
fn epoch_processing_effective_balance_updates() {
|
||||||
EpochProcessingHandler::<MinimalEthSpec, EffectiveBalanceUpdates>::default().run();
|
EpochProcessingHandler::<MinimalEthSpec, EffectiveBalanceUpdates>::default().run();
|
||||||
|
|||||||
Reference in New Issue
Block a user