diff --git a/crates/rpc/rpc-eth-api/src/helpers/call.rs b/crates/rpc/rpc-eth-api/src/helpers/call.rs index 819aff546d..c5703bccee 100644 --- a/crates/rpc/rpc-eth-api/src/helpers/call.rs +++ b/crates/rpc/rpc-eth-api/src/helpers/call.rs @@ -716,6 +716,7 @@ pub trait Call: LoadState + SpawnBlocking { // Keep a copy of gas related request values let tx_request_gas_limit = request.gas; let tx_request_gas_price = request.gas_price; + // the gas limit of the corresponding block let block_env_gas_limit = block.gas_limit; // Determine the highest possible gas limit, considering both the request's specified limit @@ -1083,6 +1084,8 @@ pub trait Call: LoadState + SpawnBlocking { /// - `disable_eip3607` is set to `true` /// - `disable_base_fee` is set to `true` /// - `nonce` is set to `None` + /// + /// In addition, this changes the block's gas limit to the configured [`Self::call_gas_limit`]. fn prepare_call_env( &self, mut cfg: CfgEnvWithHandlerCfg, @@ -1102,6 +1105,9 @@ pub trait Call: LoadState + SpawnBlocking { ) } + // apply configured gas cap + block.gas_limit = U256::from(self.call_gas_limit()); + // Disabled because eth_call is sometimes used with eoa senders // See cfg.disable_eip3607 = true;