Skip to content

Default Block param to 'latest' on eth_* state methods#812

Open
manusw7 wants to merge 1 commit into
ethereum:mainfrom
manusw7:feat/state-block-default-latest
Open

Default Block param to 'latest' on eth_* state methods#812
manusw7 wants to merge 1 commit into
ethereum:mainfrom
manusw7:feat/state-block-default-latest

Conversation

@manusw7

@manusw7 manusw7 commented Jun 1, 2026

Copy link
Copy Markdown

Marks the Block parameter required: false (default latest) on the six state-reading methods in state.yaml: eth_getBalance, eth_getStorageAt, eth_getStorageValues, eth_getTransactionCount, eth_getCode, eth_getProof.

Proposal for discussion — opening for visibility ahead of an RPC Standards discussion (ref: NethermindEth/nethermind#11764). Not expected to merge until client consensus + go-ethereum implementation.

Why

The spec is internally inconsistent on this. eth_call, eth_estimateGas and eth_createAccessList already mark Block required: false, and eth_simulateV1 documents default: 'latest' — yet the state-reading methods require it.
This PR aligns them under one rule.

Client behaviour is also already split: reth and Nethermind default an omitted block param to latest, while geth, erigon and besu reject it.
Standardising on default-to-latest matches existing behaviour in 2 of 5 clients and removes a client-diversity footgun, rather than leaving it implementation-defined.

Changes

  • src/eth/state.yamlBlockrequired: false + description: "default: 'latest'" on all six methods (mirrors the eth_simulateV1 idiom).

TBD

  • Reach consensus between all EL clients (only Nethermind/Reth rn implement this default-to-latest behaviour)
  • Enforce compliance via hive tests with a test case that explicitly omits the block tag (asserting default-to-latest behaviour)

Mark the Block param required: false (default 'latest') on the six
state-reading methods in state.yaml: eth_getBalance, eth_getStorageAt,
eth_getStorageValues, eth_getTransactionCount, eth_getCode, eth_getProof.

Mirrors the eth_simulateV1 idiom (description "default: 'latest'") since a
bare default: keyword sibling to $ref is ignored by JSON-Schema tooling.

Spec-only. Conformance fixtures (tests/*.io) are generated by rpctestgen
against go-ethereum and cannot be filled until geth implements
default-to-latest; per CONTRIBUTING the behavior must land in go-ethereum
first. Proposal for discussion at RPC Standards (ref NethermindEth/nethermind#11764).
@manusw7 manusw7 marked this pull request as ready for review June 1, 2026 12:23
@taratorio

Copy link
Copy Markdown

good with Erigon 👍

@MysticRyuujin

Copy link
Copy Markdown
Contributor

@manusw7 - I could be wrong but I'm testing making this change in go-ethereum and it APPEARS that Nethermind isn't defaulting to "latest" for eth_getStorageValues

@manusw7

manusw7 commented Jun 2, 2026

Copy link
Copy Markdown
Author

@manusw7 - I could be wrong but I'm testing making this change in go-ethereum and it APPEARS that Nethermind isn't defaulting to "latest" for eth_getStorageValues

hey @MysticRyuujin, you're right. That was the only exception I noticed missing this behaviour.
I've seen the PR, thanks! 🙌

s1na added a commit to ethereum/go-ethereum that referenced this pull request Jun 3, 2026
…35100)

Make the `Block` parameter optional on the six state-reading methods,
defaulting to `latest` when omitted:

- `eth_getBalance`
- `eth_getCode`
- `eth_getStorageAt`
- `eth_getTransactionCount`
- `eth_getProof`
- `eth_getStorageValues`

This implements the behavior proposed in ethereum/execution-apis#812.

---------

Co-authored-by: Sina M <1591639+s1na@users.noreply.github.com>
0xjvn pushed a commit to 0xjvn/go-ethereum that referenced this pull request Jun 5, 2026
…thereum#35100)

Make the `Block` parameter optional on the six state-reading methods,
defaulting to `latest` when omitted:

- `eth_getBalance`
- `eth_getCode`
- `eth_getStorageAt`
- `eth_getTransactionCount`
- `eth_getProof`
- `eth_getStorageValues`

This implements the behavior proposed in ethereum/execution-apis#812.

---------

Co-authored-by: Sina M <1591639+s1na@users.noreply.github.com>
MysticRyuujin added a commit to MysticRyuujin/execution-apis that referenced this pull request Jun 9, 2026
Mark the Block parameter required:false (default 'latest') on the six
state-reading methods: eth_getBalance, eth_getStorageAt,
eth_getStorageValues, eth_getTransactionCount, eth_getCode and
eth_getProof. Add rpctestgen cases and fixtures that omit the block
parameter and assert default-to-latest behavior.
gballet pushed a commit to gballet/go-ethereum that referenced this pull request Jun 12, 2026
…thereum#35100)

Make the `Block` parameter optional on the six state-reading methods,
defaulting to `latest` when omitted:

- `eth_getBalance`
- `eth_getCode`
- `eth_getStorageAt`
- `eth_getTransactionCount`
- `eth_getProof`
- `eth_getStorageValues`

This implements the behavior proposed in ethereum/execution-apis#812.

---------

Co-authored-by: Sina M <1591639+s1na@users.noreply.github.com>
pull Bot pushed a commit to Dustin4444/erigon that referenced this pull request Jun 16, 2026
…tech#21586)

## Summary

Make the `Block` parameter optional (defaulting to `latest` when
omitted) on the six state-reading methods:

- `eth_getBalance`
- `eth_getCode`
- `eth_getStorageAt`
- `eth_getTransactionCount`
- `eth_getProof`
- `eth_getStorageValues`

Each took a value-type `rpc.BlockNumberOrHash`, so omitting the block
parameter failed with `-32602 missing value for required argument N` —
Erigon's `rpc` package (like go-ethereum's) only permits omitting a
*trailing* argument when it is a pointer. This changes the six handlers
(and the `EthAPI` interface) to `*rpc.BlockNumberOrHash` and defaults
`nil` to `latest` via a small `orLatest` helper, reusing the existing
`latestNumOrHash` var. `eth_call` already behaves this way.

Internal callers of the interface are updated accordingly
(`rpc/contracts/direct_backend.go`, `rpc/mcp/*`) along with the affected
tests.

## Motivation

This aligns Erigon with **ethereum/execution-apis#812** by **@manusw7**,
which marks the `Block` parameter `required: false` (default `latest`)
on these methods. Full credit for the proposal and rationale to
@manusw7.

## Testing

- `go vet ./rpc/jsonrpc/` passes (handlers + updated tests compile).
- Verified against the `hive` `rpc-compat` simulator with default-block
conformance fixtures (block parameter omitted): a locally-built Erigon
with this change returns the latest-block values and all six pass
(`tests=7 failed=0`). Before the change, all six failed.

## Related

- Source proposal: ethereum/execution-apis#812 (by @manusw7)
- execution-apis spec + conformance tests: ethereum/execution-apis#814
- go-ethereum implementation: ethereum/go-ethereum#35100
- Nethermind `eth_getStorageValues` fix: NethermindEth/nethermind#11883
- Besu implementation: besu-eth/besu#10587
- ethrex implementation: lambdaclass/ethrex#6780

---------

Co-authored-by: lupin012 <58134934+lupin012@users.noreply.github.com>
AdityaSripal pushed a commit to AdityaSripal/go-ethereum that referenced this pull request Jun 21, 2026
…thereum#35100)

Make the `Block` parameter optional on the six state-reading methods,
defaulting to `latest` when omitted:

- `eth_getBalance`
- `eth_getCode`
- `eth_getStorageAt`
- `eth_getTransactionCount`
- `eth_getProof`
- `eth_getStorageValues`

This implements the behavior proposed in ethereum/execution-apis#812.

---------

Co-authored-by: Sina M <1591639+s1na@users.noreply.github.com>
MysticRyuujin added a commit to MysticRyuujin/execution-apis that referenced this pull request Jun 29, 2026
Mark the Block parameter required:false (default 'latest') on the six
state-reading methods: eth_getBalance, eth_getStorageAt,
eth_getStorageValues, eth_getTransactionCount, eth_getCode and
eth_getProof. Add rpctestgen cases and fixtures that omit the block
parameter and assert default-to-latest behavior.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants