Skip to content

Commit 6e14ec4

Browse files
committed
remove optional signer client from PbsModuleConfig as signer should only be used if modules are present
1 parent 0325702 commit 6e14ec4

11 files changed

Lines changed: 14 additions & 75 deletions

File tree

crates/cli/src/docker_init.rs

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1520,11 +1520,10 @@ mod tests {
15201520
config
15211521
}
15221522

1523-
/// Returns a `ServiceCreationInfo` whose CB config has `pbs.with_signer =
1524-
/// true` and a local signer with `TlsMode::Certificate(certs_path)`.
1523+
/// Returns a `ServiceCreationInfo` whose CB config has a local signer with
1524+
/// `TlsMode::Certificate(certs_path)`.
15251525
fn service_config_with_tls(certs_path: PathBuf) -> ServiceCreationInfo {
15261526
let mut sc = minimal_service_config();
1527-
sc.config_info.cb_config.pbs.with_signer = true;
15281527
sc.config_info.cb_config.signer = Some(local_signer_config_with_tls(certs_path));
15291528
sc
15301529
}
@@ -1620,12 +1619,15 @@ mod tests {
16201619
// -------------------------------------------------------------------------
16211620

16221621
#[test]
1623-
fn test_create_pbs_service_with_tls_adds_cert_env_and_volume() -> eyre::Result<()> {
1622+
fn test_create_pbs_service_with_tls_but_no_commit_module_no_cert() -> eyre::Result<()> {
1623+
// PBS no longer connects to the signer directly; only commit modules do.
1624+
// Even when the signer is configured with TLS, the cert env/volume must
1625+
// NOT be injected into the PBS container unless a Commit module is present.
16241626
let mut sc = service_config_with_tls(PathBuf::from("/my/certs"));
16251627
let service = create_pbs_service(&mut sc)?;
16261628

1627-
assert!(has_env_key(&service, SIGNER_TLS_CERTIFICATES_PATH_ENV));
1628-
assert!(has_volume(&service, SIGNER_TLS_CERTIFICATE_NAME));
1629+
assert!(!has_env_key(&service, SIGNER_TLS_CERTIFICATES_PATH_ENV));
1630+
assert!(!has_volume(&service, SIGNER_TLS_CERTIFICATE_NAME));
16291631
Ok(())
16301632
}
16311633

crates/common/src/config/mod.rs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -131,10 +131,9 @@ impl CommitBoostConfig {
131131

132132
/// Helper to return if the signer module is needed based on the config
133133
pub fn needs_signer_module(&self) -> bool {
134-
self.pbs.with_signer ||
135-
self.modules.as_ref().is_some_and(|modules| {
136-
modules.iter().any(|module| matches!(module.kind, ModuleKind::Commit))
137-
})
134+
self.modules.as_ref().is_some_and(|modules| {
135+
modules.iter().any(|module| matches!(module.kind, ModuleKind::Commit))
136+
})
138137
}
139138

140139
pub fn signer_uses_tls(&self) -> bool {

crates/common/src/config/pbs.rs

Lines changed: 2 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -21,17 +21,12 @@ use super::{
2121
load_optional_env_var,
2222
};
2323
use crate::{
24-
commit::client::SignerClient,
25-
config::{
26-
CONFIG_ENV, MODULE_JWT_ENV, MuxKeysLoader, PBS_IMAGE_DEFAULT, PBS_SERVICE_NAME, PbsMuxes,
27-
SIGNER_TLS_CERTIFICATE_NAME, SIGNER_TLS_CERTIFICATES_PATH_ENV, SIGNER_URL_ENV,
28-
SignerConfig, TlsMode, load_env_var, load_file_from_env,
29-
},
24+
config::{CONFIG_ENV, MuxKeysLoader, PBS_IMAGE_DEFAULT, PbsMuxes, load_file_from_env},
3025
pbs::{
3126
DEFAULT_PBS_PORT, DEFAULT_REGISTRY_REFRESH_SECONDS, DefaultTimeout, LATE_IN_SLOT_TIME_MS,
3227
REGISTER_VALIDATOR_RETRY_LIMIT, RelayClient, RelayEntry,
3328
},
34-
types::{BlsPublicKey, Chain, Jwt, ModuleId},
29+
types::{BlsPublicKey, Chain},
3530
utils::{
3631
WEI_PER_ETH, as_eth_str, default_bool, default_host, default_u16, default_u32, default_u64,
3732
default_u256,
@@ -244,9 +239,6 @@ pub struct StaticPbsConfig {
244239
/// Config of pbs module
245240
#[serde(flatten)]
246241
pub pbs_config: PbsConfig,
247-
/// Whether to enable the signer client
248-
#[serde(default = "default_bool::<false>")]
249-
pub with_signer: bool,
250242
}
251243

252244
impl StaticPbsConfig {
@@ -279,8 +271,6 @@ pub struct PbsModuleConfig {
279271
/// URL) DO NOT use this for get_header calls, use `relays` or `mux_lookup`
280272
/// instead
281273
pub all_relays: Vec<RelayClient>,
282-
/// Signer client to call Signer API
283-
pub signer_client: Option<SignerClient>,
284274
/// List of raw mux details configured, if any
285275
pub registry_muxes: Option<HashMap<MuxKeysLoader, RuntimeMuxConfig>>,
286276
/// Lookup of pubkey to mux config
@@ -355,7 +345,6 @@ pub async fn load_pbs_config(config_path: Option<PathBuf>) -> Result<(PbsModuleC
355345
pbs_config: Arc::new(config.pbs.pbs_config),
356346
relays: relay_clients,
357347
all_relays,
358-
signer_client: None,
359348
registry_muxes,
360349
mux_lookup,
361350
},
@@ -378,7 +367,6 @@ pub async fn load_pbs_custom_config<T: DeserializeOwned>() -> Result<(PbsModuleC
378367
chain: Chain,
379368
relays: Vec<RelayConfig>,
380369
pbs: CustomPbsConfig<U>,
381-
signer: Option<SignerConfig>,
382370
muxes: Option<PbsMuxes>,
383371
}
384372

@@ -431,41 +419,13 @@ pub async fn load_pbs_custom_config<T: DeserializeOwned>() -> Result<(PbsModuleC
431419

432420
let all_relays = all_relays.into_values().collect();
433421

434-
let signer_client = if cb_config.pbs.static_config.with_signer {
435-
// if custom pbs requires a signer client, load jwt
436-
let module_jwt = Jwt(load_env_var(MODULE_JWT_ENV)?);
437-
let signer_server_url = load_env_var(SIGNER_URL_ENV)?.parse()?;
438-
let certs_path = match cb_config
439-
.signer
440-
.ok_or_else(|| eyre::eyre!("with_signer = true but no [signer] section in config"))?
441-
.tls_mode
442-
{
443-
TlsMode::Insecure => None,
444-
TlsMode::Certificate(path) => Some(
445-
load_env_var(SIGNER_TLS_CERTIFICATES_PATH_ENV)
446-
.map(PathBuf::from)
447-
.unwrap_or(path)
448-
.join(SIGNER_TLS_CERTIFICATE_NAME),
449-
),
450-
};
451-
Some(SignerClient::new(
452-
signer_server_url,
453-
certs_path,
454-
module_jwt,
455-
ModuleId(PBS_SERVICE_NAME.to_string()),
456-
)?)
457-
} else {
458-
None
459-
};
460-
461422
Ok((
462423
PbsModuleConfig {
463424
chain: cb_config.chain,
464425
endpoint,
465426
pbs_config: Arc::new(cb_config.pbs.static_config.pbs_config),
466427
relays: relay_clients,
467428
all_relays,
468-
signer_client,
469429
registry_muxes,
470430
mux_lookup,
471431
},

crates/common/src/config/signer.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -485,7 +485,6 @@ mod tests {
485485
ssv_node_api_url: Url::parse("https://example.net").unwrap(),
486486
ssv_public_api_url: Url::parse("https://example.net").unwrap(),
487487
},
488-
with_signer: true,
489488
},
490489
muxes: None,
491490
modules: Some(vec![]),

docs/docs/get_started/building.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,6 @@ chain = "Hoodi"
108108

109109
[pbs]
110110
port = 18550
111-
with_signer = true
112111

113112
[[relays]]
114113
url = "https://0xafa4c6985aa049fb79dd37010438cfebeb0f2bd42b115b89dd678dab0670c1de38da0c4e9138c9290a398ecd9a0b3110@boost-relay-hoodi.flashbots.net"

docs/docs/get_started/configuration.md

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -63,8 +63,6 @@ To start a local Signer Service, you need to include its parameters in the confi
6363
```toml
6464
[pbs]
6565
...
66-
with_signer = true
67-
6866
[signer]
6967
port = 20000
7068

@@ -97,8 +95,6 @@ We currently support Lighthouse, Prysm, Teku, Lodestar, and Nimbus's keystores s
9795
```toml
9896
[pbs]
9997
...
100-
with_signer = true
101-
10298
[signer]
10399
port = 20000
104100

@@ -129,8 +125,6 @@ secrets_path = "secrets"
129125
```toml
130126
[pbs]
131127
...
132-
with_signer = true
133-
134128
[signer]
135129
port = 20000
136130

@@ -161,8 +155,6 @@ secrets_path = "secrets/password.txt"
161155
```toml
162156
[pbs]
163157
...
164-
with_signer = true
165-
166158
[signer]
167159
port = 20000
168160

@@ -192,8 +184,6 @@ secrets_path = "secrets"
192184
```toml
193185
[pbs]
194186
...
195-
with_signer = true
196-
197187
[signer]
198188
port = 20000
199189

@@ -228,8 +218,6 @@ All keys have the same password stored in `secrets/password.txt`
228218
```toml
229219
[pbs]
230220
...
231-
with_signer = true
232-
233221
[signer]
234222
port = 20000
235223

@@ -397,8 +385,6 @@ Specifying it is done within Commit-Boost's configuration file using the `[signe
397385
```toml
398386
[pbs]
399387
...
400-
with_signer = true
401-
402388
[signer]
403389
port = 20000
404390
...

tests/data/configs/pbs.happy.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ timeout_get_header_ms = 950
1414
timeout_get_payload_ms = 4000
1515
timeout_register_validator_ms = 3000
1616
wait_all_registrations = true
17-
with_signer = false
1817

1918

2019
[[relays]]

tests/data/configs/signer.happy.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ chain = "Hoodi"
22

33
[pbs]
44
docker_image = "ghcr.io/commit-boost/pbs:latest"
5-
with_signer = true
65
host = "127.0.0.1"
76
port = 18550
87
relay_check = true

tests/src/utils.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ pub fn get_pbs_config(port: u16) -> PbsConfig {
107107
}
108108

109109
pub fn get_pbs_static_config(pbs_config: PbsConfig) -> StaticPbsConfig {
110-
StaticPbsConfig { docker_image: String::from(""), pbs_config, with_signer: true }
110+
StaticPbsConfig { docker_image: String::from(""), pbs_config }
111111
}
112112

113113
pub fn get_commit_boost_config(pbs_static_config: StaticPbsConfig) -> CommitBoostConfig {
@@ -132,7 +132,6 @@ pub fn to_pbs_config(
132132
chain,
133133
endpoint: SocketAddr::new(pbs_config.host.into(), pbs_config.port),
134134
pbs_config: Arc::new(pbs_config),
135-
signer_client: None,
136135
all_relays: relays.clone(),
137136
relays,
138137
registry_muxes: None,

tests/tests/config.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,6 @@ async fn test_load_pbs_happy() -> Result<()> {
4141

4242
// Docker and general settings
4343
assert_eq!(config.pbs.docker_image, "ghcr.io/commit-boost/pbs:latest");
44-
assert!(!config.pbs.with_signer);
4544
assert_eq!(config.pbs.pbs_config.host, "127.0.0.1".parse::<Ipv4Addr>().unwrap());
4645
assert_eq!(config.pbs.pbs_config.port, 18550);
4746
assert!(config.pbs.pbs_config.relay_check);

0 commit comments

Comments
 (0)