From 0c875b02e032ebd9bebd822183a1c3d10d333a4c Mon Sep 17 00:00:00 2001 From: realbigsean Date: Sat, 20 Jan 2024 17:11:57 -0500 Subject: [PATCH] fix tests --- .../proto_array/src/fork_choice_test_definition.rs | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/consensus/proto_array/src/fork_choice_test_definition.rs b/consensus/proto_array/src/fork_choice_test_definition.rs index ebb639819d2..b669ec95e93 100644 --- a/consensus/proto_array/src/fork_choice_test_definition.rs +++ b/consensus/proto_array/src/fork_choice_test_definition.rs @@ -91,6 +91,7 @@ impl ForkChoiceTestDefinition { ) .expect("should create fork choice struct"); let equivocating_indices = BTreeSet::new(); + let mut latest_justified = self.justified_checkpoint.epoch; for (op_index, op) in self.operations.into_iter().enumerate() { match op.clone() { @@ -100,6 +101,8 @@ impl ForkChoiceTestDefinition { justified_state_balances, expected_head, } => { + let current_epoch = + std::cmp::max(justified_checkpoint.epoch, latest_justified) + 3; let justified_balances = JustifiedBalances::from_effective_balances(justified_state_balances) .unwrap(); @@ -110,7 +113,7 @@ impl ForkChoiceTestDefinition { &justified_balances, Hash256::zero(), &equivocating_indices, - Slot::new(0), + current_epoch.start_slot(MainnetEthSpec::slots_per_epoch()), &spec, ) .unwrap_or_else(|e| { @@ -131,6 +134,8 @@ impl ForkChoiceTestDefinition { expected_head, proposer_boost_root, } => { + let current_epoch = + std::cmp::max(justified_checkpoint.epoch, latest_justified) + 3; let justified_balances = JustifiedBalances::from_effective_balances(justified_state_balances) .unwrap(); @@ -141,7 +146,7 @@ impl ForkChoiceTestDefinition { &justified_balances, proposer_boost_root, &equivocating_indices, - Slot::new(0), + current_epoch.start_slot(MainnetEthSpec::slots_per_epoch()), &spec, ) .unwrap_or_else(|e| { @@ -160,6 +165,8 @@ impl ForkChoiceTestDefinition { finalized_checkpoint, justified_state_balances, } => { + let current_epoch = + std::cmp::max(justified_checkpoint.epoch, latest_justified) + 3; let justified_balances = JustifiedBalances::from_effective_balances(justified_state_balances) .unwrap(); @@ -169,7 +176,7 @@ impl ForkChoiceTestDefinition { &justified_balances, Hash256::zero(), &equivocating_indices, - Slot::new(0), + current_epoch.start_slot(MainnetEthSpec::slots_per_epoch()), &spec, ); @@ -188,6 +195,7 @@ impl ForkChoiceTestDefinition { justified_checkpoint, finalized_checkpoint, } => { + latest_justified = std::cmp::max(justified_checkpoint.epoch, latest_justified); let block = Block { slot, root,