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-15 08:23:22 +00:00
|
|
|
Builder::from_env(Env::default().default_filter_or("trace")).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
|
|
|
|
|
|
|
let mut harness = BeaconChainHarness::new(spec, validator_count as usize);
|
|
|
|
|
|
|
|
harness.advance_chain_with_block();
|
|
|
|
}
|
|
|
|
|
|
|
|
#[test]
|
|
|
|
#[ignore]
|
|
|
|
fn it_can_produce_past_first_epoch_boundary() {
|
2019-02-16 00:04:12 +00:00
|
|
|
Builder::from_env(Env::default().default_filter_or("debug")).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-02-16 00:04:12 +00:00
|
|
|
let mut harness = BeaconChainHarness::new(spec, validator_count);
|
2019-02-14 01:09:18 +00:00
|
|
|
|
|
|
|
debug!("Harness built, tests starting..");
|
|
|
|
|
2019-02-15 08:23:22 +00:00
|
|
|
let blocks = harness.spec.epoch_length * 2 + 1;
|
2019-02-14 01:09:18 +00:00
|
|
|
|
|
|
|
for i in 0..blocks {
|
|
|
|
harness.advance_chain_with_block();
|
|
|
|
debug!("Produced block {}/{}.", i, blocks);
|
|
|
|
}
|
|
|
|
let dump = harness.chain_dump().expect("Chain dump failed.");
|
|
|
|
|
|
|
|
assert_eq!(dump.len() as u64, blocks + 1); // + 1 for genesis block.
|
|
|
|
|
|
|
|
harness.dump_to_file("/tmp/chaindump.json".to_string(), &dump);
|
|
|
|
}
|