ethapi, eth: implement eth_baseFee RPC method#2231
Conversation
Assisted-by: Claude:claude-sonnet-4-6
|
@claude review once |
|
Claude finished @pratikspatil024's task in 1m 37s —— View job Code Review:
|
| Item | Severity |
|---|---|
Double CurrentHeader() call (TOCTOU) |
Medium — should fix |
| No dedicated unit test | Low — nice to have |
| Hand-edited mock file | Nit |
The design is sound — adding BaseFee to the Backend interface alongside BlobBaseFee is the right pattern, and the RPC layer wiring is correct. The TOCTOU fix is a one-line change; with that addressed, this looks good to merge.
There was a problem hiding this comment.
LGTM, straightforward read-only RPC method mirroring the existing BlobBaseFee pattern.
Extended reasoning...
Overview
This PR adds a new nonstandard eth_baseFee RPC method that returns the calculated base fee of the next block. It adds BaseFee(ctx) *big.Int to the Backend interface, implements it in EthAPIBackend using eip1559.CalcBaseFee, exposes it via EthereumAPI.BaseFee, and updates the generated gomock and two test backends to satisfy the interface.
Security risks
None identified. This is a read-only RPC method that computes a value already used internally and reachable via other paths (e.g. eth_feeHistory). No state mutation, no auth/crypto/permission surface, no user-controlled input beyond the standard JSON-RPC framing.
Level of scrutiny
Low. The change is mechanical and self-contained: it directly mirrors the adjacent BlobBaseFee implementation in the same file, uses the standard upstream eip1559.CalcBaseFee helper guarded by IsLondon, and the bulk of the diff is regenerated mock/test plumbing required to satisfy the new interface method.
Other factors
- Bug hunting system found no issues.
- SonarCloud quality gate passed (0 new issues, 0 security hotspots).
- Pre-London branch correctly returns nil, matching the BlobBaseFee precedent.
- Test mocks are updated consistently across
api_test.go,transaction_args_test.go, and the generatedeth/filters/IBackend.go.
Assisted-by: Claude:claude-sonnet-4-6
|
I regenerated it in 7e3a704 using |
|
@wjmelements Please resolve the conflicts and check the claude comments. |



Summary
Add the nonstandard
eth_baseFeemethod, which returns the calculated base fee of the next block.Executed tests
None
Rollout notes
Non-breaking