fix(jsonrpc): suppress error responses for notifications - #4146
Open
arunimshukla wants to merge 4 commits into
Open
arunimshukla wants to merge 4 commits into
arunimshukla wants to merge 4 commits into
Conversation
brbrr
requested changes
Oct 5, 2026
brbrr
left a comment
Contributor
There was a problem hiding this comment.
Thanks for the contribution!
Please take a look at the inline comment.
Nit: the PR body lists utils/broadcast and core/trie2/trieutils under validation. Those packages are not touched, and are irrelevant to your changes.
| calledMethod, found := s.methods[req.Method] | ||
| if !found { | ||
| res.Error = Err(MethodNotFound, nil) | ||
| if req.ID == nil { |
Contributor
There was a problem hiding this comment.
handleRequest already has a notification check after the handler call (if res.ID == nil { // notification). This PR adds two more before it, so the same rule now lives in three places, and the new branches assign res.Error and then throw it away. Please keep one check.
This branch has not been deployed
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.
Problem
JSON-RPC notifications are requests without an
id, so the server must not send a response, including an error response. Juno's request dispatcher currently emits error responses for notification requests that use an unknown method or have invalid parameters.Changes
id.Validation
I reproduced the bug with four focused cases: unknown-method notification, invalid-params notification, a notification-only failing batch, and a mixed batch. The new cases fail on the base commit and pass after the fix.
All three packages pass with the race detector enabled.
Reference: https://www.jsonrpc.org/specification