fix tests

This commit is contained in:
realbigsean
2024-01-20 17:11:57 -05:00
parent c84536a8eb
commit 0c875b02e0

View File

@@ -91,6 +91,7 @@ impl ForkChoiceTestDefinition {
) )
.expect("should create fork choice struct"); .expect("should create fork choice struct");
let equivocating_indices = BTreeSet::new(); let equivocating_indices = BTreeSet::new();
let mut latest_justified = self.justified_checkpoint.epoch;
for (op_index, op) in self.operations.into_iter().enumerate() { for (op_index, op) in self.operations.into_iter().enumerate() {
match op.clone() { match op.clone() {
@@ -100,6 +101,8 @@ impl ForkChoiceTestDefinition {
justified_state_balances, justified_state_balances,
expected_head, expected_head,
} => { } => {
let current_epoch =
std::cmp::max(justified_checkpoint.epoch, latest_justified) + 3;
let justified_balances = let justified_balances =
JustifiedBalances::from_effective_balances(justified_state_balances) JustifiedBalances::from_effective_balances(justified_state_balances)
.unwrap(); .unwrap();
@@ -110,7 +113,7 @@ impl ForkChoiceTestDefinition {
&justified_balances, &justified_balances,
Hash256::zero(), Hash256::zero(),
&equivocating_indices, &equivocating_indices,
Slot::new(0), current_epoch.start_slot(MainnetEthSpec::slots_per_epoch()),
&spec, &spec,
) )
.unwrap_or_else(|e| { .unwrap_or_else(|e| {
@@ -131,6 +134,8 @@ impl ForkChoiceTestDefinition {
expected_head, expected_head,
proposer_boost_root, proposer_boost_root,
} => { } => {
let current_epoch =
std::cmp::max(justified_checkpoint.epoch, latest_justified) + 3;
let justified_balances = let justified_balances =
JustifiedBalances::from_effective_balances(justified_state_balances) JustifiedBalances::from_effective_balances(justified_state_balances)
.unwrap(); .unwrap();
@@ -141,7 +146,7 @@ impl ForkChoiceTestDefinition {
&justified_balances, &justified_balances,
proposer_boost_root, proposer_boost_root,
&equivocating_indices, &equivocating_indices,
Slot::new(0), current_epoch.start_slot(MainnetEthSpec::slots_per_epoch()),
&spec, &spec,
) )
.unwrap_or_else(|e| { .unwrap_or_else(|e| {
@@ -160,6 +165,8 @@ impl ForkChoiceTestDefinition {
finalized_checkpoint, finalized_checkpoint,
justified_state_balances, justified_state_balances,
} => { } => {
let current_epoch =
std::cmp::max(justified_checkpoint.epoch, latest_justified) + 3;
let justified_balances = let justified_balances =
JustifiedBalances::from_effective_balances(justified_state_balances) JustifiedBalances::from_effective_balances(justified_state_balances)
.unwrap(); .unwrap();
@@ -169,7 +176,7 @@ impl ForkChoiceTestDefinition {
&justified_balances, &justified_balances,
Hash256::zero(), Hash256::zero(),
&equivocating_indices, &equivocating_indices,
Slot::new(0), current_epoch.start_slot(MainnetEthSpec::slots_per_epoch()),
&spec, &spec,
); );
@@ -188,6 +195,7 @@ impl ForkChoiceTestDefinition {
justified_checkpoint, justified_checkpoint,
finalized_checkpoint, finalized_checkpoint,
} => { } => {
latest_justified = std::cmp::max(justified_checkpoint.epoch, latest_justified);
let block = Block { let block = Block {
slot, slot,
root, root,