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:
@@ -29,10 +29,9 @@ use types::views::BlockView;
|
||||
|
||||
use client::{BlockChainClient, BlockChainReset, Client, ClientConfig, BlockId, ChainInfo, PrepareOpenBlock, ImportSealedBlock, ImportBlock};
|
||||
use client::BlockInfo;
|
||||
use ethereum;
|
||||
use crate::spec;
|
||||
use executive::{Executive, TransactOptions};
|
||||
use miner::{Miner, PendingOrdering, MinerService};
|
||||
use spec::Spec;
|
||||
use account_state::{State, CleanupMode, backend};
|
||||
use test_helpers::{
|
||||
self,
|
||||
@@ -44,7 +43,7 @@ use verification::queue::kind::blocks::Unverified;
|
||||
#[test]
|
||||
fn imports_from_empty() {
|
||||
let db = test_helpers::new_db();
|
||||
let spec = Spec::new_test();
|
||||
let spec = spec::new_test();
|
||||
|
||||
let client = Client::new(
|
||||
ClientConfig::default(),
|
||||
@@ -61,7 +60,7 @@ fn imports_from_empty() {
|
||||
fn should_return_registrar() {
|
||||
let db = test_helpers::new_db();
|
||||
let tempdir = TempDir::new("").unwrap();
|
||||
let spec = ethereum::new_morden(&tempdir.path().to_owned());
|
||||
let spec = spec::new_morden(&tempdir.path().to_owned());
|
||||
|
||||
let client = Client::new(
|
||||
ClientConfig::default(),
|
||||
@@ -77,7 +76,7 @@ fn should_return_registrar() {
|
||||
#[test]
|
||||
fn returns_state_root_basic() {
|
||||
let client = generate_dummy_client(6);
|
||||
let test_spec = Spec::new_test();
|
||||
let test_spec = spec::new_test();
|
||||
let genesis_header = test_spec.genesis_header();
|
||||
|
||||
assert!(client.state_data(genesis_header.state_root()).is_some());
|
||||
@@ -86,7 +85,7 @@ fn returns_state_root_basic() {
|
||||
#[test]
|
||||
fn imports_good_block() {
|
||||
let db = test_helpers::new_db();
|
||||
let spec = Spec::new_test();
|
||||
let spec = spec::new_test();
|
||||
|
||||
let client = Client::new(
|
||||
ClientConfig::default(),
|
||||
@@ -109,7 +108,7 @@ fn imports_good_block() {
|
||||
#[test]
|
||||
fn query_none_block() {
|
||||
let db = test_helpers::new_db();
|
||||
let spec = Spec::new_test();
|
||||
let spec = spec::new_test();
|
||||
|
||||
let client = Client::new(
|
||||
ClientConfig::default(),
|
||||
@@ -257,7 +256,7 @@ fn can_mine() {
|
||||
#[test]
|
||||
fn change_history_size() {
|
||||
let db = test_helpers::new_db();
|
||||
let test_spec = Spec::new_null();
|
||||
let test_spec = spec::new_null();
|
||||
let mut config = ClientConfig::default();
|
||||
|
||||
config.history = 2;
|
||||
@@ -329,7 +328,7 @@ fn transaction_proof() {
|
||||
|
||||
let client = generate_dummy_client(0);
|
||||
let address = Address::random();
|
||||
let test_spec = Spec::new_test();
|
||||
let test_spec = spec::new_test();
|
||||
for _ in 0..20 {
|
||||
let mut b = client.prepare_open_block(Address::zero(), (3141562.into(), 31415620.into()), vec![]).unwrap();
|
||||
b.block_mut().state_mut().add_balance(&address, &5.into(), CleanupMode::NoEmpty).unwrap();
|
||||
|
||||
@@ -29,6 +29,7 @@ use types::transaction::SYSTEM_ADDRESS;
|
||||
use rustc_hex::FromHex;
|
||||
|
||||
use ethereum_types::{H256, Address};
|
||||
use crate::spec;
|
||||
|
||||
evm_test!{test_blockhash_eip210: test_blockhash_eip210_int}
|
||||
fn test_blockhash_eip210(factory: Factory) {
|
||||
@@ -38,7 +39,7 @@ fn test_blockhash_eip210(factory: Factory) {
|
||||
let test_blockhash_contract = "73fffffffffffffffffffffffffffffffffffffffe33141561007a57600143036020526000356101006020510755600061010060205107141561005057600035610100610100602051050761010001555b6000620100006020510714156100755760003561010062010000602051050761020001555b61014a565b4360003512151561009057600060405260206040f35b610100600035430312156100b357610100600035075460605260206060f3610149565b62010000600035430312156100d157600061010060003507146100d4565b60005b156100f6576101006101006000350507610100015460805260206080f3610148565b630100000060003543031215610116576000620100006000350714610119565b60005b1561013c57610100620100006000350507610200015460a052602060a0f3610147565b600060c052602060c0f35b5b5b5b5b";
|
||||
let blockhash_contract_code = Arc::new(test_blockhash_contract.from_hex().unwrap());
|
||||
let blockhash_contract_code_hash = keccak(blockhash_contract_code.as_ref());
|
||||
let machine = ::ethereum::new_eip210_test_machine();
|
||||
let machine = spec::new_eip210_test_machine();
|
||||
let mut env_info = EnvInfo::default();
|
||||
|
||||
// populate state with 256 last hashes
|
||||
|
||||
@@ -21,7 +21,7 @@ use hash::keccak;
|
||||
use block::*;
|
||||
use ethereum_types::{U256, Address};
|
||||
use io::*;
|
||||
use spec::*;
|
||||
use crate::spec;
|
||||
use client::*;
|
||||
use test_helpers::get_temp_state_db;
|
||||
use client::{BlockChainClient, Client, ClientConfig};
|
||||
@@ -40,7 +40,7 @@ use types::views::BlockView;
|
||||
#[test]
|
||||
fn can_trace_block_and_uncle_reward() {
|
||||
let db = test_helpers::new_db();
|
||||
let spec = Spec::new_test_with_reward();
|
||||
let spec = spec::new_test_with_reward();
|
||||
let engine = &*spec.engine;
|
||||
|
||||
// Create client
|
||||
|
||||
Reference in New Issue
Block a user