From b4e2114c9671e4fe27854526f1bf238bea09cdb9 Mon Sep 17 00:00:00 2001 From: NC <17676176+ensi321@users.noreply.github.com> Date: Mon, 9 Sep 2024 15:04:08 -0700 Subject: [PATCH] Fix rounding issue --- packages/state-transition/src/epoch/processSlashings.ts | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/packages/state-transition/src/epoch/processSlashings.ts b/packages/state-transition/src/epoch/processSlashings.ts index 7cba5905018..6548f2dd8be 100644 --- a/packages/state-transition/src/epoch/processSlashings.ts +++ b/packages/state-transition/src/epoch/processSlashings.ts @@ -51,8 +51,7 @@ export function processSlashings( ); const increment = EFFECTIVE_BALANCE_INCREMENT; - const penaltyPerEffectiveBalanceIncrement = - Math.floor(adjustedTotalSlashingBalanceByIncrement / totalBalanceByIncrement) * increment; + const penaltyPerEffectiveBalanceIncrement = Math.floor((adjustedTotalSlashingBalanceByIncrement * increment) / totalBalanceByIncrement); const penalties: number[] = []; const penaltiesByEffectiveBalanceIncrement = new Map();