fix(evmrpc): omit notifications from legacy JSON-RPC batch responses per spec#3246
Merged
amir-deris merged 5 commits intomainfrom Apr 15, 2026
Conversation
|
The latest Buf updates on your PR. Results from workflow Buf / buf (pull_request).
|
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #3246 +/- ##
=======================================
Coverage 59.25% 59.26%
=======================================
Files 2070 2070
Lines 169784 169764 -20
=======================================
+ Hits 100600 100605 +5
+ Misses 60382 60359 -23
+ Partials 8802 8800 -2
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
bdchatham
reviewed
Apr 14, 2026
| out := make([]json.RawMessage, 0, lenMsgs) | ||
| for i := 0; i < lenMsgs; i++ { | ||
| if invalidReq[i] { | ||
| out = append(out, marshalJSONRPCError(orNullID(ids[i]), -32600, seiLegacyBatchInvalidReqMsg)) |
Contributor
There was a problem hiding this comment.
nit: can you set a constant with a self-describing name for -32600? I had to look this up. Without context, it's a magic number to a reader.
Contributor
Author
There was a problem hiding this comment.
That is a good point. Will make the fix for it.
bdchatham
reviewed
Apr 14, 2026
| // read more than the inner JSON-RPC stack will accept (see rpc.Server.SetHTTPBodyLimit). | ||
| const seiLegacyHTTPMaxBody = 5 * 1024 * 1024 | ||
|
|
||
| const ( |
bdchatham
approved these changes
Apr 14, 2026
masih
approved these changes
Apr 15, 2026
| lenMsgs int, | ||
| ) []json.RawMessage { | ||
| out := make([]json.RawMessage, 0, lenMsgs) | ||
| for i := 0; i < lenMsgs; i++ { |
Collaborator
There was a problem hiding this comment.
Use the newer for range syntax
Suggested change
| for i := 0; i < lenMsgs; i++ { | |
| for i := range lenMsgs { |
…onse-for-notifications
yzang2019
added a commit
that referenced
this pull request
Apr 16, 2026
* main: Fix buffer offset in ProposerPriorityHash (CON-200) (#3255) Handle error case in light client divergence detector (#3254) perf(evmrpc): eliminate redundant block fetches in simulate backend (#3208) fix(evmrpc): omit notifications from legacy JSON-RPC batch responses per spec (#3246) fix: deduplicate block fetch in getTransactionReceipt (#3244)
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.
Summary
Fixes the
sei-legacy-httpbatch gateway to correctly handle JSON-RPC 2.0 notifications (requests with noidfield).Previous behavior:
[](an empty JSON array)New behavior per JSON-RPC 2.0 §6:
[]Changes:
append-based slices so response count naturally matches non-notification itemsseiLegacyBatchResponsesNoForwardhelper for the no-forward pathappendMergeFailureclosure inmergeSeiLegacyHTTPBatchto eliminate repeated merge-failure blockswriteJSONRPCBatchResponsewhich handles the empty-body case (replaces directwriteJSONArrayResponsecalls)AGENTS.mdto document the notification-omission and empty-body behaviourTest plan
go test ./evmrpc/... -run TestWrapSeiLegacyHTTP_Batch