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 basic-authority = { path = "./engines/basic-authority", optional = true} # used by test-helpers feature
blooms-db = { path = "../util/blooms-db", optional = true } blooms-db = { path = "../util/blooms-db", optional = true }
client-traits = { path = "./client-traits" } client-traits = { path = "./client-traits" }
common-types = { path = "types" } common-types = { path = "./types" }
engine = { path = "./engine" } engine = { path = "./engine" }
env_logger = { version = "0.5", optional = true } env_logger = { version = "0.5", optional = true }
ethash = { path = "../ethash", optional = true } ethash = { path = "../ethash", optional = true }

View File

@ -56,7 +56,10 @@ use trace::{
localized::LocalizedTrace, localized::LocalizedTrace,
VMTrace, VMTrace,
}; };
use common_types::data_format::DataFormat; use common_types::{
data_format::DataFormat,
client_types::StateResult
};
use vm::{LastHashes, Schedule}; use vm::{LastHashes, Schedule};
/// State information to be used during client query /// State information to be used during client query
@ -68,16 +71,6 @@ pub enum StateOrBlock {
Block(BlockId) 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 { impl From<Box<dyn StateInfo>> for StateOrBlock {
fn from(info: Box<dyn StateInfo>) -> StateOrBlock { fn from(info: Box<dyn StateInfo>) -> StateOrBlock {
StateOrBlock::State(info) StateOrBlock::State(info)

View File

@ -77,7 +77,6 @@ use client_traits::{
ScheduleInfo, ScheduleInfo,
StateClient, StateClient,
StateOrBlock, StateOrBlock,
StateResult,
Tick, Tick,
TransactionInfo TransactionInfo
}; };
@ -109,8 +108,7 @@ use types::{
BlockNumber, BlockNumber,
call_analytics::CallAnalytics, call_analytics::CallAnalytics,
chain_notify::{ChainMessageType, ChainRoute, NewBlocks}, chain_notify::{ChainMessageType, ChainRoute, NewBlocks},
client_types::ClientReport, client_types::{ClientReport, Mode, StateResult},
client_types::Mode,
encoded, encoded,
engines::{ engines::{
epoch::{PendingTransition, Transition as EpochTransition}, epoch::{PendingTransition, Transition as EpochTransition},

View File

@ -55,7 +55,7 @@ use types::{
view, view,
views::BlockView, views::BlockView,
verification::Unverified, verification::Unverified,
client_types::Mode, client_types::{Mode, StateResult},
blockchain_info::BlockChainInfo, blockchain_info::BlockChainInfo,
block_status::BlockStatus, block_status::BlockStatus,
verification::VerificationQueueInfo as BlockQueueInfo, verification::VerificationQueueInfo as BlockQueueInfo,
@ -72,7 +72,7 @@ use client::{
use client_traits::{ use client_traits::{
BlockInfo, Nonce, Balance, ChainInfo, TransactionInfo, BlockChainClient, ImportBlock, BlockInfo, Nonce, Balance, ChainInfo, TransactionInfo, BlockChainClient, ImportBlock,
AccountData, BlockChain, IoClient, BadBlocks, ScheduleInfo, StateClient, ProvingBlockChainClient, AccountData, BlockChain, IoClient, BadBlocks, ScheduleInfo, StateClient, ProvingBlockChainClient,
StateOrBlock, StateResult StateOrBlock
}; };
use engine::Engine; use engine::Engine;
use machine::executed::Executed; use machine::executed::Executed;

View File

@ -89,3 +89,13 @@ impl<'a> ops::Sub<&'a ClientReport> for ClientReport {
self 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 ethereum_types::{U256, H256, Address};
use bytes::ToPretty; use bytes::ToPretty;
use rlp::PayloadInfo; use rlp::PayloadInfo;
use client_traits::{BlockChainReset, Nonce, Balance, BlockChainClient, ImportExportBlocks, StateResult}; use client_traits::{BlockChainReset, Nonce, Balance, BlockChainClient, ImportExportBlocks};
use ethcore::{ use ethcore::{
client::{DatabaseCompactionProfile, VMType}, client::{DatabaseCompactionProfile, VMType},
miner::Miner, miner::Miner,
@ -44,7 +44,7 @@ use ansi_term::Colour;
use types::{ use types::{
ids::BlockId, ids::BlockId,
errors::{ImportError, EthcoreError}, errors::{ImportError, EthcoreError},
client_types::Mode, client_types::{Mode, StateResult},
}; };
use types::data_format::DataFormat; use types::data_format::DataFormat;
use verification::queue::VerifierSettings; 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 parking_lot::Mutex;
use account_state::state::StateInfo; 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 ethash::{self, SeedHashCompute};
use ethcore::client::{Call, EngineInfo}; use ethcore::client::{Call, EngineInfo};
use ethcore::miner::{self, MinerService}; use ethcore::miner::{self, MinerService};
@ -35,6 +35,7 @@ use miner::external::ExternalMinerService;
use sync::SyncProvider; use sync::SyncProvider;
use types::{ use types::{
BlockNumber as EthBlockNumber, BlockNumber as EthBlockNumber,
client_types::StateResult,
encoded, encoded,
ids::{BlockId, TransactionId, UncleId}, ids::{BlockId, TransactionId, UncleId},
filter::Filter as EthcoreFilter, filter::Filter as EthcoreFilter,