unify loading spec && further spec cleanups (#10948)

* bundle_* macros for spec

* fixed failing tests

* renamed bundle.rs to chain.rs

* removed unused derives

* updated spec/chain.rs description
This commit is contained in:
Marek Kotewicz
2019-08-07 16:52:48 +02:00
committed by David
parent c689495826
commit 45978bc2bd
45 changed files with 378 additions and 591 deletions

View File

@@ -29,13 +29,13 @@ use types::{
receipt,
transaction
};
use ethjson::spec::ForkSpec;
use trie_vm_factories::Factories;
use evm::{VMType, FinalizationResult};
use vm::{self, ActionParams, CreateContractAddress};
use ethtrie;
use account_state::{CleanupMode, State};
use substate::Substate;
use executive_state::ExecutiveState;
/// EVM test Error.
@@ -70,9 +70,6 @@ impl fmt::Display for EvmTestError {
}
}
use ethereum;
use ethjson::spec::ForkSpec;
/// Simplified, single-block EVM test client.
pub struct EvmTestClient<'a> {
state: State<state_db::StateDB>,
@@ -101,14 +98,14 @@ impl<'a> EvmTestClient<'a> {
/// Converts a json spec definition into spec.
pub fn fork_spec_from_json(spec: &ForkSpec) -> Option<spec::Spec> {
match *spec {
ForkSpec::Frontier => Some(ethereum::new_frontier_test()),
ForkSpec::Homestead => Some(ethereum::new_homestead_test()),
ForkSpec::EIP150 => Some(ethereum::new_eip150_test()),
ForkSpec::EIP158 => Some(ethereum::new_eip161_test()),
ForkSpec::Byzantium => Some(ethereum::new_byzantium_test()),
ForkSpec::Constantinople => Some(ethereum::new_constantinople_test()),
ForkSpec::ConstantinopleFix => Some(ethereum::new_constantinople_fix_test()),
ForkSpec::EIP158ToByzantiumAt5 => Some(ethereum::new_transition_test()),
ForkSpec::Frontier => Some(spec::new_frontier_test()),
ForkSpec::Homestead => Some(spec::new_homestead_test()),
ForkSpec::EIP150 => Some(spec::new_eip150_test()),
ForkSpec::EIP158 => Some(spec::new_eip161_test()),
ForkSpec::Byzantium => Some(spec::new_byzantium_test()),
ForkSpec::Constantinople => Some(spec::new_constantinople_test()),
ForkSpec::ConstantinopleFix => Some(spec::new_constantinople_fix_test()),
ForkSpec::EIP158ToByzantiumAt5 => Some(spec::new_transition_test()),
ForkSpec::FrontierToHomesteadAt5 | ForkSpec::HomesteadToDaoAt5 | ForkSpec::HomesteadToEIP150At5 => None,
}
}

View File

@@ -66,7 +66,7 @@ use engines::Engine;
use executive::Executed;
use journaldb;
use miner::{self, Miner, MinerService};
use spec::Spec;
use spec::{Spec, self};
use account_state::state::StateInfo;
use state_db::StateDB;
use trace::LocalizedTrace;
@@ -152,7 +152,7 @@ impl TestBlockChainClient {
/// Creates new test client with specified extra data for each block
pub fn new_with_extra_data(extra_data: Bytes) -> Self {
let spec = Spec::new_test();
let spec = spec::new_test();
TestBlockChainClient::new_with_spec_and_extra(spec, extra_data)
}