Skip to content

Commit

Permalink
Merge pull request #333 from chainbound/lore/chore/drop-toml-unstable
Browse files Browse the repository at this point in the history
chore!(sidecar): drop TOML support
  • Loading branch information
thedevbirb authored Oct 28, 2024
2 parents 3300b32 + a508d9f commit 304cd37
Show file tree
Hide file tree
Showing 5 changed files with 63 additions and 90 deletions.
88 changes: 61 additions & 27 deletions bolt-sidecar/.env.example
Original file line number Diff line number Diff line change
@@ -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
34 changes: 0 additions & 34 deletions bolt-sidecar/Config.example.toml

This file was deleted.

6 changes: 1 addition & 5 deletions bolt-sidecar/bin/sidecar.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
23 changes: 0 additions & 23 deletions bolt-sidecar/src/config/mod.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
use std::fs;

use alloy::primitives::Address;
use clap::Parser;
use eyre::Context;
use reqwest::Url;
use serde::Deserialize;

Expand Down Expand Up @@ -105,14 +102,6 @@ pub struct Opts {
pub extra_args: Vec<String>,
}

impl Opts {
/// Parse the configuration from a TOML file.
pub fn parse_from_toml(file_path: &str) -> eyre::Result<Self> {
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::*;
Expand All @@ -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);
}
}
2 changes: 1 addition & 1 deletion bolt-sidecar/src/primitives/delegation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<Vec<SignedDelegation>> {
Expand Down

0 comments on commit 304cd37

Please sign in to comment.