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(rpc): implement ledger_getEvents #1058

Conversation

rkrasiuk
Copy link
Contributor

@rkrasiuk rkrasiuk commented Oct 17, 2023

Description

Implement ledger_getEvents through the extension trait. Not a fan of this solution but it saves you from the pain of having to handroll your own rpc macro.

Linked Issues

Testing

Added ledger_getEvents to getters_succeed test

@codecov
Copy link

codecov bot commented Oct 17, 2023

Codecov Report

Merging #1058 (847acde) into nightly (27ae049) will increase coverage by 78.9%.
Report is 1 commits behind head on nightly.
The diff coverage is 100.0%.

Files Coverage Δ
full-node/sov-ledger-rpc/src/client.rs 100.0% <100.0%> (ø)
full-node/sov-ledger-rpc/src/server.rs 95.5% <100.0%> (ø)

... and 203 files with indirect coverage changes

Copy link
Member

@neysofu neysofu left a comment

Choose a reason for hiding this comment

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

Hi @rkrasiuk, thanks for the PR! Greatly appreciated.

The solution looks good. The extra trait approach is quite painful, although less than rolling our own hand-written client trait.

Sooner or later, I'd still like us to roll our own trait because it allows up to completely abstract away other serialization details (e.g. HexHash, there's no good reason for that to be part of the public crate API). In the meantime, maybe there we can avoid having the extra trait by extending the server implementation to accept both parameter types: the correct one, and jsonrpsee's auto-generated one. I have tried writing an MVP here: nightly...filippo/get-events-rpc.

What do you think? I'm unsure myself what I prefer.

@rkrasiuk
Copy link
Contributor Author

hey @neysofu, i'm a bit at the crossroads as well. my preference would be for rpc to have strict behavior, but i like the code for your solution more, so i'll leave it up to you to decide :)

on the sidenote, could you point me to some good first issues i could take? very few seem to be tagged

@neysofu
Copy link
Member

neysofu commented Oct 18, 2023

It's great that you want to pick up more issues, @rkrasiuk, thank you! I'll chat with the team later today and we'll tag a few issues as good-first-issue or something of that sort to help newcomers, and I can ping you when we do so.

As for the ledger_getEvents pattern, I think the nested parameter hack is good enough for now – when we hand-roll our own client trait, we can then remove the pathological case handler on the server's side, and the test for it.

Let me know if you're able to rewrite the branch history to include the changes in d86f02d. Feel free to modify the test, comments, or anything that you'd like to improve on. In the meantime, I'll create a new issue to track the hand-written client trait development.

@rkrasiuk
Copy link
Contributor Author

no need to cherry-pick then, that solution looks good enough. closing in favor of d86f02d

@rkrasiuk rkrasiuk closed this Oct 18, 2023
@rkrasiuk rkrasiuk deleted the rkrasiuk/rpc-ledeger-get-events branch October 18, 2023 11:54
@neysofu
Copy link
Member

neysofu commented Oct 19, 2023

Hey @rkrasiuk!

I think there's few issues you could take on:

@citizen-stig
Copy link
Member

Additional issue that can be good to fix for sequencer:

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.

Add ledger_getEvents to sov_ledger_rpc::RpcClient
3 participants