Skip to content

Commit

Permalink
chore(sidecar): review CLI options and their defaults
Browse files Browse the repository at this point in the history
  • Loading branch information
thedevbirb committed Oct 22, 2024
1 parent 9d33dc5 commit 5baeb51
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 14 deletions.
30 changes: 22 additions & 8 deletions bolt-sidecar/src/config/chain.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
use std::time::Duration;
use core::fmt;
use std::{fmt::Display, time::Duration};

use clap::{Args, ValueEnum};
use ethereum_consensus::deneb::{compute_fork_data_root, Root};
Expand All @@ -25,7 +26,7 @@ pub const COMMIT_BOOST_DOMAIN_MASK: [u8; 4] = [109, 109, 111, 67];
#[derive(Debug, Clone, Copy, Args, Deserialize)]
pub struct ChainConfig {
/// Chain on which the sidecar is running
#[clap(long, env = "BOLT_SIDECAR_CHAIN", default_value = "mainnet")]
#[clap(long, env = "BOLT_SIDECAR_CHAIN", default_value_t = Chain::Mainnet)]
chain: Chain,
/// The deadline in the slot at which the sidecar will stop accepting
/// new commitments for the next block (parsed as milliseconds).
Expand Down Expand Up @@ -65,6 +66,24 @@ pub enum Chain {
Kurtosis,
}

impl Chain {
/// Get the chain name for the given chain.
pub fn name(&self) -> &'static str {
match self {
Chain::Mainnet => "mainnet",
Chain::Holesky => "holesky",
Chain::Helder => "helder",
Chain::Kurtosis => "kurtosis",
}
}
}

impl Display for Chain {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
write!(f, "{}", self.name())
}
}

impl ChainConfig {
/// Get the chain ID for the given chain.
pub fn chain_id(&self) -> u64 {
Expand All @@ -78,12 +97,7 @@ impl ChainConfig {

/// Get the chain name for the given chain.
pub fn name(&self) -> &'static str {
match self.chain {
Chain::Mainnet => "mainnet",
Chain::Holesky => "holesky",
Chain::Helder => "helder",
Chain::Kurtosis => "kurtosis",
}
self.chain.name()
}

/// Get the slot time for the given chain in seconds.
Expand Down
14 changes: 8 additions & 6 deletions bolt-sidecar/src/config/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,13 @@ use limits::LimitsOpts;

use crate::common::{BlsSecretKeyWrapper, EcdsaSecretKeyWrapper, JwtSecretConfig};

/// Default port for the JSON-RPC server exposed by the sidecar.
pub const DEFAULT_RPC_PORT: u16 = 8000;
/// Default port for the JSON-RPC server exposed by the sidecar supporting the Commitments API.
///
/// 8017 -> BOLT :)
pub const DEFAULT_RPC_PORT: u16 = 8017;

/// Default port for the Constraints proxy server.
pub const DEFAULT_CONSTRAINTS_PROXY_PORT: u16 = 18551;
/// Default port for the Constraints proxy server, binded to the default port used by MEV-Boost.
pub const DEFAULT_CONSTRAINTS_PROXY_PORT: u16 = 18550;

/// Command-line options for the Bolt sidecar
#[derive(Debug, Parser, Deserialize)]
Expand All @@ -52,7 +54,7 @@ pub struct Opts {
#[clap(
long,
env = "BOLT_SIDECAR_CONSTRAINTS_API_URL",
default_value = "http://localhost:3030"
default_value = "http://localhost:18551"
)]
pub constraints_api_url: Url,
/// The port from which the Bolt sidecar will receive Builder-API requests from the
Expand All @@ -68,7 +70,7 @@ pub struct Opts {
/// - a comma-separated list of indexes (e.g. "1,2,3,4")
/// - a contiguous range of indexes (e.g. "1..4")
/// - a mix of the above (e.g. "1,2..4,6..8")
#[clap(long, env = "BOLT_SIDECAR_VALIDATOR_INDEXES", default_value_t)]
#[clap(long, env = "BOLT_SIDECAR_VALIDATOR_INDEXES")]
pub validator_indexes: ValidatorIndexes,
/// The JWT secret token to authenticate calls to the engine API.
///
Expand Down

0 comments on commit 5baeb51

Please sign in to comment.