2019-02-14 01:09:18 +00:00
|
|
|
use env_logger::{Builder, Env};
|
|
|
|
use log::debug;
|
|
|
|
use test_harness::BeaconChainHarness;
|
2019-02-15 08:23:22 +00:00
|
|
|
use types::ChainSpec;
|
2019-02-14 01:09:18 +00:00
|
|
|
|
|
|
|
#[test]
|
|
|
|
fn it_can_build_on_genesis_block() {
|
2019-02-17 09:23:31 +00:00
|
|
|
Builder::from_env(Env::default().default_filter_or("info")).init();
|
2019-02-14 01:09:18 +00:00
|
|
|
|
2019-02-16 00:04:12 +00:00
|
|
|
let spec = ChainSpec::few_validators();
|
2019-02-15 08:23:22 +00:00
|
|
|
let validator_count = 8;
|
2019-02-14 01:09:18 +00:00
|
|
|
|
2019-03-11 00:52:16 +00:00
|
|
|
let mut harness = BeaconChainHarness::new(spec, validator_count as usize, None, true);
|
2019-02-14 01:09:18 +00:00
|
|
|
|
|
|
|
harness.advance_chain_with_block();
|
|
|
|
}
|
|
|
|
|
|
|
|
#[test]
|
|
|
|
#[ignore]
|
|
|
|
fn it_can_produce_past_first_epoch_boundary() {
|
2019-02-17 09:23:31 +00:00
|
|
|
Builder::from_env(Env::default().default_filter_or("info")).init();
|
2019-02-14 01:09:18 +00:00
|
|
|
|
2019-02-16 00:04:12 +00:00
|
|
|
let spec = ChainSpec::few_validators();
|
|
|
|
let validator_count = 8;
|
2019-02-14 01:09:18 +00:00
|
|
|
|
|
|
|
debug!("Starting harness build...");
|
|
|
|
|
2019-03-11 00:52:16 +00:00
|
|
|
let mut harness = BeaconChainHarness::new(spec, validator_count, None, true);
|
2019-02-14 01:09:18 +00:00
|
|
|
|
|
|
|
debug!("Harness built, tests starting..");
|
|
|
|
|
2019-03-04 06:51:54 +00:00
|
|
|
let blocks = harness.spec.slots_per_epoch * 2 + 1;
|
2019-02-14 01:09:18 +00:00
|
|
|
|
|
|
|
for i in 0..blocks {
|
|
|
|
harness.advance_chain_with_block();
|
2019-02-16 04:08:33 +00:00
|
|
|
debug!("Produced block {}/{}.", i + 1, blocks);
|
2019-02-14 01:09:18 +00:00
|
|
|
}
|
2019-02-22 05:14:16 +00:00
|
|
|
|
|
|
|
harness.run_fork_choice();
|
|
|
|
|
2019-02-14 01:09:18 +00:00
|
|
|
let dump = harness.chain_dump().expect("Chain dump failed.");
|
|
|
|
|
|
|
|
assert_eq!(dump.len() as u64, blocks + 1); // + 1 for genesis block.
|
|
|
|
}
|