-
Notifications
You must be signed in to change notification settings - Fork 77
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
fix(composer)!: update to work with appside mempool #1643
Changes from 9 commits
ae142a3
3b69c0b
39d18b3
368715b
cfbf479
9da9d23
12a346a
cab8154
d809986
9541015
bda2d87
09af906
f517085
fe86cae
9d2b75a
8ef17cd
1d98d64
8f6db63
5bdfddc
703687d
119e8ae
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -19,7 +19,8 @@ config: | |
maxSubmitInterval: 2000 | ||
sequencerAddressPrefix: astria | ||
sequencerNativeAssetBaseDenomination: "nria" | ||
sequencerRpc: "" | ||
cometbftEndpoint: "http://node0-sequencer-rpc-service.astria-dev-cluster.svc.cluster.local:26657" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should template from |
||
sequencerGrpcEndpoint: "http://node0-sequencer-grpc-service.astria-dev-cluster.svc.cluster.local:8080" | ||
sequencerChainId: "" | ||
privateKey: | ||
devContent: "" | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,8 +12,14 @@ homepage = "https://astria.org" | |
name = "astria-composer" | ||
|
||
[dependencies] | ||
http = "0.2.9" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is to work with |
||
|
||
astria-build-info = { path = "../astria-build-info", features = ["runtime"] } | ||
astria-core = { path = "../astria-core", features = ["serde", "server"] } | ||
astria-core = { path = "../astria-core", features = [ | ||
"client", | ||
"serde", | ||
"server", | ||
] } | ||
astria-eyre = { path = "../astria-eyre" } | ||
config = { package = "astria-config", path = "../astria-config" } | ||
telemetry = { package = "astria-telemetry", path = "../astria-telemetry", features = [ | ||
|
@@ -59,6 +65,7 @@ path = "../astria-sequencer-client" | |
features = ["http"] | ||
|
||
[dev-dependencies] | ||
astria-grpc-mock = { path = "../astria-grpc-mock" } | ||
config = { package = "astria-config", path = "../astria-config", features = [ | ||
"tests", | ||
] } | ||
|
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -25,7 +25,10 @@ NO_COLOR= | |||||
ASTRIA_COMPOSER_API_LISTEN_ADDR="0.0.0.0:0" | ||||||
|
||||||
# Address of the RPC server for the sequencer chain | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
ASTRIA_COMPOSER_SEQUENCER_URL="http://127.0.0.1:26657" | ||||||
ASTRIA_COMPOSER_COMETBFT_ENDPOINT="http://127.0.0.1:26657" | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
|
||||||
# Address of the RPC server for the sequencer chain | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
ASTRIA_COMPOSER_SEQUENCER_GRPC_ENDPOINT="http://127.0.0.1:8080" | ||||||
|
||||||
# Chain ID of the sequencer chain which transactions are submitted to. | ||||||
ASTRIA_COMPOSER_SEQUENCER_CHAIN_ID="astria-dev-1" | ||||||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -27,7 +27,10 @@ pub struct Config { | |
pub api_listen_addr: SocketAddr, | ||
|
||
/// Address of the RPC server for the sequencer chain | ||
pub sequencer_url: String, | ||
pub cometbft_endpoint: String, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. As for the comment on the env.example - to be consistent we should call this |
||
|
||
/// Address of the GRPC server for the sequencer chain | ||
pub sequencer_grpc_endpoint: String, | ||
|
||
/// The chain ID of the sequencer chain | ||
pub sequencer_chain_id: String, | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,6 +6,7 @@ use std::{ | |
|
||
use astria_core::{ | ||
crypto::SigningKey, | ||
generated::sequencerblock::v1alpha1::sequencer_service_client::SequencerServiceClient, | ||
primitive::v1::Address, | ||
protocol::transaction::v1alpha1::action::Sequence, | ||
}; | ||
|
@@ -14,6 +15,7 @@ use astria_eyre::eyre::{ | |
eyre, | ||
WrapErr as _, | ||
}; | ||
use http::Uri; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Mentioned in the toml: remove this (see also my other comment on |
||
use tokio::sync::watch; | ||
use tokio_util::sync::CancellationToken; | ||
|
||
|
@@ -24,7 +26,8 @@ use crate::{ | |
}; | ||
|
||
pub(crate) struct Builder { | ||
pub(crate) sequencer_url: String, | ||
pub(crate) cometbft_endpoint: String, | ||
pub(crate) sequencer_grpc_endpoint: String, | ||
pub(crate) sequencer_chain_id: String, | ||
pub(crate) private_key_file: String, | ||
pub(crate) sequencer_address_prefix: String, | ||
|
@@ -38,7 +41,8 @@ pub(crate) struct Builder { | |
impl Builder { | ||
pub(crate) fn build(self) -> eyre::Result<(super::Executor, executor::Handle)> { | ||
let Self { | ||
sequencer_url, | ||
cometbft_endpoint, | ||
sequencer_grpc_endpoint, | ||
sequencer_chain_id, | ||
private_key_file, | ||
sequencer_address_prefix, | ||
|
@@ -48,8 +52,14 @@ impl Builder { | |
shutdown_token, | ||
metrics, | ||
} = self; | ||
let sequencer_client = sequencer_client::HttpClient::new(sequencer_url.as_str()) | ||
.wrap_err("failed constructing sequencer client")?; | ||
let cometbft_client = sequencer_client::HttpClient::new(cometbft_endpoint.as_str()) | ||
.wrap_err("failed constructing sequencer http client")?; | ||
|
||
let sequencer_grpc_client = connect_sequencer_grpc(sequencer_grpc_endpoint.as_str()) | ||
.wrap_err_with(|| { | ||
format!("failed to connect to sequencer over gRPC at `{sequencer_grpc_endpoint}`") | ||
})?; | ||
|
||
let (status, _) = watch::channel(Status::new()); | ||
|
||
let sequencer_key = read_signing_key_from_file(&private_key_file).wrap_err_with(|| { | ||
|
@@ -69,7 +79,8 @@ impl Builder { | |
super::Executor { | ||
status, | ||
serialized_rollup_transactions: serialized_rollup_transaction_rx, | ||
sequencer_client, | ||
cometbft_client, | ||
sequencer_grpc_client, | ||
sequencer_chain_id, | ||
sequencer_key, | ||
address: sequencer_address, | ||
|
@@ -91,3 +102,14 @@ fn read_signing_key_from_file<P: AsRef<Path>>(path: P) -> eyre::Result<SigningKe | |
.map_err(|_| eyre!("invalid private key length; must be 32 bytes"))?; | ||
Ok(SigningKey::from(private_key_bytes)) | ||
} | ||
|
||
fn connect_sequencer_grpc( | ||
sequencer_grpc_endpoint: &str, | ||
) -> eyre::Result<SequencerServiceClient<tonic::transport::Channel>> { | ||
let uri: Uri = sequencer_grpc_endpoint | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Just qualify this as |
||
.parse() | ||
.wrap_err("failed to parse endpoint as URI")?; | ||
Ok(SequencerServiceClient::new( | ||
tonic::transport::Endpoint::from(uri).connect_lazy(), | ||
)) | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should move under
global.dev
statements, marking a breaking change.