Remove dupe info between ChainSpec and EthSpec

This commit is contained in:
Paul Hauner
2019-06-08 07:57:25 -04:00
parent f69d9093a3
commit e74d49fc8a
57 changed files with 299 additions and 252 deletions

View File

@@ -676,7 +676,7 @@ mod tests {
}
fn test_state(rng: &mut XorShiftRng) -> (ChainSpec, BeaconState<FoundationEthSpec>) {
let spec = FoundationEthSpec::spec();
let spec = FoundationEthSpec::default_spec();
let mut state = BeaconState::random_for_test(rng);
@@ -721,21 +721,21 @@ mod tests {
fn attestation_test_state<E: EthSpec>(
num_committees: usize,
) -> (BeaconState<E>, Vec<Keypair>, ChainSpec) {
let spec = E::spec();
let spec = E::default_spec();
let num_validators =
num_committees * spec.slots_per_epoch as usize * spec.target_committee_size;
num_committees * T::slots_per_epoch() as usize * spec.target_committee_size;
let mut state_builder = TestingBeaconStateBuilder::from_default_keypairs_file_if_exists(
num_validators,
&spec,
);
let slot_offset = 1000 * spec.slots_per_epoch + spec.slots_per_epoch / 2;
let slot_offset = 1000 * T::slots_per_epoch() + T::slots_per_epoch() / 2;
let slot = spec.genesis_slot + slot_offset;
state_builder.teleport_to_slot(slot, &spec);
state_builder.build_caches(&spec).unwrap();
let (state, keypairs) = state_builder.build();
(state, keypairs, FoundationEthSpec::spec())
(state, keypairs, FoundationEthSpec::default_spec())
}
#[test]
@@ -852,7 +852,7 @@ mod tests {
// But once we advance to more than an epoch after the attestation, it should prune it
// out of existence.
state.slot += 2 * spec.slots_per_epoch;
state.slot += 2 * T::slots_per_epoch();
op_pool.prune_attestations(state);
assert_eq!(op_pool.num_attestations(), 0);
}