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

@@ -29,9 +29,9 @@ impl<E: EthSpec> Case for EpochProcessingCrosslinks<E> {
let mut expected = self.post.clone();
// Processing requires the epoch cache.
state.build_all_caches(&E::spec()).unwrap();
state.build_all_caches(&E::default_spec()).unwrap();
let mut result = process_crosslinks(&mut state, &E::spec()).map(|_| state);
let mut result = process_crosslinks(&mut state, &E::default_spec()).map(|_| state);
compare_beacon_state_results_without_caches(&mut result, &mut expected)
}

View File

@@ -27,7 +27,7 @@ impl<E: EthSpec> Case for EpochProcessingRegistryUpdates<E> {
fn result(&self, _case_index: usize) -> Result<(), Error> {
let mut state = self.pre.clone();
let mut expected = self.post.clone();
let spec = &E::spec();
let spec = &E::default_spec();
// Processing requires the epoch cache.
state.build_all_caches(spec).unwrap();

View File

@@ -31,9 +31,10 @@ impl<E: EthSpec> Case for OperationsAttesterSlashing<E> {
let mut expected = self.post.clone();
// Processing requires the epoch cache.
state.build_all_caches(&E::spec()).unwrap();
state.build_all_caches(&E::default_spec()).unwrap();
let result = process_attester_slashings(&mut state, &[attester_slashing], &E::spec());
let result =
process_attester_slashings(&mut state, &[attester_slashing], &E::default_spec());
let mut result = result.and_then(|_| Ok(state));

View File

@@ -34,7 +34,7 @@ impl<E: EthSpec> Case for OperationsDeposit<E> {
let deposit = self.deposit.clone();
let mut expected = self.post.clone();
let result = process_deposits(&mut state, &[deposit], &E::spec());
let result = process_deposits(&mut state, &[deposit], &E::default_spec());
let mut result = result.and_then(|_| Ok(state));

View File

@@ -31,9 +31,9 @@ impl<E: EthSpec> Case for OperationsExit<E> {
let mut expected = self.post.clone();
// Exit processing requires the epoch cache.
state.build_all_caches(&E::spec()).unwrap();
state.build_all_caches(&E::default_spec()).unwrap();
let result = process_exits(&mut state, &[exit], &E::spec());
let result = process_exits(&mut state, &[exit], &E::default_spec());
let mut result = result.and_then(|_| Ok(state));

View File

@@ -31,9 +31,10 @@ impl<E: EthSpec> Case for OperationsProposerSlashing<E> {
let mut expected = self.post.clone();
// Processing requires the epoch cache.
state.build_all_caches(&E::spec()).unwrap();
state.build_all_caches(&E::default_spec()).unwrap();
let result = process_proposer_slashings(&mut state, &[proposer_slashing], &E::spec());
let result =
process_proposer_slashings(&mut state, &[proposer_slashing], &E::default_spec());
let mut result = result.and_then(|_| Ok(state));

View File

@@ -31,9 +31,9 @@ impl<E: EthSpec> Case for OperationsTransfer<E> {
let mut expected = self.post.clone();
// Transfer processing requires the epoch cache.
state.build_all_caches(&E::spec()).unwrap();
state.build_all_caches(&E::default_spec()).unwrap();
let mut spec = E::spec();
let mut spec = E::default_spec();
spec.max_transfers = 1;
let result = process_transfers(&mut state, &[transfer], &spec);

View File

@@ -24,7 +24,7 @@ impl<T: EthSpec> Case for Shuffling<T> {
if self.count == 0 {
compare_result::<_, Error>(&Ok(vec![]), &Some(self.shuffled.clone()))?;
} else {
let spec = T::spec();
let spec = T::default_spec();
let seed = hex::decode(&self.seed[2..])
.map_err(|e| Error::FailedToParseTest(format!("{:?}", e)))?;

View File

@@ -1,6 +1,6 @@
use serde_derive::{Deserialize, Serialize};
use types::{
typenum::{U64, U8},
typenum::{U0, U64, U8},
ChainSpec, EthSpec, FewValidatorsEthSpec, FoundationEthSpec,
};
@@ -18,10 +18,12 @@ impl EthSpec for MinimalEthSpec {
type LatestRandaoMixesLength = U64;
type LatestActiveIndexRootsLength = U64;
type LatestSlashedExitLength = U64;
type SlotsPerEpoch = U8;
type GenesisEpoch = U0;
fn spec() -> ChainSpec {
fn default_spec() -> ChainSpec {
// TODO: this spec is likely incorrect!
let mut spec = FewValidatorsEthSpec::spec();
let mut spec = FewValidatorsEthSpec::default_spec();
spec.shuffle_round_count = 10;
spec
}