From 71d95ee9db698aa558dd78780202db7128de8ac1 Mon Sep 17 00:00:00 2001 From: Paul Hauner Date: Mon, 18 Mar 2019 18:08:53 +1100 Subject: [PATCH] Add new field to test_harness YAML, remove prints --- beacon_node/beacon_chain/src/beacon_chain.rs | 5 ----- .../beacon_chain/test_harness/specs/validator_registry.yaml | 1 + beacon_node/beacon_chain/test_harness/src/test_case.rs | 4 ++++ .../beacon_chain/test_harness/src/test_case/config.rs | 3 +++ 4 files changed, 8 insertions(+), 5 deletions(-) diff --git a/beacon_node/beacon_chain/src/beacon_chain.rs b/beacon_node/beacon_chain/src/beacon_chain.rs index bf87adf10..01787f95b 100644 --- a/beacon_node/beacon_chain/src/beacon_chain.rs +++ b/beacon_node/beacon_chain/src/beacon_chain.rs @@ -596,7 +596,6 @@ where // Transition the parent state to the present slot. let mut state = parent_state; - println!("parent process state: {:?}", state.latest_block_header); let previous_block_header = parent_block.into_header(); for _ in state.slot.as_u64()..present_slot.as_u64() { if let Err(e) = per_slot_processing(&mut state, &previous_block_header, &self.spec) { @@ -614,8 +613,6 @@ where )); } - println!("process state: {:?}", state.latest_block_header); - let state_root = state.canonical_root(); if block.state_root != state_root { @@ -706,8 +703,6 @@ where per_block_processing_without_verifying_block_signature(&mut state, &block, &self.spec)?; - println!("produce state: {:?}", state.latest_block_header); - let state_root = state.canonical_root(); block.state_root = state_root; diff --git a/beacon_node/beacon_chain/test_harness/specs/validator_registry.yaml b/beacon_node/beacon_chain/test_harness/specs/validator_registry.yaml index aea7dcf31..0c4f5004b 100644 --- a/beacon_node/beacon_chain/test_harness/specs/validator_registry.yaml +++ b/beacon_node/beacon_chain/test_harness/specs/validator_registry.yaml @@ -9,6 +9,7 @@ test_cases: deposits_for_chain_start: 1000 num_slots: 64 skip_slots: [2, 3] + persistent_committee_period: 0 deposits: # At slot 1, create a new validator deposit of 5 ETH. - slot: 1 diff --git a/beacon_node/beacon_chain/test_harness/src/test_case.rs b/beacon_node/beacon_chain/test_harness/src/test_case.rs index 1361127a1..f65b45505 100644 --- a/beacon_node/beacon_chain/test_harness/src/test_case.rs +++ b/beacon_node/beacon_chain/test_harness/src/test_case.rs @@ -62,6 +62,10 @@ impl TestCase { spec.slots_per_epoch = n; } + if let Some(n) = self.config.persistent_committee_period { + spec.persistent_committee_period = n; + } + spec } diff --git a/beacon_node/beacon_chain/test_harness/src/test_case/config.rs b/beacon_node/beacon_chain/test_harness/src/test_case/config.rs index f336b9d53..12d5da2d7 100644 --- a/beacon_node/beacon_chain/test_harness/src/test_case/config.rs +++ b/beacon_node/beacon_chain/test_harness/src/test_case/config.rs @@ -20,6 +20,8 @@ pub struct Config { pub deposits_for_chain_start: usize, /// Number of slots in an epoch. pub slots_per_epoch: Option, + /// Affects the number of epochs a validator must be active before they can withdraw. + pub persistent_committee_period: Option, /// Number of slots to build before ending execution. pub num_slots: u64, /// Number of slots that should be skipped due to inactive validator. @@ -45,6 +47,7 @@ impl Config { deposits_for_chain_start: as_usize(&yaml, "deposits_for_chain_start") .expect("Must specify validator count"), slots_per_epoch: as_u64(&yaml, "slots_per_epoch"), + persistent_committee_period: as_u64(&yaml, "persistent_committee_period"), num_slots: as_u64(&yaml, "num_slots").expect("Must specify `config.num_slots`"), skip_slots: as_vec_u64(yaml, "skip_slots"), deposits: parse_deposits(&yaml),