Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
293 changes: 287 additions & 6 deletions Cargo.lock

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ cb-signer = { path = "crates/signer" }

# ethereum
alloy = { version = "0.8.0", features = [
"full",
"rpc-types-beacon",
"serde",
"ssz",
Expand Down
4 changes: 2 additions & 2 deletions bin/pbs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@ async fn main() -> Result<()> {
if std::env::var_os("RUST_BACKTRACE").is_none() {
std::env::set_var("RUST_BACKTRACE", "1");
}

let pbs_config = load_pbs_config()?;
let _guard = initialize_pbs_tracing_log();

let pbs_config = load_pbs_config().await?;

let state = PbsState::new(pbs_config);
PbsService::init_metrics()?;
let server = PbsService::run::<_, DefaultBuilderApi>(state);
Expand Down
2 changes: 1 addition & 1 deletion bin/signer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ async fn main() -> Result<()> {
if std::env::var_os("RUST_BACKTRACE").is_none() {
std::env::set_var("RUST_BACKTRACE", "1");
}
let _guard = initialize_tracing_log(SIGNER_MODULE_NAME);

let config = StartSignerConfig::load_from_env()?;
let _guard = initialize_tracing_log(SIGNER_MODULE_NAME);
let server = SigningService::run(config);

tokio::select! {
Expand Down
7 changes: 5 additions & 2 deletions config.example.toml
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ late_in_slot_time_ms = 2000
extra_validation_enabled = false
# Execution Layer RPC url to use for extra validation
# OPTIONAL
rpc_url = "http://abc.xyz"
rpc_url = "https://ethereum-holesky-rpc.publicnode.com"

# The PBS module needs one or more [[relays]] as defined below.
[[relays]]
Expand Down Expand Up @@ -111,9 +111,12 @@ validator_pubkeys = [
"0x80c7f782b2467c5898c5516a8b6595d75623960b4afc4f71ee07d40985d20e117ba35e7cd352a3e75fb85a8668a3b745",
"0xa119589bb33ef52acbb8116832bec2b58fca590fe5c85eac5d3230b44d5bc09fe73ccd21f88eab31d6de16194d17782e",
]
# Path to a file containing a list of validator pubkeys
# Path to a file containing a list of validator pubkeys or details of a registry to load keys from.
# Supported registries:
# - Lido: NodeOperatorsRegistry
# OPTIONAL
loader = "./mux_keys.example.json"
# loader = { registry = "lido", node_operator_id = 8 }
timeout_get_header_ms = 900
late_in_slot_time_ms = 1500
# For each mux, one or more [[mux.relays]] can be defined, which will be used for the matching validator pubkeys
Expand Down
11 changes: 11 additions & 0 deletions configs/pbs-mux.toml → configs/pbs_mux.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ chain = "Holesky"
port = 18550
timeout_get_header_ms = 950
late_in_slot_time_ms = 2000
rpc_url = "https://ethereum-holesky-rpc.publicnode.com"

# Used for all validators except the ones in the mux
[[relays]]
Expand All @@ -22,8 +23,18 @@ loader = "./mux_keys.example.json"
timeout_get_header_ms = 900
late_in_slot_time_ms = 1500


[[mux.relays]]
id = "relay-2"
url = "http://0xa119589bb33ef52acbb8116832bec2b58fca590fe5c85eac5d3230b44d5bc09fe73ccd21f88eab31d6de16194d17782e@def.xyz"
enable_timing_games = true
target_first_request_ms = 200


[[mux]]
id = "lido-mux"
loader = { registry = "lido", node_operator_id = 8 }

[[mux.relays]]
id = "relay-3"
url = "http://0x80c7f782b2467c5898c5516a8b6595d75623960b4afc4f71ee07d40985d20e117ba35e7cd352a3e75fb85a8668a3b745@fgh.xyz"
4 changes: 3 additions & 1 deletion crates/cli/src/docker_init.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,11 @@ const SIGNER_NETWORK: &str = "signer_network";

/// Builds the docker compose file for the Commit-Boost services
// TODO: do more validation for paths, images, etc
pub fn handle_docker_init(config_path: String, output_dir: String) -> Result<()> {
pub async fn handle_docker_init(config_path: String, output_dir: String) -> Result<()> {
println!("Initializing Commit-Boost with config file: {}", config_path);
let cb_config = CommitBoostConfig::from_file(&config_path)?;
cb_config.validate().await?;

let chain_spec_path = CommitBoostConfig::chain_spec_file(&config_path);

let metrics_enabled = cb_config.metrics.is_some();
Expand Down
2 changes: 1 addition & 1 deletion crates/cli/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ impl Args {

match self.cmd {
Command::Init { config_path, output_path } => {
docker_init::handle_docker_init(config_path, output_path)
docker_init::handle_docker_init(config_path, output_path).await
}

Command::Start { compose_path, env_path } => {
Expand Down
56 changes: 56 additions & 0 deletions crates/common/src/abi/LidoNORegistry.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
[
{
"constant": true,
"inputs": [
{
"name": "_nodeOperatorId",
"type": "uint256"
}
],
"name": "getTotalSigningKeyCount",
"outputs": [
{
"name": "",
"type": "uint256"
}
],
"payable": false,
"stateMutability": "view",
"type": "function"
},
{
"constant": true,
"inputs": [
{
"name": "_nodeOperatorId",
"type": "uint256"
},
{
"name": "_offset",
"type": "uint256"
},
{
"name": "_limit",
"type": "uint256"
}
],
"name": "getSigningKeys",
"outputs": [
{
"name": "pubkeys",
"type": "bytes"
},
{
"name": "signatures",
"type": "bytes"
},
{
"name": "used",
"type": "bool[]"
}
],
"payable": false,
"stateMutability": "view",
"type": "function"
}
]
6 changes: 2 additions & 4 deletions crates/common/src/config/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,14 +38,13 @@ pub struct CommitBoostConfig {

impl CommitBoostConfig {
/// Validate config
pub fn validate(&self) -> Result<()> {
self.pbs.pbs_config.validate()?;
pub async fn validate(&self) -> Result<()> {
self.pbs.pbs_config.validate(self.chain).await?;
Ok(())
}

pub fn from_file(path: &str) -> Result<Self> {
let config: Self = load_from_file(path)?;
config.validate()?;
Ok(config)
}

Expand Down Expand Up @@ -83,7 +82,6 @@ impl CommitBoostConfig {
logs: helper_config.logs,
};

config.validate()?;
Ok(config)
}

Expand Down
Loading
Loading