Skip to content

Commit bf8a3b7

Browse files
committed
Merge branch 'main' into sg/peer-network-interface
2 parents 21f7e67 + 37aad40 commit bf8a3b7

File tree

7 files changed

+37
-64
lines changed

7 files changed

+37
-64
lines changed

common/src/types.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -717,8 +717,8 @@ impl Credential {
717717

718718
pub fn to_json_string(&self) -> String {
719719
match self {
720-
Self::ScriptHash(hash) => format!("scriptHash-{}", hex::encode(hash)),
721-
Self::AddrKeyHash(hash) => format!("keyHash-{}", hex::encode(hash)),
720+
Self::ScriptHash(hash) => format!("scriptHash-{}", hash),
721+
Self::AddrKeyHash(hash) => format!("keyHash-{}", hash),
722722
}
723723
}
724724

modules/accounts_state/src/rewards.rs

Lines changed: 9 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -120,8 +120,7 @@ pub fn calculate_rewards(
120120

121121
debug!(
122122
"SPO {} reward account registered two epochs ago: {}",
123-
hex::encode(operator_id),
124-
pay_to_pool_reward_account
123+
operator_id, pay_to_pool_reward_account
125124
);
126125

127126
// Also, to handle the early Shelley timing bug, we allow it if it was registered
@@ -138,8 +137,7 @@ pub fn calculate_rewards(
138137
if pay_to_pool_reward_account {
139138
info!(
140139
"SPO {}'s reward account {} was registered in this epoch",
141-
hex::encode(operator_id),
142-
staking_spo.reward_account
140+
operator_id, staking_spo.reward_account
143141
);
144142
}
145143
}
@@ -160,18 +158,15 @@ pub fn calculate_rewards(
160158
if performance.spos.get(other_id).map(|s| s.blocks_produced).unwrap_or(0) > 0 {
161159
pay_to_pool_reward_account = false;
162160
warn!("Shelley shared reward account bug: Dropping reward to {} in favour of {} on shared account {}",
163-
hex::encode(operator_id),
164-
hex::encode(other_id),
161+
operator_id,
162+
other_id,
165163
staking_spo.reward_account);
166164
break;
167165
}
168166
}
169167
}
170168
} else {
171-
info!(
172-
"Reward account for SPO {} isn't registered",
173-
hex::encode(operator_id)
174-
)
169+
info!("Reward account for SPO {} isn't registered", operator_id)
175170
}
176171

177172
// Calculate rewards for this SPO
@@ -250,7 +245,7 @@ fn calculate_spo_rewards(
250245
// Active stake (sigma)
251246
let pool_stake = BigDecimal::from(spo.total_stake);
252247
if pool_stake.is_zero() {
253-
warn!("SPO {} has no stake - skipping", hex::encode(operator_id));
248+
warn!("SPO {} has no stake - skipping", operator_id);
254249

255250
// No stake, no rewards or earnings
256251
return vec![];
@@ -264,9 +259,7 @@ fn calculate_spo_rewards(
264259
if pool_owner_stake < spo.pledge {
265260
debug!(
266261
"SPO {} has owner stake {} less than pledge {} - skipping",
267-
hex::encode(operator_id),
268-
pool_owner_stake,
269-
spo.pledge
262+
operator_id, pool_owner_stake, spo.pledge
270263
);
271264
return vec![];
272265
}
@@ -313,7 +306,7 @@ fn calculate_spo_rewards(
313306

314307
debug!(%pool_stake, %relative_pool_stake, %pool_performance,
315308
%optimum_rewards, %pool_rewards, pool_owner_stake, %pool_pledge,
316-
"Pool {}", hex::encode(operator_id));
309+
"Pool {}", operator_id);
317310

318311
// Subtract fixed costs
319312
let fixed_cost = BigDecimal::from(spo.fixed_cost);
@@ -411,9 +404,7 @@ fn calculate_spo_rewards(
411404
} else {
412405
info!(
413406
"SPO {}'s reward account {} not paid {}",
414-
hex::encode(operator_id),
415-
spo.reward_account,
416-
spo_benefit,
407+
operator_id, spo.reward_account, spo_benefit,
417408
);
418409
}
419410

modules/accounts_state/src/snapshot.rs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ impl Snapshot {
9999
epoch,
100100
previous_epoch = two_previous_snapshot.epoch,
101101
"Two previous reward account for SPO {} registered: {}",
102-
hex::encode(spo_id),
102+
spo_id,
103103
two_previous_reward_account_is_registered
104104
);
105105

@@ -135,9 +135,7 @@ impl Snapshot {
135135
// SPO has retired - this stake is simply ignored
136136
debug!(
137137
epoch,
138-
"SPO {} for stake address {} retired? Ignored",
139-
hex::encode(spo_id),
140-
stake_address
138+
"SPO {} for stake address {} retired? Ignored", spo_id, stake_address
141139
);
142140
continue;
143141
}

modules/accounts_state/src/state.rs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -717,7 +717,7 @@ impl State {
717717
margin = ?spo.margin,
718718
reward = %spo.reward_account,
719719
"Updated parameters for SPO {}",
720-
hex::encode(id)
720+
id
721721
);
722722
}
723723
}
@@ -730,7 +730,7 @@ impl State {
730730
margin = ?spo.margin,
731731
reward = %spo.reward_account,
732732
"Registered new SPO {}",
733-
hex::encode(id)
733+
id
734734
);
735735
}
736736
}
@@ -751,8 +751,7 @@ impl State {
751751
if let Some(retired_spo) = new_spos.get(id) {
752752
debug!(
753753
"SPO {} has retired - refunding their deposit to {}",
754-
hex::encode(id),
755-
retired_spo.reward_account
754+
id, retired_spo.reward_account
756755
);
757756
self.pool_refunds.push((retired_spo.operator, retired_spo.reward_account.clone()));
758757
// Store full StakeAddress

modules/accounts_state/src/verifier.rs

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -195,15 +195,15 @@ impl Verifier {
195195
Left(expected_spo) => {
196196
error!(
197197
"Missing rewards SPO: {} {} rewards",
198-
hex::encode(expected_spo.0),
198+
expected_spo.0,
199199
expected_spo.1.len()
200200
);
201201
errors += 1;
202202
}
203203
Right(actual_spo) => {
204204
error!(
205205
"Extra rewards SPO: {} {} rewards",
206-
hex::encode(actual_spo.0),
206+
actual_spo.0,
207207
actual_spo.1.len()
208208
);
209209
errors += 1;
@@ -222,7 +222,7 @@ impl Verifier {
222222
Left(expected) => {
223223
error!(
224224
"Missing reward: SPO {} account {} {:?} {}",
225-
hex::encode(expected_spo.0),
225+
expected_spo.0,
226226
expected.account,
227227
expected.rtype,
228228
expected.amount
@@ -232,17 +232,14 @@ impl Verifier {
232232
Right(actual) => {
233233
error!(
234234
"Extra reward: SPO {} account {} {:?} {}",
235-
hex::encode(actual_spo.0),
236-
actual.account,
237-
actual.rtype,
238-
actual.amount
235+
actual_spo.0, actual.account, actual.rtype, actual.amount
239236
);
240237
errors += 1;
241238
}
242239
Both(expected, actual) => {
243240
if expected.amount != actual.amount {
244241
error!("Different reward: SPO {} account {} {:?} expected {}, actual {} ({})",
245-
hex::encode(expected_spo.0),
242+
expected_spo.0,
246243
expected.account,
247244
expected.rtype,
248245
expected.amount,
@@ -252,7 +249,7 @@ impl Verifier {
252249
} else {
253250
debug!(
254251
"Reward match: SPO {} account {} {:?} {}",
255-
hex::encode(expected_spo.0),
252+
expected_spo.0,
256253
expected.account,
257254
expected.rtype,
258255
expected.amount

modules/spo_state/src/state.rs

Lines changed: 14 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -283,12 +283,9 @@ impl State {
283283
let deregistrations = self.pending_deregistrations.remove(&self.epoch);
284284
if let Some(deregistrations) = deregistrations {
285285
for dr in deregistrations {
286-
debug!("Retiring SPO {}", hex::encode(dr));
286+
debug!("Retiring SPO {}", dr);
287287
match self.spos.remove(&dr) {
288-
None => error!(
289-
"Retirement requested for unregistered SPO {}",
290-
hex::encode(dr),
291-
),
288+
None => error!("Retirement requested for unregistered SPO {}", dr,),
292289
Some(_de_reg) => {
293290
retired_spos.push(dr);
294291
}
@@ -318,7 +315,7 @@ impl State {
318315
epoch = self.epoch,
319316
block = block.number,
320317
"New pending SPO update {} {:?}",
321-
hex::encode(reg.operator),
318+
reg.operator,
322319
reg
323320
);
324321
self.pending_updates.insert(reg.operator, reg.clone());
@@ -327,7 +324,7 @@ impl State {
327324
epoch = self.epoch,
328325
block = block.number,
329326
"Registering SPO {} {:?}",
330-
hex::encode(reg.operator),
327+
reg.operator,
331328
reg
332329
);
333330
self.spos.insert(reg.operator, reg.clone());
@@ -340,8 +337,7 @@ impl State {
340337
if deregistrations.len() != old_len {
341338
debug!(
342339
"Removed pending deregistration of SPO {} from epoch {}",
343-
hex::encode(reg.operator),
344-
epoch
340+
reg.operator, epoch
345341
);
346342
}
347343
}
@@ -368,21 +364,17 @@ impl State {
368364
) {
369365
debug!(
370366
"SPO {} wants to retire at the end of epoch {} (cert in block number {})",
371-
hex::encode(ret.operator),
372-
ret.epoch,
373-
block.number
367+
ret.operator, ret.epoch, block.number
374368
);
375369
if ret.epoch <= self.epoch {
376370
error!(
377371
"SPO retirement received for current or past epoch {} for SPO {}",
378-
ret.epoch,
379-
hex::encode(ret.operator)
372+
ret.epoch, ret.operator
380373
);
381374
} else if ret.epoch > self.epoch + TECHNICAL_PARAMETER_POOL_RETIRE_MAX_EPOCH {
382375
error!(
383376
"SPO retirement received for epoch {} that exceeds future limit for SPO {}",
384-
ret.epoch,
385-
hex::encode(ret.operator)
377+
ret.epoch, ret.operator
386378
);
387379
} else {
388380
// Replace any existing queued deregistrations
@@ -392,8 +384,7 @@ impl State {
392384
if deregistrations.len() != old_len {
393385
debug!(
394386
"Replaced pending deregistration of SPO {} from epoch {}",
395-
hex::encode(ret.operator),
396-
epoch
387+
ret.operator, epoch
397388
);
398389
}
399390
}
@@ -412,7 +403,7 @@ impl State {
412403
} else {
413404
error!(
414405
"Historical SPO for {} not registered when try to retire it",
415-
hex::encode(ret.operator)
406+
ret.operator
416407
);
417408
}
418409
}
@@ -443,8 +434,7 @@ impl State {
443434
if !removed {
444435
error!(
445436
"Historical SPO state for {} does not contain delegator {}",
446-
hex::encode(old_spo),
447-
stake_address
437+
old_spo, stake_address
448438
);
449439
}
450440
}
@@ -474,14 +464,13 @@ impl State {
474464
if !removed {
475465
error!(
476466
"Historical SPO state for {} does not contain delegator {}",
477-
hex::encode(old_spo),
478-
stake_address
467+
old_spo, stake_address
479468
);
480469
}
481470
}
482471
}
483472
_ => {
484-
error!("Missing Historical SPO state for {}", hex::encode(old_spo));
473+
error!("Missing Historical SPO state for {}", old_spo);
485474
}
486475
}
487476
}
@@ -494,8 +483,7 @@ impl State {
494483
if !added {
495484
error!(
496485
"Historical SPO state for {} already contains delegator {}",
497-
hex::encode(spo),
498-
stake_address
486+
spo, stake_address
499487
);
500488
}
501489
}

processes/tx_submitter_cli/src/main.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ impl CliDriver {
114114
TransactionsCommandResponse::Submitted { id },
115115
)) = response.as_ref()
116116
{
117-
info!("Submitted TX {}", hex::encode(id));
117+
info!("Submitted TX {}", id);
118118
} else {
119119
info!("{response:?}");
120120
}

0 commit comments

Comments
 (0)