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

feat: initial implementation of OpenRPC definitions for methods #4033

Merged
merged 29 commits into from
Mar 14, 2024

Conversation

aatifsyed
Copy link
Contributor

@aatifsyed aatifsyed commented Mar 6, 2024

Summary of changes

  • crate::rpc::reflect::SelfDescribingRpcModule creates OpenRPC definitions for methods
  • chain_get_path uses that struct
  • cleanup error types
  • add TODOs for various issues

Follow up

#4032

Change checklist

  • I have performed a self-review of my own code,
  • I have made corresponding changes to the documentation,
  • I have added tests that prove my fix is effective or that my feature works (if possible),
  • I have made sure the CHANGELOG is up-to-date. All user-facing changes should be reflected in this document.

@aatifsyed aatifsyed requested a review from a team as a code owner March 6, 2024 16:04
@aatifsyed aatifsyed requested review from hanabi1224 and LesnyRumcajs and removed request for a team March 6, 2024 16:04
@LesnyRumcajs
Copy link
Member

Let's have an issue with the context for this PR. What problem does it solve? Why is it needed? What decisions needed to be made?

@aatifsyed aatifsyed mentioned this pull request Mar 7, 2024
Copy link
Member

@LesnyRumcajs LesnyRumcajs left a comment

Choose a reason for hiding this comment

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

  1. In general, should the reflect code live in the Forest repository? Could it potentially live elsewhere and be published to crates.io as something others could reuse?
  2. As noted elsewhere, panics are rough. Can they be avoided so that the error can be handled by the caller?

src/rpc/reflect/mod.rs Show resolved Hide resolved
src/rpc/reflect/mod.rs Show resolved Hide resolved
src/rpc/reflect/mod.rs Show resolved Hide resolved
src/rpc/reflect/openrpc_types.rs Outdated Show resolved Hide resolved
@aatifsyed
Copy link
Contributor Author

  1. In general, should the reflect code live in the Forest repository? Could it potentially live elsewhere and be published to crates.io as something others could reuse?
  2. As noted elsewhere, panics are rough. Can they be avoided so that the error can be handled by the caller?
  1. I think reflect could be broken out, but that can be a later PR - maybe once it's had more use. I'm also meh about jsonrpsee in general - I feel more restricted than enabled by it.
  2. I think the existing panics are appropriate. They're not handle-able, they require code to be written to fix. I think it follows the same precedence as tokio::spawn or axum::Router::route.

Copy link
Member

@LesnyRumcajs LesnyRumcajs left a comment

Choose a reason for hiding this comment

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

Approving. That said, I have my doubts regarding the design decision of having panics here. I hope it won't bite us in the future.

Cargo.toml Outdated Show resolved Hide resolved
src/rpc/reflect/util.rs Outdated Show resolved Hide resolved
@ruseinov ruseinov self-requested a review March 12, 2024 16:30
Copy link
Contributor

@ruseinov ruseinov left a comment

Choose a reason for hiding this comment

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

This is looking good!

I have submitted some comments, mostly regarding docs.

This code is quite hard to read due to the specifics of the problem it's trying to solve, so it would be nice to make sure it's well-documented, so the next time it needs to be touched it wouldn't take as much brain space as it does to review it.

Especially the macros, parser and serde code.

@aatifsyed aatifsyed added this pull request to the merge queue Mar 14, 2024
Merged via the queue into main with commit 5c56711 Mar 14, 2024
27 checks passed
@aatifsyed aatifsyed deleted the aatifsyed/what-r-pc branch March 14, 2024 15:22
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.

4 participants