Skip to content

Commit cf0de03

Browse files
committed
sugondat-shim: rename AdapterServerParams
1 parent 7572999 commit cf0de03

File tree

2 files changed

+12
-10
lines changed

2 files changed

+12
-10
lines changed

sugondat-shim/src/cli.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,12 @@ struct Cli {
1111
command: Commands,
1212
}
1313

14-
/// Common parameters for all subcommands.
14+
/// Common parameters for the adapter subcommands.
1515
///
1616
/// It's not declared on the `Cli` struct with `clap(flatten)` because of how the syntax
1717
/// `sugondat-shim -p 10 serve --node-url` looks unintuitive.
1818
#[derive(clap::Args, Debug)]
19-
pub struct CommonParams {
19+
pub struct AdapterServerParams {
2020
/// The address on which the shim should listen for incoming connections from the rollup nodes.
2121
#[clap(short, long, default_value = "127.0.0.1", group = "listen")]
2222
pub address: String,
@@ -33,7 +33,7 @@ pub struct CommonParams {
3333
// TODO: e.g. --submit-key, prometheus stuff, enabled adapters, etc.
3434
}
3535

36-
impl CommonParams {
36+
impl AdapterServerParams {
3737
/// Whether the sovereign adapter should be enabled.
3838
pub fn enable_sovereign(&self) -> bool {
3939
true

sugondat-shim/src/serve.rs

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
use crate::{adapters::sovereign::SovereignAdapter, cli::CommonParams, sugondat_rpc::Client};
1+
use crate::{
2+
adapters::sovereign::SovereignAdapter, cli::AdapterServerParams, sugondat_rpc::Client,
3+
};
24
use clap::Args;
35
use jsonrpsee::{server::Server, Methods};
46
use sugondat_shim_common_sovereign::SovereignRPCServer;
@@ -11,18 +13,18 @@ pub struct Params {
1113
node_url: String,
1214

1315
#[clap(flatten)]
14-
common: CommonParams,
16+
adapter: AdapterServerParams,
1517
}
1618

1719
pub async fn run(params: Params) -> anyhow::Result<()> {
1820
info!(
1921
"starting sugondat-shim server on {}:{}",
20-
params.common.address, params.common.port
22+
params.adapter.address, params.adapter.port
2123
);
22-
let listen_on = (params.common.address.as_str(), params.common.port);
24+
let listen_on = (params.adapter.address.as_str(), params.adapter.port);
2325
let server = Server::builder().build(listen_on).await?;
2426
let client = connect_client(&params.node_url).await?;
25-
let handle = server.start(init_adapters(client, &params.common));
27+
let handle = server.start(init_adapters(client, &params.adapter));
2628
handle.stopped().await;
2729
Ok(())
2830
}
@@ -32,9 +34,9 @@ async fn connect_client(url: &str) -> anyhow::Result<Client> {
3234
Ok(client)
3335
}
3436

35-
fn init_adapters(client: Client, common: &CommonParams) -> Methods {
37+
fn init_adapters(client: Client, adapter: &AdapterServerParams) -> Methods {
3638
let mut methods = Methods::new();
37-
if common.enable_sovereign() {
39+
if adapter.enable_sovereign() {
3840
debug!("enabling sovereign adapter");
3941
let adapter = SovereignAdapter::new(client.clone());
4042
methods.merge(adapter.into_rpc()).unwrap();

0 commit comments

Comments
 (0)