From 36ba004c29b3a33e55863a8bc676a8142d544607 Mon Sep 17 00:00:00 2001 From: Marek Kotewicz Date: Wed, 17 Jan 2018 10:35:43 +0100 Subject: [PATCH] removed redundant ethcore/basic_types.rs (#7584) --- ethcore/src/basic_types.rs | 31 --------------------- ethcore/src/block.rs | 3 +- ethcore/src/client/client.rs | 3 +- ethcore/src/header.rs | 13 ++++++--- ethcore/src/lib.rs | 1 - ethcore/src/snapshot/block.rs | 3 +- ethcore/src/snapshot/consensus/authority.rs | 4 +-- ethcore/src/snapshot/consensus/work.rs | 4 +-- 8 files changed, 17 insertions(+), 45 deletions(-) delete mode 100644 ethcore/src/basic_types.rs diff --git a/ethcore/src/basic_types.rs b/ethcore/src/basic_types.rs deleted file mode 100644 index 6f21f503e..000000000 --- a/ethcore/src/basic_types.rs +++ /dev/null @@ -1,31 +0,0 @@ -// Copyright 2015-2017 Parity Technologies (UK) Ltd. -// This file is part of Parity. - -// Parity is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. - -// Parity is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// You should have received a copy of the GNU General Public License -// along with Parity. If not, see . - -//! Ethcore basic typenames. - -/// Type for a 2048-bit log-bloom, as used by our blocks. -use ethereum_types::Bloom; - -/// Constant 2048-bit datum for 0. Often used as a default. -pub static ZERO_LOGBLOOM: Bloom = Bloom([0x00; 256]); - -/// Semantic boolean for when a seal/signature is included. -pub enum Seal { - /// The seal/signature is included. - With, - /// The seal/signature is not included. - Without, -} diff --git a/ethcore/src/block.rs b/ethcore/src/block.rs index 4cfba59b2..c4c82a17b 100644 --- a/ethcore/src/block.rs +++ b/ethcore/src/block.rs @@ -27,12 +27,11 @@ use ethereum_types::{H256, U256, Address, Bloom}; use bytes::Bytes; use unexpected::{Mismatch, OutOfBounds}; -use basic_types::Seal; use vm::{EnvInfo, LastHashes}; use engines::EthEngine; use error::{Error, BlockError}; use factory::Factories; -use header::Header; +use header::{Header, Seal}; use receipt::{Receipt, TransactionOutcome}; use state::State; use state_db::StateDB; diff --git a/ethcore/src/client/client.rs b/ethcore/src/client/client.rs index c8b416f63..f828b1b84 100644 --- a/ethcore/src/client/client.rs +++ b/ethcore/src/client/client.rs @@ -33,7 +33,6 @@ use kvdb::{DBValue, KeyValueDB, DBTransaction}; // other use ethereum_types::{H256, Address, U256}; -use basic_types::Seal; use block::*; use blockchain::{BlockChain, BlockProvider, TreeRoute, ImportRoute}; use blockchain::extras::TransactionAddress; @@ -52,7 +51,7 @@ use evm::{Factory as EvmFactory, Schedule}; use executive::{Executive, Executed, TransactOptions, contract_address}; use factory::Factories; use futures::{future, Future}; -use header::{BlockNumber, Header}; +use header::{BlockNumber, Header, Seal}; use io::*; use log_entry::LocalizedLogEntry; use miner::{Miner, MinerService}; diff --git a/ethcore/src/header.rs b/ethcore/src/header.rs index d2069af1c..cfac04f3c 100644 --- a/ethcore/src/header.rs +++ b/ethcore/src/header.rs @@ -22,14 +22,19 @@ use hash::{KECCAK_NULL_RLP, KECCAK_EMPTY_LIST_RLP, keccak}; use heapsize::HeapSizeOf; use ethereum_types::{H256, U256, Address, Bloom}; use bytes::Bytes; -use basic_types::{ZERO_LOGBLOOM}; use time::get_time; use rlp::*; -pub use basic_types::Seal; - pub use types::BlockNumber; +/// Semantic boolean for when a seal/signature is included. +pub enum Seal { + /// The seal/signature is included. + With, + /// The seal/signature is not included. + Without, +} + /// A block header. /// /// Reflects the specific RLP fields of a block in the chain with additional room for the seal @@ -109,7 +114,7 @@ impl Default for Header { state_root: KECCAK_NULL_RLP, receipts_root: KECCAK_NULL_RLP, - log_bloom: ZERO_LOGBLOOM.clone(), + log_bloom: Bloom::default(), gas_used: U256::default(), gas_limit: U256::default(), diff --git a/ethcore/src/lib.rs b/ethcore/src/lib.rs index c576aad74..19acaa516 100644 --- a/ethcore/src/lib.rs +++ b/ethcore/src/lib.rs @@ -152,7 +152,6 @@ pub mod views; mod cache_manager; mod blooms; -mod basic_types; mod pod_account; mod state_db; mod account_db; diff --git a/ethcore/src/snapshot/block.rs b/ethcore/src/snapshot/block.rs index b5505dd83..d503a57bb 100644 --- a/ethcore/src/snapshot/block.rs +++ b/ethcore/src/snapshot/block.rs @@ -135,6 +135,7 @@ impl AbridgedBlock { mod tests { use views::BlockView; use block::Block; + use header::Seal; use super::AbridgedBlock; use transaction::{Action, Transaction}; @@ -142,7 +143,7 @@ mod tests { use bytes::Bytes; fn encode_block(b: &Block) -> Bytes { - b.rlp_bytes(::basic_types::Seal::With) + b.rlp_bytes(Seal::With) } #[test] diff --git a/ethcore/src/snapshot/consensus/authority.rs b/ethcore/src/snapshot/consensus/authority.rs index a6e6ac834..46f433c00 100644 --- a/ethcore/src/snapshot/consensus/authority.rs +++ b/ethcore/src/snapshot/consensus/authority.rs @@ -28,7 +28,7 @@ use blockchain::{BlockChain, BlockProvider}; use engines::{EthEngine, EpochVerifier, EpochTransition}; use machine::EthereumMachine; use ids::BlockId; -use header::Header; +use header::{Header, Seal}; use receipt::Receipt; use snapshot::{Error, ManifestData}; @@ -324,7 +324,7 @@ impl Rebuilder for ChunkRebuilder { transactions: last_rlp.list_at(1)?, uncles: last_rlp.list_at(2)?, }; - let block_data = block.rlp_bytes(::basic_types::Seal::With); + let block_data = block.rlp_bytes(Seal::With); let receipts: Vec = last_rlp.list_at(3)?; { diff --git a/ethcore/src/snapshot/consensus/work.rs b/ethcore/src/snapshot/consensus/work.rs index f905b9036..2c3b89d98 100644 --- a/ethcore/src/snapshot/consensus/work.rs +++ b/ethcore/src/snapshot/consensus/work.rs @@ -220,7 +220,7 @@ impl Rebuilder for PowRebuilder { /// Feed the rebuilder an uncompressed block chunk. /// Returns the number of blocks fed or any errors. fn feed(&mut self, chunk: &[u8], engine: &EthEngine, abort_flag: &AtomicBool) -> Result<(), ::error::Error> { - use basic_types::Seal::With; + use header::Seal; use views::BlockView; use snapshot::verify_old_block; use ethereum_types::U256; @@ -253,7 +253,7 @@ impl Rebuilder for PowRebuilder { ); let block = abridged_block.to_block(parent_hash, cur_number, receipts_root)?; - let block_bytes = block.rlp_bytes(With); + let block_bytes = block.rlp_bytes(Seal::With); let is_best = cur_number == self.best_number; if is_best {