Skip to content

Commit

Permalink
Update calculation
Browse files Browse the repository at this point in the history
  • Loading branch information
ensi321 committed Sep 9, 2024
1 parent b4e2114 commit e16e9ca
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
2 changes: 1 addition & 1 deletion packages/beacon-node/test/spec/utils/specTestIterator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,8 @@ export const defaultSkipOpts: SkipOpts = {
/^capella\/light_client\/single_merkle_proof\/BeaconBlockBody.*/,
/^deneb\/light_client\/single_merkle_proof\/BeaconBlockBody.*/,
/^electra\/light_client\/.*/,
/^(?!.*slashings).*$/,
],
// TODO Electra: Review this test in the next spec test release
skippedTests: [/^deneb\/light_client\/sync\/.*electra_fork.*/],
skippedRunners: ["merkle_proof", "networking"],
};
Expand Down
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 e16e9ca

Please sign in to comment.