Skip to content

Commit 4ed40a7

Browse files
committed
fix: log slash amounts as strings
Fixes [A-478](https://linear.app/aztec-labs/issue/A-478/investigate-wrong-slashing-amounts) GKE was clamping the numbers when logging to 64-bit, hence the number `9223372036854776000` being logged (which is approximately `2^63`). Converting those number to strings but maybe should look into a utility in `pino-logger.ts` Added follow-up: https://linear.app/aztec-labs/issue/A-495/handle-bigints-in-pino-logger
1 parent 1a0fb2f commit 4ed40a7

File tree

2 files changed

+15
-3
lines changed

2 files changed

+15
-3
lines changed

yarn-project/slasher/src/slash_offenses_collector.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,11 @@ export class SlashOffensesCollector {
8585
}
8686
}
8787

88-
this.log.info(`Adding pending offense for validator ${arg.validator}`, pendingOffense);
88+
this.log.info(`Adding pending offense for validator ${arg.validator}`, {
89+
...pendingOffense,
90+
epochOrSlot: pendingOffense.epochOrSlot.toString(),
91+
amount: pendingOffense.amount.toString(),
92+
});
8993
await this.offensesStore.addPendingOffense(pendingOffense);
9094
}
9195
}

yarn-project/slasher/src/tally_slasher_client.ts

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -281,8 +281,12 @@ export class TallySlasherClient implements ProposerSlashActionProvider, SlasherC
281281
return undefined;
282282
}
283283

284+
const slashActionsWithAmounts = slashActions.map(action => ({
285+
validator: action.validator.toString(),
286+
slashAmount: action.slashAmount.toString(),
287+
}));
284288
this.log.info(`Round ${executableRound} is ready to execute with ${slashActions.length} slashes`, {
285-
slashActions,
289+
slashActions: slashActionsWithAmounts,
286290
payloadAddress: payload.address.toString(),
287291
...logData,
288292
});
@@ -348,11 +352,15 @@ export class TallySlasherClient implements ProposerSlashActionProvider, SlasherC
348352
return undefined;
349353
}
350354

355+
const offensesToSlashLog = offensesToSlash.map(offense => ({
356+
...offense,
357+
amount: offense.amount.toString(),
358+
}));
351359
this.log.info(`Voting to slash ${offensesToSlash.length} offenses`, {
352360
slotNumber,
353361
currentRound,
354362
slashedRound,
355-
offensesToSlash,
363+
offensesToSlash: offensesToSlashLog,
356364
});
357365

358366
const committees = await this.collectCommitteesActiveDuringRound(slashedRound);

0 commit comments

Comments
 (0)