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

Dedicated ledger JSON-RPC crate #1032

Merged
merged 9 commits into from
Oct 16, 2023
Merged

Dedicated ledger JSON-RPC crate #1032

merged 9 commits into from
Oct 16, 2023

Conversation

neysofu
Copy link
Member

@neysofu neysofu commented Oct 13, 2023

Description

With this PR, I'm introducing a new crate full-node/sov-ledger-rpc which has two components:

  • A jsonrpsee::RpcModule builder for the LedgerDB JSON-RPC API.
  • A type-safe client trait RpcClient.

This results in some code deduplication across rollup crates, which can just import the server implementation to serve ledger data. The provided server implementation is also more extensive compared to what we had in demo-rollup, and exposes all getters that LedgerRpcProvider offers.

rollup-template has been modified accordingly.

Testing

Existing test_rpc.rs in demo-rollup, combined with new doc tests and two integration tests.

@neysofu neysofu requested a review from bkolad October 13, 2023 13:24
@neysofu neysofu marked this pull request as draft October 13, 2023 14:49
@codecov
Copy link

codecov bot commented Oct 13, 2023

Codecov Report

Merging #1032 (29cf3ae) into nightly (a0cfbca) will increase coverage by 0.7%.
Report is 1 commits behind head on nightly.
The diff coverage is 93.1%.

Files Coverage Δ
full-node/db/sov-db/src/ledger_db/rpc.rs 82.2% <100.0%> (+36.6%) ⬆️
full-node/sov-ledger-rpc/src/client.rs 100.0% <100.0%> (ø)
full-node/sov-ledger-rpc/src/lib.rs 100.0% <100.0%> (ø)
full-node/sov-stf-runner/src/lib.rs 100.0% <ø> (ø)
sov-rollup-starter/src/register_rpc.rs 100.0% <ø> (ø)
sov-rollup-starter/src/rollup.rs 91.2% <100.0%> (+1.6%) ⬆️
...m/module-implementations/sov-evm/src/signer/mod.rs 82.7% <0.0%> (-3.0%) ⬇️
full-node/sov-ledger-rpc/src/server.rs 95.4% <95.4%> (ø)
rollup-interface/src/node/rpc/mod.rs 86.9% <83.3%> (ø)

... and 1 file with indirect coverage changes

Signed-off-by: Filippo Costa <filippo@sovlabs.io>
Signed-off-by: Filippo Costa <filippo@sovlabs.io>
Signed-off-by: Filippo Costa <filippo@sovlabs.io>
Signed-off-by: Filippo Costa <filippo@sovlabs.io>
Signed-off-by: Filippo Costa <filippo@sovlabs.io>
Signed-off-by: Filippo Costa <filippo@sovlabs.io>
Signed-off-by: Filippo Costa <filippo@sovlabs.io>
Copy link
Member

@bkolad bkolad left a comment

Choose a reason for hiding this comment

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

LGTM!

@neysofu neysofu disabled auto-merge October 16, 2023 12:21
Signed-off-by: Filippo Costa <filippo@sovlabs.io>
@neysofu neysofu added this pull request to the merge queue Oct 16, 2023
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to no response for status checks Oct 16, 2023
@neysofu neysofu added this pull request to the merge queue Oct 16, 2023
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to no response for status checks Oct 16, 2023
@neysofu neysofu added this pull request to the merge queue Oct 16, 2023
Merged via the queue into nightly with commit 48a9040 Oct 16, 2023
14 checks passed
@neysofu neysofu deleted the filippo/rpc-lib-pr branch October 16, 2023 16:49
neysofu added a commit that referenced this pull request Oct 17, 2023
* Add sov-ledger-rpc

Signed-off-by: Filippo Costa <filippo@sovlabs.io>

* Fixes

Signed-off-by: Filippo Costa <filippo@sovlabs.io>

* Remove outdated comment

Signed-off-by: Filippo Costa <filippo@sovlabs.io>

* Fix failing test

Signed-off-by: Filippo Costa <filippo@sovlabs.io>

* Add docs to methods

Signed-off-by: Filippo Costa <filippo@sovlabs.io>

* Fix optional dep issue

Signed-off-by: Filippo Costa <filippo@sovlabs.io>

* Reuse hex rpc logic

Signed-off-by: Filippo Costa <filippo@sovlabs.io>

* Delete old template Cargo.toml

Signed-off-by: Filippo Costa <filippo@sovlabs.io>

---------

Signed-off-by: Filippo Costa <filippo@sovlabs.io>
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