Trait EstimateCall
pub trait EstimateCall: Call {
// Provided methods
fn estimate_gas_with<S>(
&self,
evm_env: EvmEnv<<<<Self::Evm as ConfigureEvm>::BlockExecutorFactory as BlockExecutorFactory>::EvmFactory as EvmFactory>::Spec>,
request: <<Self::RpcConvert as RpcConvert>::Network as RpcTypes>::TransactionRequest,
state: S,
state_override: Option<HashMap<Address, AccountOverride, FbBuildHasher<20>>>,
) -> Result<Uint<256, 4>, Self::Error>
where S: StateProvider { ... }
fn estimate_gas_at(
&self,
request: <<Self::RpcConvert as RpcConvert>::Network as RpcTypes>::TransactionRequest,
at: BlockId,
state_override: Option<HashMap<Address, AccountOverride, FbBuildHasher<20>>>,
) -> impl Future<Output = Result<Uint<256, 4>, Self::Error>> + Send
where Self: LoadPendingBlock { ... }
fn map_out_of_gas_err<DB>(
evm: &mut <<<Self::Evm as ConfigureEvm>::BlockExecutorFactory as BlockExecutorFactory>::EvmFactory as EvmFactory>::Evm<DB, NoOpInspector>,
tx_env: <<<Self::Evm as ConfigureEvm>::BlockExecutorFactory as BlockExecutorFactory>::EvmFactory as EvmFactory>::Tx,
max_gas_limit: u64,
) -> Result<Uint<256, 4>, Self::Error>
where DB: Database<Error = ProviderError>,
EthApiError: From<<DB as Database>::Error> { ... }
}
Expand description
Gas execution estimates
Provided Methods§
fn estimate_gas_with<S>(
&self,
evm_env: EvmEnv<<<<Self::Evm as ConfigureEvm>::BlockExecutorFactory as BlockExecutorFactory>::EvmFactory as EvmFactory>::Spec>,
request: <<Self::RpcConvert as RpcConvert>::Network as RpcTypes>::TransactionRequest,
state: S,
state_override: Option<HashMap<Address, AccountOverride, FbBuildHasher<20>>>,
) -> Result<Uint<256, 4>, Self::Error>where
S: StateProvider,
fn estimate_gas_with<S>(
&self,
evm_env: EvmEnv<<<<Self::Evm as ConfigureEvm>::BlockExecutorFactory as BlockExecutorFactory>::EvmFactory as EvmFactory>::Spec>,
request: <<Self::RpcConvert as RpcConvert>::Network as RpcTypes>::TransactionRequest,
state: S,
state_override: Option<HashMap<Address, AccountOverride, FbBuildHasher<20>>>,
) -> Result<Uint<256, 4>, Self::Error>where
S: StateProvider,
Estimates the gas usage of the request
with the state.
This will execute the RpcTxReq
and find the best gas limit via binary search.
§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
fn estimate_gas_at(
&self,
request: <<Self::RpcConvert as RpcConvert>::Network as RpcTypes>::TransactionRequest,
at: BlockId,
state_override: Option<HashMap<Address, AccountOverride, FbBuildHasher<20>>>,
) -> impl Future<Output = Result<Uint<256, 4>, Self::Error>> + Sendwhere
Self: LoadPendingBlock,
fn estimate_gas_at(
&self,
request: <<Self::RpcConvert as RpcConvert>::Network as RpcTypes>::TransactionRequest,
at: BlockId,
state_override: Option<HashMap<Address, AccountOverride, FbBuildHasher<20>>>,
) -> impl Future<Output = Result<Uint<256, 4>, Self::Error>> + Sendwhere
Self: LoadPendingBlock,
Estimate gas needed for execution of the request
at the BlockId
.
fn map_out_of_gas_err<DB>(
evm: &mut <<<Self::Evm as ConfigureEvm>::BlockExecutorFactory as BlockExecutorFactory>::EvmFactory as EvmFactory>::Evm<DB, NoOpInspector>,
tx_env: <<<Self::Evm as ConfigureEvm>::BlockExecutorFactory as BlockExecutorFactory>::EvmFactory as EvmFactory>::Tx,
max_gas_limit: u64,
) -> Result<Uint<256, 4>, Self::Error>
fn map_out_of_gas_err<DB>( evm: &mut <<<Self::Evm as ConfigureEvm>::BlockExecutorFactory as BlockExecutorFactory>::EvmFactory as EvmFactory>::Evm<DB, NoOpInspector>, tx_env: <<<Self::Evm as ConfigureEvm>::BlockExecutorFactory as BlockExecutorFactory>::EvmFactory as EvmFactory>::Tx, max_gas_limit: u64, ) -> Result<Uint<256, 4>, Self::Error>
Executes the requests again after an out of gas error to check if the error is gas related or not
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.