You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
let pubkey = BlsPublicKey::deserialize(&hex!("0xac6e77dfe25ecd6110b8e780608cce0dab71fdd5ebea22a16c0205200f2f8e2e3ad3b71d3499c54ad14d6c21b41a37ae")).unwrap();
138
+
let pubkey = bls_pubkey_from_hex_unchecked("0xac6e77dfe25ecd6110b8e780608cce0dab71fdd5ebea22a16c0205200f2f8e2e3ad3b71d3499c54ad14d6c21b41a37ae");
139
139
let s = format!("http://{pubkey}@abc.xyz/");
140
140
141
141
let parsed = serde_json::from_str::<RelayEntry>(&format!("\"{s}\"")).unwrap();
@@ -149,7 +149,7 @@ mod tests {
149
149
fntest_relay_url(){
150
150
let slot = 0;
151
151
let parent_hash = B256::ZERO;
152
-
let validator_pubkey = BlsPublicKey::deserialize(&hex!("0xac6e77dfe25ecd6110b8e780608cce0dab71fdd5ebea22a16c0205200f2f8e2e3ad3b71d3499c54ad14d6c21b41a37ae")).unwrap();
152
+
let validator_pubkey = bls_pubkey_from_hex_unchecked("0xac6e77dfe25ecd6110b8e780608cce0dab71fdd5ebea22a16c0205200f2f8e2e3ad3b71d3499c54ad14d6c21b41a37ae");
153
153
let expected = format!("http://0xa1cec75a3f0661e99299274182938151e8433c61a19222347ea1313d839229cb4ce4e3e5aa2bdeb71c8fcf1b084963c2@abc.xyz/eth/v1/builder/header/{slot}/{parent_hash}/{validator_pubkey}");
154
154
155
155
let relay_config = r#"
@@ -183,7 +183,7 @@ mod tests {
183
183
fntest_relay_url_with_get_params(){
184
184
let slot = 0;
185
185
let parent_hash = B256::ZERO;
186
-
let validator_pubkey = BlsPublicKey::deserialize(&hex!("0xac6e77dfe25ecd6110b8e780608cce0dab71fdd5ebea22a16c0205200f2f8e2e3ad3b71d3499c54ad14d6c21b41a37ae")).unwrap();
186
+
let validator_pubkey = bls_pubkey_from_hex_unchecked("0xac6e77dfe25ecd6110b8e780608cce0dab71fdd5ebea22a16c0205200f2f8e2e3ad3b71d3499c54ad14d6c21b41a37ae");
187
187
// Note: HashMap iteration order is not guaranteed, so we can't predict the
188
188
// exact order of parameters Instead of hard-coding the order, we'll
189
189
// check that both parameters are present in the URL
Copy file name to clipboardExpand all lines: tests/src/mock_validator.rs
+4-3Lines changed: 4 additions & 3 deletions
Original file line number
Diff line number
Diff line change
@@ -1,7 +1,8 @@
1
-
use alloy::{hex,primitives::B256, rpc::types::beacon::relay::ValidatorRegistration};
1
+
use alloy::{primitives::B256, rpc::types::beacon::relay::ValidatorRegistration};
2
2
use cb_common::{
3
3
pbs::{RelayClient,SignedBlindedBeaconBlock},
4
4
types::BlsPublicKey,
5
+
utils::bls_pubkey_from_hex,
5
6
};
6
7
use reqwest::Response;
7
8
@@ -13,12 +14,12 @@ pub struct MockValidator {
13
14
14
15
implMockValidator{
15
16
pubfnnew(port:u16) -> eyre::Result<Self>{
16
-
let pubkey = BlsPublicKey::deserialize(&hex!("0xac6e77dfe25ecd6110b8e780608cce0dab71fdd5ebea22a16c0205200f2f8e2e3ad3b71d3499c54ad14d6c21b41a37ae")).unwrap();
17
+
let pubkey = bls_pubkey_from_hex("0xac6e77dfe25ecd6110b8e780608cce0dab71fdd5ebea22a16c0205200f2f8e2e3ad3b71d3499c54ad14d6c21b41a37ae")?;
let default_pubkey = BlsPublicKey::deserialize(&hex!("0xac6e77dfe25ecd6110b8e780608cce0dab71fdd5ebea22a16c0205200f2f8e2e3ad3b71d3499c54ad14d6c21b41a37ae")).unwrap();
22
+
let default_pubkey = bls_pubkey_from_hex("0xac6e77dfe25ecd6110b8e780608cce0dab71fdd5ebea22a16c0205200f2f8e2e3ad3b71d3499c54ad14d6c21b41a37ae")?;
0 commit comments