Skip to content
This repository was archived by the owner on Nov 6, 2020. It is now read-only.

clean up ethcore::spec module imports #7990

Merged
merged 2 commits into from
Feb 23, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions ethcore/src/spec/genesis.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@
// along with Parity. If not, see <http://www.gnu.org/licenses/>.

use ethereum_types::{H256, U256, Address};
use hash::KECCAK_NULL_RLP;
use ethjson;
use super::seal::Seal;
use hash::KECCAK_NULL_RLP;
use spec::seal::Seal;

/// Genesis components.
pub struct Genesis {
Expand Down
4 changes: 2 additions & 2 deletions ethcore/src/spec/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

mod genesis;
mod seal;
pub mod spec;
mod spec;

pub use self::spec::*;
pub use self::genesis::Genesis;
pub use self::spec::{Spec, SpecParams, CommonParams, OptimizeFor};
2 changes: 1 addition & 1 deletion ethcore/src/spec/seal.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

//! Spec seal.

use rlp::*;
use rlp::RlpStream;
use ethereum_types::{H64, H256, H520};
use ethjson;

Expand Down
32 changes: 12 additions & 20 deletions ethcore/src/spec/spec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,34 +16,33 @@

//! Parameters for a block chain.

use std::io::Read;
use std::collections::BTreeMap;
use std::io::Read;
use std::path::Path;
use std::sync::Arc;

use ethereum_types::{H256, Bloom, U256, Address};
use memorydb::MemoryDB;
use bytes::Bytes;
use ethereum_types::{H256, Bloom, U256, Address};
use ethjson;
use hash::{KECCAK_NULL_RLP, keccak};
use memorydb::MemoryDB;
use parking_lot::RwLock;
use rlp::{Rlp, RlpStream};
use rustc_hex::FromHex;
use vm::{EnvInfo, CallType, ActionValue, ActionParams, ParamsType};

use super::genesis::Genesis;
use super::seal::Generic as GenericSeal;

use builtin::Builtin;
use engines::{EthEngine, NullEngine, InstantSeal, BasicAuthority, AuthorityRound, Tendermint, DEFAULT_BLOCKHASH_CONTRACT};
use error::Error;
use executive::Executive;
use factory::Factories;
use header::{BlockNumber, Header};
use machine::EthereumMachine;
use pod_state::*;
use state::{Backend, State, Substate};
use pod_state::PodState;
use spec::Genesis;
use spec::seal::Generic as GenericSeal;
use state::backend::Basic as BasicBackend;
use state::{Backend, State, Substate};
use trace::{NoopTracer, NoopVMTracer};

pub use ethash::OptimizeFor;
Expand Down Expand Up @@ -819,9 +818,8 @@ impl Spec {
mod tests {
use super::*;
use state::State;
use std::str::FromStr;
use tests::helpers::get_temp_state_db;
use views::*;
use views::BlockView;

// https://github.com/paritytech/parity/issues/1840
#[test]
Expand All @@ -835,16 +833,12 @@ mod tests {

assert_eq!(
test_spec.state_root(),
H256::from_str(
"f3f4696bbf3b3b07775128eb7a3763279a394e382130f27c21e70233e04946a9",
).unwrap()
"f3f4696bbf3b3b07775128eb7a3763279a394e382130f27c21e70233e04946a9".into()
);
let genesis = test_spec.genesis_block();
assert_eq!(
BlockView::new(&genesis).header_view().hash(),
H256::from_str(
"0cd786a2425d16f152c658316c423e6ce1181e15c3295826d7c9904cba9ce303",
).unwrap()
"0cd786a2425d16f152c658316c423e6ce1181e15c3295826d7c9904cba9ce303".into()
);
}

Expand All @@ -860,10 +854,8 @@ mod tests {
spec.engine.account_start_nonce(0),
Default::default(),
).unwrap();
let expected = H256::from_str(
"0000000000000000000000000000000000000000000000000000000000000001",
).unwrap();
let address = Address::from_str("0000000000000000000000000000000000001337").unwrap();
let expected = "0000000000000000000000000000000000000000000000000000000000000001".into();
let address = "0000000000000000000000000000000000001337".into();

assert_eq!(state.storage_at(&address, &H256::zero()).unwrap(), expected);
assert_eq!(state.balance(&address).unwrap(), 1.into());
Expand Down