Skip to content

Commit f2a275b

Browse files
committed
Merge branch 'main' into sigp-audit-fixes
2 parents 52aec57 + 66ccc94 commit f2a275b

File tree

28 files changed

+222
-525
lines changed

28 files changed

+222
-525
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
signature::{
1413
verify_proposer_commitment_signature_bls, verify_proposer_commitment_signature_ecdsa,
1514
},

config.example.toml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -241,17 +241,16 @@ 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"
252251
# Unique hash that the Signer service will combine with the incoming data in signing requests to generate a signature specific to this module
253252
signing_id = "0x6a33a23ef26a4836979edff86c493a69b26ccf0b4a16491a815a13787657431b"
254-
# Type of the module. Supported values: commit, events
253+
# Type of the module. Supported values: commit
255254
type = "commit"
256255
# Docker image of the module
257256
docker_image = "test_da_commit"

crates/cli/src/docker_init.rs

Lines changed: 5 additions & 66 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,11 @@ use std::{
77
use cb_common::{
88
config::{
99
CommitBoostConfig, LogsSettings, ModuleKind, SignerConfig, SignerType, ADMIN_JWT_ENV,
10-
BUILDER_PORT_ENV, BUILDER_URLS_ENV, CHAIN_SPEC_ENV, CONFIG_DEFAULT, CONFIG_ENV,
11-
DIRK_CA_CERT_DEFAULT, DIRK_CA_CERT_ENV, DIRK_CERT_DEFAULT, DIRK_CERT_ENV,
12-
DIRK_DIR_SECRETS_DEFAULT, DIRK_DIR_SECRETS_ENV, DIRK_KEY_DEFAULT, DIRK_KEY_ENV, JWTS_ENV,
13-
LOGS_DIR_DEFAULT, LOGS_DIR_ENV, METRICS_PORT_ENV, MODULE_ID_ENV, MODULE_JWT_ENV,
14-
PBS_ENDPOINT_ENV, PBS_MODULE_NAME, PROXY_DIR_DEFAULT, PROXY_DIR_ENV,
15-
PROXY_DIR_KEYS_DEFAULT, PROXY_DIR_KEYS_ENV, PROXY_DIR_SECRETS_DEFAULT,
10+
CHAIN_SPEC_ENV, CONFIG_DEFAULT, CONFIG_ENV, DIRK_CA_CERT_DEFAULT, DIRK_CA_CERT_ENV,
11+
DIRK_CERT_DEFAULT, DIRK_CERT_ENV, DIRK_DIR_SECRETS_DEFAULT, DIRK_DIR_SECRETS_ENV,
12+
DIRK_KEY_DEFAULT, DIRK_KEY_ENV, JWTS_ENV, LOGS_DIR_DEFAULT, LOGS_DIR_ENV, METRICS_PORT_ENV,
13+
MODULE_ID_ENV, MODULE_JWT_ENV, PBS_ENDPOINT_ENV, PBS_MODULE_NAME, PROXY_DIR_DEFAULT,
14+
PROXY_DIR_ENV, PROXY_DIR_KEYS_DEFAULT, PROXY_DIR_KEYS_ENV, PROXY_DIR_SECRETS_DEFAULT,
1615
PROXY_DIR_SECRETS_ENV, SIGNER_DEFAULT, SIGNER_DIR_KEYS_DEFAULT, SIGNER_DIR_KEYS_ENV,
1716
SIGNER_DIR_SECRETS_DEFAULT, SIGNER_DIR_SECRETS_ENV, SIGNER_ENDPOINT_ENV, SIGNER_KEYS_ENV,
1817
SIGNER_MODULE_NAME, SIGNER_PORT_DEFAULT, SIGNER_URL_ENV,
@@ -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

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

crates/common/src/config/log.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,9 @@ use crate::utils::default_bool;
88

99
#[derive(Clone, Default, Debug, Deserialize, Serialize)]
1010
pub struct LogsSettings {
11+
#[serde(default)]
1112
pub stdout: StdoutLogSettings,
13+
#[serde(default)]
1214
pub file: FileLogSettings,
1315
}
1416

crates/common/src/config/module.rs

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ use crate::{
1111
constants::{CONFIG_ENV, MODULE_ID_ENV, MODULE_JWT_ENV, SIGNER_URL_ENV},
1212
load_env_var,
1313
utils::load_file_from_env,
14-
BUILDER_PORT_ENV,
1514
},
1615
types::{Chain, Jwt, ModuleId},
1716
};
@@ -20,8 +19,6 @@ use crate::{
2019
pub enum ModuleKind {
2120
#[serde(alias = "commit")]
2221
Commit,
23-
#[serde(alias = "events")]
24-
Events,
2522
}
2623

2724
/// Static module config from config file
@@ -123,16 +120,13 @@ pub struct StartBuilderModuleConfig<T> {
123120
pub id: ModuleId,
124121
/// Chain spec
125122
pub chain: Chain,
126-
/// Where to listen for Builder events
127-
pub server_port: u16,
128123
/// Opaque module config
129124
pub extra: T,
130125
}
131126

132127
pub fn load_builder_module_config<T: DeserializeOwned>() -> eyre::Result<StartBuilderModuleConfig<T>>
133128
{
134129
let module_id = ModuleId(load_env_var(MODULE_ID_ENV)?);
135-
let builder_events_port: u16 = load_env_var(BUILDER_PORT_ENV)?.parse()?;
136130

137131
#[derive(Debug, Deserialize)]
138132
struct ThisModuleConfig<U> {
@@ -179,7 +173,6 @@ pub fn load_builder_module_config<T: DeserializeOwned>() -> eyre::Result<StartBu
179173
Ok(StartBuilderModuleConfig {
180174
id: module_config.static_config.id,
181175
chain: cb_config.chain,
182-
server_port: builder_events_port,
183176
extra: module_config.extra,
184177
})
185178
}

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::{
@@ -214,8 +214,6 @@ pub struct PbsModuleConfig {
214214
pub all_relays: Vec<RelayClient>,
215215
/// Signer client to call Signer API
216216
pub signer_client: Option<SignerClient>,
217-
/// Event publisher
218-
pub event_publisher: Option<BuilderEventPublisher>,
219217
/// Muxes config
220218
pub muxes: Option<HashMap<BlsPublicKey, RuntimeMuxConfig>>,
221219
}
@@ -254,7 +252,6 @@ pub async fn load_pbs_config() -> Result<PbsModuleConfig> {
254252

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

260257
if let Some(muxes) = &muxes {
@@ -282,7 +279,6 @@ pub async fn load_pbs_config() -> Result<PbsModuleConfig> {
282279
relays: relay_clients,
283280
all_relays,
284281
signer_client: None,
285-
event_publisher: maybe_publiher,
286282
muxes,
287283
})
288284
}
@@ -330,7 +326,6 @@ pub async fn load_pbs_custom_config<T: DeserializeOwned>() -> Result<(PbsModuleC
330326

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

336331
if let Some(muxes) = &muxes {
@@ -372,7 +367,6 @@ pub async fn load_pbs_custom_config<T: DeserializeOwned>() -> Result<(PbsModuleC
372367
relays: relay_clients,
373368
all_relays,
374369
signer_client,
375-
event_publisher: maybe_publiher,
376370
muxes,
377371
},
378372
cb_config.pbs.extra,

crates/common/src/pbs/constants.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@ pub const RELOAD_PATH: &str = "/reload";
1616
pub const HEADER_VERSION_KEY: &str = "X-CommitBoost-Version";
1717
pub const HEADER_VERSION_VALUE: &str = COMMIT_BOOST_VERSION;
1818
pub const HEADER_START_TIME_UNIX_MS: &str = "Date-Milliseconds";
19+
pub const HEADER_TIMEOUT_MS: &str = "X-Timeout-Ms";
1920

20-
pub const BUILDER_EVENTS_PATH: &str = "/builder_events";
2121
pub const DEFAULT_PBS_JWT_KEY: &str = "DEFAULT_PBS";
2222

2323
pub const DEFAULT_PBS_PORT: u16 = 18550;

0 commit comments

Comments
 (0)