diff --git a/crates/ethereum/payload/src/config.rs b/crates/ethereum/payload/src/config.rs index 1684f0c81dd7..0e625d5571b9 100644 --- a/crates/ethereum/payload/src/config.rs +++ b/crates/ethereum/payload/src/config.rs @@ -40,8 +40,8 @@ impl EthereumBuilderConfig { /// Calculate the gas limit for the next block based on parent and desired gas limits. /// Ref: pub fn calculate_block_gas_limit(parent_gas_limit: u64, desired_gas_limit: u64) -> u64 { - let delta = parent_gas_limit / GAS_LIMIT_BOUND_DIVISOR - 1; - let min_gas_limit = parent_gas_limit + delta; - let max_gas_limit = parent_gas_limit - delta; + let delta = (parent_gas_limit / GAS_LIMIT_BOUND_DIVISOR).saturating_sub(1); + let min_gas_limit = parent_gas_limit - delta; + let max_gas_limit = parent_gas_limit + delta; desired_gas_limit.clamp(min_gas_limit, max_gas_limit) }