pub trait EstimateCall: Call {
// Provided methods
fn estimate_gas_with<S>(
&self,
cfg: CfgEnvWithHandlerCfg,
block: BlockEnv,
request: TransactionRequest,
state: S,
state_override: Option<StateOverride>,
) -> Result<U256, Self::Error>
where S: StateProvider { ... }
fn estimate_gas_at(
&self,
request: TransactionRequest,
at: BlockId,
state_override: Option<StateOverride>,
) -> impl Future<Output = Result<U256, Self::Error>> + Send
where Self: LoadPendingBlock { ... }
fn map_out_of_gas_err<DB>(
&self,
env_gas_limit: U256,
env: EnvWithHandlerCfg,
db: &mut DB,
) -> Self::Error
where DB: Database,
EthApiError: From<DB::Error> { ... }
}
Expand description
Gas execution estimates
Provided Methods§
Sourcefn estimate_gas_with<S>(
&self,
cfg: CfgEnvWithHandlerCfg,
block: BlockEnv,
request: TransactionRequest,
state: S,
state_override: Option<StateOverride>,
) -> Result<U256, Self::Error>where
S: StateProvider,
fn estimate_gas_with<S>(
&self,
cfg: CfgEnvWithHandlerCfg,
block: BlockEnv,
request: TransactionRequest,
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 [TransactionRequest
] 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: TransactionRequest,
at: BlockId,
state_override: Option<StateOverride>,
) -> impl Future<Output = Result<U256, Self::Error>> + Sendwhere
Self: LoadPendingBlock,
fn estimate_gas_at(
&self,
request: TransactionRequest,
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>(
&self,
env_gas_limit: U256,
env: EnvWithHandlerCfg,
db: &mut DB,
) -> Self::Errorwhere
DB: Database,
EthApiError: From<DB::Error>,
fn map_out_of_gas_err<DB>(
&self,
env_gas_limit: U256,
env: EnvWithHandlerCfg,
db: &mut DB,
) -> Self::Errorwhere
DB: Database,
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.