Skip to content

Commit

Permalink
chore(sidecar): add max gas to cli
Browse files Browse the repository at this point in the history
  • Loading branch information
namn-grg committed Jul 19, 2024
1 parent c408c2b commit 28a17c5
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
8 changes: 6 additions & 2 deletions bolt-sidecar/bin/sidecar.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,12 @@ async fn main() -> eyre::Result<()> {
let signer = Signer::new(config.private_key.clone().unwrap());

let state_client = StateClient::new(config.execution_api_url.clone());
let mut execution_state =
ExecutionState::new(state_client, config.limits.max_commitments_per_slot).await?;
let mut execution_state = ExecutionState::new(
state_client,
config.limits.max_commitments_per_slot,
config.limits.max_committed_gas_per_slot,
)
.await?;

let mevboost_client = MevBoostClient::new(config.mevboost_url.clone());
let beacon_client = BeaconClient::new(config.beacon_api_url.clone());
Expand Down
9 changes: 9 additions & 0 deletions bolt-sidecar/src/config/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,9 @@ pub struct Opts {
/// Max number of commitments to accept per block
#[clap(short = 'm', long)]
pub(super) max_commitments: Option<NonZero<usize>>,
/// Max committed gas per slot
#[clap(short = 'g', long)]
pub(super) max_committed_gas: Option<NonZero<u64>>,
/// Validator indexes of connected validators that the sidecar
/// should accept commitments on behalf of. Accepted values:
/// - a comma-separated list of indexes (e.g. "1,2,3,4")
Expand Down Expand Up @@ -137,12 +140,14 @@ impl Default for Config {
pub struct Limits {
/// Maximum number of commitments to accept per block
pub max_commitments_per_slot: NonZero<usize>,
pub max_committed_gas_per_slot: NonZero<u64>,
}

impl Default for Limits {
fn default() -> Self {
Self {
max_commitments_per_slot: NonZero::new(6).expect("Valid non-zero"),
max_committed_gas_per_slot: NonZero::new(10_000_000).expect("Valid non-zero"),
}
}
}
Expand All @@ -169,6 +174,10 @@ impl TryFrom<Opts> for Config {
config.limits.max_commitments_per_slot = max_commitments;
}

if let Some(max_committed_gas) = opts.max_committed_gas {
config.limits.max_committed_gas_per_slot = max_committed_gas;
}

config.commit_boost_url = opts
.signing
.commit_boost_url
Expand Down

0 comments on commit 28a17c5

Please sign in to comment.