rpc/jsonrpc: use overridden fee values consistently in eth_estimateGas and eth_call#20949
Conversation
| blobGasPrice := st.evm.Context.BlobBaseFee | ||
| maxFeePerBlobGas := st.msg.MaxFeePerBlobGas() | ||
| if !st.evm.Config().NoBaseFee && blobGasPrice.Cmp(maxFeePerBlobGas) > 0 { | ||
| if maxFeePerBlobGas == nil { |
There was a problem hiding this comment.
skipBlobCheck := st.evm.Config().NoBaseFee && maxFeePerBlobGas.IsZero()
if !skipBlobCheck && blobGasPrice.Cmp(maxFeePerBlobGas) > 0 {
return ErrMaxFeePerBlobGas
}
The blob fee check should mirror the skipCheck pattern already used for EIP-1559 fees at line 321-323
Removing all skip logic makes erigon stricter than geth: a caller who leaves maxFeePerBlobGas at zero will now always get an error, even in simulation contexts where no fee is intended.
There was a problem hiding this comment.
Pull request overview
This PR makes RPC simulation consistent when block fee-related overrides are provided, ensuring eth_call and eth_estimateGas use overridden fee values uniformly during message construction and transaction pre-checks.
Changes:
eth_call: build the call message and EVM block context using a header withBlockOverridesapplied (notablyBaseFeePerGas).eth_estimateGas: ensure blob fee-cap validation is not incorrectly skipped underNoBaseFeewhen blob-related fields are present.- Add/extend regression tests covering gasLimit bounding, blob base fee override validation, and
GASPRICEimpact from base fee overrides.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
rpc/transactions/call.go |
Uses an overridden header to compute 1559 gas price fields and initialize block context consistently under block overrides. |
rpc/jsonrpc/eth_call_test.go |
Adds regression tests for override behavior (gasLimit ceiling, blob base fee validation, baseFee affecting GASPRICE), plus test refactors/helpers. |
execution/protocol/txn_executor.go |
Adjusts blob fee-cap pre-check skip logic so estimate/call modes don’t bypass validation when blob fee caps are explicitly provided. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| blobGasPrice := st.evm.Context.BlobBaseFee | ||
| maxFeePerBlobGas := st.msg.MaxFeePerBlobGas() | ||
| if !st.evm.Config().NoBaseFee && blobGasPrice.Cmp(maxFeePerBlobGas) > 0 { | ||
| skipBlobCheck := st.evm.Config().NoBaseFee && (maxFeePerBlobGas == nil || maxFeePerBlobGas.IsZero()) |
This PR fixes two inconsistencies in RPC behavior.
First, in
eth_estimateGas, the validation for blob fee caps was not working properly when ablobBaseFeeblock override was provided. This happened because estimate mode was skipping that validation whenNoBaseFeewas enabled. The fix ensures that even in estimate mode, blob fee caps are still properly validated when the transaction includes blobs.Second, in
eth_call, the gas price calculation for EIP-1559 was using the original block header’s base fee instead of the overriddenBaseFeePerGas. This could lead to incorrectGASPRICEand related fee calculations when block overrides were used. The fix makeseth_callconstruct its message and block context using the overridden header whenever header-based fee fields are changed.In simple terms, if a caller overrides block fee settings, the RPC now consistently uses those overridden values everywhere.
The regression tests added cover:
eth_estimateGasGASPRICEcalculations