pub struct Backend {Show 22 fields
db: Arc<RwLock<Box<dyn Db>>>,
blockchain: Blockchain,
states: Arc<RwLock<InMemoryBlockStates>>,
env: Arc<RwLock<EnvWithHandlerCfg>>,
fork: Arc<RwLock<Option<ClientFork>>>,
time: TimeManager,
cheats: CheatsManager,
fees: FeeManager,
genesis: GenesisConfig,
new_block_listeners: Arc<Mutex<Vec<UnboundedSender<NewBlockNotification>>>>,
active_state_snapshots: Arc<Mutex<HashMap<U256, (u64, B256)>>>,
enable_steps_tracing: bool,
print_logs: bool,
alphanet: bool,
prune_state_history_config: PruneStateHistoryConfig,
transaction_block_keeper: Option<usize>,
node_config: Arc<RwLock<NodeConfig>>,
slots_in_an_epoch: u64,
precompile_factory: Option<Arc<dyn PrecompileFactory>>,
mining: Arc<Mutex<()>>,
capabilities: Arc<RwLock<WalletCapabilities>>,
executor_wallet: Arc<RwLock<Option<EthereumWallet>>>,
}
Expand description
Gives access to the [revm::Database]
Fields§
§db: Arc<RwLock<Box<dyn Db>>>
Access to [revm::Database
] abstraction.
This will be used in combination with [revm::Evm
] and is responsible for feeding data to
the evm during its execution.
At time of writing, there are two different types of Db
:
MemDb
: everything is stored in memoryForkDb
: forks off a remote client, missing data is retrieved via RPC-calls
In order to commit changes to the [revm::Database
], the [revm::Evm
] requires mutable
access, which requires a write-lock from this db
. In forking mode, the time during
which the write-lock is active depends on whether the ForkDb
can provide all requested
data from memory or whether it has to retrieve it via RPC calls first. This means that it
potentially blocks for some time, even taking into account the rate limits of RPC
endpoints. Therefore the Db
is guarded by a tokio::sync::RwLock
here so calls that
need to read from it, while it’s currently written to, don’t block. E.g. a new block is
currently mined and a new Self::set_storage_at()
request is being executed.
blockchain: Blockchain
stores all block related data in memory.
states: Arc<RwLock<InMemoryBlockStates>>
Historic states of previous blocks.
env: Arc<RwLock<EnvWithHandlerCfg>>
Env data of the chain
fork: Arc<RwLock<Option<ClientFork>>>
This is set if this is currently forked off another client.
time: TimeManager
Provides time related info, like timestamp.
cheats: CheatsManager
Contains state of custom overrides.
fees: FeeManager
Contains fee data.
genesis: GenesisConfig
Initialised genesis.
new_block_listeners: Arc<Mutex<Vec<UnboundedSender<NewBlockNotification>>>>
Listeners for new blocks that get notified when a new block was imported.
active_state_snapshots: Arc<Mutex<HashMap<U256, (u64, B256)>>>
Keeps track of active state snapshots at a specific block.
enable_steps_tracing: bool
§print_logs: bool
§alphanet: bool
§prune_state_history_config: PruneStateHistoryConfig
How to keep history state
transaction_block_keeper: Option<usize>
max number of blocks with transactions in memory
node_config: Arc<RwLock<NodeConfig>>
§slots_in_an_epoch: u64
Slots in an epoch
precompile_factory: Option<Arc<dyn PrecompileFactory>>
Precompiles to inject to the EVM.
mining: Arc<Mutex<()>>
Prevent race conditions during mining
capabilities: Arc<RwLock<WalletCapabilities>>
§executor_wallet: Arc<RwLock<Option<EthereumWallet>>>
Implementations§
Source§impl Backend
impl Backend
Sourcepub async fn with_genesis(
db: Arc<AsyncRwLock<Box<dyn Db>>>,
env: Arc<RwLock<EnvWithHandlerCfg>>,
genesis: GenesisConfig,
fees: FeeManager,
fork: Arc<RwLock<Option<ClientFork>>>,
enable_steps_tracing: bool,
print_logs: bool,
alphanet: bool,
prune_state_history_config: PruneStateHistoryConfig,
max_persisted_states: Option<usize>,
transaction_block_keeper: Option<usize>,
automine_block_time: Option<Duration>,
cache_path: Option<PathBuf>,
node_config: Arc<AsyncRwLock<NodeConfig>>,
) -> Self
pub async fn with_genesis( db: Arc<AsyncRwLock<Box<dyn Db>>>, env: Arc<RwLock<EnvWithHandlerCfg>>, genesis: GenesisConfig, fees: FeeManager, fork: Arc<RwLock<Option<ClientFork>>>, enable_steps_tracing: bool, print_logs: bool, alphanet: bool, prune_state_history_config: PruneStateHistoryConfig, max_persisted_states: Option<usize>, transaction_block_keeper: Option<usize>, automine_block_time: Option<Duration>, cache_path: Option<PathBuf>, node_config: Arc<AsyncRwLock<NodeConfig>>, ) -> Self
Initialises the balance of the given accounts
Sourcepub async fn set_create2_deployer(&self, address: Address) -> DatabaseResult<()>
pub async fn set_create2_deployer(&self, address: Address) -> DatabaseResult<()>
Writes the CREATE2 deployer code directly to the database at the address provided.
Sourcepub(crate) fn get_capabilities(&self) -> WalletCapabilities
pub(crate) fn get_capabilities(&self) -> WalletCapabilities
Get the capabilities of the wallet.
Currently the only capability is DelegationCapability
.
Sourcepub(crate) fn update_interval_mine_block_time(&self, block_time: Duration)
pub(crate) fn update_interval_mine_block_time(&self, block_time: Duration)
Updates memory limits that should be more strict when auto-mine is enabled
pub(crate) fn executor_wallet(&self) -> Option<EthereumWallet>
Sourcepub(crate) fn add_capability(&self, address: Address)
pub(crate) fn add_capability(&self, address: Address)
Adds an address to the [DelegationCapability
] of the wallet.
pub(crate) fn set_executor( &self, executor_pk: String, ) -> Result<Address, BlockchainError>
Sourceasync fn apply_genesis(&self) -> Result<(), DatabaseError>
async fn apply_genesis(&self) -> Result<(), DatabaseError>
Applies the configured genesis settings
This will fund, create the genesis accounts
Sourcepub fn impersonate(&self, addr: Address) -> bool
pub fn impersonate(&self, addr: Address) -> bool
Sets the account to impersonate
Returns true
if the account is already impersonated
Sourcepub fn stop_impersonating(&self, addr: Address)
pub fn stop_impersonating(&self, addr: Address)
Removes the account that from the impersonated set
If the impersonated addr
is a contract then we also reset the code here
Sourcepub fn auto_impersonate_account(&self, enabled: bool)
pub fn auto_impersonate_account(&self, enabled: bool)
If set to true will make every account impersonated
Sourcepub fn get_fork(&self) -> Option<ClientFork>
pub fn get_fork(&self) -> Option<ClientFork>
Returns the configured fork, if any
Sourcepub async fn get_account(&self, address: Address) -> DatabaseResult<AccountInfo>
pub async fn get_account(&self, address: Address) -> DatabaseResult<AccountInfo>
Returns the AccountInfo
from the database
pub fn precompiles(&self) -> Vec<Address>
Sourcepub async fn reset_fork(&self, forking: Forking) -> Result<(), BlockchainError>
pub async fn reset_fork(&self, forking: Forking) -> Result<(), BlockchainError>
Resets the fork to a fresh state
Sourcepub fn time(&self) -> &TimeManager
pub fn time(&self) -> &TimeManager
Returns the TimeManager
responsible for timestamps
Sourcepub fn cheats(&self) -> &CheatsManager
pub fn cheats(&self) -> &CheatsManager
Returns the CheatsManager
responsible for executing cheatcodes
Sourcepub fn fees(&self) -> &FeeManager
pub fn fees(&self) -> &FeeManager
Returns the FeeManager
that manages fee/pricings
Sourcepub fn best_number(&self) -> u64
pub fn best_number(&self) -> u64
Returns the current best number of the chain
Sourcepub fn set_block_number(&self, number: U256)
pub fn set_block_number(&self, number: U256)
Sets the block number
pub fn set_chain_id(&self, chain_id: u64)
Sourcepub async fn current_balance(&self, address: Address) -> DatabaseResult<U256>
pub async fn current_balance(&self, address: Address) -> DatabaseResult<U256>
Returns balance of the given account.
Sourcepub async fn current_nonce(&self, address: Address) -> DatabaseResult<u64>
pub async fn current_nonce(&self, address: Address) -> DatabaseResult<u64>
Returns balance of the given account.
Sourcepub fn set_coinbase(&self, address: Address)
pub fn set_coinbase(&self, address: Address)
Sets the coinbase address
Sourcepub async fn set_nonce(
&self,
address: Address,
nonce: U256,
) -> DatabaseResult<()>
pub async fn set_nonce( &self, address: Address, nonce: U256, ) -> DatabaseResult<()>
Sets the nonce of the given address
Sourcepub async fn set_balance(
&self,
address: Address,
balance: U256,
) -> DatabaseResult<()>
pub async fn set_balance( &self, address: Address, balance: U256, ) -> DatabaseResult<()>
Sets the balance of the given address
Sourcepub async fn set_code(
&self,
address: Address,
code: Bytes,
) -> DatabaseResult<()>
pub async fn set_code( &self, address: Address, code: Bytes, ) -> DatabaseResult<()>
Sets the code of the given address
Sourcepub async fn set_storage_at(
&self,
address: Address,
slot: U256,
val: B256,
) -> DatabaseResult<()>
pub async fn set_storage_at( &self, address: Address, slot: U256, val: B256, ) -> DatabaseResult<()>
Sets the value for the given slot of the given address
Sourcepub fn is_eip1559(&self) -> bool
pub fn is_eip1559(&self) -> bool
Returns true for post London
Sourcepub fn is_eip3675(&self) -> bool
pub fn is_eip3675(&self) -> bool
Returns true for post Merge
Sourcepub fn is_eip2930(&self) -> bool
pub fn is_eip2930(&self) -> bool
Returns true for post Berlin
Sourcepub fn is_eip4844(&self) -> bool
pub fn is_eip4844(&self) -> bool
Returns true for post Cancun
Sourcepub fn is_eip7702(&self) -> bool
pub fn is_eip7702(&self) -> bool
Returns true for post Prague
Sourcepub fn is_optimism(&self) -> bool
pub fn is_optimism(&self) -> bool
Returns true if op-stack deposits are active
Sourcepub fn ensure_eip1559_active(&self) -> Result<(), BlockchainError>
pub fn ensure_eip1559_active(&self) -> Result<(), BlockchainError>
Returns an error if EIP1559 is not active (pre Berlin)
Sourcepub fn ensure_eip2930_active(&self) -> Result<(), BlockchainError>
pub fn ensure_eip2930_active(&self) -> Result<(), BlockchainError>
Returns an error if EIP1559 is not active (pre muirGlacier)
pub fn ensure_eip4844_active(&self) -> Result<(), BlockchainError>
pub fn ensure_eip7702_active(&self) -> Result<(), BlockchainError>
Sourcepub fn ensure_op_deposits_active(&self) -> Result<(), BlockchainError>
pub fn ensure_op_deposits_active(&self) -> Result<(), BlockchainError>
Returns an error if op-stack deposits are not active
Sourcepub fn set_gas_limit(&self, gas_limit: u128)
pub fn set_gas_limit(&self, gas_limit: u128)
Sets the block gas limit
Sourcepub fn is_min_priority_fee_enforced(&self) -> bool
pub fn is_min_priority_fee_enforced(&self) -> bool
Returns whether the minimum suggested priority fee is enforced
pub fn excess_blob_gas_and_price(&self) -> Option<BlobExcessGasAndPrice>
Sourcepub fn set_base_fee(&self, basefee: u64)
pub fn set_base_fee(&self, basefee: u64)
Sets the current basefee
Sourcepub fn set_gas_price(&self, price: u128)
pub fn set_gas_price(&self, price: u128)
Sets the gas price
pub fn elasticity(&self) -> f64
Sourcepub fn total_difficulty(&self) -> U256
pub fn total_difficulty(&self) -> U256
Returns the total difficulty of the chain until this block
Note: this will always be 0
in memory mode
In forking mode this will always be the total difficulty of the forked block
Sourcepub async fn create_state_snapshot(&self) -> U256
pub async fn create_state_snapshot(&self) -> U256
Creates a new evm_snapshot
at the current height.
Returns the id of the snapshot created.
Sourcepub async fn revert_state_snapshot(
&self,
id: U256,
) -> Result<bool, BlockchainError>
pub async fn revert_state_snapshot( &self, id: U256, ) -> Result<bool, BlockchainError>
Reverts the state to the state snapshot identified by the given id
.
pub fn list_state_snapshots(&self) -> BTreeMap<U256, (u64, B256)>
Sourcepub async fn serialized_state(
&self,
preserve_historical_states: bool,
) -> Result<SerializableState, BlockchainError>
pub async fn serialized_state( &self, preserve_historical_states: bool, ) -> Result<SerializableState, BlockchainError>
Get the current state.
Sourcepub async fn dump_state(
&self,
preserve_historical_states: bool,
) -> Result<Bytes, BlockchainError>
pub async fn dump_state( &self, preserve_historical_states: bool, ) -> Result<Bytes, BlockchainError>
Write all chain data to serialized bytes buffer
Sourcepub async fn load_state(
&self,
state: SerializableState,
) -> Result<bool, BlockchainError>
pub async fn load_state( &self, state: SerializableState, ) -> Result<bool, BlockchainError>
Apply SerializableState data to the backend storage.
Sourcepub async fn load_state_bytes(
&self,
buf: Bytes,
) -> Result<bool, BlockchainError>
pub async fn load_state_bytes( &self, buf: Bytes, ) -> Result<bool, BlockchainError>
Deserialize and add all chain data to the backend storage
Sourcefn new_evm_with_inspector_ref<'i, 'db>(
&self,
db: &'db dyn DatabaseRef<Error = DatabaseError>,
env: EnvWithHandlerCfg,
inspector: &'i mut dyn Inspector<WrapDatabaseRef<&'db dyn DatabaseRef<Error = DatabaseError>>>,
) -> Evm<'_, &'i mut dyn Inspector<WrapDatabaseRef<&'db dyn DatabaseRef<Error = DatabaseError>>>, WrapDatabaseRef<&'db dyn DatabaseRef<Error = DatabaseError>>>
fn new_evm_with_inspector_ref<'i, 'db>( &self, db: &'db dyn DatabaseRef<Error = DatabaseError>, env: EnvWithHandlerCfg, inspector: &'i mut dyn Inspector<WrapDatabaseRef<&'db dyn DatabaseRef<Error = DatabaseError>>>, ) -> Evm<'_, &'i mut dyn Inspector<WrapDatabaseRef<&'db dyn DatabaseRef<Error = DatabaseError>>>, WrapDatabaseRef<&'db dyn DatabaseRef<Error = DatabaseError>>>
Creates an EVM instance with optionally injected precompiles.
Sourcepub async fn inspect_tx(
&self,
tx: Arc<PoolTransaction>,
) -> Result<(InstructionResult, Option<Output>, u64, State, Vec<Log>), BlockchainError>
pub async fn inspect_tx( &self, tx: Arc<PoolTransaction>, ) -> Result<(InstructionResult, Option<Output>, u64, State, Vec<Log>), BlockchainError>
executes the transactions without writing to the underlying database
Sourcepub async fn pending_block(
&self,
pool_transactions: Vec<Arc<PoolTransaction>>,
) -> BlockInfo
pub async fn pending_block( &self, pool_transactions: Vec<Arc<PoolTransaction>>, ) -> BlockInfo
Creates the pending block
This will execute all transaction in the order they come but will not mine the block
Sourcepub async fn with_pending_block<F, T>(
&self,
pool_transactions: Vec<Arc<PoolTransaction>>,
f: F,
) -> T
pub async fn with_pending_block<F, T>( &self, pool_transactions: Vec<Arc<PoolTransaction>>, f: F, ) -> T
Creates the pending block
This will execute all transaction in the order they come but will not mine the block
Sourcepub async fn mine_block(
&self,
pool_transactions: Vec<Arc<PoolTransaction>>,
) -> MinedBlockOutcome
pub async fn mine_block( &self, pool_transactions: Vec<Arc<PoolTransaction>>, ) -> MinedBlockOutcome
Mines a new block and stores it.
this will execute all transaction in the order they come in and return all the markers they provide.
async fn do_mine_block( &self, pool_transactions: Vec<Arc<PoolTransaction>>, ) -> MinedBlockOutcome
Sourcepub async fn call(
&self,
request: WithOtherFields<TransactionRequest>,
fee_details: FeeDetails,
block_request: Option<BlockRequest>,
overrides: Option<StateOverride>,
) -> Result<(InstructionResult, Option<Output>, u128, State), BlockchainError>
pub async fn call( &self, request: WithOtherFields<TransactionRequest>, fee_details: FeeDetails, block_request: Option<BlockRequest>, overrides: Option<StateOverride>, ) -> Result<(InstructionResult, Option<Output>, u128, State), BlockchainError>
Executes the [TransactionRequest] without writing to the DB
§Errors
Returns an error if the block_number
is greater than the current height
Sourcefn build_call_env(
&self,
request: WithOtherFields<TransactionRequest>,
fee_details: FeeDetails,
block_env: BlockEnv,
) -> EnvWithHandlerCfg
fn build_call_env( &self, request: WithOtherFields<TransactionRequest>, fee_details: FeeDetails, block_env: BlockEnv, ) -> EnvWithHandlerCfg
§EVM settings
This modifies certain EVM settings to mirror geth’s SkipAccountChecks
when transacting requests, see also: https://github.com/ethereum/go-ethereum/blob/380688c636a654becc8f114438c2a5d93d2db032/core/state_transition.go#L145-L148:
disable_eip3607
is set totrue
disable_base_fee
is set totrue
nonce
is set toNone
Sourcefn build_inspector(&self) -> Inspector
fn build_inspector(&self) -> Inspector
Builds Inspector
with the configured options
pub fn call_with_state( &self, state: &dyn DatabaseRef<Error = DatabaseError>, request: WithOtherFields<TransactionRequest>, fee_details: FeeDetails, block_env: BlockEnv, ) -> Result<(InstructionResult, Option<Output>, u128, State), BlockchainError>
pub async fn call_with_tracing( &self, request: WithOtherFields<TransactionRequest>, fee_details: FeeDetails, block_request: Option<BlockRequest>, opts: GethDebugTracingCallOptions, ) -> Result<GethTrace, BlockchainError>
pub fn build_access_list_with_state( &self, state: &dyn DatabaseRef<Error = DatabaseError>, request: WithOtherFields<TransactionRequest>, fee_details: FeeDetails, block_env: BlockEnv, ) -> Result<(InstructionResult, Option<Output>, u64, AccessList), BlockchainError>
Sourcefn get_receipts(
&self,
tx_hashes: impl IntoIterator<Item = TxHash>,
) -> Vec<TypedReceipt>
fn get_receipts( &self, tx_hashes: impl IntoIterator<Item = TxHash>, ) -> Vec<TypedReceipt>
returns all receipts for the given transactions
Sourceasync fn logs_for_block(
&self,
filter: Filter,
hash: B256,
) -> Result<Vec<Log>, BlockchainError>
async fn logs_for_block( &self, filter: Filter, hash: B256, ) -> Result<Vec<Log>, BlockchainError>
Returns the logs of the block that match the filter
Sourcefn mined_logs_for_block(&self, filter: Filter, block: Block) -> Vec<Log>
fn mined_logs_for_block(&self, filter: Filter, block: Block) -> Vec<Log>
Returns all Log
s mined by the node that were emitted in the block
and match the Filter
Sourceasync fn logs_for_range(
&self,
filter: &Filter,
from: u64,
to: u64,
) -> Result<Vec<Log>, BlockchainError>
async fn logs_for_range( &self, filter: &Filter, from: u64, to: u64, ) -> Result<Vec<Log>, BlockchainError>
Returns the logs that match the filter in the given range of blocks
Sourcepub async fn logs(&self, filter: Filter) -> Result<Vec<Log>, BlockchainError>
pub async fn logs(&self, filter: Filter) -> Result<Vec<Log>, BlockchainError>
Returns the logs according to the filter
pub async fn block_by_hash( &self, hash: B256, ) -> Result<Option<AnyRpcBlock>, BlockchainError>
pub async fn block_by_hash_full( &self, hash: B256, ) -> Result<Option<AnyRpcBlock>, BlockchainError>
fn mined_block_by_hash(&self, hash: B256) -> Option<AnyRpcBlock>
pub(crate) async fn mined_transactions_by_block_number( &self, number: BlockNumber, ) -> Option<Vec<AnyRpcTransaction>>
Sourcepub(crate) fn mined_transactions_in_block(
&self,
block: &Block,
) -> Option<Vec<AnyRpcTransaction>>
pub(crate) fn mined_transactions_in_block( &self, block: &Block, ) -> Option<Vec<AnyRpcTransaction>>
Returns all transactions given a block
pub async fn block_by_number( &self, number: BlockNumber, ) -> Result<Option<AnyRpcBlock>, BlockchainError>
pub async fn block_by_number_full( &self, number: BlockNumber, ) -> Result<Option<AnyRpcBlock>, BlockchainError>
pub fn get_block(&self, id: impl Into<BlockId>) -> Option<Block>
pub fn get_block_by_hash(&self, hash: B256) -> Option<Block>
pub fn mined_block_by_number(&self, number: BlockNumber) -> Option<AnyRpcBlock>
pub fn get_full_block(&self, id: impl Into<BlockId>) -> Option<AnyRpcBlock>
Sourcepub fn convert_block(&self, block: Block) -> AnyRpcBlock
pub fn convert_block(&self, block: Block) -> AnyRpcBlock
Takes a block as it’s stored internally and returns the eth api conform block format.
Sourcepub async fn ensure_block_number<T: Into<BlockId>>(
&self,
block_id: Option<T>,
) -> Result<u64, BlockchainError>
pub async fn ensure_block_number<T: Into<BlockId>>( &self, block_id: Option<T>, ) -> Result<u64, BlockchainError>
Converts the BlockNumber
into a numeric value
§Errors
returns an error if the requested number is larger than the current height
pub fn convert_block_number(&self, block: Option<BlockNumber>) -> u64
Sourcepub async fn with_database_at<F, T>(
&self,
block_request: Option<BlockRequest>,
f: F,
) -> Result<T, BlockchainError>
pub async fn with_database_at<F, T>( &self, block_request: Option<BlockRequest>, f: F, ) -> Result<T, BlockchainError>
Helper function to execute a closure with the database at a specific block
pub async fn storage_at( &self, address: Address, index: U256, block_request: Option<BlockRequest>, ) -> Result<B256, BlockchainError>
Sourcepub async fn get_code(
&self,
address: Address,
block_request: Option<BlockRequest>,
) -> Result<Bytes, BlockchainError>
pub async fn get_code( &self, address: Address, block_request: Option<BlockRequest>, ) -> Result<Bytes, BlockchainError>
Returns the code of the address
If the code is not present and fork mode is enabled then this will try to fetch it from the forked client
pub fn get_code_with_state( &self, state: &dyn DatabaseRef<Error = DatabaseError>, address: Address, ) -> Result<Bytes, BlockchainError>
Sourcepub async fn get_balance(
&self,
address: Address,
block_request: Option<BlockRequest>,
) -> Result<U256, BlockchainError>
pub async fn get_balance( &self, address: Address, block_request: Option<BlockRequest>, ) -> Result<U256, BlockchainError>
Returns the balance of the address
If the requested number predates the fork then this will fetch it from the endpoint
pub async fn get_account_at_block( &self, address: Address, block_request: Option<BlockRequest>, ) -> Result<Account, BlockchainError>
pub fn get_balance_with_state<D>(
&self,
state: D,
address: Address,
) -> Result<U256, BlockchainError>where
D: DatabaseRef<Error = DatabaseError>,
Sourcepub async fn get_nonce(
&self,
address: Address,
block_request: BlockRequest,
) -> Result<u64, BlockchainError>
pub async fn get_nonce( &self, address: Address, block_request: BlockRequest, ) -> Result<u64, BlockchainError>
Returns the nonce of the address
If the requested number predates the fork then this will fetch it from the endpoint
Sourcepub async fn trace_transaction(
&self,
hash: B256,
) -> Result<Vec<LocalizedTransactionTrace>, BlockchainError>
pub async fn trace_transaction( &self, hash: B256, ) -> Result<Vec<LocalizedTransactionTrace>, BlockchainError>
Returns the traces for the given transaction
Sourcepub(crate) fn mined_parity_trace_transaction(
&self,
hash: B256,
) -> Option<Vec<LocalizedTransactionTrace>>
pub(crate) fn mined_parity_trace_transaction( &self, hash: B256, ) -> Option<Vec<LocalizedTransactionTrace>>
Returns the traces for the given transaction
Sourcepub(crate) fn mined_transaction(&self, hash: B256) -> Option<MinedTransaction>
pub(crate) fn mined_transaction(&self, hash: B256) -> Option<MinedTransaction>
Returns the traces for the given transaction
Sourcepub(crate) fn mined_parity_trace_block(
&self,
block: u64,
) -> Option<Vec<LocalizedTransactionTrace>>
pub(crate) fn mined_parity_trace_block( &self, block: u64, ) -> Option<Vec<LocalizedTransactionTrace>>
Returns the traces for the given block
Sourcepub async fn debug_trace_transaction(
&self,
hash: B256,
opts: GethDebugTracingOptions,
) -> Result<GethTrace, BlockchainError>
pub async fn debug_trace_transaction( &self, hash: B256, opts: GethDebugTracingOptions, ) -> Result<GethTrace, BlockchainError>
Returns the traces for the given transaction
fn mined_geth_trace_transaction( &self, hash: B256, opts: GethDebugTracingOptions, ) -> Option<Result<GethTrace, BlockchainError>>
Sourcepub async fn trace_block(
&self,
block: BlockNumber,
) -> Result<Vec<LocalizedTransactionTrace>, BlockchainError>
pub async fn trace_block( &self, block: BlockNumber, ) -> Result<Vec<LocalizedTransactionTrace>, BlockchainError>
Returns the traces for the given block
pub async fn transaction_receipt( &self, hash: B256, ) -> Result<Option<ReceiptResponse>, BlockchainError>
pub async fn trace_filter( &self, filter: TraceFilter, ) -> Result<Vec<LocalizedTransactionTrace>, BlockchainError>
Sourcepub fn mined_receipts(&self, hash: B256) -> Option<Vec<TypedReceipt>>
pub fn mined_receipts(&self, hash: B256) -> Option<Vec<TypedReceipt>>
Returns all receipts of the block
Sourcepub fn mined_block_receipts(
&self,
id: impl Into<BlockId>,
) -> Option<Vec<ReceiptResponse>>
pub fn mined_block_receipts( &self, id: impl Into<BlockId>, ) -> Option<Vec<ReceiptResponse>>
Returns all transaction receipts of the block
Sourcepub(crate) fn mined_transaction_receipt(
&self,
hash: B256,
) -> Option<MinedTransactionReceipt>
pub(crate) fn mined_transaction_receipt( &self, hash: B256, ) -> Option<MinedTransactionReceipt>
Returns the transaction receipt for the given hash
Sourcepub async fn block_receipts(
&self,
number: BlockId,
) -> Result<Option<Vec<ReceiptResponse>>, BlockchainError>
pub async fn block_receipts( &self, number: BlockId, ) -> Result<Option<Vec<ReceiptResponse>>, BlockchainError>
Returns the blocks receipts for the given number
pub async fn transaction_by_block_number_and_index( &self, number: BlockNumber, index: Index, ) -> Result<Option<AnyRpcTransaction>, BlockchainError>
pub async fn transaction_by_block_hash_and_index( &self, hash: B256, index: Index, ) -> Result<Option<AnyRpcTransaction>, BlockchainError>
pub fn mined_transaction_by_block_hash_and_index( &self, block_hash: B256, index: Index, ) -> Option<AnyRpcTransaction>
pub async fn transaction_by_hash( &self, hash: B256, ) -> Result<Option<AnyRpcTransaction>, BlockchainError>
pub fn mined_transaction_by_hash(&self, hash: B256) -> Option<AnyRpcTransaction>
Sourcepub async fn prove_account_at(
&self,
address: Address,
keys: Vec<B256>,
block_request: Option<BlockRequest>,
) -> Result<AccountProof, BlockchainError>
pub async fn prove_account_at( &self, address: Address, keys: Vec<B256>, block_request: Option<BlockRequest>, ) -> Result<AccountProof, BlockchainError>
Prove an account’s existence or nonexistence in the state trie.
Returns a merkle proof of the account’s trie node, account_key
== keccak(address)
Sourcepub fn new_block_notifications(&self) -> NewBlockNotifications
pub fn new_block_notifications(&self) -> NewBlockNotifications
Returns a new block event stream
Sourcefn notify_on_new_block(&self, header: Header, hash: B256)
fn notify_on_new_block(&self, header: Header, hash: B256)
Notifies all new_block_listeners
about the new block
Sourcepub async fn reorg(
&self,
depth: u64,
tx_pairs: HashMap<u64, Vec<Arc<PoolTransaction>>>,
common_block: Block,
) -> Result<(), BlockchainError>
pub async fn reorg( &self, depth: u64, tx_pairs: HashMap<u64, Vec<Arc<PoolTransaction>>>, common_block: Block, ) -> Result<(), BlockchainError>
Reorg the chain to a common height and execute blocks to build new chain.
The state of the chain is rewound using rewind
to the common block, including the db,
storage, and env.
Finally, do_mine_block
is called to create the new chain.
Trait Implementations§
Source§impl TransactionValidator for Backend
impl TransactionValidator for Backend
Source§fn validate_pool_transaction<'life0, 'life1, 'async_trait>(
&'life0 self,
tx: &'life1 PendingTransaction,
) -> Pin<Box<dyn Future<Output = Result<(), BlockchainError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn validate_pool_transaction<'life0, 'life1, 'async_trait>(
&'life0 self,
tx: &'life1 PendingTransaction,
) -> Pin<Box<dyn Future<Output = Result<(), BlockchainError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Source§fn validate_pool_transaction_for(
&self,
pending: &PendingTransaction,
account: &AccountInfo,
env: &EnvWithHandlerCfg,
) -> Result<(), InvalidTransactionError>
fn validate_pool_transaction_for( &self, pending: &PendingTransaction, account: &AccountInfo, env: &EnvWithHandlerCfg, ) -> Result<(), InvalidTransactionError>
Source§fn validate_for(
&self,
tx: &PendingTransaction,
account: &AccountInfo,
env: &EnvWithHandlerCfg,
) -> Result<(), InvalidTransactionError>
fn validate_for( &self, tx: &PendingTransaction, account: &AccountInfo, env: &EnvWithHandlerCfg, ) -> Result<(), InvalidTransactionError>
Auto Trait Implementations§
impl !Freeze for Backend
impl !RefUnwindSafe for Backend
impl Send for Backend
impl Sync for Backend
impl Unpin for Backend
impl !UnwindSafe for Backend
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T, R> CollectAndApply<T, R> for T
impl<T, R> CollectAndApply<T, R> for T
§impl<T> Conv for T
impl<T> Conv for T
§impl<T> FmtForward for T
impl<T> FmtForward for T
§fn fmt_binary(self) -> FmtBinary<Self>where
Self: Binary,
fn fmt_binary(self) -> FmtBinary<Self>where
Self: Binary,
self
to use its Binary
implementation when Debug
-formatted.§fn fmt_display(self) -> FmtDisplay<Self>where
Self: Display,
fn fmt_display(self) -> FmtDisplay<Self>where
Self: Display,
self
to use its Display
implementation when
Debug
-formatted.§fn fmt_lower_exp(self) -> FmtLowerExp<Self>where
Self: LowerExp,
fn fmt_lower_exp(self) -> FmtLowerExp<Self>where
Self: LowerExp,
self
to use its LowerExp
implementation when
Debug
-formatted.§fn fmt_lower_hex(self) -> FmtLowerHex<Self>where
Self: LowerHex,
fn fmt_lower_hex(self) -> FmtLowerHex<Self>where
Self: LowerHex,
self
to use its LowerHex
implementation when
Debug
-formatted.§fn fmt_octal(self) -> FmtOctal<Self>where
Self: Octal,
fn fmt_octal(self) -> FmtOctal<Self>where
Self: Octal,
self
to use its Octal
implementation when Debug
-formatted.§fn fmt_pointer(self) -> FmtPointer<Self>where
Self: Pointer,
fn fmt_pointer(self) -> FmtPointer<Self>where
Self: Pointer,
self
to use its Pointer
implementation when
Debug
-formatted.§fn fmt_upper_exp(self) -> FmtUpperExp<Self>where
Self: UpperExp,
fn fmt_upper_exp(self) -> FmtUpperExp<Self>where
Self: UpperExp,
self
to use its UpperExp
implementation when
Debug
-formatted.§fn fmt_upper_hex(self) -> FmtUpperHex<Self>where
Self: UpperHex,
fn fmt_upper_hex(self) -> FmtUpperHex<Self>where
Self: UpperHex,
self
to use its UpperHex
implementation when
Debug
-formatted.§fn fmt_list(self) -> FmtList<Self>where
&'a Self: for<'a> IntoIterator,
fn fmt_list(self) -> FmtList<Self>where
&'a Self: for<'a> IntoIterator,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T
in a tonic::Request
§impl<T> Paint for Twhere
T: ?Sized,
impl<T> Paint for Twhere
T: ?Sized,
§fn fg(&self, value: Color) -> Painted<&T>
fn fg(&self, value: Color) -> Painted<&T>
Returns a styled value derived from self
with the foreground set to
value
.
This method should be used rarely. Instead, prefer to use color-specific
builder methods like red()
and
green()
, which have the same functionality but are
pithier.
§Example
Set foreground color to white using fg()
:
use yansi::{Paint, Color};
painted.fg(Color::White);
Set foreground color to white using white()
.
use yansi::Paint;
painted.white();
§fn bright_black(&self) -> Painted<&T>
fn bright_black(&self) -> Painted<&T>
§fn bright_red(&self) -> Painted<&T>
fn bright_red(&self) -> Painted<&T>
§fn bright_green(&self) -> Painted<&T>
fn bright_green(&self) -> Painted<&T>
§fn bright_yellow(&self) -> Painted<&T>
fn bright_yellow(&self) -> Painted<&T>
§fn bright_blue(&self) -> Painted<&T>
fn bright_blue(&self) -> Painted<&T>
§fn bright_magenta(&self) -> Painted<&T>
fn bright_magenta(&self) -> Painted<&T>
§fn bright_cyan(&self) -> Painted<&T>
fn bright_cyan(&self) -> Painted<&T>
§fn bright_white(&self) -> Painted<&T>
fn bright_white(&self) -> Painted<&T>
§fn bg(&self, value: Color) -> Painted<&T>
fn bg(&self, value: Color) -> Painted<&T>
Returns a styled value derived from self
with the background set to
value
.
This method should be used rarely. Instead, prefer to use color-specific
builder methods like on_red()
and
on_green()
, which have the same functionality but
are pithier.
§Example
Set background color to red using fg()
:
use yansi::{Paint, Color};
painted.bg(Color::Red);
Set background color to red using on_red()
.
use yansi::Paint;
painted.on_red();
§fn on_primary(&self) -> Painted<&T>
fn on_primary(&self) -> Painted<&T>
§fn on_magenta(&self) -> Painted<&T>
fn on_magenta(&self) -> Painted<&T>
§fn on_bright_black(&self) -> Painted<&T>
fn on_bright_black(&self) -> Painted<&T>
§fn on_bright_red(&self) -> Painted<&T>
fn on_bright_red(&self) -> Painted<&T>
§fn on_bright_green(&self) -> Painted<&T>
fn on_bright_green(&self) -> Painted<&T>
§fn on_bright_yellow(&self) -> Painted<&T>
fn on_bright_yellow(&self) -> Painted<&T>
§fn on_bright_blue(&self) -> Painted<&T>
fn on_bright_blue(&self) -> Painted<&T>
§fn on_bright_magenta(&self) -> Painted<&T>
fn on_bright_magenta(&self) -> Painted<&T>
§fn on_bright_cyan(&self) -> Painted<&T>
fn on_bright_cyan(&self) -> Painted<&T>
§fn on_bright_white(&self) -> Painted<&T>
fn on_bright_white(&self) -> Painted<&T>
§fn attr(&self, value: Attribute) -> Painted<&T>
fn attr(&self, value: Attribute) -> Painted<&T>
Enables the styling [Attribute
] value
.
This method should be used rarely. Instead, prefer to use
attribute-specific builder methods like bold()
and
underline()
, which have the same functionality
but are pithier.
§Example
Make text bold using attr()
:
use yansi::{Paint, Attribute};
painted.attr(Attribute::Bold);
Make text bold using using bold()
.
use yansi::Paint;
painted.bold();
§fn rapid_blink(&self) -> Painted<&T>
fn rapid_blink(&self) -> Painted<&T>
§fn quirk(&self, value: Quirk) -> Painted<&T>
fn quirk(&self, value: Quirk) -> Painted<&T>
Enables the yansi
[Quirk
] value
.
This method should be used rarely. Instead, prefer to use quirk-specific
builder methods like mask()
and
wrap()
, which have the same functionality but are
pithier.
§Example
Enable wrapping using .quirk()
:
use yansi::{Paint, Quirk};
painted.quirk(Quirk::Wrap);
Enable wrapping using wrap()
.
use yansi::Paint;
painted.wrap();
§fn clear(&self) -> Painted<&T>
👎Deprecated since 1.0.1: renamed to resetting()
due to conflicts with Vec::clear()
.
The clear()
method will be removed in a future release.
fn clear(&self) -> Painted<&T>
resetting()
due to conflicts with Vec::clear()
.
The clear()
method will be removed in a future release.§fn whenever(&self, value: Condition) -> Painted<&T>
fn whenever(&self, value: Condition) -> Painted<&T>
Conditionally enable styling based on whether the [Condition
] value
applies. Replaces any previous condition.
See the crate level docs for more details.
§Example
Enable styling painted
only when both stdout
and stderr
are TTYs:
use yansi::{Paint, Condition};
painted.red().on_yellow().whenever(Condition::STDOUTERR_ARE_TTY);
§impl<T> Pipe for Twhere
T: ?Sized,
impl<T> Pipe for Twhere
T: ?Sized,
§fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
§fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
self
and passes that borrow into the pipe function. Read more§fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
self
and passes that borrow into the pipe function. Read more§fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
§fn pipe_borrow_mut<'a, B, R>(
&'a mut self,
func: impl FnOnce(&'a mut B) -> R,
) -> R
fn pipe_borrow_mut<'a, B, R>( &'a mut self, func: impl FnOnce(&'a mut B) -> R, ) -> R
§fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
self
, then passes self.as_ref()
into the pipe function.§fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
self
, then passes self.as_mut()
into the pipe
function.§fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
self
, then passes self.deref()
into the pipe function.§impl<T> Pointable for T
impl<T> Pointable for T
§impl<T> Tap for T
impl<T> Tap for T
§fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
Borrow<B>
of a value. Read more§fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
BorrowMut<B>
of a value. Read more§fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
AsRef<R>
view of a value. Read more§fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
AsMut<R>
view of a value. Read more§fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
Deref::Target
of a value. Read more§fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
Deref::Target
of a value. Read more§fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
.tap()
only in debug builds, and is erased in release builds.§fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
.tap_mut()
only in debug builds, and is erased in release
builds.§fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
.tap_borrow()
only in debug builds, and is erased in release
builds.§fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
.tap_borrow_mut()
only in debug builds, and is erased in release
builds.§fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
.tap_ref()
only in debug builds, and is erased in release
builds.§fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
.tap_ref_mut()
only in debug builds, and is erased in release
builds.§fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
.tap_deref()
only in debug builds, and is erased in release
builds.§impl<T> TryConv for T
impl<T> TryConv for T
§impl<T> WithSubscriber for T
impl<T> WithSubscriber for T
§fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>where
S: Into<Dispatch>,
fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>where
S: Into<Dispatch>,
§fn with_current_subscriber(self) -> WithDispatch<Self>
fn with_current_subscriber(self) -> WithDispatch<Self>
impl<T> ErasedDestructor for Twhere
T: 'static,
impl<T> MaybeSendSync for T
Layout§
Note: Most layout information is completely unstable and may even differ between compilations. The only exception is types with certain repr(...)
attributes. Please see the Rust Reference's “Type Layout” chapter for details on type layout guarantees.
Size: 1056 bytes