Skip to content

Commit

Permalink
Update calculation
Browse files Browse the repository at this point in the history
  • Loading branch information
ensi321 committed Sep 25, 2024
1 parent d3bec5a commit e07ed10
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion packages/state-transition/src/epoch/processSlashings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,12 @@ export function processSlashings(
const effectiveBalanceIncrement = effectiveBalanceIncrements[index];
let penalty = penaltiesByEffectiveBalanceIncrement.get(effectiveBalanceIncrement);
if (penalty === undefined) {
penalty = penaltyPerEffectiveBalanceIncrement * effectiveBalanceIncrement;
if (fork < ForkSeq.electra) {
const penaltyNumeratorByIncrement = effectiveBalanceIncrement * adjustedTotalSlashingBalanceByIncrement;
penalty = Math.floor(penaltyNumeratorByIncrement / totalBalanceByIncrement) * increment;
} else {
penalty = penaltyPerEffectiveBalanceIncrement * effectiveBalanceIncrement;
}
penaltiesByEffectiveBalanceIncrement.set(effectiveBalanceIncrement, penalty);
}

Expand Down

0 comments on commit e07ed10

Please sign in to comment.