From 7c920cfb96136105771bac06b518c8c9efc03f01 Mon Sep 17 00:00:00 2001 From: Paul Hauner Date: Fri, 15 Feb 2019 19:23:22 +1100 Subject: [PATCH 1/8] Add incomplete progress on fixing test harness --- beacon_node/beacon_chain/src/beacon_chain.rs | 6 +++ .../beacon_chain/src/cached_beacon_state.rs | 49 +++++++++++++++++++ beacon_node/beacon_chain/src/lib.rs | 1 + .../test_harness/src/beacon_chain_harness.rs | 1 + .../beacon_chain/test_harness/tests/chain.rs | 17 +++---- eth2/types/src/beacon_state.rs | 45 ++++++++++++++++- eth2/types/src/spec/few_validators.rs | 21 ++++++++ eth2/types/src/spec/mod.rs | 1 + 8 files changed, 128 insertions(+), 13 deletions(-) create mode 100644 beacon_node/beacon_chain/src/cached_beacon_state.rs create mode 100644 eth2/types/src/spec/few_validators.rs diff --git a/beacon_node/beacon_chain/src/beacon_chain.rs b/beacon_node/beacon_chain/src/beacon_chain.rs index c16337fd4..6c7a8c751 100644 --- a/beacon_node/beacon_chain/src/beacon_chain.rs +++ b/beacon_node/beacon_chain/src/beacon_chain.rs @@ -253,6 +253,7 @@ where /// Information is read from the present `beacon_state` shuffling, so only information from the /// present and prior epoch is available. pub fn block_proposer(&self, slot: Slot) -> Result { + trace!("BeaconChain::block_proposer: slot: {}", slot); let index = self .state .read() @@ -274,6 +275,10 @@ where &self, validator_index: usize, ) -> Result, BeaconStateError> { + trace!( + "BeaconChain::validator_attestion_slot_and_shard: validator_index: {}", + validator_index + ); if let Some((slot, shard, _committee)) = self .state .read() @@ -287,6 +292,7 @@ where /// Produce an `AttestationData` that is valid for the present `slot` and given `shard`. pub fn produce_attestation_data(&self, shard: u64) -> Result { + trace!("BeaconChain::produce_attestation_data: shard: {}", shard); let justified_epoch = self.justified_epoch(); let justified_block_root = *self .state diff --git a/beacon_node/beacon_chain/src/cached_beacon_state.rs b/beacon_node/beacon_chain/src/cached_beacon_state.rs new file mode 100644 index 000000000..4717d1744 --- /dev/null +++ b/beacon_node/beacon_chain/src/cached_beacon_state.rs @@ -0,0 +1,49 @@ +use types::{beacon_state::BeaconStateError, BeaconState, ChainSpec, Epoch, Slot}; + +pub const CACHED_EPOCHS: usize = 3; // previous, current, next. + +pub type CrosslinkCommittees = Vec<(Vec, u64)>; + +pub struct CachedBeaconState<'a> { + state: BeaconState, + crosslinks: Vec>, + spec: &'a ChainSpec, +} + +impl<'a> CachedBeaconState<'a> { + pub fn from_beacon_state( + state: BeaconState, + spec: &'a ChainSpec, + ) -> Result { + let current_epoch = state.current_epoch(spec); + let previous_epoch = if current_epoch == spec.genesis_epoch { + current_epoch + } else { + current_epoch.saturating_sub(1_u64) + }; + let next_epoch = state.next_epoch(spec); + + let mut crosslinks: Vec> = Vec::with_capacity(3); + crosslinks.push(committees_for_all_slots(&state, previous_epoch, spec)?); + crosslinks.push(committees_for_all_slots(&state, current_epoch, spec)?); + crosslinks.push(committees_for_all_slots(&state, next_epoch, spec)?); + + Ok(Self { + state, + crosslinks, + spec, + }) + } +} + +fn committees_for_all_slots( + state: &BeaconState, + epoch: Epoch, + spec: &ChainSpec, +) -> Result, BeaconStateError> { + let mut crosslinks: Vec = Vec::with_capacity(spec.epoch_length as usize); + for slot in epoch.slot_iter(spec.epoch_length) { + crosslinks.push(state.get_crosslink_committees_at_slot(slot, false, spec)?) + } + Ok(crosslinks) +} diff --git a/beacon_node/beacon_chain/src/lib.rs b/beacon_node/beacon_chain/src/lib.rs index 4dac0b672..bc9085fbe 100644 --- a/beacon_node/beacon_chain/src/lib.rs +++ b/beacon_node/beacon_chain/src/lib.rs @@ -1,5 +1,6 @@ mod attestation_aggregator; mod beacon_chain; +mod cached_beacon_state; mod checkpoint; pub use self::beacon_chain::{BeaconChain, Error}; diff --git a/beacon_node/beacon_chain/test_harness/src/beacon_chain_harness.rs b/beacon_node/beacon_chain/test_harness/src/beacon_chain_harness.rs index acba2e015..5ea681ca3 100644 --- a/beacon_node/beacon_chain/test_harness/src/beacon_chain_harness.rs +++ b/beacon_node/beacon_chain/test_harness/src/beacon_chain_harness.rs @@ -209,6 +209,7 @@ impl BeaconChainHarness { self.increment_beacon_chain_slot(); // Produce a new block. + debug!("Producing block..."); let block = self.produce_block(); debug!("Submitting block for processing..."); self.beacon_chain.process_block(block).unwrap(); diff --git a/beacon_node/beacon_chain/test_harness/tests/chain.rs b/beacon_node/beacon_chain/test_harness/tests/chain.rs index 8be6f2a26..13e276abb 100644 --- a/beacon_node/beacon_chain/test_harness/tests/chain.rs +++ b/beacon_node/beacon_chain/test_harness/tests/chain.rs @@ -1,19 +1,14 @@ use env_logger::{Builder, Env}; use log::debug; use test_harness::BeaconChainHarness; -use types::{ChainSpec, Slot}; +use types::ChainSpec; #[test] -#[ignore] fn it_can_build_on_genesis_block() { - let mut spec = ChainSpec::foundation(); - spec.genesis_slot = Slot::new(spec.epoch_length * 8); + Builder::from_env(Env::default().default_filter_or("trace")).init(); + let spec = ChainSpec::few_validators(); - /* - spec.shard_count = spec.shard_count / 8; - spec.target_committee_size = spec.target_committee_size / 8; - */ - let validator_count = 1000; + let validator_count = 8; let mut harness = BeaconChainHarness::new(spec, validator_count as usize); @@ -23,7 +18,7 @@ fn it_can_build_on_genesis_block() { #[test] #[ignore] fn it_can_produce_past_first_epoch_boundary() { - Builder::from_env(Env::default().default_filter_or("debug")).init(); + Builder::from_env(Env::default().default_filter_or("trace")).init(); let validator_count = 100; @@ -33,7 +28,7 @@ fn it_can_produce_past_first_epoch_boundary() { debug!("Harness built, tests starting.."); - let blocks = harness.spec.epoch_length * 3 + 1; + let blocks = harness.spec.epoch_length * 2 + 1; for i in 0..blocks { harness.advance_chain_with_block(); diff --git a/eth2/types/src/beacon_state.rs b/eth2/types/src/beacon_state.rs index af815cbe2..aa6690705 100644 --- a/eth2/types/src/beacon_state.rs +++ b/eth2/types/src/beacon_state.rs @@ -6,6 +6,7 @@ use crate::{ }; use bls::verify_proof_of_possession; use honey_badger_split::SplitExt; +use log::trace; use rand::RngCore; use serde_derive::Serialize; use ssz::{hash, Decodable, DecodeError, Encodable, SszStream, TreeHash}; @@ -259,11 +260,24 @@ impl BeaconState { let active_validator_indices = get_active_validator_indices(&self.validator_registry, epoch); + if active_validator_indices.is_empty() { + return None; + } + + trace!( + "BeaconState::get_shuffling: active_validator_indices.len() == {}", + active_validator_indices.len() + ); + let committees_per_epoch = self.get_epoch_committee_count(active_validator_indices.len(), spec); - let mut shuffled_active_validator_indices = - Vec::with_capacity(active_validator_indices.len()); + trace!( + "BeaconState::get_shuffling: active_validator_indices.len() == {}, committees_per_epoch: {}", + active_validator_indices.len(), committees_per_epoch + ); + + let mut shuffled_active_validator_indices = vec![0; active_validator_indices.len()]; for &i in &active_validator_indices { let shuffled_i = get_permutated_index( i, @@ -317,9 +331,17 @@ impl BeaconState { + 1; let latest_index_root = current_epoch + spec.entry_exit_delay; + trace!( + "BeaconState::get_active_index_root: epoch: {}, earliest: {}, latest: {}", + epoch, + earliest_index_root, + latest_index_root + ); + if (epoch >= earliest_index_root) & (epoch <= latest_index_root) { Some(self.latest_index_roots[epoch.as_usize() % spec.latest_index_roots_length]) } else { + trace!("BeaconState::get_active_index_root: epoch out of range."); None } } @@ -371,8 +393,14 @@ impl BeaconState { }; let next_epoch = self.next_epoch(spec); + trace!( + "BeaconState::get_crosslink_committees_at_slot: epoch: {}", + epoch + ); + let (committees_per_epoch, seed, shuffling_epoch, shuffling_start_shard) = if epoch == previous_epoch { + trace!("BeaconState::get_crosslink_committees_at_slot: epoch == previous_epoch"); ( self.get_previous_epoch_committee_count(spec), self.previous_epoch_seed, @@ -380,6 +408,7 @@ impl BeaconState { self.previous_epoch_start_shard, ) } else if epoch == current_epoch { + trace!("BeaconState::get_crosslink_committees_at_slot: epoch == current_epoch"); ( self.get_current_epoch_committee_count(spec), self.current_epoch_seed, @@ -387,6 +416,7 @@ impl BeaconState { self.current_epoch_start_shard, ) } else if epoch == next_epoch { + trace!("BeaconState::get_crosslink_committees_at_slot: epoch == next_epoch"); let current_committees_per_epoch = self.get_current_epoch_committee_count(spec); let epochs_since_last_registry_update = current_epoch - self.validator_registry_update_epoch; @@ -423,6 +453,12 @@ impl BeaconState { let slot_start_shard = (shuffling_start_shard + committees_per_slot * offset) % spec.shard_count; + trace!( + "BeaconState::get_crosslink_committees_at_slot: committees_per_slot: {}, slot_start_shard: {}", + committees_per_slot, + slot_start_shard + ); + let mut crosslinks_at_slot = vec![]; for i in 0..committees_per_slot { let tuple = ( @@ -474,6 +510,11 @@ impl BeaconState { spec: &ChainSpec, ) -> Result { let committees = self.get_crosslink_committees_at_slot(slot, false, spec)?; + trace!( + "get_beacon_proposer_index: slot: {}, committees_count: {}", + slot, + committees.len() + ); committees .first() .ok_or(BeaconStateError::InsufficientValidators) diff --git a/eth2/types/src/spec/few_validators.rs b/eth2/types/src/spec/few_validators.rs new file mode 100644 index 000000000..05fe4c6cd --- /dev/null +++ b/eth2/types/src/spec/few_validators.rs @@ -0,0 +1,21 @@ +use crate::{ChainSpec, Slot}; + +impl ChainSpec { + /// Returns a `ChainSpec` compatible with the specification suitable for 8 validators. + /// + /// Spec v0.2.0 + pub fn few_validators() -> Self { + let genesis_slot = Slot::new(2_u64.pow(19)); + let epoch_length = 8; + let genesis_epoch = genesis_slot.epoch(epoch_length); + + Self { + shard_count: 1, + target_committee_size: 1, + genesis_slot, + genesis_epoch, + epoch_length, + ..ChainSpec::foundation() + } + } +} diff --git a/eth2/types/src/spec/mod.rs b/eth2/types/src/spec/mod.rs index 3632108ca..3e983a148 100644 --- a/eth2/types/src/spec/mod.rs +++ b/eth2/types/src/spec/mod.rs @@ -1,3 +1,4 @@ +mod few_validators; mod foundation; use crate::{Address, Epoch, Hash256, Slot}; From 3b92b69028021537ba98340c9552bf183957c822 Mon Sep 17 00:00:00 2001 From: Paul Hauner Date: Sat, 16 Feb 2019 11:04:12 +1100 Subject: [PATCH 2/8] Apply CachedBeaconState to some functions - Attestation aggregation - Getting attestation duties --- .../src/attestation_aggregator.rs | 8 +- beacon_node/beacon_chain/src/beacon_chain.rs | 29 +++- .../beacon_chain/src/cached_beacon_state.rs | 138 +++++++++++++++--- .../beacon_chain/test_harness/tests/chain.rs | 9 +- 4 files changed, 151 insertions(+), 33 deletions(-) diff --git a/beacon_node/beacon_chain/src/attestation_aggregator.rs b/beacon_node/beacon_chain/src/attestation_aggregator.rs index 6fbc11612..fa2ec87ab 100644 --- a/beacon_node/beacon_chain/src/attestation_aggregator.rs +++ b/beacon_node/beacon_chain/src/attestation_aggregator.rs @@ -1,3 +1,4 @@ +use crate::cached_beacon_state::CachedBeaconState; use state_processing::validate_attestation_without_signature; use std::collections::{HashMap, HashSet}; use types::{ @@ -76,12 +77,12 @@ impl AttestationAggregator { /// - The signature is verified against that of the validator at `validator_index`. pub fn process_free_attestation( &mut self, - state: &BeaconState, + cached_state: &CachedBeaconState, free_attestation: &FreeAttestation, spec: &ChainSpec, ) -> Result { let (slot, shard, committee_index) = some_or_invalid!( - state.attestation_slot_and_shard_for_validator( + cached_state.attestation_slot_and_shard_for_validator( free_attestation.validator_index as usize, spec, )?, @@ -104,7 +105,8 @@ impl AttestationAggregator { let signable_message = free_attestation.data.signable_message(PHASE_0_CUSTODY_BIT); let validator_record = some_or_invalid!( - state + cached_state + .state .validator_registry .get(free_attestation.validator_index as usize), Message::BadValidatorIndex diff --git a/beacon_node/beacon_chain/src/beacon_chain.rs b/beacon_node/beacon_chain/src/beacon_chain.rs index 6c7a8c751..b2d041654 100644 --- a/beacon_node/beacon_chain/src/beacon_chain.rs +++ b/beacon_node/beacon_chain/src/beacon_chain.rs @@ -1,4 +1,5 @@ use crate::attestation_aggregator::{AttestationAggregator, Outcome as AggregationOutcome}; +use crate::cached_beacon_state::CachedBeaconState; use crate::checkpoint::CheckPoint; use db::{ stores::{BeaconBlockStore, BeaconStateStore}, @@ -69,6 +70,7 @@ pub struct BeaconChain { canonical_head: RwLock, finalized_head: RwLock, pub state: RwLock, + pub cached_state: RwLock, pub spec: ChainSpec, pub fork_choice: RwLock, } @@ -107,6 +109,11 @@ where let block_root = genesis_block.canonical_root(); block_store.put(&block_root, &ssz_encode(&genesis_block)[..])?; + let cached_state = RwLock::new(CachedBeaconState::from_beacon_state( + genesis_state.clone(), + spec.clone(), + )?); + let finalized_head = RwLock::new(CheckPoint::new( genesis_block.clone(), block_root, @@ -127,6 +134,7 @@ where slot_clock, attestation_aggregator, state: RwLock::new(genesis_state.clone()), + cached_state, finalized_head, canonical_head, spec, @@ -280,7 +288,7 @@ where validator_index ); if let Some((slot, shard, _committee)) = self - .state + .cached_state .read() .attestation_slot_and_shard_for_validator(validator_index, &self.spec)? { @@ -338,9 +346,7 @@ where let aggregation_outcome = self .attestation_aggregator .write() - .process_free_attestation(&self.state.read(), &free_attestation, &self.spec)?; - // TODO: Check this comment - //.map_err(|e| e.into())?; + .process_free_attestation(&self.cached_state.read(), &free_attestation, &self.spec)?; // return if the attestation is invalid if !aggregation_outcome.valid { @@ -495,6 +501,9 @@ where ); // Update the local state variable. *self.state.write() = state.clone(); + // Update the cached state variable. + *self.cached_state.write() = + CachedBeaconState::from_beacon_state(state.clone(), self.spec.clone())?; } Ok(BlockProcessingOutcome::ValidBlock(ValidBlock::Processed)) @@ -543,9 +552,15 @@ where }, }; - state - .per_block_processing_without_verifying_block_signature(&block, &self.spec) - .ok()?; + trace!("BeaconChain::produce_block: updating state for new block.",); + + let result = + state.per_block_processing_without_verifying_block_signature(&block, &self.spec); + trace!( + "BeaconNode::produce_block: state processing result: {:?}", + result + ); + result.ok()?; let state_root = state.canonical_root(); diff --git a/beacon_node/beacon_chain/src/cached_beacon_state.rs b/beacon_node/beacon_chain/src/cached_beacon_state.rs index 4717d1744..fec1d7c06 100644 --- a/beacon_node/beacon_chain/src/cached_beacon_state.rs +++ b/beacon_node/beacon_chain/src/cached_beacon_state.rs @@ -1,49 +1,149 @@ +use log::debug; +use std::collections::HashMap; use types::{beacon_state::BeaconStateError, BeaconState, ChainSpec, Epoch, Slot}; -pub const CACHED_EPOCHS: usize = 3; // previous, current, next. +pub const CACHE_PREVIOUS: bool = false; +pub const CACHE_CURRENT: bool = true; +pub const CACHE_NEXT: bool = false; pub type CrosslinkCommittees = Vec<(Vec, u64)>; +pub type Shard = u64; +pub type CommitteeIndex = u64; +pub type AttestationDuty = (Slot, Shard, CommitteeIndex); +pub type AttestationDutyMap = HashMap; -pub struct CachedBeaconState<'a> { - state: BeaconState, - crosslinks: Vec>, - spec: &'a ChainSpec, +// TODO: CachedBeaconState is presently duplicating `BeaconState` and `ChainSpec`. This is a +// massive memory waste, switch them to references. + +pub struct CachedBeaconState { + pub state: BeaconState, + committees: Vec>, + attestation_duties: Vec, + next_epoch: Epoch, + current_epoch: Epoch, + previous_epoch: Epoch, + spec: ChainSpec, } -impl<'a> CachedBeaconState<'a> { +impl CachedBeaconState { pub fn from_beacon_state( state: BeaconState, - spec: &'a ChainSpec, + spec: ChainSpec, ) -> Result { - let current_epoch = state.current_epoch(spec); + let current_epoch = state.current_epoch(&spec); let previous_epoch = if current_epoch == spec.genesis_epoch { current_epoch } else { current_epoch.saturating_sub(1_u64) }; - let next_epoch = state.next_epoch(spec); + let next_epoch = state.next_epoch(&spec); - let mut crosslinks: Vec> = Vec::with_capacity(3); - crosslinks.push(committees_for_all_slots(&state, previous_epoch, spec)?); - crosslinks.push(committees_for_all_slots(&state, current_epoch, spec)?); - crosslinks.push(committees_for_all_slots(&state, next_epoch, spec)?); + let mut committees: Vec> = Vec::with_capacity(3); + let mut attestation_duties: Vec = Vec::with_capacity(3); + + if CACHE_PREVIOUS { + debug!("CachedBeaconState::from_beacon_state: building previous epoch cache."); + let cache = build_epoch_cache(&state, previous_epoch, &spec)?; + committees.push(cache.committees); + attestation_duties.push(cache.attestation_duty_map); + } else { + committees.push(vec![]); + attestation_duties.push(HashMap::new()); + } + if CACHE_CURRENT { + debug!("CachedBeaconState::from_beacon_state: building current epoch cache."); + let cache = build_epoch_cache(&state, current_epoch, &spec)?; + committees.push(cache.committees); + attestation_duties.push(cache.attestation_duty_map); + } else { + committees.push(vec![]); + attestation_duties.push(HashMap::new()); + } + if CACHE_NEXT { + debug!("CachedBeaconState::from_beacon_state: building next epoch cache."); + let cache = build_epoch_cache(&state, next_epoch, &spec)?; + committees.push(cache.committees); + attestation_duties.push(cache.attestation_duty_map); + } else { + committees.push(vec![]); + attestation_duties.push(HashMap::new()); + } Ok(Self { state, - crosslinks, + committees, + attestation_duties, + next_epoch, + current_epoch, + previous_epoch, spec, }) } + + fn slot_to_cache_index(&self, slot: Slot) -> Option { + match slot.epoch(self.spec.epoch_length) { + epoch if (epoch == self.previous_epoch) & CACHE_PREVIOUS => Some(0), + epoch if (epoch == self.current_epoch) & CACHE_CURRENT => Some(1), + epoch if (epoch == self.next_epoch) & CACHE_NEXT => Some(2), + _ => None, + } + } + + /// Returns the `slot`, `shard` and `committee_index` for which a validator must produce an + /// attestation. + /// + /// Cached method. + /// + /// Spec v0.2.0 + pub fn attestation_slot_and_shard_for_validator( + &self, + validator_index: usize, + _spec: &ChainSpec, + ) -> Result, BeaconStateError> { + // Get the result for this epoch. + let cache_index = self + .slot_to_cache_index(self.state.slot) + .expect("Current epoch should always have a cache index."); + + let duties = self.attestation_duties[cache_index] + .get(&(validator_index as u64)) + .and_then(|tuple| Some(*tuple)); + + Ok(duties) + } } -fn committees_for_all_slots( +struct EpochCacheResult { + committees: Vec, + attestation_duty_map: AttestationDutyMap, +} + +fn build_epoch_cache( state: &BeaconState, epoch: Epoch, spec: &ChainSpec, -) -> Result, BeaconStateError> { - let mut crosslinks: Vec = Vec::with_capacity(spec.epoch_length as usize); +) -> Result { + let mut epoch_committees: Vec = + Vec::with_capacity(spec.epoch_length as usize); + let mut attestation_duty_map: AttestationDutyMap = HashMap::new(); + for slot in epoch.slot_iter(spec.epoch_length) { - crosslinks.push(state.get_crosslink_committees_at_slot(slot, false, spec)?) + let slot_committees = state.get_crosslink_committees_at_slot(slot, false, spec)?; + + for (committee, shard) in slot_committees { + for (committee_index, validator_index) in committee.iter().enumerate() { + attestation_duty_map.insert( + *validator_index as u64, + (slot, shard, committee_index as u64), + ); + } + } + + epoch_committees.push(state.get_crosslink_committees_at_slot(slot, false, spec)?) } - Ok(crosslinks) + + Ok(EpochCacheResult { + committees: epoch_committees, + attestation_duty_map, + }) } diff --git a/beacon_node/beacon_chain/test_harness/tests/chain.rs b/beacon_node/beacon_chain/test_harness/tests/chain.rs index 13e276abb..a57a0161f 100644 --- a/beacon_node/beacon_chain/test_harness/tests/chain.rs +++ b/beacon_node/beacon_chain/test_harness/tests/chain.rs @@ -6,8 +6,8 @@ use types::ChainSpec; #[test] fn it_can_build_on_genesis_block() { Builder::from_env(Env::default().default_filter_or("trace")).init(); - let spec = ChainSpec::few_validators(); + let spec = ChainSpec::few_validators(); let validator_count = 8; let mut harness = BeaconChainHarness::new(spec, validator_count as usize); @@ -18,13 +18,14 @@ fn it_can_build_on_genesis_block() { #[test] #[ignore] fn it_can_produce_past_first_epoch_boundary() { - Builder::from_env(Env::default().default_filter_or("trace")).init(); + Builder::from_env(Env::default().default_filter_or("debug")).init(); - let validator_count = 100; + let spec = ChainSpec::few_validators(); + let validator_count = 8; debug!("Starting harness build..."); - let mut harness = BeaconChainHarness::new(ChainSpec::foundation(), validator_count); + let mut harness = BeaconChainHarness::new(spec, validator_count); debug!("Harness built, tests starting.."); From b0513b1ec1839826ad64704b5457d47adcc8d257 Mon Sep 17 00:00:00 2001 From: Paul Hauner Date: Sat, 16 Feb 2019 15:08:33 +1100 Subject: [PATCH 3/8] Add and update logs --- .../beacon_chain/src/cached_beacon_state.rs | 9 ++-- .../test_harness/src/beacon_chain_harness.rs | 13 ++++- .../beacon_chain/test_harness/tests/chain.rs | 2 +- .../state_processing/src/block_processable.rs | 13 ++--- .../state_processing/src/epoch_processable.rs | 13 +++++ eth2/types/src/beacon_state.rs | 49 ++++++++----------- 6 files changed, 59 insertions(+), 40 deletions(-) diff --git a/beacon_node/beacon_chain/src/cached_beacon_state.rs b/beacon_node/beacon_chain/src/cached_beacon_state.rs index fec1d7c06..e14e9fe99 100644 --- a/beacon_node/beacon_chain/src/cached_beacon_state.rs +++ b/beacon_node/beacon_chain/src/cached_beacon_state.rs @@ -1,4 +1,4 @@ -use log::debug; +use log::{debug, trace}; use std::collections::HashMap; use types::{beacon_state::BeaconStateError, BeaconState, ChainSpec, Epoch, Slot}; @@ -42,7 +42,7 @@ impl CachedBeaconState { let mut attestation_duties: Vec = Vec::with_capacity(3); if CACHE_PREVIOUS { - debug!("CachedBeaconState::from_beacon_state: building previous epoch cache."); + debug!("from_beacon_state: building previous epoch cache."); let cache = build_epoch_cache(&state, previous_epoch, &spec)?; committees.push(cache.committees); attestation_duties.push(cache.attestation_duty_map); @@ -51,7 +51,7 @@ impl CachedBeaconState { attestation_duties.push(HashMap::new()); } if CACHE_CURRENT { - debug!("CachedBeaconState::from_beacon_state: building current epoch cache."); + debug!("from_beacon_state: building current epoch cache."); let cache = build_epoch_cache(&state, current_epoch, &spec)?; committees.push(cache.committees); attestation_duties.push(cache.attestation_duty_map); @@ -60,7 +60,7 @@ impl CachedBeaconState { attestation_duties.push(HashMap::new()); } if CACHE_NEXT { - debug!("CachedBeaconState::from_beacon_state: building next epoch cache."); + debug!("from_beacon_state: building next epoch cache."); let cache = build_epoch_cache(&state, next_epoch, &spec)?; committees.push(cache.committees); attestation_duties.push(cache.attestation_duty_map); @@ -81,6 +81,7 @@ impl CachedBeaconState { } fn slot_to_cache_index(&self, slot: Slot) -> Option { + trace!("slot_to_cache_index: cache lookup"); match slot.epoch(self.spec.epoch_length) { epoch if (epoch == self.previous_epoch) & CACHE_PREVIOUS => Some(0), epoch if (epoch == self.current_epoch) & CACHE_CURRENT => Some(1), diff --git a/beacon_node/beacon_chain/test_harness/src/beacon_chain_harness.rs b/beacon_node/beacon_chain/test_harness/src/beacon_chain_harness.rs index 5ea681ca3..9d61952f0 100644 --- a/beacon_node/beacon_chain/test_harness/src/beacon_chain_harness.rs +++ b/beacon_node/beacon_chain/test_harness/src/beacon_chain_harness.rs @@ -128,7 +128,18 @@ impl BeaconChainHarness { pub fn increment_beacon_chain_slot(&mut self) -> Slot { let slot = self.beacon_chain.present_slot() + 1; - debug!("Incrementing BeaconChain slot to {}.", slot); + let nth_slot = slot + - slot + .epoch(self.spec.epoch_length) + .start_slot(self.spec.epoch_length); + let nth_epoch = slot.epoch(self.spec.epoch_length) - self.spec.genesis_epoch; + debug!( + "Advancing BeaconChain to slot {}, epoch {} (epoch height: {}, slot {} in epoch.).", + slot, + slot.epoch(self.spec.epoch_length), + nth_epoch, + nth_slot + ); self.beacon_chain.slot_clock.set_slot(slot.as_u64()); self.beacon_chain.advance_state(slot).unwrap(); diff --git a/beacon_node/beacon_chain/test_harness/tests/chain.rs b/beacon_node/beacon_chain/test_harness/tests/chain.rs index a57a0161f..b3354784f 100644 --- a/beacon_node/beacon_chain/test_harness/tests/chain.rs +++ b/beacon_node/beacon_chain/test_harness/tests/chain.rs @@ -33,7 +33,7 @@ fn it_can_produce_past_first_epoch_boundary() { for i in 0..blocks { harness.advance_chain_with_block(); - debug!("Produced block {}/{}.", i, blocks); + debug!("Produced block {}/{}.", i + 1, blocks); } let dump = harness.chain_dump().expect("Chain dump failed."); diff --git a/eth2/state_processing/src/block_processable.rs b/eth2/state_processing/src/block_processable.rs index 904d2fac5..539711c69 100644 --- a/eth2/state_processing/src/block_processable.rs +++ b/eth2/state_processing/src/block_processable.rs @@ -1,7 +1,7 @@ use crate::SlotProcessingError; use hashing::hash; use int_to_bytes::int_to_bytes32; -use log::debug; +use log::{debug, trace}; use ssz::{ssz_encode, TreeHash}; use types::{ beacon_state::{AttestationParticipantsError, BeaconStateError}, @@ -219,6 +219,8 @@ fn per_block_processing_signature_optional( Error::MaxAttestationsExceeded ); + debug!("Verifying {} attestations.", block.body.attestations.len()); + for attestation in &block.body.attestations { validate_attestation(&state, attestation, spec)?; @@ -231,11 +233,6 @@ fn per_block_processing_signature_optional( state.latest_attestations.push(pending_attestation); } - debug!( - "{} attestations verified & processed.", - block.body.attestations.len() - ); - /* * Deposits */ @@ -312,6 +309,10 @@ fn validate_attestation_signature_optional( spec: &ChainSpec, verify_signature: bool, ) -> Result<(), AttestationValidationError> { + trace!( + "validate_attestation_signature_optional: attestation epoch: {}", + attestation.data.slot.epoch(spec.epoch_length) + ); ensure!( attestation.data.slot + spec.min_attestation_inclusion_delay <= state.slot, AttestationValidationError::IncludedTooEarly diff --git a/eth2/state_processing/src/epoch_processable.rs b/eth2/state_processing/src/epoch_processable.rs index 658449d6f..80318914c 100644 --- a/eth2/state_processing/src/epoch_processable.rs +++ b/eth2/state_processing/src/epoch_processable.rs @@ -315,6 +315,11 @@ impl EpochProcessable for BeaconState { // for slot in self.slot.saturating_sub(2 * spec.epoch_length)..self.slot { for slot in self.previous_epoch(spec).slot_iter(spec.epoch_length) { + trace!( + "Finding winning root for slot: {} (epoch: {})", + slot, + slot.epoch(spec.epoch_length) + ); let crosslink_committees_at_slot = self.get_crosslink_committees_at_slot(slot, false, spec)?; @@ -539,6 +544,12 @@ impl EpochProcessable for BeaconState { */ self.previous_calculation_epoch = self.current_calculation_epoch; self.previous_epoch_start_shard = self.current_epoch_start_shard; + + debug!( + "setting previous_epoch_seed to : {}", + self.current_epoch_seed + ); + self.previous_epoch_seed = self.current_epoch_seed; let should_update_validator_registy = if self.finalized_epoch @@ -553,6 +564,7 @@ impl EpochProcessable for BeaconState { }; if should_update_validator_registy { + trace!("updating validator registry."); self.update_validator_registry(spec); self.current_calculation_epoch = next_epoch; @@ -561,6 +573,7 @@ impl EpochProcessable for BeaconState { % spec.shard_count; self.current_epoch_seed = self.generate_seed(self.current_calculation_epoch, spec)? } else { + trace!("not updating validator registry."); let epochs_since_last_registry_update = current_epoch - self.validator_registry_update_epoch; if (epochs_since_last_registry_update > 1) diff --git a/eth2/types/src/beacon_state.rs b/eth2/types/src/beacon_state.rs index aa6690705..6a4033d5c 100644 --- a/eth2/types/src/beacon_state.rs +++ b/eth2/types/src/beacon_state.rs @@ -265,7 +265,7 @@ impl BeaconState { } trace!( - "BeaconState::get_shuffling: active_validator_indices.len() == {}", + "get_shuffling: active_validator_indices.len() == {}", active_validator_indices.len() ); @@ -273,8 +273,9 @@ impl BeaconState { self.get_epoch_committee_count(active_validator_indices.len(), spec); trace!( - "BeaconState::get_shuffling: active_validator_indices.len() == {}, committees_per_epoch: {}", - active_validator_indices.len(), committees_per_epoch + "get_shuffling: active_validator_indices.len() == {}, committees_per_epoch: {}", + active_validator_indices.len(), + committees_per_epoch ); let mut shuffled_active_validator_indices = vec![0; active_validator_indices.len()]; @@ -332,7 +333,7 @@ impl BeaconState { let latest_index_root = current_epoch + spec.entry_exit_delay; trace!( - "BeaconState::get_active_index_root: epoch: {}, earliest: {}, latest: {}", + "get_active_index_root: epoch: {}, earliest: {}, latest: {}", epoch, earliest_index_root, latest_index_root @@ -341,7 +342,7 @@ impl BeaconState { if (epoch >= earliest_index_root) & (epoch <= latest_index_root) { Some(self.latest_index_roots[epoch.as_usize() % spec.latest_index_roots_length]) } else { - trace!("BeaconState::get_active_index_root: epoch out of range."); + trace!("get_active_index_root: epoch out of range."); None } } @@ -386,37 +387,28 @@ impl BeaconState { ) -> Result, u64)>, BeaconStateError> { let epoch = slot.epoch(spec.epoch_length); let current_epoch = self.current_epoch(spec); - let previous_epoch = if current_epoch == spec.genesis_epoch { - current_epoch - } else { - current_epoch.saturating_sub(1_u64) - }; + let previous_epoch = self.previous_epoch(spec); let next_epoch = self.next_epoch(spec); - trace!( - "BeaconState::get_crosslink_committees_at_slot: epoch: {}", - epoch - ); - let (committees_per_epoch, seed, shuffling_epoch, shuffling_start_shard) = - if epoch == previous_epoch { - trace!("BeaconState::get_crosslink_committees_at_slot: epoch == previous_epoch"); - ( - self.get_previous_epoch_committee_count(spec), - self.previous_epoch_seed, - self.previous_calculation_epoch, - self.previous_epoch_start_shard, - ) - } else if epoch == current_epoch { - trace!("BeaconState::get_crosslink_committees_at_slot: epoch == current_epoch"); + if epoch == current_epoch { + trace!("get_crosslink_committees_at_slot: current_epoch"); ( self.get_current_epoch_committee_count(spec), self.current_epoch_seed, self.current_calculation_epoch, self.current_epoch_start_shard, ) + } else if epoch == previous_epoch { + trace!("get_crosslink_committees_at_slot: previous_epoch"); + ( + self.get_previous_epoch_committee_count(spec), + self.previous_epoch_seed, + self.previous_calculation_epoch, + self.previous_epoch_start_shard, + ) } else if epoch == next_epoch { - trace!("BeaconState::get_crosslink_committees_at_slot: epoch == next_epoch"); + trace!("get_crosslink_committees_at_slot: next_epoch"); let current_committees_per_epoch = self.get_current_epoch_committee_count(spec); let epochs_since_last_registry_update = current_epoch - self.validator_registry_update_epoch; @@ -454,9 +446,10 @@ impl BeaconState { (shuffling_start_shard + committees_per_slot * offset) % spec.shard_count; trace!( - "BeaconState::get_crosslink_committees_at_slot: committees_per_slot: {}, slot_start_shard: {}", + "get_crosslink_committees_at_slot: committees_per_slot: {}, slot_start_shard: {}, seed: {}", committees_per_slot, - slot_start_shard + slot_start_shard, + seed ); let mut crosslinks_at_slot = vec![]; From c5158e297494dcae1c992fe592121698bd1c2176 Mon Sep 17 00:00:00 2001 From: Paul Hauner Date: Sat, 16 Feb 2019 15:08:57 +1100 Subject: [PATCH 4/8] Fix bug with total_balance in epoch processing --- eth2/state_processing/src/epoch_processable.rs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/eth2/state_processing/src/epoch_processable.rs b/eth2/state_processing/src/epoch_processable.rs index 80318914c..a930cd750 100644 --- a/eth2/state_processing/src/epoch_processable.rs +++ b/eth2/state_processing/src/epoch_processable.rs @@ -144,8 +144,10 @@ impl EpochProcessable for BeaconState { let previous_epoch_attester_indices = self.get_attestation_participants_union(&previous_epoch_attestations[..], spec)?; - let previous_total_balance = - self.get_total_balance(&previous_epoch_attester_indices[..], spec); + let previous_total_balance = self.get_total_balance( + &get_active_validator_indices(&self.validator_registry, previous_epoch), + spec, + ); /* * Validators targetting the previous justified slot From b79f0cdf68a26666bbd2bac6e578bf59627ff76c Mon Sep 17 00:00:00 2001 From: Paul Hauner Date: Sat, 16 Feb 2019 15:09:14 +1100 Subject: [PATCH 5/8] Fix bug with reward quotient in epoch processing --- eth2/state_processing/src/epoch_processable.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/eth2/state_processing/src/epoch_processable.rs b/eth2/state_processing/src/epoch_processable.rs index a930cd750..11b2b224d 100644 --- a/eth2/state_processing/src/epoch_processable.rs +++ b/eth2/state_processing/src/epoch_processable.rs @@ -359,7 +359,8 @@ impl EpochProcessable for BeaconState { /* * Rewards and Penalities */ - let base_reward_quotient = previous_total_balance.integer_sqrt(); + let base_reward_quotient = + previous_total_balance.integer_sqrt() / spec.base_reward_quotient; if base_reward_quotient == 0 { return Err(Error::BaseRewardQuotientIsZero); } From f83d02b394d7cc40e5ce5647c286d061bb2f9599 Mon Sep 17 00:00:00 2001 From: Paul Hauner Date: Sat, 16 Feb 2019 15:09:43 +1100 Subject: [PATCH 6/8] Update previous epoch function --- eth2/types/src/beacon_state.rs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/eth2/types/src/beacon_state.rs b/eth2/types/src/beacon_state.rs index 6a4033d5c..2e1df45f2 100644 --- a/eth2/types/src/beacon_state.rs +++ b/eth2/types/src/beacon_state.rs @@ -203,7 +203,12 @@ impl BeaconState { /// /// Spec v0.2.0 pub fn previous_epoch(&self, spec: &ChainSpec) -> Epoch { - self.current_epoch(spec).saturating_sub(1_u64) + let current_epoch = self.current_epoch(&spec); + if current_epoch == spec.genesis_epoch { + current_epoch + } else { + current_epoch - 1 + } } /// The epoch following `self.current_epoch()`. From c4bedc03a8f704cb10e6c8da689e3f9b06362c1a Mon Sep 17 00:00:00 2001 From: Paul Hauner Date: Sun, 17 Feb 2019 20:21:13 +1100 Subject: [PATCH 7/8] Fix file org. inconsistency in `types` --- .../src/{spec/foundation.rs => chain_spec.rs} | 111 +++++++++++++++++- eth2/types/src/lib.rs | 4 +- eth2/types/src/spec/few_validators.rs | 21 ---- eth2/types/src/spec/mod.rs | 93 --------------- 4 files changed, 112 insertions(+), 117 deletions(-) rename eth2/types/src/{spec/foundation.rs => chain_spec.rs} (54%) delete mode 100644 eth2/types/src/spec/few_validators.rs delete mode 100644 eth2/types/src/spec/mod.rs diff --git a/eth2/types/src/spec/foundation.rs b/eth2/types/src/chain_spec.rs similarity index 54% rename from eth2/types/src/spec/foundation.rs rename to eth2/types/src/chain_spec.rs index 79abe4061..b5d5689e3 100644 --- a/eth2/types/src/spec/foundation.rs +++ b/eth2/types/src/chain_spec.rs @@ -1,7 +1,96 @@ -use crate::{Address, ChainSpec, Epoch, Hash256, Signature, Slot}; +use crate::{Address, Epoch, Hash256, Slot}; +use bls::Signature; const GWEI: u64 = 1_000_000_000; +/// Holds all the "constants" for a BeaconChain. +/// +/// Spec v0.2.0 +#[derive(PartialEq, Debug, Clone)] +pub struct ChainSpec { + /* + * Misc + */ + pub shard_count: u64, + pub target_committee_size: u64, + pub max_balance_churn_quotient: u64, + pub beacon_chain_shard_number: u64, + pub max_indices_per_slashable_vote: u64, + pub max_withdrawals_per_epoch: u64, + pub shuffle_round_count: u8, + + /* + * Deposit contract + */ + pub deposit_contract_address: Address, + pub deposit_contract_tree_depth: u64, + + /* + * Gwei values + */ + pub min_deposit_amount: u64, + pub max_deposit_amount: u64, + pub fork_choice_balance_increment: u64, + pub ejection_balance: u64, + + /* + * Initial Values + */ + pub genesis_fork_version: u64, + pub genesis_slot: Slot, + pub genesis_epoch: Epoch, + pub genesis_start_shard: u64, + pub far_future_epoch: Epoch, + pub zero_hash: Hash256, + pub empty_signature: Signature, + pub bls_withdrawal_prefix_byte: u8, + + /* + * Time parameters + */ + pub slot_duration: u64, + pub min_attestation_inclusion_delay: u64, + pub epoch_length: u64, + pub seed_lookahead: Epoch, + pub entry_exit_delay: u64, + pub eth1_data_voting_period: u64, + pub min_validator_withdrawal_epochs: Epoch, + + /* + * State list lengths + */ + pub latest_block_roots_length: usize, + pub latest_randao_mixes_length: usize, + pub latest_index_roots_length: usize, + pub latest_penalized_exit_length: usize, + + /* + * Reward and penalty quotients + */ + pub base_reward_quotient: u64, + pub whistleblower_reward_quotient: u64, + pub includer_reward_quotient: u64, + pub inactivity_penalty_quotient: u64, + + /* + * Max operations per block + */ + pub max_proposer_slashings: u64, + pub max_attester_slashings: u64, + pub max_attestations: u64, + pub max_deposits: u64, + pub max_exits: u64, + + /* + * Signature domains + */ + pub domain_deposit: u64, + pub domain_attestation: u64, + pub domain_proposal: u64, + pub domain_exit: u64, + pub domain_randao: u64, +} + impl ChainSpec { /// Returns a `ChainSpec` compatible with the specification from Ethereum Foundation. /// @@ -100,6 +189,26 @@ impl ChainSpec { } } +impl ChainSpec { + /// Returns a `ChainSpec` compatible with the specification suitable for 8 validators. + /// + /// Spec v0.2.0 + pub fn few_validators() -> Self { + let genesis_slot = Slot::new(2_u64.pow(19)); + let epoch_length = 8; + let genesis_epoch = genesis_slot.epoch(epoch_length); + + Self { + shard_count: 1, + target_committee_size: 1, + genesis_slot, + genesis_epoch, + epoch_length, + ..ChainSpec::foundation() + } + } +} + #[cfg(test)] mod tests { use super::*; diff --git a/eth2/types/src/lib.rs b/eth2/types/src/lib.rs index 233d1cc3e..f2c128440 100644 --- a/eth2/types/src/lib.rs +++ b/eth2/types/src/lib.rs @@ -8,6 +8,7 @@ pub mod beacon_block; pub mod beacon_block_body; pub mod beacon_state; pub mod casper_slashing; +pub mod chain_spec; pub mod crosslink; pub mod deposit; pub mod deposit_data; @@ -28,7 +29,6 @@ pub mod slashable_vote_data; pub mod slot_epoch_macros; pub mod slot_epoch; pub mod slot_height; -pub mod spec; pub mod validator; pub mod validator_registry; pub mod validator_registry_delta_block; @@ -44,6 +44,7 @@ pub use crate::beacon_block::BeaconBlock; pub use crate::beacon_block_body::BeaconBlockBody; pub use crate::beacon_state::BeaconState; pub use crate::casper_slashing::CasperSlashing; +pub use crate::chain_spec::ChainSpec; pub use crate::crosslink::Crosslink; pub use crate::deposit::Deposit; pub use crate::deposit_data::DepositData; @@ -60,7 +61,6 @@ pub use crate::slashable_attestation::SlashableAttestation; pub use crate::slashable_vote_data::SlashableVoteData; pub use crate::slot_epoch::{Epoch, Slot}; pub use crate::slot_height::SlotHeight; -pub use crate::spec::ChainSpec; pub use crate::validator::{StatusFlags as ValidatorStatusFlags, Validator}; pub use crate::validator_registry_delta_block::ValidatorRegistryDeltaBlock; diff --git a/eth2/types/src/spec/few_validators.rs b/eth2/types/src/spec/few_validators.rs deleted file mode 100644 index 05fe4c6cd..000000000 --- a/eth2/types/src/spec/few_validators.rs +++ /dev/null @@ -1,21 +0,0 @@ -use crate::{ChainSpec, Slot}; - -impl ChainSpec { - /// Returns a `ChainSpec` compatible with the specification suitable for 8 validators. - /// - /// Spec v0.2.0 - pub fn few_validators() -> Self { - let genesis_slot = Slot::new(2_u64.pow(19)); - let epoch_length = 8; - let genesis_epoch = genesis_slot.epoch(epoch_length); - - Self { - shard_count: 1, - target_committee_size: 1, - genesis_slot, - genesis_epoch, - epoch_length, - ..ChainSpec::foundation() - } - } -} diff --git a/eth2/types/src/spec/mod.rs b/eth2/types/src/spec/mod.rs deleted file mode 100644 index 3e983a148..000000000 --- a/eth2/types/src/spec/mod.rs +++ /dev/null @@ -1,93 +0,0 @@ -mod few_validators; -mod foundation; - -use crate::{Address, Epoch, Hash256, Slot}; -use bls::Signature; - -/// Holds all the "constants" for a BeaconChain. -/// -/// Spec v0.2.0 -#[derive(PartialEq, Debug, Clone)] -pub struct ChainSpec { - /* - * Misc - */ - pub shard_count: u64, - pub target_committee_size: u64, - pub max_balance_churn_quotient: u64, - pub beacon_chain_shard_number: u64, - pub max_indices_per_slashable_vote: u64, - pub max_withdrawals_per_epoch: u64, - pub shuffle_round_count: u8, - - /* - * Deposit contract - */ - pub deposit_contract_address: Address, - pub deposit_contract_tree_depth: u64, - - /* - * Gwei values - */ - pub min_deposit_amount: u64, - pub max_deposit_amount: u64, - pub fork_choice_balance_increment: u64, - pub ejection_balance: u64, - - /* - * Initial Values - */ - pub genesis_fork_version: u64, - pub genesis_slot: Slot, - pub genesis_epoch: Epoch, - pub genesis_start_shard: u64, - pub far_future_epoch: Epoch, - pub zero_hash: Hash256, - pub empty_signature: Signature, - pub bls_withdrawal_prefix_byte: u8, - - /* - * Time parameters - */ - pub slot_duration: u64, - pub min_attestation_inclusion_delay: u64, - pub epoch_length: u64, - pub seed_lookahead: Epoch, - pub entry_exit_delay: u64, - pub eth1_data_voting_period: u64, - pub min_validator_withdrawal_epochs: Epoch, - - /* - * State list lengths - */ - pub latest_block_roots_length: usize, - pub latest_randao_mixes_length: usize, - pub latest_index_roots_length: usize, - pub latest_penalized_exit_length: usize, - - /* - * Reward and penalty quotients - */ - pub base_reward_quotient: u64, - pub whistleblower_reward_quotient: u64, - pub includer_reward_quotient: u64, - pub inactivity_penalty_quotient: u64, - - /* - * Max operations per block - */ - pub max_proposer_slashings: u64, - pub max_attester_slashings: u64, - pub max_attestations: u64, - pub max_deposits: u64, - pub max_exits: u64, - - /* - * Signature domains - */ - pub domain_deposit: u64, - pub domain_attestation: u64, - pub domain_proposal: u64, - pub domain_exit: u64, - pub domain_randao: u64, -} From dc0696754be06da921b2536af1771f9bdbc9d200 Mon Sep 17 00:00:00 2001 From: Paul Hauner Date: Sun, 17 Feb 2019 20:23:31 +1100 Subject: [PATCH 8/8] Raise log level on test_harness tests --- beacon_node/beacon_chain/test_harness/tests/chain.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/beacon_node/beacon_chain/test_harness/tests/chain.rs b/beacon_node/beacon_chain/test_harness/tests/chain.rs index b3354784f..1a08ffcf1 100644 --- a/beacon_node/beacon_chain/test_harness/tests/chain.rs +++ b/beacon_node/beacon_chain/test_harness/tests/chain.rs @@ -5,7 +5,7 @@ use types::ChainSpec; #[test] fn it_can_build_on_genesis_block() { - Builder::from_env(Env::default().default_filter_or("trace")).init(); + Builder::from_env(Env::default().default_filter_or("info")).init(); let spec = ChainSpec::few_validators(); let validator_count = 8; @@ -18,7 +18,7 @@ fn it_can_build_on_genesis_block() { #[test] #[ignore] fn it_can_produce_past_first_epoch_boundary() { - Builder::from_env(Env::default().default_filter_or("debug")).init(); + Builder::from_env(Env::default().default_filter_or("info")).init(); let spec = ChainSpec::few_validators(); let validator_count = 8;