diff --git a/crates/ethereum/payload/src/config.rs b/crates/ethereum/payload/src/config.rs index 0185bc28d286..1684f0c81dd7 100644 --- a/crates/ethereum/payload/src/config.rs +++ b/crates/ethereum/payload/src/config.rs @@ -18,7 +18,7 @@ impl EthereumBuilderConfig { } /// Set desired gas limit. - pub fn with_gas_limit(mut self, desired_gas_limit: u64) -> Self { + pub const fn with_gas_limit(mut self, desired_gas_limit: u64) -> Self { self.desired_gas_limit = desired_gas_limit; self } @@ -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; - let min_gas_limit = parent_gas_limit + delta - 1; - let max_gas_limit = parent_gas_limit - delta + 1; + 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; desired_gas_limit.clamp(min_gas_limit, max_gas_limit) }