Skip to content

Commit ef64d9d

Browse files
committed
Removed the Option from the SSV API URL
1 parent d7e4ae8 commit ef64d9d

File tree

4 files changed

+7
-10
lines changed

4 files changed

+7
-10
lines changed

crates/common/src/config/mux.rs

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,7 @@ impl MuxKeysLoader {
211211
&self,
212212
mux_id: &str,
213213
chain: Chain,
214-
ssv_api_url: Option<Url>,
214+
ssv_api_url: Url,
215215
rpc_url: Option<Url>,
216216
http_timeout: Duration,
217217
) -> eyre::Result<Vec<BlsPublicKey>> {
@@ -254,10 +254,6 @@ impl MuxKeysLoader {
254254
.await
255255
}
256256
NORegistry::SSV => {
257-
let Some(ssv_api_url) = ssv_api_url else {
258-
bail!("SSV registry requires SSV API URL to be set in the PBS config");
259-
};
260-
261257
fetch_ssv_pubkeys(
262258
ssv_api_url,
263259
chain,

crates/common/src/config/pbs.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ pub struct PbsConfig {
125125
pub rpc_url: Option<Url>,
126126
/// URL for the SSV network API
127127
#[serde(default = "default_ssv_api_url")]
128-
pub ssv_api_url: Option<Url>,
128+
pub ssv_api_url: Url,
129129
/// Timeout for HTTP requests in seconds
130130
#[serde(default = "default_u64::<HTTP_TIMEOUT_SECONDS_DEFAULT>")]
131131
pub http_timeout_seconds: u64,
@@ -398,6 +398,6 @@ pub async fn load_pbs_custom_config<T: DeserializeOwned>() -> Result<(PbsModuleC
398398
}
399399

400400
/// Default URL for the SSV network API
401-
fn default_ssv_api_url() -> Option<Url> {
402-
Some(Url::parse("https://api.ssv.network/api/v4").expect("default URL is valid"))
401+
fn default_ssv_api_url() -> Url {
402+
Url::parse("https://api.ssv.network/api/v4").expect("default URL is valid")
403403
}

tests/src/utils.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ use cb_common::{
1717
utils::{bls_pubkey_from_hex, default_host},
1818
};
1919
use eyre::Result;
20+
use url::Url;
2021

2122
pub fn get_local_address(port: u16) -> String {
2223
format!("http://0.0.0.0:{port}")
@@ -78,7 +79,7 @@ pub fn get_pbs_static_config(port: u16) -> PbsConfig {
7879
min_bid_wei: U256::ZERO,
7980
late_in_slot_time_ms: u64::MAX,
8081
extra_validation_enabled: false,
81-
ssv_api_url: None,
82+
ssv_api_url: Url::parse("https://example.net").unwrap(),
8283
rpc_url: None,
8384
http_timeout_seconds: 10,
8485
register_validator_retry_limit: u32::MAX,

tests/tests/pbs_mux_refresh.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ async fn test_auto_refresh() -> Result<()> {
8686

8787
// Set up the PBS config
8888
let mut pbs_config = get_pbs_static_config(pbs_port);
89-
pbs_config.ssv_api_url = Some(ssv_api_url.clone());
89+
pbs_config.ssv_api_url = ssv_api_url.clone();
9090
pbs_config.mux_registry_refresh_interval_seconds = 1; // Refresh the mux every second
9191
let (mux_lookup, registry_muxes) = muxes.validate_and_fill(chain, &pbs_config).await?;
9292
let relays = vec![default_relay.clone()]; // Default relay only

0 commit comments

Comments
 (0)