Skip to content
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

make json-rpc server id handling spec-compliant #807

Merged
merged 3 commits into from
Aug 26, 2024

Conversation

voliva
Copy link
Contributor

@voliva voliva commented Aug 23, 2024

Initial bit of work for #801

This makes id handling spec-compliant by JSON-RPC 2.0. Notable changes:

  • The id can now be parsed as a number, string, null or undefined
  • If the id is a number, it must be an integer.
  • The id from error responses is now correct:
    • If it was while parsing the message, then it's null.
    • If it was while handling a request, then it's the same request id as that request.
  • It handles notifications correctly: if the id is undefined, no response is returned.

I couldn't find a good place to add tests for these cases - please let me know if you want me to add some, or if you need anything else.
I could find the test file, e2e/src/http.test.ts

Copy link
Collaborator

@ermalkaleci ermalkaleci left a comment

Choose a reason for hiding this comment

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

LGTM

@xlc xlc merged commit 4b7208a into AcalaNetwork:master Aug 26, 2024
5 of 6 checks passed
@voliva voliva deleted the json-rpc-id branch August 26, 2024 08:58
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.

3 participants