Skip to content

Commit

Permalink
Add list of default relays and config to enable them
Browse files Browse the repository at this point in the history
  • Loading branch information
ferranbt committed Dec 31, 2024
1 parent 5bed43c commit c1c6b62
Show file tree
Hide file tree
Showing 2 changed files with 80 additions and 9 deletions.
7 changes: 1 addition & 6 deletions config-playground.toml
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,4 @@ ignore_cancellable_orders = true
sbundle_mergeable_signers = []
live_builders = ["mp-ordering", "mgp-ordering", "parallel"]

[[relays]]
name = "custom"
url = "http://0xac6e77dfe25ecd6110b8e780608cce0dab71fdd5ebea22a16c0205200f2f8e2e3ad3b71d3499c54ad14d6c21b41a37ae@localhost:5555"
priority = 0
use_ssz_for_submit = false
use_gzip_for_submit = false
enabled_relays = ["playground"]
82 changes: 79 additions & 3 deletions crates/rbuilder/src/live_builder/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,8 @@ pub struct Config {
pub struct L1Config {
// Relay Submission configuration
pub relays: Vec<RelayConfig>,
pub enabled_relays: Vec<String>,

pub dry_run: bool,
#[serde_as(deserialize_as = "OneOrMany<_>")]
pub dry_run_validation_url: Vec<String>,
Expand Down Expand Up @@ -138,7 +140,70 @@ pub struct L1Config {
impl Default for L1Config {
fn default() -> Self {
Self {
relays: vec![],
relays: vec![
RelayConfig {
name: "flashbots".to_string(),
url: "http://k8s-default-boostrel-9f278153f5-947835446.us-east-2.elb.amazonaws.com".to_string(),
use_ssz_for_submit: true,
use_gzip_for_submit: false,
priority: 0,
optimistic: false,
interval_between_submissions_ms: Some(250),
authorization_header: None,
builder_id_header: None,
api_token_header: None,
},
RelayConfig {
name: "ultrasound-us".to_string(),
url: "https://relay-builders-us.ultrasound.money".to_string(),
use_ssz_for_submit: true,
use_gzip_for_submit: true,
priority: 0,
optimistic: true,
interval_between_submissions_ms: None,
authorization_header: None,
builder_id_header: None,
api_token_header: None,
},
RelayConfig {
name: "ultrasound-eu".to_string(),
url: "https://relay-builders-eu.ultrasound.money".to_string(),
use_ssz_for_submit: true,
use_gzip_for_submit: true,
priority: 0,
optimistic: true,
interval_between_submissions_ms: None,
authorization_header: None,
builder_id_header: None,
api_token_header: None,
},
RelayConfig {
name: "agnostic".to_string(),
url: "https://0xa7ab7a996c8584251c8f925da3170bdfd6ebc75d50f5ddc4050a6fdc77f2a3b5fce2cc750d0865e05d7228af97d69561@agnostic-relay.net".to_string(),
use_ssz_for_submit: true,
use_gzip_for_submit: true,
priority: 0,
optimistic: true,
interval_between_submissions_ms: None,
authorization_header: None,
builder_id_header: None,
api_token_header: None,
},
// Local relay configuration for the playground
RelayConfig {
name: "playground".to_string(),
url: "http://0xac6e77dfe25ecd6110b8e780608cce0dab71fdd5ebea22a16c0205200f2f8e2e3ad3b71d3499c54ad14d6c21b41a37ae@localhost:5555".to_string(),
priority: 0,
use_ssz_for_submit: false,
use_gzip_for_submit: false,
optimistic: false,
interval_between_submissions_ms: None,
authorization_header: None,
builder_id_header: None,
api_token_header: None,
}
],
enabled_relays: vec![],
dry_run: false,
dry_run_validation_url: vec![],
relay_secret_key: "".into(),
Expand Down Expand Up @@ -170,8 +235,19 @@ impl L1Config {

pub fn create_relays(&self) -> eyre::Result<Vec<MevBoostRelay>> {
let mut results = Vec::new();
for relay in &self.relays {
results.push(MevBoostRelay::from_config(relay)?);
for relay_name in &self.enabled_relays {
match self.relays.iter().find(|r| r.name == *relay_name) {
Some(relay) => {
match MevBoostRelay::from_config(relay) {
Ok(relay) => {
info!("Created relay: {:?} (priority: {})", relay_name, relay.priority);
results.push(relay)
},
Err(e) => return Err(eyre::eyre!("Failed to create relay {}: {:?}", relay_name, e)),
}
}
None => return Err(eyre::eyre!("Relay {} not found in relays list", relay_name)),
}
}
Ok(results)
}
Expand Down

0 comments on commit c1c6b62

Please sign in to comment.