From a508d9fdf13a03c2a1974db65cc278576a2ed9e7 Mon Sep 17 00:00:00 2001 From: thedevbirb Date: Thu, 24 Oct 2024 16:09:56 +0200 Subject: [PATCH] chore!(sidecar): drop TOML support --- bolt-sidecar/.env.example | 88 ++++++++++++++++------- bolt-sidecar/Config.example.toml | 34 --------- bolt-sidecar/bin/sidecar.rs | 6 +- bolt-sidecar/src/config/mod.rs | 23 ------ bolt-sidecar/src/primitives/delegation.rs | 2 +- 5 files changed, 63 insertions(+), 90 deletions(-) delete mode 100644 bolt-sidecar/Config.example.toml diff --git a/bolt-sidecar/.env.example b/bolt-sidecar/.env.example index cb234a599..cf7785bb4 100644 --- a/bolt-sidecar/.env.example +++ b/bolt-sidecar/.env.example @@ -1,33 +1,67 @@ -# Ethereum node connections -BOLT_SIDECAR_EXECUTION_API_URL=http://localhost:4485 -BOLT_SIDECAR_BEACON_API_URL=http://localhost:4400 -BOLT_SIDECAR_ENGINE_API_URL=http://localhost:4451 -BOLT_SIDECAR_ENGINE_JWT_HEX= - -# Constraint URL: should point to the constraint API sidecar. -# Usually this corresponds to `mev-boost` or `bolt-boost` -BOLT_SIDECAR_CONSTRAINTS_URL=http://localhost:19550 +# Ethereum Node Connections + PBS URLs -# Commit-boost specific options (optional) -BOLT_SIDECAR_CB_SIGNER_URL=http://localhost:19551 -BOLT_SIDECAR_CB_JWT_HEX= - -# server ports -BOLT_SIDECAR_PORT=8000 -BOLT_SIDECAR_CONSTRAINTS_PROXY_PORT=18551 +# Port to listen on for incoming JSON-RPC requests of the Commitments API. This +# port should be open on your firewall in order to receive external requests! +BOLT_SIDECAR_PORT=8017 +# Execution client API URL +BOLT_SIDECAR_EXECUTION_API_URL="http://localhost:8545" +# URL for the beacon client +BOLT_SIDECAR_BEACON_API_URL="http://localhost:5052" +# Execution client Engine API URL. This is needed for fallback block building +# and must be a synced Geth node +BOLT_SIDECAR_ENGINE_API_URL="http://localhost:8551" +# The port from which the Bolt sidecar will receive Builder-API requests from the Beacon client +BOLT_SIDECAR_CONSTRAINTS_PROXY_PORT=18550 +# URL to forward the constraints produced by the Bolt sidecar to a server +# supporting the Constraints API, such as an MEV-Boost fork +BOLT_SIDECAR_CONSTRAINTS_API_URL="http://localhost:18551" +# 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") +# - a contiguous range of indexes (e.g. "1..4") +# - a mix of the above (e.g. "1,2..4,6..8") +BOLT_SIDECAR_VALIDATOR_INDEXES= +# The JWT secret token to authenticate calls to the engine API. It can be +# either be a hex-encoded string or a file path to a file containing the +# hex-encoded secret. +BOLT_SIDECAR_ENGINE_JWT_HEX= +# The fee recipient address for fallback blocks +BOLT_SIDECAR_FEE_RECIPIENT= +# Secret ECDSA key to sign commitment messages with. The public key associated +# to it must be then used when registering the operator in the `BoltManager` +# contract +BOLT_SIDECAR_COMMITMENT_PRIVATE_KEY= +# Secret BLS key to sign fallback payloads with +BOLT_SIDECAR_BUILDER_PRIVATE_KEY= -# commitment limits -BOLT_SIDECAR_MAX_COMMITMENTS=128 -BOLT_SIDECAR_MAX_COMMITTED_GAS=10000000 +# Commitments limits +# Max number of commitments to accept per block +BOLT_SIDECAR_MAX_COMMITMENTS_PER_SLOT=128 +# Max committed gas per slot +BOLT_SIDECAR_MAX_COMMITTED_GAS_PER_SLOT=10_000_000 +# Min priority fee to accept for a commitment +BOLT_SIDECAR_MIN_PRIORITY_FEE=4_000_000_000 # 4 Gwei = 4 * 10^9 wei -# chain configs -BOLT_SIDECAR_CHAIN=holesky -BOLT_SIDECAR_COMMITMENT_DEADLINE=8000 +# Chain configuration +# Chain on which the sidecar is running +BOLT_SIDECAR_CHAIN="holesky" +# The slot time duration in seconds. If provided, it overrides the default for +# the selected [chain] BOLT_SIDECAR_SLOT_TIME=12 +# The deadline in the slot at which the sidecar will stop accepting new +# commitments for the next block (parsed as milliseconds) +BOLT_SIDECAR_COMMITMENT_DEADLINE=8000 -# sidecar security configs -BOLT_SIDECAR_VALIDATOR_INDEXES= -BOLT_SIDECAR_FEE_RECIPIENT= -BOLT_SIDECAR_BUILDER_PRIVATE_KEY= +# Signing options. BOLT_SIDECAR_CONSTRAINT_PRIVATE_KEY= -BOLT_SIDECAR_COMMITMENT_PRIVATE_KEY= +BOLT_SIDECAR_CB_SIGNER_URL= +BOLT_SIDECAR_CB_JWT_HEX= +BOLT_SIDECAR_KEYSTORE_PASSWORD= +BOLT_SIDECAR_KEYSTORE_SECRETS_PATH= +BOLT_SIDECAR_KEYSTORE_PATH= +BOLT_SIDECAR_DELEGATIONS_PATH= + +# Telemetry and Metrics +BOLT_SIDECAR_METRICS_PORT=9091 +BOLT_SIDECAR_DISABLE_METRICS=false diff --git a/bolt-sidecar/Config.example.toml b/bolt-sidecar/Config.example.toml deleted file mode 100644 index b73e925da..000000000 --- a/bolt-sidecar/Config.example.toml +++ /dev/null @@ -1,34 +0,0 @@ -# ports -port = 8000 -metrics_port = 3300 - -# node urls -execution_api_url = "http://localhost:8545" -beacon_api_url = "http://localhost:5052" -engine_api_url = "http://localhost:8551" -engine_jwt_hex = "0x573300d0cd9a8e253429998a3ceecf358aa4868d96772d1344a80144d3b7b593" - -# constraints options -constraints_api_url = "http://localhost:3030" -constraints_proxy_port = 18551 - -validator_indexes = "0..64" -fee_recipient = "0x0155ef0C0fE550C297c1216585e0DE1478EA30e4" - -builder_private_key = "0x359c156600e1f5715a58c9e09f17c8d04e7ee3a9f88b39f6e489ffca0148fabe" -commitment_private_key = "0x359c156600e1f5715a58c9e09f17c8d04e7ee3a9f88b39f6e489ffca0148fabe" - -# chain options -[chain] -chain = "Kurtosis" -slot_time = 2 -commitment_deadline = 8000 - -[telemetry] -metrics_port = 3300 -disable_metrics = false - -# signing options -[constraint_signing] -constraint_private_key = "0x359c156600e1f5715a58c9e09f17c8d04e7ee3a9f88b39f6e489ffca0148fabe" -delegations_path = "./delegations.json" diff --git a/bolt-sidecar/bin/sidecar.rs b/bolt-sidecar/bin/sidecar.rs index 07c590ed3..c58f9a1a0 100644 --- a/bolt-sidecar/bin/sidecar.rs +++ b/bolt-sidecar/bin/sidecar.rs @@ -6,11 +6,7 @@ use bolt_sidecar::{telemetry::init_telemetry_stack, Opts, SidecarDriver}; #[tokio::main] async fn main() -> Result<()> { - let opts = if let Ok(config_path) = std::env::var("BOLT_SIDECAR_CONFIG_PATH") { - Opts::parse_from_toml(config_path.as_str())? - } else { - Opts::parse() - }; + let opts = Opts::parse(); if let Err(err) = init_telemetry_stack(opts.telemetry.metrics_port()) { bail!("Failed to initialize telemetry stack: {:?}", err) diff --git a/bolt-sidecar/src/config/mod.rs b/bolt-sidecar/src/config/mod.rs index af3256000..7bc1025b1 100644 --- a/bolt-sidecar/src/config/mod.rs +++ b/bolt-sidecar/src/config/mod.rs @@ -1,8 +1,5 @@ -use std::fs; - use alloy::primitives::Address; use clap::Parser; -use eyre::Context; use reqwest::Url; use serde::Deserialize; @@ -105,14 +102,6 @@ pub struct Opts { pub extra_args: Vec, } -impl Opts { - /// Parse the configuration from a TOML file. - pub fn parse_from_toml(file_path: &str) -> eyre::Result { - let contents = fs::read_to_string(file_path).wrap_err("Unable to read file")?; - toml::from_str(&contents).wrap_err("Error parsing the TOML file") - } -} - #[cfg(test)] mod tests { use super::*; @@ -131,16 +120,4 @@ mod tests { let localhost_socket = "0.0.0.0:3030".parse().unwrap(); assert_eq!(socket_addr, localhost_socket); } - - #[test] - fn test_parse_config_from_toml() { - let path = env!("CARGO_MANIFEST_DIR").to_string() + "/Config.example.toml"; - - let config = Opts::parse_from_toml(&path).expect("Failed to parse config from TOML"); - assert_eq!(config.execution_api_url, Url::parse("http://localhost:8545").unwrap()); - assert_eq!(config.beacon_api_url, Url::parse("http://localhost:5052").unwrap()); - assert_eq!(config.engine_api_url, Url::parse("http://localhost:8551").unwrap()); - assert_eq!(config.constraints_api_url, Url::parse("http://localhost:3030").unwrap()); - assert_eq!(config.constraints_proxy_port, 18551); - } } diff --git a/bolt-sidecar/src/primitives/delegation.rs b/bolt-sidecar/src/primitives/delegation.rs index 20b689bbd..3d41f275f 100644 --- a/bolt-sidecar/src/primitives/delegation.rs +++ b/bolt-sidecar/src/primitives/delegation.rs @@ -47,7 +47,7 @@ impl SignableBLS for DelegationMessage { } } -/// read the delegaitons from disk if they exist and add them to the constraints client +/// read the delegations from disk if they exist and add them to the constraints client pub fn read_signed_delegations_from_file( file_path: &PathBuf, ) -> eyre::Result> {