Skip to content

Commit 95ff459

Browse files
committed
remove builder events modules
1 parent bbb260b commit 95ff459

26 files changed

Lines changed: 227 additions & 541 deletions

File tree

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: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ 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::{BlsPublicKey, BlsSignature, BuilderEvent, BuilderEventClient, OnBuilderApiEvent},
12+
pbs::{BlsPublicKey, BlsSignature},
1313
signer::EcdsaSignature,
1414
types::Chain,
1515
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
@@ -239,15 +239,14 @@ proxy_dir = "./proxies"
239239
# secrets_path = "./tests/data/proxy/secrets"
240240

241241
# Commit-Boost can optionally run "modules" which extend the capabilities of the sidecar.
242-
# Currently, two types of modules are supported:
242+
# Currently, one type of module is currently supported:
243243
# - "commit": modules which request commitment signatures from the validator keys
244-
# - "events": modules which callback to BuilderAPI events as triggered from the PBS modules, used e.g. for monitoring
245244
# If any "commit" module is present, then the [signer] section should also be configured
246245
# OPTIONAL
247246
[[modules]]
248247
# Unique ID of the module
249248
id = "DA_COMMIT"
250-
# Type of the module. Supported values: commit, events
249+
# Type of the module. Supported values: commit
251250
type = "commit"
252251
# Docker image of the module
253252
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_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_URL_ENV,
1918
},
2019
pbs::{BUILDER_API_PATH, GET_STATUS_PATH},
2120
signer::{ProxyStore, SignerLoader, DEFAULT_SIGNER_PORT},
@@ -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

@@ -90,7 +87,3 @@ pub const MODULE_ID_ENV: &str = "CB_MODULE_ID";
9087
pub const MODULE_JWT_ENV: &str = "CB_SIGNER_JWT";
9188
/// Where to send signature request
9289
pub const SIGNER_URL_ENV: &str = "CB_SIGNER_URL";
93-
94-
/// Events modules
95-
/// Where to receive builder events
96-
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-
BlsPublicKey, BuilderEventPublisher, DefaultTimeout, RelayClient, RelayEntry,
29-
DEFAULT_PBS_PORT, LATE_IN_SLOT_TIME_MS, REGISTER_VALIDATOR_RETRY_LIMIT,
28+
BlsPublicKey, DefaultTimeout, RelayClient, RelayEntry, DEFAULT_PBS_PORT,
29+
LATE_IN_SLOT_TIME_MS, REGISTER_VALIDATOR_RETRY_LIMIT,
3030
},
3131
types::{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
}
@@ -245,7 +243,6 @@ pub async fn load_pbs_config() -> Result<PbsModuleConfig> {
245243

246244
let relay_clients =
247245
config.relays.into_iter().map(RelayClient::new).collect::<Result<Vec<_>>>()?;
248-
let maybe_publiher = BuilderEventPublisher::new_from_env()?;
249246
let mut all_relays = HashMap::with_capacity(relay_clients.len());
250247

251248
if let Some(muxes) = &muxes {
@@ -273,7 +270,6 @@ pub async fn load_pbs_config() -> Result<PbsModuleConfig> {
273270
relays: relay_clients,
274271
all_relays,
275272
signer_client: None,
276-
event_publisher: maybe_publiher,
277273
muxes,
278274
})
279275
}
@@ -321,7 +317,6 @@ pub async fn load_pbs_custom_config<T: DeserializeOwned>() -> Result<(PbsModuleC
321317

322318
let relay_clients =
323319
cb_config.relays.into_iter().map(RelayClient::new).collect::<Result<Vec<_>>>()?;
324-
let maybe_publiher = BuilderEventPublisher::new_from_env()?;
325320
let mut all_relays = HashMap::with_capacity(relay_clients.len());
326321

327322
if let Some(muxes) = &muxes {
@@ -363,7 +358,6 @@ pub async fn load_pbs_custom_config<T: DeserializeOwned>() -> Result<(PbsModuleC
363358
relays: relay_clients,
364359
all_relays,
365360
signer_client,
366-
event_publisher: maybe_publiher,
367361
muxes,
368362
},
369363
cb_config.pbs.extra,

crates/common/src/pbs/constants.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ pub const HEADER_VERSION_KEY: &str = "X-CommitBoost-Version";
1616
pub const HEADER_VERSION_VALUE: &str = COMMIT_BOOST_VERSION;
1717
pub const HEADER_START_TIME_UNIX_MS: &str = "Date-Milliseconds";
1818

19-
pub const BUILDER_EVENTS_PATH: &str = "/builder_events";
2019
pub const DEFAULT_PBS_JWT_KEY: &str = "DEFAULT_PBS";
2120

2221
pub const DEFAULT_PBS_PORT: u16 = 18550;

0 commit comments

Comments
 (0)