Skip to content

Commit 01fb66f

Browse files
committed
fix: remove uneeded to_hex_string code
1 parent a3b4b6f commit 01fb66f

File tree

8 files changed

+15
-19
lines changed

8 files changed

+15
-19
lines changed

adapter/src/dummy.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ impl Adapter for DummyAdapter {
4242
let signature = format!(
4343
"Dummy adapter signature for {} by {}",
4444
state_root,
45-
self.whoami().to_hex_prefix_string()
45+
self.whoami().to_string()
4646
);
4747
Ok(signature)
4848
}
@@ -56,7 +56,7 @@ impl Adapter for DummyAdapter {
5656
// select the `identity` and compare it to the signer
5757
// for empty string this will return array with 1 element - an empty string `[""]`
5858
let is_same = match signature.rsplit(' ').take(1).next() {
59-
Some(from) => from == signer.to_hex_prefix_string(),
59+
Some(from) => from == signer.to_string(),
6060
None => false,
6161
};
6262

adapter/src/ethereum.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -411,7 +411,7 @@ mod test {
411411
let mut eth_adapter = setup_eth_adapter();
412412
let whoami = eth_adapter.whoami();
413413
assert_eq!(
414-
whoami.to_hex_prefix_string(),
414+
whoami.to_string(),
415415
"0x2bdeafae53940669daa6f519373f686c1f3d3393",
416416
"failed to get correct whoami"
417417
);

primitives/src/validator.rs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,6 @@ pub type ValidatorFuture<T> = Pin<Box<dyn Future<Output = Result<T, ValidatorErr
2424
pub struct ValidatorId(#[serde(with = "SerHex::<StrictPfx>")] [u8; 20]);
2525

2626
impl ValidatorId {
27-
pub fn to_hex_prefix_string(&self) -> String {
28-
format!("0x{}", hex::encode(self.0))
29-
}
30-
3127
pub fn inner(&self) -> [u8; 20] {
3228
self.0
3329
}

validator_worker/src/core/fees.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -209,9 +209,9 @@ mod test {
209209
let expected_balances: BalancesMap = vec![
210210
("a".to_string(), 990.into()),
211211
("b".to_string(), 1_188.into()),
212-
(IDS.get("leader").unwrap().to_hex_prefix_string(), 11.into()),
212+
(IDS.get("leader").unwrap().to_string(), 11.into()),
213213
(
214-
IDS.get("follower").unwrap().to_hex_prefix_string(),
214+
IDS.get("follower").unwrap().to_string(),
215215
11.into(),
216216
),
217217
]
@@ -237,7 +237,7 @@ mod test {
237237
("a".to_string(), 100.into()),
238238
("b".to_string(), 2_000.into()),
239239
(
240-
IDS.get("leader").unwrap().to_hex_prefix_string(),
240+
IDS.get("leader").unwrap().to_string(),
241241
200.into(),
242242
),
243243
]
@@ -248,11 +248,11 @@ mod test {
248248
("a".to_string(), 99.into()),
249249
("b".to_string(), 1_980.into()),
250250
(
251-
IDS.get("leader").unwrap().to_hex_prefix_string(),
251+
IDS.get("leader").unwrap().to_string(),
252252
209.into(),
253253
),
254254
(
255-
IDS.get("follower").unwrap().to_hex_prefix_string(),
255+
IDS.get("follower").unwrap().to_string(),
256256
11.into(),
257257
),
258258
]
@@ -291,9 +291,9 @@ mod test {
291291
("c".to_string(), 693.into()),
292292
("d".to_string(), 4_950.into()),
293293
("e".to_string(), 3_960.into()),
294-
(IDS.get("leader").unwrap().to_hex_prefix_string(), 51.into()),
294+
(IDS.get("leader").unwrap().to_string(), 51.into()),
295295
(
296-
IDS.get("follower").unwrap().to_hex_prefix_string(),
296+
IDS.get("follower").unwrap().to_string(),
297297
50.into(),
298298
),
299299
]

validator_worker/src/follower.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ enum NewStateResult {
2424
pub async fn tick<A: Adapter + 'static>(iface: &SentryApi<A>) -> Result<(), Box<dyn Error>> {
2525
let from = iface.channel.spec.validators.leader().id.clone();
2626
let new_msg_response = iface
27-
.get_latest_msg(from.to_hex_prefix_string(), &["NewState"])
27+
.get_latest_msg(from.to_string(), &["NewState"])
2828
.await?;
2929
let new_msg = match new_msg_response {
3030
Some(MessageTypes::NewState(new_state)) => Some(new_state),

validator_worker/src/lib.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,8 +83,8 @@ mod test {
8383
let iface = setup_iface(&channel);
8484

8585
let balances: BalancesMap = vec![
86-
(IDS["publisher"].to_hex_prefix_string(), 1.into()),
87-
(IDS["tester"].to_hex_prefix_string(), 2.into()),
86+
(IDS["publisher"].to_string(), 1.into()),
87+
(IDS["tester"].to_string(), 2.into()),
8888
]
8989
.into_iter()
9090
.collect();

validator_worker/src/main.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ async fn infinite<A: Adapter + 'static>(args: Args<A>) -> Result<(), ()> {
158158
}
159159

160160
async fn iterate_channels<A: Adapter + 'static>(args: Args<A>) -> Result<(), ()> {
161-
let result = all_channels(&args.sentry_url, args.whoami.to_hex_prefix_string()).await;
161+
let result = all_channels(&args.sentry_url, args.whoami.to_string()).await;
162162

163163
if let Err(e) = result {
164164
eprintln!("Failed to get channels {}", e);

validator_worker/src/sentry_interface.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ impl<T: Adapter + 'static> SentryApi<T> {
120120
&self,
121121
message_types: &[&str],
122122
) -> Result<Option<MessageTypes>, reqwest::Error> {
123-
self.get_latest_msg(self.whoami.to_hex_prefix_string(), message_types)
123+
self.get_latest_msg(self.whoami.to_string(), message_types)
124124
.await
125125
}
126126

0 commit comments

Comments
 (0)