Skip to content

Commit 966a111

Browse files
authored
chore: remove builder events modules (#338)
1 parent ec6a469 commit 966a111

File tree

26 files changed

+205
-528
lines changed

26 files changed

+205
-528
lines changed

Cargo.lock

Lines changed: 0 additions & 11 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[workspace]
2-
members = ["benches/*", "bin", "crates/*", "examples/builder_log", "examples/da_commit", "examples/status_api", "tests"]
2+
members = ["benches/*", "bin", "crates/*", "examples/da_commit", "examples/status_api", "tests"]
33
resolver = "2"
44

55
[workspace.package]

bin/src/lib.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ pub mod prelude {
99
load_builder_module_config, load_commit_module_config, load_pbs_config,
1010
load_pbs_custom_config, LogsSettings, StartCommitModuleConfig, PBS_MODULE_NAME,
1111
},
12-
pbs::{BuilderEvent, BuilderEventClient, OnBuilderApiEvent},
1312
signer::EcdsaSignature,
1413
types::{BlsPublicKey, BlsSignature, Chain},
1514
utils::{initialize_tracing_log, utcnow_ms, utcnow_ns, utcnow_sec, utcnow_us},

config.example.toml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -241,15 +241,14 @@ proxy_dir = "./proxies"
241241
# secrets_path = "./tests/data/proxy/secrets"
242242

243243
# Commit-Boost can optionally run "modules" which extend the capabilities of the sidecar.
244-
# Currently, two types of modules are supported:
244+
# Currently, one type of module is supported:
245245
# - "commit": modules which request commitment signatures from the validator keys
246-
# - "events": modules which callback to BuilderAPI events as triggered from the PBS modules, used e.g. for monitoring
247246
# If any "commit" module is present, then the [signer] section should also be configured
248247
# OPTIONAL
249248
[[modules]]
250249
# Unique ID of the module
251250
id = "DA_COMMIT"
252-
# Type of the module. Supported values: commit, events
251+
# Type of the module. Supported values: commit
253252
type = "commit"
254253
# Docker image of the module
255254
docker_image = "test_da_commit"

crates/cli/src/docker_init.rs

Lines changed: 9 additions & 70 deletions
Original file line numberDiff line numberDiff line change
@@ -6,16 +6,15 @@ use std::{
66

77
use cb_common::{
88
config::{
9-
CommitBoostConfig, LogsSettings, ModuleKind, SignerConfig, SignerType, BUILDER_PORT_ENV,
10-
BUILDER_URLS_ENV, CHAIN_SPEC_ENV, CONFIG_DEFAULT, CONFIG_ENV, DIRK_CA_CERT_DEFAULT,
11-
DIRK_CA_CERT_ENV, DIRK_CERT_DEFAULT, DIRK_CERT_ENV, DIRK_DIR_SECRETS_DEFAULT,
12-
DIRK_DIR_SECRETS_ENV, DIRK_KEY_DEFAULT, DIRK_KEY_ENV, JWTS_ENV, LOGS_DIR_DEFAULT,
13-
LOGS_DIR_ENV, METRICS_PORT_ENV, MODULE_ID_ENV, MODULE_JWT_ENV, PBS_ENDPOINT_ENV,
14-
PBS_MODULE_NAME, PROXY_DIR_DEFAULT, PROXY_DIR_ENV, PROXY_DIR_KEYS_DEFAULT,
15-
PROXY_DIR_KEYS_ENV, PROXY_DIR_SECRETS_DEFAULT, PROXY_DIR_SECRETS_ENV, SIGNER_DEFAULT,
16-
SIGNER_DIR_KEYS_DEFAULT, SIGNER_DIR_KEYS_ENV, SIGNER_DIR_SECRETS_DEFAULT,
17-
SIGNER_DIR_SECRETS_ENV, SIGNER_ENDPOINT_ENV, SIGNER_KEYS_ENV, SIGNER_MODULE_NAME,
18-
SIGNER_PORT_DEFAULT, SIGNER_URL_ENV,
9+
CommitBoostConfig, LogsSettings, ModuleKind, SignerConfig, SignerType, CHAIN_SPEC_ENV,
10+
CONFIG_DEFAULT, CONFIG_ENV, DIRK_CA_CERT_DEFAULT, DIRK_CA_CERT_ENV, DIRK_CERT_DEFAULT,
11+
DIRK_CERT_ENV, DIRK_DIR_SECRETS_DEFAULT, DIRK_DIR_SECRETS_ENV, DIRK_KEY_DEFAULT,
12+
DIRK_KEY_ENV, JWTS_ENV, LOGS_DIR_DEFAULT, LOGS_DIR_ENV, METRICS_PORT_ENV, MODULE_ID_ENV,
13+
MODULE_JWT_ENV, PBS_ENDPOINT_ENV, PBS_MODULE_NAME, PROXY_DIR_DEFAULT, PROXY_DIR_ENV,
14+
PROXY_DIR_KEYS_DEFAULT, PROXY_DIR_KEYS_ENV, PROXY_DIR_SECRETS_DEFAULT,
15+
PROXY_DIR_SECRETS_ENV, SIGNER_DEFAULT, SIGNER_DIR_KEYS_DEFAULT, SIGNER_DIR_KEYS_ENV,
16+
SIGNER_DIR_SECRETS_DEFAULT, SIGNER_DIR_SECRETS_ENV, SIGNER_ENDPOINT_ENV, SIGNER_KEYS_ENV,
17+
SIGNER_MODULE_NAME, SIGNER_PORT_DEFAULT, SIGNER_URL_ENV,
1918
},
2019
pbs::{BUILDER_V1_API_PATH, GET_STATUS_PATH},
2120
signer::{ProxyStore, SignerLoader},
@@ -81,9 +80,6 @@ pub async fn handle_docker_init(config_path: PathBuf, output_dir: PathBuf) -> Re
8180
format!("http://cb_signer:{signer_port}")
8281
};
8382

84-
let builder_events_port = 30000;
85-
let mut builder_events_modules = Vec::new();
86-
8783
let mut warnings = Vec::new();
8884

8985
let needs_signer_module = cb_config.pbs.with_signer ||
@@ -185,58 +181,6 @@ pub async fn handle_docker_init(config_path: PathBuf, output_dir: PathBuf) -> Re
185181
..Service::default()
186182
}
187183
}
188-
// an event module just needs a port to listen on
189-
ModuleKind::Events => {
190-
let mut ports = vec![];
191-
builder_events_modules
192-
.push(format!("http://{module_cid}:{builder_events_port}"));
193-
194-
// module ids are assumed unique, so envs dont override each other
195-
let mut module_envs = IndexMap::from([
196-
get_env_val(MODULE_ID_ENV, &module.id),
197-
get_env_val(CONFIG_ENV, CONFIG_DEFAULT),
198-
get_env_uval(BUILDER_PORT_ENV, builder_events_port),
199-
]);
200-
201-
if let Some((key, val)) = chain_spec_env.clone() {
202-
module_envs.insert(key, val);
203-
}
204-
if let Some(metrics_config) = &cb_config.metrics {
205-
if metrics_config.enabled {
206-
let host_endpoint =
207-
SocketAddr::from((metrics_config.host, metrics_port));
208-
ports.push(format!("{}:{}", host_endpoint, metrics_port));
209-
warnings.push(format!(
210-
"{} has an exported port on {}",
211-
module_cid, metrics_port
212-
));
213-
targets.push(format!("{host_endpoint}"));
214-
let (key, val) = get_env_uval(METRICS_PORT_ENV, metrics_port as u64);
215-
module_envs.insert(key, val);
216-
217-
metrics_port += 1;
218-
}
219-
}
220-
if log_to_file {
221-
let (key, val) = get_env_val(LOGS_DIR_ENV, LOGS_DIR_DEFAULT);
222-
module_envs.insert(key, val);
223-
}
224-
225-
// volumes
226-
let mut module_volumes = vec![config_volume.clone()];
227-
module_volumes.extend(chain_spec_volume.clone());
228-
module_volumes.extend(get_log_volume(&cb_config.logs, &module.id));
229-
230-
Service {
231-
container_name: Some(module_cid.clone()),
232-
image: Some(module.docker_image),
233-
ports: Ports::Short(ports),
234-
volumes: module_volumes,
235-
environment: Environment::KvPair(module_envs),
236-
depends_on: DependsOnOptions::Simple(vec!["cb_pbs".to_owned()]),
237-
..Service::default()
238-
}
239-
}
240184
};
241185

242186
services.insert(module_cid, Some(module_service));
@@ -283,11 +227,6 @@ pub async fn handle_docker_init(config_path: PathBuf, output_dir: PathBuf) -> Re
283227
let (key, val) = get_env_val(LOGS_DIR_ENV, LOGS_DIR_DEFAULT);
284228
pbs_envs.insert(key, val);
285229
}
286-
if !builder_events_modules.is_empty() {
287-
let env = builder_events_modules.join(",");
288-
let (k, v) = get_env_val(BUILDER_URLS_ENV, &env);
289-
pbs_envs.insert(k, v);
290-
}
291230

292231
// inside the container expose on 0.0.0.0
293232
let container_endpoint =

crates/common/src/config/constants.rs

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,6 @@ pub const LOGS_DIR_DEFAULT: &str = "/var/logs/commit-boost";
1919
pub const PBS_IMAGE_DEFAULT: &str = "ghcr.io/commit-boost/pbs:latest";
2020
pub const PBS_MODULE_NAME: &str = "pbs";
2121

22-
/// Urls the pbs modules should post events to (comma separated)
23-
pub const BUILDER_URLS_ENV: &str = "CB_BUILDER_URLS";
24-
2522
/// Where to receive BuilderAPI calls from beacon node
2623
pub const PBS_ENDPOINT_ENV: &str = "CB_PBS_ENDPOINT";
2724

@@ -95,7 +92,3 @@ pub const MODULE_ID_ENV: &str = "CB_MODULE_ID";
9592
pub const MODULE_JWT_ENV: &str = "CB_SIGNER_JWT";
9693
/// Where to send signature request
9794
pub const SIGNER_URL_ENV: &str = "CB_SIGNER_URL";
98-
99-
/// Events modules
100-
/// Where to receive builder events
101-
pub const BUILDER_PORT_ENV: &str = "CB_BUILDER_PORT";

crates/common/src/config/module.rs

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ use crate::{
1010
constants::{CONFIG_ENV, MODULE_ID_ENV, MODULE_JWT_ENV, SIGNER_URL_ENV},
1111
load_env_var,
1212
utils::load_file_from_env,
13-
BUILDER_PORT_ENV,
1413
},
1514
types::{Chain, Jwt, ModuleId},
1615
};
@@ -19,8 +18,6 @@ use crate::{
1918
pub enum ModuleKind {
2019
#[serde(alias = "commit")]
2120
Commit,
22-
#[serde(alias = "events")]
23-
Events,
2421
}
2522

2623
/// Static module config from config file
@@ -120,16 +117,13 @@ pub struct StartBuilderModuleConfig<T> {
120117
pub id: ModuleId,
121118
/// Chain spec
122119
pub chain: Chain,
123-
/// Where to listen for Builder events
124-
pub server_port: u16,
125120
/// Opaque module config
126121
pub extra: T,
127122
}
128123

129124
pub fn load_builder_module_config<T: DeserializeOwned>() -> eyre::Result<StartBuilderModuleConfig<T>>
130125
{
131126
let module_id = ModuleId(load_env_var(MODULE_ID_ENV)?);
132-
let builder_events_port: u16 = load_env_var(BUILDER_PORT_ENV)?.parse()?;
133127

134128
#[derive(Debug, Deserialize)]
135129
struct ThisModuleConfig<U> {
@@ -176,7 +170,6 @@ pub fn load_builder_module_config<T: DeserializeOwned>() -> eyre::Result<StartBu
176170
Ok(StartBuilderModuleConfig {
177171
id: module_config.static_config.id,
178172
chain: cb_config.chain,
179-
server_port: builder_events_port,
180173
extra: module_config.extra,
181174
})
182175
}

crates/common/src/config/pbs.rs

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,8 @@ use crate::{
2525
SIGNER_URL_ENV,
2626
},
2727
pbs::{
28-
BuilderEventPublisher, DefaultTimeout, RelayClient, RelayEntry, DEFAULT_PBS_PORT,
29-
LATE_IN_SLOT_TIME_MS, REGISTER_VALIDATOR_RETRY_LIMIT,
28+
DefaultTimeout, RelayClient, RelayEntry, DEFAULT_PBS_PORT, LATE_IN_SLOT_TIME_MS,
29+
REGISTER_VALIDATOR_RETRY_LIMIT,
3030
},
3131
types::{BlsPublicKey, Chain, Jwt, ModuleId},
3232
utils::{
@@ -213,8 +213,6 @@ pub struct PbsModuleConfig {
213213
pub all_relays: Vec<RelayClient>,
214214
/// Signer client to call Signer API
215215
pub signer_client: Option<SignerClient>,
216-
/// Event publisher
217-
pub event_publisher: Option<BuilderEventPublisher>,
218216
/// Muxes config
219217
pub muxes: Option<HashMap<BlsPublicKey, RuntimeMuxConfig>>,
220218
}
@@ -253,7 +251,6 @@ pub async fn load_pbs_config() -> Result<PbsModuleConfig> {
253251

254252
let relay_clients =
255253
config.relays.into_iter().map(RelayClient::new).collect::<Result<Vec<_>>>()?;
256-
let maybe_publiher = BuilderEventPublisher::new_from_env()?;
257254
let mut all_relays = HashMap::with_capacity(relay_clients.len());
258255

259256
if let Some(muxes) = &muxes {
@@ -281,7 +278,6 @@ pub async fn load_pbs_config() -> Result<PbsModuleConfig> {
281278
relays: relay_clients,
282279
all_relays,
283280
signer_client: None,
284-
event_publisher: maybe_publiher,
285281
muxes,
286282
})
287283
}
@@ -329,7 +325,6 @@ pub async fn load_pbs_custom_config<T: DeserializeOwned>() -> Result<(PbsModuleC
329325

330326
let relay_clients =
331327
cb_config.relays.into_iter().map(RelayClient::new).collect::<Result<Vec<_>>>()?;
332-
let maybe_publiher = BuilderEventPublisher::new_from_env()?;
333328
let mut all_relays = HashMap::with_capacity(relay_clients.len());
334329

335330
if let Some(muxes) = &muxes {
@@ -371,7 +366,6 @@ pub async fn load_pbs_custom_config<T: DeserializeOwned>() -> Result<(PbsModuleC
371366
relays: relay_clients,
372367
all_relays,
373368
signer_client,
374-
event_publisher: maybe_publiher,
375369
muxes,
376370
},
377371
cb_config.pbs.extra,

crates/common/src/pbs/constants.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ pub const HEADER_VERSION_VALUE: &str = COMMIT_BOOST_VERSION;
1818
pub const HEADER_START_TIME_UNIX_MS: &str = "Date-Milliseconds";
1919
pub const HEADER_TIMEOUT_MS: &str = "X-Timeout-Ms";
2020

21-
pub const BUILDER_EVENTS_PATH: &str = "/builder_events";
2221
pub const DEFAULT_PBS_JWT_KEY: &str = "DEFAULT_PBS";
2322

2423
pub const DEFAULT_PBS_PORT: u16 = 18550;

0 commit comments

Comments
 (0)