From 1eb591c256de6688c82eca48d43593dc2b183b1c Mon Sep 17 00:00:00 2001 From: Roman Krasiuk Date: Thu, 12 Dec 2024 11:14:10 -0500 Subject: [PATCH] fix --- crates/ethereum/payload/src/config.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) 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) }