Skip to content

Commit

Permalink
test
Browse files Browse the repository at this point in the history
  • Loading branch information
realbigsean committed Jun 17, 2022
1 parent 0ce2a6b commit 3a0fea7
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 18 deletions.
6 changes: 5 additions & 1 deletion consensus/fork_choice/src/fork_choice.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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())?
}

Expand Down
24 changes: 8 additions & 16 deletions testing/ef_tests/src/cases/fork_choice.rs
Original file line number Diff line number Diff line change
Expand Up @@ -316,23 +316,15 @@ impl<E: EthSpec> Tester<E> {
}

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<E>, valid: bool) -> Result<(), Error> {
Expand Down
1 change: 0 additions & 1 deletion testing/ef_tests/src/handler.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
})
Expand Down

0 comments on commit 3a0fea7

Please sign in to comment.