pub trait EstimateCall: Call {
// Provided methods
fn estimate_gas_with<S>(
&self,
evm_env: EvmEnvFor<Self::Evm>,
request: RpcTxReq<<Self::RpcConvert as RpcConvert>::Network>,
state: S,
state_override: Option<StateOverride>,
) -> Result<U256, Self::Error>
where S: StateProvider { ... }
fn estimate_gas_at(
&self,
request: RpcTxReq<<Self::RpcConvert as RpcConvert>::Network>,
at: BlockId,
state_override: Option<StateOverride>,
) -> impl Future<Output = Result<U256, Self::Error>> + Send
where Self: LoadPendingBlock { ... }
fn map_out_of_gas_err<DB>(
evm: &mut EvmFor<Self::Evm, DB>,
tx_env: TxEnvFor<Self::Evm>,
max_gas_limit: u64,
) -> Result<U256, Self::Error>
where DB: Database<Error = ProviderError>,
EthApiError: From<DB::Error> { ... }
}
Expand description
Gas execution estimates
Provided Methods§
Sourcefn estimate_gas_with<S>(
&self,
evm_env: EvmEnvFor<Self::Evm>,
request: RpcTxReq<<Self::RpcConvert as RpcConvert>::Network>,
state: S,
state_override: Option<StateOverride>,
) -> Result<U256, Self::Error>where
S: StateProvider,
fn estimate_gas_with<S>(
&self,
evm_env: EvmEnvFor<Self::Evm>,
request: RpcTxReq<<Self::RpcConvert as RpcConvert>::Network>,
state: S,
state_override: Option<StateOverride>,
) -> Result<U256, 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
Sourcefn estimate_gas_at(
&self,
request: RpcTxReq<<Self::RpcConvert as RpcConvert>::Network>,
at: BlockId,
state_override: Option<StateOverride>,
) -> impl Future<Output = Result<U256, Self::Error>> + Sendwhere
Self: LoadPendingBlock,
fn estimate_gas_at(
&self,
request: RpcTxReq<<Self::RpcConvert as RpcConvert>::Network>,
at: BlockId,
state_override: Option<StateOverride>,
) -> impl Future<Output = Result<U256, Self::Error>> + Sendwhere
Self: LoadPendingBlock,
Estimate gas needed for execution of the request
at the [BlockId
].
Sourcefn map_out_of_gas_err<DB>(
evm: &mut EvmFor<Self::Evm, DB>,
tx_env: TxEnvFor<Self::Evm>,
max_gas_limit: u64,
) -> Result<U256, Self::Error>where
DB: Database<Error = ProviderError>,
EthApiError: From<DB::Error>,
fn map_out_of_gas_err<DB>(
evm: &mut EvmFor<Self::Evm, DB>,
tx_env: TxEnvFor<Self::Evm>,
max_gas_limit: u64,
) -> Result<U256, Self::Error>where
DB: Database<Error = ProviderError>,
EthApiError: From<DB::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.