Skip to content

Conversation

@jaoleal
Copy link
Collaborator

@jaoleal jaoleal commented Jan 17, 2026

Description and Notes

  • ee24899: While messing around the codebase i noticed that we actually were tying our rpcs to Json which actually makes our codebase messy mixing rpc execution and response/request building, which IMHO should be done in separate api levels. Theres still Json types being re-implemented in the server but i wanted to keep the scope, maybe a follow-up Pr to solve that ? Also, jsonrpc client implementation is pretty robust, besides it should make easier to also make floresta-cli core-compatible for us to better test our schema compatibility and achieve what i mentioned here
    f6a3311: With this proposal in mind I moved our floresta-specific RPC code to a proper module expecting it to receive more RPC handling over types. "floresta-rpc should hold only client implementation", well if we really need to stick with that and consequently still have problems with type re-implementation and drifting maybe we should consider nuking it totally and moving these to floresta common since we would need only some work-arounds to corepc-client to satisfy the support for floresta, which is not an horrible idea IMHO... But is MUCH more conformable to not to.

Dropped the related commit, Im thinking that may be better to use another lib to handle server and client for us...

How to verify the changes you have done?

cargo build
cargo test -p floresta-rpc

The tests are all returning 422 Http error Lol, Ill debug that because we may be doing something wrong Client or Server side... because of that, draft for now.

Found the bug and it was indeed our side... Ill add the third commit fixing the bug since it introduces a lot of changes server side.

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 Jan 17, 2026

cc @moisesPompilio

@moisesPompilio
Copy link
Collaborator

Concept ACK

The idea of using the RPC client directly is interesting. It appears to be easier to understand and reduces our code maintenance burden.

@jaoleal
Copy link
Collaborator Author

jaoleal commented Jan 18, 2026

Actually, instead of using rust-bitcoins rpc ive been seeing this other crate which appears to be even more extensive about jsonrpc and rpc in general... Being production ready, used by many people and should be better in order to have a robust clien-server

https://docs.rs/jsonrpsee/latest/jsonrpsee/

@jaoleal jaoleal force-pushed the json_types_fromjsonrpc branch from 807ec46 to b4b3172 Compare January 20, 2026 00:30
@jaoleal jaoleal changed the title Refact rpc client to use jsonrpcs Client directly and Chores to centralize rpc related code. Refact rpc client to use jsonrpcs Client directly, server support for named and null parameters. Jan 22, 2026
@jaoleal
Copy link
Collaborator Author

jaoleal commented Jan 23, 2026

Im reconsidering this, im thinking to actually copy paste jsonrpc inside floresta-rpc.

Why?

  1. Their types are used against core and should help us to prevent compatibility bugs.
  2. We are using them anyway but we are blocked to ask for support, changes and we are partially rewriting the code but still using theirs

cc @Davidson-Souza @moisesPompilio

The previous commit introduced the changes where we delegate the request
building to jsonrpc which was building some request with null params,
breaking our current code that was expecting an array. Since now the
server type holds a Option<Value> I separated methods that required
params and those who didnt, and added support to getting value
from objects by strings, supporting named parameters.

I also added a simple test to be sure that named parameters are supported.
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.

2 participants