move StateResult to common-types (#11121)

This commit is contained in:
Juan Aguilar 2019-10-03 16:52:29 +02:00 committed by Andronik Ordian
parent 79a17dedd0
commit acc5bdfc35
7 changed files with 22 additions and 20 deletions

View File

@ -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 }

View File

@ -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<T> {
/// State is missing
Missing,
/// State is some
Some(T),
}
impl From<Box<dyn StateInfo>> for StateOrBlock {
fn from(info: Box<dyn StateInfo>) -> StateOrBlock {
StateOrBlock::State(info)

View File

@ -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},

View File

@ -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;

View File

@ -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<T> {
/// State is missing
Missing,
/// State is some
Some(T),
}

View File

@ -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;

View File

@ -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,