Skip to content

Commit f984dae

Browse files
JasonVranekPedroCM96
authored andcommitted
reformat and fix broken tests
1 parent 5304f6c commit f984dae

4 files changed

Lines changed: 26 additions & 30 deletions

File tree

crates/common/src/config/mux.rs

Lines changed: 12 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,11 @@ use tracing::{debug, info, warn};
1919
use url::Url;
2020

2121
use super::{MUX_PATH_ENV, PbsConfig, RelayConfig, load_optional_env_var};
22-
use crate::types::StaderPool;
2322
use crate::{
2423
config::{remove_duplicate_keys, safe_read_http_response},
2524
interop::{lido::utils::*, ssv::utils::*, stader::utils::*},
2625
pbs::RelayClient,
27-
types::{BlsPublicKey, Chain},
26+
types::{BlsPublicKey, Chain, StaderPool},
2827
utils::default_bool,
2928
};
3029

@@ -157,7 +156,7 @@ pub struct MuxConfig {
157156

158157
impl MuxConfig {
159158
/// Returns the env, actual path, and internal path to use for the file
160-
/// loader. In File mode, validates the mux file prior to returning.
159+
/// loader. In File mode, validates the mux file prior to returning.
161160
pub fn loader_env(&self) -> eyre::Result<Option<(String, String, String)>> {
162161
let Some(loader) = self.loader.as_ref() else {
163162
return Ok(None);
@@ -260,29 +259,19 @@ impl MuxKeysLoader {
260259
bail!("Lido registry requires RPC URL to be set in the PBS config");
261260
};
262261

263-
fetch_lido_registry_keys(
264-
rpc_url,
265-
chain,
266-
U256::from(*node_operator_id),
267-
lido_module_id.unwrap_or(1),
268-
http_timeout,
269-
)
270-
.await
271-
}
272-
NORegistry::SSV => {
273-
fetch_ssv_pubkeys(
274-
ssv_node_api_url,
275-
ssv_public_api_url,
276-
chain,
277-
U256::from(*node_operator_id),
278-
http_timeout,
279-
)
280-
.await
281-
}
262+
fetch_lido_registry_keys(
263+
rpc_url,
264+
chain,
265+
U256::from(*node_operator_id),
266+
lido_module_id.unwrap_or(1),
267+
http_timeout,
268+
)
269+
.await
282270
}
283271
NORegistry::SSV => {
284272
fetch_ssv_pubkeys(
285-
ssv_api_url,
273+
ssv_node_api_url,
274+
ssv_public_api_url,
286275
chain,
287276
U256::from(*node_operator_id),
288277
http_timeout,

crates/common/src/interop/stader/utils.rs

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,17 @@
11
use std::collections::HashMap;
22

3-
use crate::interop::stader::types::StaderRegistry;
4-
use crate::types::{Chain, StaderPool};
5-
use alloy::primitives::{Address, Bytes, U256, address};
6-
use alloy::rpc::types::beacon::constants::BLS_PUBLIC_KEY_BYTES_LEN;
3+
use alloy::{
4+
primitives::{Address, Bytes, U256, address},
5+
rpc::types::beacon::constants::BLS_PUBLIC_KEY_BYTES_LEN,
6+
};
77
use eyre::ensure;
88
use lazy_static::lazy_static;
99

10+
use crate::{
11+
interop::stader::types::StaderRegistry,
12+
types::{Chain, StaderPool},
13+
};
14+
1015
const REGISTRY_CALL_BATCH_SIZE: u64 = 250u64;
1116

1217
lazy_static! {

tests/tests/pbs_mux.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -320,6 +320,7 @@ async fn test_ssv_multi_with_node() -> Result<()> {
320320
node_operator_id: 1,
321321
lido_module_id: None,
322322
registry: cb_common::config::NORegistry::SSV,
323+
stader_pool: None,
323324
};
324325
let muxes = PbsMuxes {
325326
muxes: vec![MuxConfig {
@@ -358,7 +359,7 @@ async fn test_ssv_multi_with_node() -> Result<()> {
358359
info!("Sending get header");
359360
let res = mock_validator.do_get_header(Some(pubkey2.clone())).await?;
360361
assert_eq!(res.status(), StatusCode::OK);
361-
assert_eq!(relay_state.received_get_header(), 1); // pubkey2 was loaded from the SSV node
362+
assert_eq!(relay_state.received_get_header(), 1); // pubkey2 was loaded from the SSV node
362363

363364
// Shut down the server handles
364365
pbs_server.abort();
@@ -416,6 +417,7 @@ async fn test_ssv_multi_with_public() -> Result<()> {
416417
node_operator_id: 1,
417418
lido_module_id: None,
418419
registry: cb_common::config::NORegistry::SSV,
420+
stader_pool: None,
419421
};
420422
let muxes = PbsMuxes {
421423
muxes: vec![MuxConfig {
@@ -454,7 +456,7 @@ async fn test_ssv_multi_with_public() -> Result<()> {
454456
info!("Sending get header");
455457
let res = mock_validator.do_get_header(Some(pubkey2.clone())).await?;
456458
assert_eq!(res.status(), StatusCode::OK);
457-
assert_eq!(relay_state.received_get_header(), 1); // pubkey2 was loaded from the SSV public API
459+
assert_eq!(relay_state.received_get_header(), 1); // pubkey2 was loaded from the SSV public API
458460

459461
// Shut down the server handles
460462
pbs_server.abort();

tests/tests/pbs_mux_refresh.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ async fn test_auto_refresh() -> Result<()> {
7474
node_operator_id: 1,
7575
lido_module_id: None,
7676
registry: cb_common::config::NORegistry::SSV,
77-
stader_pool: None
77+
stader_pool: None,
7878
};
7979
let muxes = PbsMuxes {
8080
muxes: vec![MuxConfig {

0 commit comments

Comments
 (0)