diff --git a/crates/rpc/rpc-eth-api/src/helpers/call.rs b/crates/rpc/rpc-eth-api/src/helpers/call.rs index 4589effbda..66d053e40f 100644 --- a/crates/rpc/rpc-eth-api/src/helpers/call.rs +++ b/crates/rpc/rpc-eth-api/src/helpers/call.rs @@ -21,7 +21,9 @@ use reth_rpc_eth_types::{ }, EthApiError, EthResult, RevertError, RpcInvalidTransactionError, StateCacheDb, }; -use reth_rpc_server_types::constants::gas_oracle::{ESTIMATE_GAS_ERROR_RATIO, MIN_TRANSACTION_GAS}; +use reth_rpc_server_types::constants::gas_oracle::{ + CALL_STIPEND_GAS, ESTIMATE_GAS_ERROR_RATIO, MIN_TRANSACTION_GAS, +}; use reth_rpc_types::{ state::{EvmOverrides, StateOverride}, AccessListWithGasUsed, BlockId, Bundle, EthCallResponse, StateContext, TransactionInfo, @@ -631,7 +633,7 @@ pub trait Call: LoadState + SpawnBlocking { // // Calculate the optimistic gas limit by adding gas used and gas refund, // then applying a 64/63 multiplier to account for gas forwarding rules. - let optimistic_gas_limit = (gas_used + gas_refund) * 64 / 63; + let optimistic_gas_limit = (gas_used + gas_refund + CALL_STIPEND_GAS) * 64 / 63; if optimistic_gas_limit < highest_gas_limit { // Set the transaction's gas limit to the calculated optimistic gas limit. env.tx.gas_limit = optimistic_gas_limit; diff --git a/crates/rpc/rpc-server-types/src/constants.rs b/crates/rpc/rpc-server-types/src/constants.rs index e3c129bf6e..e433bda0d4 100644 --- a/crates/rpc/rpc-server-types/src/constants.rs +++ b/crates/rpc/rpc-server-types/src/constants.rs @@ -87,6 +87,9 @@ pub mod gas_oracle { /// Taken from Geth's implementation in order to pass the hive tests /// pub const ESTIMATE_GAS_ERROR_RATIO: f64 = 0.015; + + /// Gas required at the beginning of a call. + pub const CALL_STIPEND_GAS: u64 = 2_300; } /// Cache specific constants