Skip to content

Commit

Permalink
Fix dev-node options
Browse files Browse the repository at this point in the history
  • Loading branch information
jbearer committed Jun 4, 2024
1 parent bf2dd4a commit 186e2a4
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 15 deletions.
8 changes: 2 additions & 6 deletions sequencer/src/api/options.rs
Original file line number Diff line number Diff line change
Expand Up @@ -503,15 +503,15 @@ impl Options {
pub struct Http {
/// Port that the HTTP API will use.
#[clap(long, env = "ESPRESSO_SEQUENCER_API_PORT")]
pub(super) port: u16,
pub port: u16,

/// Maximum number of concurrent HTTP connections the server will allow.
///
/// Connections exceeding this will receive and immediate 429 response and be closed.
///
/// Leave unset for no connection limit.
#[clap(long, env = "ESPRESSO_SEQUENCER_MAX_CONNECTIONS")]
pub(super) max_connections: Option<usize>,
pub max_connections: Option<usize>,
}

impl Http {
Expand All @@ -522,10 +522,6 @@ impl Http {
max_connections: None,
}
}

pub fn port(&self) -> u16 {
self.port
}
}

/// Options for the submission API module.
Expand Down
26 changes: 17 additions & 9 deletions sequencer/src/bin/espresso-dev-node.rs
Original file line number Diff line number Diff line change
Expand Up @@ -47,15 +47,20 @@ struct Args {
)]
account_index: u32,

/// Port that the HTTP API will use.
#[clap(long, env = "ESPRESSO_SEQUENCER_API_PORT")]
sequencer_api_port: u16,

/// Maximum concurrent connections allowed by the HTTP API server.
#[clap(long, env = "ESPRESSO_SEQUENCER_MAX_CONNECTIONS")]
sequencer_api_max_connections: Option<usize>,

/// If provided, the service will run a basic HTTP server on the given port.
///
/// The server provides healthcheck and version endpoints.
#[clap(short, long, env = "ESPRESSO_COMMITMENT_TASK_PORT")]
commitment_task_port: u16,

#[clap(flatten)]
http: options::Http,

#[clap(flatten)]
sql: persistence::sql::Options,
}
Expand All @@ -66,11 +71,14 @@ async fn main() -> anyhow::Result<()> {
setup_backtrace();

let opt = Args::parse();
let options = options::Options::from(opt.http)
.status(Default::default())
.state(Default::default())
.submit(Default::default())
.query_sql(Default::default(), opt.sql);
let options = options::Options::from(options::Http {
port: opt.sequencer_api_port,
max_connections: opt.sequencer_api_max_connections,
})
.status(Default::default())
.state(Default::default())
.submit(Default::default())
.query_sql(Default::default(), opt.sql);

let (url, _anvil) = if let Some(url) = opt.rpc_url {
(url, None)
Expand Down Expand Up @@ -118,7 +126,7 @@ async fn main() -> anyhow::Result<()> {
start_commitment_server(opt.commitment_task_port, hotshot_address, SEQUENCER_VERSION).unwrap();

let sequencer_url =
Url::parse(format!("http://localhost:{}", opt.http.port()).as_str()).unwrap();
Url::parse(format!("http://localhost:{}", opt.sequencer_api_port).as_str()).unwrap();
let commitment_task_options = CommitmentTaskOptions {
l1_provider: url,
l1_chain_id: None,
Expand Down

0 comments on commit 186e2a4

Please sign in to comment.