diff --git a/crates/rpc/rpc/src/eth/api/call.rs b/crates/rpc/rpc/src/eth/api/call.rs index e489addfd2..44db47a313 100644 --- a/crates/rpc/rpc/src/eth/api/call.rs +++ b/crates/rpc/rpc/src/eth/api/call.rs @@ -30,6 +30,7 @@ use revm::{ }, Database, }; +use tracing::trace; // Gas per transaction not creating a contract. const MIN_TRANSACTION_GAS: u64 = 21_000u64; @@ -86,11 +87,18 @@ where apply_state_overrides(state_overrides, &mut db)?; } + // The basefee should be ignored for eth_call + // See: + // + env.block.basefee = U256::ZERO; + if request_gas.is_none() && env.tx.gas_price > U256::ZERO { + trace!(target: "rpc::eth::call", ?env, "Applying gas limit cap"); // no gas limit was provided in the request, so we need to cap the request's gas limit cap_tx_gas_limit_with_caller_allowance(&mut db, &mut env.tx)?; } + trace!(target: "rpc::eth::call", ?env, "Executing call"); transact(&mut db, env) } diff --git a/crates/rpc/rpc/src/eth/revm_utils.rs b/crates/rpc/rpc/src/eth/revm_utils.rs index 17ffa8a2d7..a21942efc6 100644 --- a/crates/rpc/rpc/src/eth/revm_utils.rs +++ b/crates/rpc/rpc/src/eth/revm_utils.rs @@ -168,6 +168,10 @@ impl CallFees { base_fee: U256, ) -> EthResult { match (call_gas_price, call_max_fee, call_priority_fee) { + (None, None, None) => { + // when none are specified, they are all set to zero + Ok(CallFees { gas_price: U256::ZERO, max_priority_fee_per_gas: None }) + } (gas_price, None, None) => { // request for a legacy transaction // set everything to zero