fix(rpc): emit canonical block hash in newHeads subscription#1214
Open
puneet2019 wants to merge 2 commits into
Open
fix(rpc): emit canonical block hash in newHeads subscription#1214puneet2019 wants to merge 2 commits into
puneet2019 wants to merge 2 commits into
Conversation
Contributor
|
PR author is not in the allowed authors list. |
Signed-off-by: puneetmahajan <59960662+puneet2019@users.noreply.github.com> Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
d004317 to
81c4558
Compare
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #1214 +/- ##
==========================================
- Coverage 67.02% 66.99% -0.03%
==========================================
Files 320 320
Lines 23438 23438
==========================================
- Hits 15709 15702 -7
- Misses 6572 6578 +6
- Partials 1157 1158 +1
🚀 New features to boost your workflow:
|
mmsqe
approved these changes
Jul 2, 2026
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Description
eth_subscribe("newHeads")publishes the derived Ethereum-header hash (keccak(RLP(eth header))), buteth_getBlockByNumber/eth_getBlockByHashreport and resolve by the CometBFT block hash (RPCMarshalHeadersets"hash"to it;GetBlockByHashlooks it up via CometBFT). So anewHeadsnotification'shashdoesn't match the same block frometh_getBlockByNumber, and passing it toeth_getBlockByHash/eth_getLogs({blockHash})returns "block not found".This completes #725 — that PR aligned the JSON-RPC responses and added the canonical hash to the stream header (
stream.RPCHeader.Hash = data.BlockID.Hash), but the WebSocketsubscribeNewHeadshandler was left emittingheader.EthHeader.Change (
rpc/websockets.go):RPCMarshalHeaderreturns the full header map with the canonical"hash", sonewHeadsnow matcheseth_getBlockByNumber.How to review / test
newHeads.hashnow equalseth_getBlockByNumber(<same height>).hash, and that hash resolves viaeth_getBlockByHash/eth_getLogs({blockHash})(previously "block not found"). Verified end-to-end in a downstream chain adoptingcosmos/evm/rpc(WSeth_subscribee2e green). Happy to add an integration assertion if preferred.Author Checklist
mainbranch🤖 Generated with Claude Code