Skip to content

Commit 30e89c4

Browse files
committed
shim: mass rename adapter -> dock
1 parent 01722b9 commit 30e89c4

File tree

4 files changed

+25
-22
lines changed

4 files changed

+25
-22
lines changed

sugondat-shim/src/cli.rs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ pub struct Cli {
3838
}
3939

4040
/// Common parameters for key management in a subcommand.
41-
// TODO: for adapters, this should not be required and for query submit it should
41+
// TODO: for docks, this should not be required and for query submit it should
4242
// be. Unfortunately, clap doesn't support this easily so it is handled manually
4343
// within the command execution for submit.
4444
#[derive(clap::Args, Debug)]
@@ -62,9 +62,9 @@ pub struct KeyManagementParams {
6262
pub submit_private_key: Option<std::path::PathBuf>,
6363
}
6464

65-
/// Common parameters for the adapter subcommands.
65+
/// Common parameters for the subcommands that run docks.
6666
#[derive(clap::Args, Debug)]
67-
pub struct AdapterServerParams {
67+
pub struct DockParams {
6868
/// The address on which the shim should listen for incoming connections from the rollup nodes.
6969
#[clap(short, long, default_value = "127.0.0.1", group = "listen")]
7070
pub address: String,
@@ -79,7 +79,7 @@ pub struct AdapterServerParams {
7979
)]
8080
pub port: u16,
8181

82-
// TODO: e.g. prometheus stuff, enabled adapters, etc.
82+
// TODO: e.g. prometheus stuff, enabled docks, etc.
8383
}
8484

8585
/// Common parameters for that commands that connect to the sugondat-node.
@@ -90,8 +90,8 @@ pub struct SugondatRpcParams {
9090
pub node_url: String,
9191
}
9292

93-
impl AdapterServerParams {
94-
/// Whether the sovereign adapter should be enabled.
93+
impl DockParams {
94+
/// Whether the sovereign dock should be enabled.
9595
pub fn enable_sovereign(&self) -> bool {
9696
true
9797
}
@@ -110,7 +110,7 @@ pub enum Commands {
110110
pub mod serve {
111111
//! CLI definition for the `serve` subcommand.
112112
113-
use super::{AdapterServerParams, KeyManagementParams, SugondatRpcParams};
113+
use super::{DockParams, KeyManagementParams, SugondatRpcParams};
114114
use clap::Args;
115115

116116
#[derive(Debug, Args)]
@@ -119,7 +119,7 @@ pub mod serve {
119119
pub rpc: SugondatRpcParams,
120120

121121
#[clap(flatten)]
122-
pub adapter: AdapterServerParams,
122+
pub dock: DockParams,
123123

124124
#[clap(flatten)]
125125
pub key_management: KeyManagementParams,

sugondat-shim/src/cmd/serve.rs

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
use crate::{
2-
dock::sovereign::SovereignAdapter,
3-
cli::{serve::Params, AdapterServerParams},
2+
dock::sovereign::SovereignDock,
3+
cli::{serve::Params, DockParams},
44
key::Keypair,
55
sugondat_rpc::Client,
66
};
@@ -12,13 +12,13 @@ use tracing::{debug, info};
1212
pub async fn run(params: Params) -> anyhow::Result<()> {
1313
info!(
1414
"starting sugondat-shim server on {}:{}",
15-
params.adapter.address, params.adapter.port
15+
params.dock.address, params.dock.port
1616
);
17-
let listen_on = (params.adapter.address.as_str(), params.adapter.port);
17+
let listen_on = (params.dock.address.as_str(), params.dock.port);
1818
let maybe_key = crate::cmd::load_key(params.key_management)?;
1919
let server = Server::builder().build(listen_on).await?;
2020
let client = connect_client(&params.rpc.node_url).await?;
21-
let handle = server.start(init_adapters(client, &params.adapter, maybe_key));
21+
let handle = server.start(init_docks(client, &params.dock, maybe_key));
2222
handle.stopped().await;
2323
Ok(())
2424
}
@@ -28,16 +28,16 @@ async fn connect_client(url: &str) -> anyhow::Result<Client> {
2828
Ok(client)
2929
}
3030

31-
fn init_adapters(
31+
fn init_docks(
3232
client: Client,
33-
adapter: &AdapterServerParams,
33+
dock_params: &DockParams,
3434
maybe_key: Option<Keypair>,
3535
) -> Methods {
3636
let mut methods = Methods::new();
37-
if adapter.enable_sovereign() {
38-
debug!("enabling sovereign adapter");
39-
let adapter = SovereignAdapter::new(client.clone(), maybe_key);
40-
methods.merge(adapter.into_rpc()).unwrap();
37+
if dock_params.enable_sovereign() {
38+
debug!("enabling sovereign adapter dock");
39+
let dock = SovereignDock::new(client.clone(), maybe_key);
40+
methods.merge(dock.into_rpc()).unwrap();
4141
}
4242
methods
4343
}

sugondat-shim/src/dock/mod.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,4 @@
1+
//! A dock is a component that provides an ad-hoc API consumed by the corresponding adapter in the
2+
//! rollup.
3+
14
pub mod sovereign;

sugondat-shim/src/dock/sovereign.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,19 +4,19 @@ use tracing::info;
44

55
use crate::{key::Keypair, sugondat_rpc};
66

7-
pub struct SovereignAdapter {
7+
pub struct SovereignDock {
88
client: sugondat_rpc::Client,
99
submit_key: Option<Keypair>,
1010
}
1111

12-
impl SovereignAdapter {
12+
impl SovereignDock {
1313
pub fn new(client: sugondat_rpc::Client, submit_key: Option<Keypair>) -> Self {
1414
Self { client, submit_key }
1515
}
1616
}
1717

1818
#[async_trait::async_trait]
19-
impl SovereignRPCServer for SovereignAdapter {
19+
impl SovereignRPCServer for SovereignDock {
2020
async fn get_block(
2121
&self,
2222
height: u64,

0 commit comments

Comments
 (0)