Skip to content

Commit

Permalink
sequencer-client: add extension trait to subscriber to new sequencer …
Browse files Browse the repository at this point in the history
…blocks (#382)

## Summary
Add a `SequencerSubscriptionClientExt` trait with a
`subscribe_new_block_data` method.

## Background
Removing gossipnet from conductor as part of
#332 requires it to read new
blocks directly from cometbft / sequencer. This patch extends the
sequencer-client crate to provide that functionality using a convenience
function so that conductor need not know how to convert comertbft
new-block events to sequencer block data.

## Changes
- Add a `SequencerSubscriptionClientExt` trait to the sequencer-client
crate.
- Reorganize the sequencer-client crate to export items under the
appropriate features.
- warn users if they set neither the `http` nor `websocket` features.

## Testing
Testing this client is out of scope for this PR. We are relying on the
underlying tendermint-rpc WebSocketClient being correctly implemented.
It would be great to extend wiremock or a similar crate to provide a quick way
to test websocket APIs.

An alternative is to derive a jsonrpc server with jsonrpsee, but that's
a lot more work.

## Breaking Changelist
None, only functionality was added crates depending on sequencer-client
were not touched.

## Related Issues
Part of #332

#375 and
#376 are precursor PRs
unblocking this patch.

---------

Co-authored-by: noot <36753753+noot@users.noreply.github.com>
  • Loading branch information
SuperFluffy and noot authored Sep 20, 2023
1 parent a889ca6 commit 1df160e
Show file tree
Hide file tree
Showing 8 changed files with 490 additions and 341 deletions.
5 changes: 4 additions & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ tendermint = "0.32"
tendermint-config = "0.32"
tendermint-proto = "0.32"
tendermint-rpc = "0.32"
thiserror = "1"
tokio = "1.28"
tonic = "0.9"
tracing = "0.1"
Expand Down
5 changes: 4 additions & 1 deletion crates/astria-sequencer-client/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,15 @@ edition = "2021"

[dependencies]
proto = { package = "astria-proto", path = "../astria-proto" }
sequencer-types = { package = "astria-sequencer-types", path = "../astria-sequencer-types" }

async-trait = { workspace = true }
eyre = { workspace = true }
futures = { workspace = true }
hex = { workspace = true }
tendermint = { workspace = true }
tendermint-rpc = { workspace = true }
tracing = { workspace = true }
thiserror = { workspace = true }

[features]
http = ["tendermint-rpc/http-client"]
Expand Down
Loading

0 comments on commit 1df160e

Please sign in to comment.