2019-01-30 13:39:34 +00:00
|
|
|
use env_logger::{Builder, Env};
|
|
|
|
use log::debug;
|
2019-01-27 03:25:26 +00:00
|
|
|
use test_harness::BeaconChainHarness;
|
2019-02-07 00:22:48 +00:00
|
|
|
use types::{ChainSpec, Slot};
|
2019-01-24 00:51:48 +00:00
|
|
|
|
2019-01-27 03:22:51 +00:00
|
|
|
#[test]
|
2019-02-05 01:29:08 +00:00
|
|
|
#[ignore]
|
2019-01-27 03:22:51 +00:00
|
|
|
fn it_can_build_on_genesis_block() {
|
2019-01-30 13:39:34 +00:00
|
|
|
let mut spec = ChainSpec::foundation();
|
2019-02-07 00:22:48 +00:00
|
|
|
spec.genesis_slot = Slot::new(spec.epoch_length * 8);
|
2019-01-30 13:39:34 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
spec.shard_count = spec.shard_count / 8;
|
|
|
|
spec.target_committee_size = spec.target_committee_size / 8;
|
|
|
|
*/
|
|
|
|
let validator_count = 1000;
|
|
|
|
|
|
|
|
let mut harness = BeaconChainHarness::new(spec, validator_count as usize);
|
2019-01-27 03:22:51 +00:00
|
|
|
|
2019-01-28 05:21:33 +00:00
|
|
|
harness.advance_chain_with_block();
|
2019-01-27 03:22:51 +00:00
|
|
|
}
|
2018-12-30 01:59:24 +00:00
|
|
|
|
|
|
|
#[test]
|
2019-01-26 11:22:52 +00:00
|
|
|
#[ignore]
|
2019-01-27 03:22:51 +00:00
|
|
|
fn it_can_produce_past_first_epoch_boundary() {
|
2019-01-30 13:39:34 +00:00
|
|
|
Builder::from_env(Env::default().default_filter_or("debug")).init();
|
|
|
|
|
2019-02-01 04:39:30 +00:00
|
|
|
let validator_count = 100;
|
2019-01-30 13:39:34 +00:00
|
|
|
|
|
|
|
debug!("Starting harness build...");
|
|
|
|
|
2019-01-28 05:21:33 +00:00
|
|
|
let mut harness = BeaconChainHarness::new(ChainSpec::foundation(), validator_count);
|
2019-01-26 11:22:52 +00:00
|
|
|
|
2019-01-30 13:39:34 +00:00
|
|
|
debug!("Harness built, tests starting..");
|
|
|
|
|
|
|
|
let blocks = harness.spec.epoch_length * 3 + 1;
|
2019-01-26 11:22:52 +00:00
|
|
|
|
2019-01-30 13:39:34 +00:00
|
|
|
for i in 0..blocks {
|
2019-01-28 05:21:33 +00:00
|
|
|
harness.advance_chain_with_block();
|
2019-01-30 13:39:34 +00:00
|
|
|
debug!("Produced block {}/{}.", i, blocks);
|
2019-01-25 05:47:24 +00:00
|
|
|
}
|
2019-01-28 05:21:33 +00:00
|
|
|
let dump = harness.chain_dump().expect("Chain dump failed.");
|
2019-01-25 20:20:58 +00:00
|
|
|
|
2019-01-26 11:22:52 +00:00
|
|
|
assert_eq!(dump.len() as u64, blocks + 1); // + 1 for genesis block.
|
2019-01-25 21:25:56 +00:00
|
|
|
|
2019-01-28 05:21:33 +00:00
|
|
|
harness.dump_to_file("/tmp/chaindump.json".to_string(), &dump);
|
2018-12-30 01:59:24 +00:00
|
|
|
}
|