-
Notifications
You must be signed in to change notification settings - Fork 2
fix(rpc): eth_call accepts any block tag; empty logsBloom is now 256 bytes #707
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🧹 Nitpick | 🔵 Trivial | 💤 Low value
Consider validating the block tag parameter even when ignoring it.
The comment states
params[1] = block tag(line 964), but the implementation at line 988 doesn't parse, validate, or use it. While the PR objective is to maximize compatibility with off-the-shelf agents, silently ignoring malformed block tags (e.g.,"0xZZZ", invalid JSON types) means callers won't receive-32602errors for parameter mistakes.Compare with
eth_getBlockByNumber(lines 141-146), which validates the block parameter format even when it can serve the request. Basic validation would catch caller bugs without compromising compatibility.Optional: Add basic block tag validation
async fn eth_call(params: &Value, state: &SharedState) -> DispatchResult { // Execute a read-only EVM call without state mutation. // params[0] = {from, to, data, value, gas} // params[1] = block tag. // // 2026-05-21: dropped the strict historical-state gate here for // the same reason as eth_getTransactionCount. Off-the-shelf // EVM agents (Hyperlane relayer, ethers, viem) pin eth_call to // a recent past block as routine bookkeeping, even when the // underlying view function only has meaning against tip // (Mailbox.delivered, ERC20.totalSupply at finality, etc.). // Returning -32004 here kills every off-the-shelf integration. // // The trade-off: callers asking for "balanceOf(x) at h=N" get // current balance instead of historical. The agent ecosystem // already accounts for this by reading from a deterministic // current-state view of the chain. Use eth_getBalance / // eth_getCode / eth_getStorageAt for explicit state-read // pinning — those keep the strict gate so a wallet asking // "what was my balance at h=N" gets an honest -32004 instead // of a stale-passing-as-historical answer. // // Telemetry note: callers that pin eth_call to a non-tip block // are visible in tracing — span enters with the requested tag, // result reflects current state. No on-the-wire warning is // emitted because the spec compatibility cost outweighs the // audit-surface gain. + + // Optional: validate block tag format even though we ignore its value + if let Some(tag) = params.get(1) { + let bc = state.read().await; + let _ = resolve_block_tag(Some(tag), bc.height()) + .map_err(|e| (-32602, e.to_string()))?; + } + match run_evm_dry_run(¶ms[0], state).await {🤖 Prompt for AI Agents