From acc5bdfc35ed43916893a60c0703328ad698d8ec Mon Sep 17 00:00:00 2001 From: Juan Aguilar Date: Thu, 3 Oct 2019 16:52:29 +0200 Subject: [PATCH] move StateResult to `common-types` (#11121) --- ethcore/Cargo.toml | 2 +- ethcore/client-traits/src/lib.rs | 15 ++++----------- ethcore/src/client/client.rs | 4 +--- ethcore/src/test_helpers/test_client.rs | 4 ++-- ethcore/types/src/client_types.rs | 10 ++++++++++ parity/blockchain.rs | 4 ++-- rpc/src/v1/impls/eth.rs | 3 ++- 7 files changed, 22 insertions(+), 20 deletions(-) diff --git a/ethcore/Cargo.toml b/ethcore/Cargo.toml index e147d26b7..ed33bfa64 100644 --- a/ethcore/Cargo.toml +++ b/ethcore/Cargo.toml @@ -12,7 +12,7 @@ ansi_term = "0.11" basic-authority = { path = "./engines/basic-authority", optional = true} # used by test-helpers feature blooms-db = { path = "../util/blooms-db", optional = true } client-traits = { path = "./client-traits" } -common-types = { path = "types" } +common-types = { path = "./types" } engine = { path = "./engine" } env_logger = { version = "0.5", optional = true } ethash = { path = "../ethash", optional = true } diff --git a/ethcore/client-traits/src/lib.rs b/ethcore/client-traits/src/lib.rs index d802a3459..3bdec5fa0 100644 --- a/ethcore/client-traits/src/lib.rs +++ b/ethcore/client-traits/src/lib.rs @@ -56,7 +56,10 @@ use trace::{ localized::LocalizedTrace, VMTrace, }; -use common_types::data_format::DataFormat; +use common_types::{ + data_format::DataFormat, + client_types::StateResult +}; use vm::{LastHashes, Schedule}; /// State information to be used during client query @@ -68,16 +71,6 @@ pub enum StateOrBlock { Block(BlockId) } -/// Result to be used during get address code at given block's state -// todo[botika] move to `common-types` -pub enum StateResult { - /// State is missing - Missing, - - /// State is some - Some(T), -} - impl From> for StateOrBlock { fn from(info: Box) -> StateOrBlock { StateOrBlock::State(info) diff --git a/ethcore/src/client/client.rs b/ethcore/src/client/client.rs index 22d9e5a49..6d3e740d0 100644 --- a/ethcore/src/client/client.rs +++ b/ethcore/src/client/client.rs @@ -77,7 +77,6 @@ use client_traits::{ ScheduleInfo, StateClient, StateOrBlock, - StateResult, Tick, TransactionInfo }; @@ -109,8 +108,7 @@ use types::{ BlockNumber, call_analytics::CallAnalytics, chain_notify::{ChainMessageType, ChainRoute, NewBlocks}, - client_types::ClientReport, - client_types::Mode, + client_types::{ClientReport, Mode, StateResult}, encoded, engines::{ epoch::{PendingTransition, Transition as EpochTransition}, diff --git a/ethcore/src/test_helpers/test_client.rs b/ethcore/src/test_helpers/test_client.rs index 55134f5cc..dd34f0849 100644 --- a/ethcore/src/test_helpers/test_client.rs +++ b/ethcore/src/test_helpers/test_client.rs @@ -55,7 +55,7 @@ use types::{ view, views::BlockView, verification::Unverified, - client_types::Mode, + client_types::{Mode, StateResult}, blockchain_info::BlockChainInfo, block_status::BlockStatus, verification::VerificationQueueInfo as BlockQueueInfo, @@ -72,7 +72,7 @@ use client::{ use client_traits::{ BlockInfo, Nonce, Balance, ChainInfo, TransactionInfo, BlockChainClient, ImportBlock, AccountData, BlockChain, IoClient, BadBlocks, ScheduleInfo, StateClient, ProvingBlockChainClient, - StateOrBlock, StateResult + StateOrBlock }; use engine::Engine; use machine::executed::Executed; diff --git a/ethcore/types/src/client_types.rs b/ethcore/types/src/client_types.rs index 00fcd91be..d38d1bd5e 100644 --- a/ethcore/types/src/client_types.rs +++ b/ethcore/types/src/client_types.rs @@ -89,3 +89,13 @@ impl<'a> ops::Sub<&'a ClientReport> for ClientReport { self } } + +/// Result to be used during get address code at given block's state +pub enum StateResult { + /// State is missing + Missing, + + /// State is some + Some(T), +} + diff --git a/parity/blockchain.rs b/parity/blockchain.rs index ba8073617..3686476c8 100644 --- a/parity/blockchain.rs +++ b/parity/blockchain.rs @@ -26,7 +26,7 @@ use hash::{keccak, KECCAK_NULL_RLP}; use ethereum_types::{U256, H256, Address}; use bytes::ToPretty; use rlp::PayloadInfo; -use client_traits::{BlockChainReset, Nonce, Balance, BlockChainClient, ImportExportBlocks, StateResult}; +use client_traits::{BlockChainReset, Nonce, Balance, BlockChainClient, ImportExportBlocks}; use ethcore::{ client::{DatabaseCompactionProfile, VMType}, miner::Miner, @@ -44,7 +44,7 @@ use ansi_term::Colour; use types::{ ids::BlockId, errors::{ImportError, EthcoreError}, - client_types::Mode, + client_types::{Mode, StateResult}, }; use types::data_format::DataFormat; use verification::queue::VerifierSettings; diff --git a/rpc/src/v1/impls/eth.rs b/rpc/src/v1/impls/eth.rs index a70c3e458..9ba85b940 100644 --- a/rpc/src/v1/impls/eth.rs +++ b/rpc/src/v1/impls/eth.rs @@ -25,7 +25,7 @@ use ethereum_types::{Address, H64, H160, H256, U64, U256, BigEndianHash}; use parking_lot::Mutex; use account_state::state::StateInfo; -use client_traits::{BlockChainClient, StateClient, ProvingBlockChainClient, StateOrBlock, StateResult}; +use client_traits::{BlockChainClient, StateClient, ProvingBlockChainClient, StateOrBlock}; use ethash::{self, SeedHashCompute}; use ethcore::client::{Call, EngineInfo}; use ethcore::miner::{self, MinerService}; @@ -35,6 +35,7 @@ use miner::external::ExternalMinerService; use sync::SyncProvider; use types::{ BlockNumber as EthBlockNumber, + client_types::StateResult, encoded, ids::{BlockId, TransactionId, UncleId}, filter::Filter as EthcoreFilter,