Skip to content

Commit

Permalink
fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
realbigsean committed Jan 20, 2024
1 parent c84536a commit 0c875b0
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions consensus/proto_array/src/fork_choice_test_definition.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand All @@ -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();
Expand All @@ -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| {
Expand All @@ -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();
Expand All @@ -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| {
Expand All @@ -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();
Expand All @@ -169,7 +176,7 @@ impl ForkChoiceTestDefinition {
&justified_balances,
Hash256::zero(),
&equivocating_indices,
Slot::new(0),
current_epoch.start_slot(MainnetEthSpec::slots_per_epoch()),
&spec,
);

Expand All @@ -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,
Expand Down

0 comments on commit 0c875b0

Please sign in to comment.