Skip to content

rpc: resolve block tags in debug_getModifiedAccountsByNumber - #23129

Open
Sahil-4555 wants to merge 4 commits into
erigontech:mainfrom
Sahil-4555:fix/rpc-debug-get-modified-accounts-tag-resolution
Open

rpc: resolve block tags in debug_getModifiedAccountsByNumber#23129
Sahil-4555 wants to merge 4 commits into
erigontech:mainfrom
Sahil-4555:fix/rpc-debug-get-modified-accounts-tag-resolution

Conversation

@Sahil-4555

@Sahil-4555 Sahil-4555 commented Aug 9, 2026

Copy link
Copy Markdown
Collaborator

Fixes a bug causing integer underflow errors when passing named block tags (latest, safe, finalized, pending) to debug_getModifiedAccountsByNumber.

The endpoint parameter signature accepts rpc.BlockNumber, which decodes named tags into negative int64 sentinels (latest=-1, pending=-2, safe=-3, finalized=-4). Those sentinels were cast directly into uint64(startNumber.Int64()) by the handler and wrapped around to values near $2^{64}-1$ (18446744073709551615), failing the range validation check.

This PR updates GetModifiedAccountsByNumber to resolve startNumber and endNumber using rpchelper.GetBlockNumber before evaluating range semantics. Additionally, resolved block numbers are validated against committed execution stage progress (stages.Execution) to ensure unexecuted blocks return an explicit error instead of querying unindexed state history.

Unit test coverage in TestGetModifiedAccountsByNumber has been expanded to cover named block tags (latest, earliest, pending, safe, finalized), invalid tag ranges, and pending blocks populated in Filters.

Closes #23125

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Resolves named block tags before querying modified-account history.

Changes:

  • Resolve start and end block tags via rpchelper.GetBlockNumber.
  • Add tests for supported tags and invalid ranges.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
rpc/jsonrpc/debug_api.go Resolves tagged block parameters.
rpc/jsonrpc/debug_api_test.go Adds block-tag coverage.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread rpc/jsonrpc/debug_api.go
Comment thread rpc/jsonrpc/debug_api_test.go
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.

debug_getModifiedAccountsByNumber rejects latest, pending, safe, and finalized tags as future block numbers

2 participants