From 3a0fea7a4e1b03d53bef6fe9c4271afad366f5ca Mon Sep 17 00:00:00 2001 From: sean Date: Fri, 17 Jun 2022 15:56:28 +0000 Subject: [PATCH] test --- consensus/fork_choice/src/fork_choice.rs | 6 +++++- testing/ef_tests/src/cases/fork_choice.rs | 24 ++++++++--------------- testing/ef_tests/src/handler.rs | 1 - 3 files changed, 13 insertions(+), 18 deletions(-) diff --git a/consensus/fork_choice/src/fork_choice.rs b/consensus/fork_choice/src/fork_choice.rs index e46082bc6a..0f00e15d95 100644 --- a/consensus/fork_choice/src/fork_choice.rs +++ b/consensus/fork_choice/src/fork_choice.rs @@ -4,6 +4,7 @@ use ssz_derive::{Decode, Encode}; use std::cmp::Ordering; use std::marker::PhantomData; use std::time::Duration; +use types::MainnetEthSpec; use types::{ consts::merge::INTERVALS_PER_SLOT, AttestationShufflingId, BeaconBlock, BeaconState, BeaconStateError, ChainSpec, Checkpoint, Epoch, EthSpec, ExecPayload, ExecutionBlockHash, @@ -603,7 +604,7 @@ where // Update unrealized justified/finalized checkpoints. let (unrealized_justified_checkpoint, unrealized_finalized_checkpoint) = { - if !matches!(block, BeaconBlock::Merge(_)) { + if matches!(block, BeaconBlock::Merge(_)) { let (justifiable_beacon_state, _) = state_processing::per_epoch_processing::altair::process_justifiable( state, spec, @@ -953,6 +954,9 @@ where // Note: we are relying upon `on_tick` to update `fc_store.time` to ensure we don't // get stuck in a loop. //TODO(sean) fix chain spec + if (previous_slot + 1) % MainnetEthSpec::slots_per_epoch() == 0 { + dbg!("hitting epoch boundary"); + } self.on_tick(previous_slot + 1, &ChainSpec::mainnet())? } diff --git a/testing/ef_tests/src/cases/fork_choice.rs b/testing/ef_tests/src/cases/fork_choice.rs index 6a822b6698..c0d53dca61 100644 --- a/testing/ef_tests/src/cases/fork_choice.rs +++ b/testing/ef_tests/src/cases/fork_choice.rs @@ -316,23 +316,15 @@ impl Tester { } pub fn set_tick(&self, tick: u64) { - // get current slot, get difference, call update_time on every slot + let new_slot = tick.checked_div(self.spec.seconds_per_slot).unwrap(); - let slot = self.harness.chain.slot().unwrap(); - let new_slots = tick.checked_div(self.spec.seconds_per_slot).unwrap(); - - for i in slot.as_u64()..new_slots { - let new_slot = i + 1; - - self.harness.chain.slot_clock.set_slot(new_slot); - - self.harness - .chain - .fork_choice - .write() - .update_time(Slot::new(new_slot)) - .unwrap(); - } + self.harness.chain.slot_clock.set_slot(new_slot); + self.harness + .chain + .fork_choice + .write() + .update_time(Slot::new(new_slot)) + .unwrap(); } pub fn process_block(&self, block: SignedBeaconBlock, valid: bool) -> Result<(), Error> { diff --git a/testing/ef_tests/src/handler.rs b/testing/ef_tests/src/handler.rs index 5480e177e6..230a82b17c 100644 --- a/testing/ef_tests/src/handler.rs +++ b/testing/ef_tests/src/handler.rs @@ -54,7 +54,6 @@ pub trait Handler { .filter_map(as_directory) .map(|test_case_dir| { let path = test_case_dir.path(); - dbg!(&path); let case = Self::Case::load_from_dir(&path, fork_name).expect("test should load"); (path, case) })