Skip to content

Commit b0aed0d

Browse files
authored
fix: force set basefee to 0 if gasprice is 0 (paradigmxyz#17496)
1 parent 81b93ac commit b0aed0d

File tree

1 file changed

+5
-0
lines changed
  • crates/rpc/rpc-eth-api/src/helpers

1 file changed

+5
-0
lines changed

crates/rpc/rpc-eth-api/src/helpers/call.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -771,6 +771,11 @@ pub trait Call:
771771
let request_gas = request.as_ref().gas_limit();
772772
let mut tx_env = self.create_txn_env(&evm_env, request, &mut *db)?;
773773

774+
// lower the basefee to 0 to avoid breaking EVM invariants (basefee < gasprice): <https://github.com/ethereum/go-ethereum/blob/355228b011ef9a85ebc0f21e7196f892038d49f0/internal/ethapi/api.go#L700-L704>
775+
if tx_env.gas_price() == 0 {
776+
evm_env.block_env.basefee = 0;
777+
}
778+
774779
if request_gas.is_none() {
775780
// No gas limit was provided in the request, so we need to cap the transaction gas limit
776781
if tx_env.gas_price() > 0 {

0 commit comments

Comments
 (0)