You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
rpc: unify BlockOverrides into a single type with three override methods
Two separate BlockOverrides structs existed in the codebase
(ethapi.BlockOverrides and transactions.BlockOverrides) with overlapping
but divergent fields, different field types, and different JSON tags.
This caused inconsistencies across eth_call, eth_estimateGas,
eth_simulateV1, and eth_callMany.
Changes:
- Merge into a single ethapi.BlockOverrides with all 11 fields:
Number, Difficulty, Time, GasLimit, FeeRecipient, PrevRandao,
BaseFeePerGas, BlobBaseFee, BeaconRoot, BlockHash, Withdrawals
- Add ethapi.BlockHashOverrides (was only in transactions package)
- Three methods with clearly separated responsibilities:
- Override(*BlockContext) error — for eth_call/eth_estimateGas;
rejects BeaconRoot and Withdrawals (aligned with Geth);
now propagates error (was silently swallowed before)
- OverrideHeader(*Header) *Header — for eth_simulateV1 block assembly
- OverrideBlockContext(*BlockContext, BlockHashOverrides) — for
eth_simulateV1/eth_callMany; applies all fields including
BlobBaseFee and BlockHash
- Remove duplicate struct from transactions/call.go
- Replace manual field-by-field application in eth_callMany with
OverrideBlockContext call
- Add complete unit test suite: 20 tests covering all three methods,
nil receivers, field isolation, overflow checks, rejection of
unsupported fields, and BlockHash map merging
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
0 commit comments