Add v0.8 genesis tests (#466)

Closes #452
This commit is contained in:
Michael Sproul
2019-07-30 17:02:38 +10:00
committed by GitHub
parent a236003a7b
commit eb669ab40f
10 changed files with 200 additions and 47 deletions

View File

@@ -14,15 +14,22 @@ pub fn get_compact_committees_root<T: EthSpec>(
// FIXME: this is a spec bug, whereby the start shard for the epoch after the next epoch
// is mistakenly used. The start shard from the cache SHOULD work.
// Waiting on a release to fix https://github.com/ethereum/eth2.0-specs/issues/1315
// let start_shard = state.get_epoch_start_shard(relative_epoch)?;
let start_shard = state.next_epoch_start_shard(spec)?;
let start_shard = if relative_epoch == RelativeEpoch::Next {
state.next_epoch_start_shard(spec)?
} else {
state.get_epoch_start_shard(relative_epoch)?
};
for committee_number in 0..state.get_committee_count(relative_epoch)? {
let shard = (start_shard + committee_number) % T::ShardCount::to_u64();
// FIXME: this is a partial workaround for the above, but it only works in the case
// where there's a committee for every shard in every epoch. It works for the minimal
// tests but not the mainnet ones.
let fake_shard = (shard + 1) % T::ShardCount::to_u64();
let fake_shard = if relative_epoch == RelativeEpoch::Next {
(shard + 1) % T::ShardCount::to_u64()
} else {
shard
};
for &index in state
.get_crosslink_committee_for_shard(fake_shard, relative_epoch)?