Skip to content

Conversation

@jaoleal
Copy link
Collaborator

@jaoleal jaoleal commented Feb 6, 2026

Description and Notes

Some time ago i was messing with the server trying to fix some pains that i had developing methods on it and i encountered some points to upgrade.

4839dc6 - fixes #827 by matching errors and returning constant values, i also mapped some custom error codes to internal errors as I understood that were allowed by the spec.

29220da- Adds named and null parameters support, I also reviewed some Options in internal rpc methods that actually had internal defaults, created a getter for that case.

fix #827
fix #704

How to verify the changes you have done?

Pushed some extensive tests regarding request and result parsing and behavior, checking that calls are accepted when expected and when refused we assert the error response.

Contributor Checklist

  • I've followed the contribution guidelines
  • I've verified one of the following:
    • Ran just pcc (recommended but slower)
    • Ran just lint-features '-- -D warnings' && cargo test --release
    • Confirmed CI passed on my fork
  • I've linked any related issue(s) in the sections above

Finally, you are encouraged to sign all your commits (it proves authorship and guards against tampering—see How (and why) to sign Git commits and GitHub's guide to signing commits).

@jaoleal
Copy link
Collaborator Author

jaoleal commented Feb 6, 2026

cc @csgui

Why i cant alter the name of the PR 😭

@jaoleal jaoleal force-pushed the some_fixes_rpcserver branch from 766648c to 5cd9007 Compare February 6, 2026 23:25
@jaoleal
Copy link
Collaborator Author

jaoleal commented Feb 6, 2026

Can someone with permission to alter the pr title fix it for me ?

rpcserver: Support named and null parameters, Review optionals on rpc internal methods, Stronger Response and Error codes.

@jaoleal
Copy link
Collaborator Author

jaoleal commented Feb 6, 2026

5cd9007 Unrelated test fail

@Davidson-Souza Davidson-Souza added RPC Changes something with our JSON-RPC interface code quality Generally improves code readability and maintainability labels Feb 7, 2026
@Davidson-Souza Davidson-Souza changed the title rpcserver: Support named and null parameters, Review optionals on rpc internal methods, rpcserver: Support named and null parameters, Review optionals on rpc internal methods, Stronger Response and Error codes Feb 7, 2026
@csgui
Copy link
Contributor

csgui commented Feb 8, 2026

@jaoleal double check if you can use <T: DeserializeOwned> or <'de, T: Deserialize<'de>>. Not both, choose one.

That would makes more sense and allows the remove of clone in the code. When parsing RPC parameters clone can cause performance issues and increased memory pressure under heavy load. We do not have control on what Floresta user is passing to a RPC call.

@jaoleal jaoleal force-pushed the some_fixes_rpcserver branch 2 times, most recently from c13b68a to 0e160f5 Compare February 9, 2026 09:22
@jaoleal
Copy link
Collaborator Author

jaoleal commented Feb 9, 2026

top commit: 0e160f5

  • Removed a clone from get_at, lifetime matching solved that.
  • Included back MempoolAccept, sorry conflict problems.
  • Fixed a bug matching against params in get_arr_at where it would result unwrapping in a malformed input.
  • Added extensive tests, they were written by claudiao but i reviewed it and found a bug.
  • Fixed a bug when an optional parameter is omitted when params are omitted as a whole.

Thanks for the suggestions @csgui

@moisesPompilio
Copy link
Collaborator

I think the commit descriptions are missing because they only have titles.

@jaoleal jaoleal force-pushed the some_fixes_rpcserver branch from 0e160f5 to 781ea91 Compare February 9, 2026 19:07
@jaoleal
Copy link
Collaborator Author

jaoleal commented Feb 9, 2026

[781ea91 Rebased and extended commit message with descriptions.

@jaoleal
Copy link
Collaborator Author

jaoleal commented Feb 9, 2026

Added formal fix statement for the issues that this pr fixes.

@jaoleal jaoleal force-pushed the some_fixes_rpcserver branch from 781ea91 to 994e4b7 Compare February 10, 2026 01:44
@jaoleal

This comment was marked as outdated.

@jaoleal jaoleal force-pushed the some_fixes_rpcserver branch 4 times, most recently from 2d230a8 to bd4d7a1 Compare February 10, 2026 15:45
@jaoleal
Copy link
Collaborator Author

jaoleal commented Feb 10, 2026

gaddamit these conflicts

These changes replaces error code literals to constants, being them http or jsonrpc error codes, as well creating methods to convert internal errors to them. That also brings a well-defined response type that matches jsonrpc spec.
…nd refact arg_parser.

According the spec, jsonrpc 2.0 should be able to support flexible params definition, allowing them to be named or totally omitted inside the request, respecting the method definition and these changes present that support. Changes reflected in a refact of the internal arg_parser module, also creating better handles for optionals and params with default values.
…requests cases.

The last commit presented some changes for the rpcserver and these tests assert them.
@jaoleal jaoleal force-pushed the some_fixes_rpcserver branch from bd4d7a1 to d18e6dd Compare February 10, 2026 20:32
@jaoleal
Copy link
Collaborator Author

jaoleal commented Feb 10, 2026

unrelated fail on functional tests d18e6dd

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

code quality Generally improves code readability and maintainability RPC Changes something with our JSON-RPC interface

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Replace JSON-RPC error code literals with named constants [Bug] json-rpc server doesn't support named parameter

4 participants