From 28a17c5d086b132d9d7ad86054c2e73b519cf58e Mon Sep 17 00:00:00 2001 From: Naman Garg <0708ng@gmail.com> Date: Fri, 19 Jul 2024 12:39:04 +0530 Subject: [PATCH] chore(sidecar): add max gas to cli --- bolt-sidecar/bin/sidecar.rs | 8 ++++++-- bolt-sidecar/src/config/mod.rs | 9 +++++++++ 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/bolt-sidecar/bin/sidecar.rs b/bolt-sidecar/bin/sidecar.rs index 04cde0908..47eb1a912 100644 --- a/bolt-sidecar/bin/sidecar.rs +++ b/bolt-sidecar/bin/sidecar.rs @@ -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()); diff --git a/bolt-sidecar/src/config/mod.rs b/bolt-sidecar/src/config/mod.rs index d0f60d595..e80318825 100644 --- a/bolt-sidecar/src/config/mod.rs +++ b/bolt-sidecar/src/config/mod.rs @@ -47,6 +47,9 @@ pub struct Opts { /// Max number of commitments to accept per block #[clap(short = 'm', long)] pub(super) max_commitments: Option>, + /// Max committed gas per slot + #[clap(short = 'g', long)] + pub(super) max_committed_gas: Option>, /// 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") @@ -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, + pub max_committed_gas_per_slot: NonZero, } 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"), } } } @@ -169,6 +174,10 @@ impl TryFrom 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