Skip to main content

derive_gas_limit

Function derive_gas_limit 

Source
pub fn derive_gas_limit(
    estimate: u64,
    gas_buffer_bps: u32,
    gas_limit: u64,
) -> Result<u64>
Expand description

Applies gas_buffer_bps over the eth_estimateGas result.

A buffered estimate above gas_limit rejects the transaction rather than clamping to the ceiling: on Arbitrum the estimate folds the L1 data fee into gas units, and clamping guarantees a paid-for out-of-gas revert.

ยงErrors

Returns an error if the buffered estimate exceeds gas_limit or the arithmetic overflows.