Skip to content

Commit ed8ba53

Browse files
authored
chore: remove relay monitor (#261)
1 parent 7f021a7 commit ed8ba53

File tree

7 files changed

+4
-71
lines changed

7 files changed

+4
-71
lines changed

config.example.toml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,9 +44,6 @@ skip_sigverify = false
4444
# Can be specified as a float or a string for extra precision (e.g. "0.01")
4545
# OPTIONAL, DEFAULT: 0.0
4646
min_bid_eth = 0.0
47-
# List of URLs of relay monitors to send registrations to
48-
# OPTIONAL
49-
relay_monitors = []
5047
# How late in milliseconds in the slot is "late". This impacts the `get_header` requests, by shortening timeouts for `get_header` calls to
5148
# relays and make sure a header is returned within this deadline. If the request from the CL comes later in the slot, then fetching headers is skipped
5249
# to force local building and miniminzing the risk of missed slots. See also the timing games section below

crates/common/src/config/pbs.rs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -111,9 +111,6 @@ pub struct PbsConfig {
111111
/// Minimum bid that will be accepted from get_header
112112
#[serde(rename = "min_bid_eth", with = "as_eth_str", default = "default_u256")]
113113
pub min_bid_wei: U256,
114-
/// List of relay monitor urls in the form of scheme://host
115-
#[serde(default)]
116-
pub relay_monitors: Vec<Url>,
117114
/// How late in the slot we consider to be "late"
118115
#[serde(default = "default_u64::<LATE_IN_SLOT_TIME_MS>")]
119116
pub late_in_slot_time_ms: u64,
Lines changed: 3 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,8 @@
1-
use std::time::Instant;
2-
31
use alloy::rpc::types::beacon::relay::ValidatorRegistration;
42
use axum::{extract::State, http::HeaderMap, response::IntoResponse, Json};
5-
use cb_common::{
6-
pbs::{BuilderEvent, REGISTER_VALIDATOR_PATH},
7-
utils::get_user_agent,
8-
DEFAULT_REQUEST_TIMEOUT,
9-
};
10-
use reqwest::{StatusCode, Url};
11-
use tracing::{debug, error, info, trace};
3+
use cb_common::{pbs::BuilderEvent, utils::get_user_agent};
4+
use reqwest::StatusCode;
5+
use tracing::{error, info, trace};
126
use uuid::Uuid;
137

148
use crate::{
@@ -34,13 +28,6 @@ pub async fn handle_register_validator<S: BuilderApiState, A: BuilderApi<S>>(
3428

3529
info!(ua, num_registrations = registrations.len());
3630

37-
if state.has_monitors() {
38-
// send registrations to monitors
39-
for relay_monitor in state.pbs_config().relay_monitors.clone() {
40-
tokio::spawn(send_relay_monitor_registrations(registrations.clone(), relay_monitor));
41-
}
42-
}
43-
4431
if let Err(err) = A::register_validator(registrations, req_headers, state.clone()).await {
4532
state.publish_event(BuilderEvent::RegisterValidatorResponse);
4633
error!(%err, "all relays failed registration");
@@ -57,44 +44,3 @@ pub async fn handle_register_validator<S: BuilderApiState, A: BuilderApi<S>>(
5744
Ok(StatusCode::OK)
5845
}
5946
}
60-
61-
#[tracing::instrument(skip_all, name = "monitor", fields(url = relay_monitor_url.host_str().unwrap_or_default()))]
62-
async fn send_relay_monitor_registrations(
63-
registrations: Vec<ValidatorRegistration>,
64-
relay_monitor_url: Url,
65-
) {
66-
let Ok(url) = relay_monitor_url.join(REGISTER_VALIDATOR_PATH) else {
67-
error!("invalid URL");
68-
return;
69-
};
70-
71-
let start_request = Instant::now();
72-
let res = match reqwest::Client::new()
73-
.post(url)
74-
.timeout(DEFAULT_REQUEST_TIMEOUT)
75-
.json(&registrations)
76-
.send()
77-
.await
78-
{
79-
Ok(res) => res,
80-
Err(err) => {
81-
error!(%err, "failed monitor registration");
82-
return;
83-
}
84-
};
85-
let request_latency = start_request.elapsed();
86-
87-
let code = res.status();
88-
match res.bytes().await {
89-
Ok(response_bytes) => {
90-
if code.is_success() {
91-
debug!(?code, latency = ?request_latency, "relay monitor registration successful");
92-
} else {
93-
let err = String::from_utf8_lossy(&response_bytes);
94-
error!(?code, %err, "failed monitor registration");
95-
}
96-
}
97-
98-
Err(err) => error!(%err, "failed to decode monitor response"),
99-
}
100-
}

crates/pbs/src/state.rs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -69,10 +69,6 @@ where
6969
}
7070
}
7171

72-
pub fn has_monitors(&self) -> bool {
73-
!self.config.pbs_config.relay_monitors.is_empty()
74-
}
75-
7672
pub fn extra_validation_enabled(&self) -> bool {
7773
self.config.pbs_config.extra_validation_enabled
7874
}

tests/data/configs/pbs.happy.toml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ timeout_get_payload_ms = 4000
1212
timeout_register_validator_ms = 3000
1313
skip_sigverify = false
1414
min_bid_eth = 0.5
15-
relay_monitors = []
1615
late_in_slot_time_ms = 2000
1716
extra_validation_enabled = false
1817
rpc_url = "https://ethereum-holesky-rpc.publicnode.com"
@@ -23,4 +22,4 @@ url = "http://0xa1cec75a3f0661e99299274182938151e8433c61a19222347ea1313d839229cb
2322
headers = { X-MyCustomHeader = "MyCustomHeader" }
2423
enable_timing_games = false
2524
target_first_request_ms = 200
26-
frequency_get_header_ms = 300
25+
frequency_get_header_ms = 300

tests/src/utils.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,6 @@ pub fn get_pbs_static_config(port: u16) -> PbsConfig {
6868
skip_sigverify: false,
6969
min_bid_wei: U256::ZERO,
7070
late_in_slot_time_ms: u64::MAX,
71-
relay_monitors: vec![],
7271
extra_validation_enabled: false,
7372
rpc_url: None,
7473
}

tests/tests/config.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,6 @@ async fn test_load_pbs_happy() -> Result<()> {
4545
dbg!(&config.pbs.pbs_config.min_bid_wei);
4646
dbg!(&U256::from(0.5));
4747
assert_eq!(config.pbs.pbs_config.min_bid_wei, U256::from((0.5 * WEI_PER_ETH as f64) as u64));
48-
assert!(config.pbs.pbs_config.relay_monitors.is_empty());
4948
assert_eq!(config.pbs.pbs_config.late_in_slot_time_ms, 2000);
5049
assert_eq!(config.pbs.pbs_config.extra_validation_enabled, false);
5150
assert_eq!(

0 commit comments

Comments
 (0)