File tree Expand file tree Collapse file tree 2 files changed +10
-4
lines changed
beacon-node/test/spec/utils
state-transition/src/epoch Expand file tree Collapse file tree 2 files changed +10
-4
lines changed Original file line number Diff line number Diff line change @@ -66,8 +66,6 @@ export const defaultSkipOpts: SkipOpts = {
6666 / ^ c a p e l l a \/ l i g h t _ c l i e n t \/ s i n g l e _ m e r k l e _ p r o o f \/ B e a c o n B l o c k B o d y .* / ,
6767 / ^ d e n e b \/ l i g h t _ c l i e n t \/ s i n g l e _ m e r k l e _ p r o o f \/ B e a c o n B l o c k B o d y .* / ,
6868 / ^ e l e c t r a \/ l i g h t _ c l i e n t \/ s i n g l e _ m e r k l e _ p r o o f \/ B e a c o n B l o c k B o d y .* / ,
69- // TODO Electra: slashings tests to be enabled in PR#7071
70- / ^ e l e c t r a \/ e p o c h _ p r o c e s s i n g \/ s l a s h i n g s .* / ,
7169 ] ,
7270 skippedTests : [ ] ,
7371 skippedRunners : [ "merkle_proof" , "networking" ] ,
Original file line number Diff line number Diff line change @@ -50,15 +50,23 @@ export function processSlashings(
5050 totalBalanceByIncrement
5151 ) ;
5252 const increment = EFFECTIVE_BALANCE_INCREMENT ;
53+
54+ const penaltyPerEffectiveBalanceIncrement = Math . floor (
55+ ( adjustedTotalSlashingBalanceByIncrement * increment ) / totalBalanceByIncrement
56+ ) ;
5357 const penalties : number [ ] = [ ] ;
5458
5559 const penaltiesByEffectiveBalanceIncrement = new Map < number , number > ( ) ;
5660 for ( const index of cache . indicesToSlash ) {
5761 const effectiveBalanceIncrement = effectiveBalanceIncrements [ index ] ;
5862 let penalty = penaltiesByEffectiveBalanceIncrement . get ( effectiveBalanceIncrement ) ;
5963 if ( penalty === undefined ) {
60- const penaltyNumeratorByIncrement = effectiveBalanceIncrement * adjustedTotalSlashingBalanceByIncrement ;
61- penalty = Math . floor ( penaltyNumeratorByIncrement / totalBalanceByIncrement ) * increment ;
64+ if ( fork < ForkSeq . electra ) {
65+ const penaltyNumeratorByIncrement = effectiveBalanceIncrement * adjustedTotalSlashingBalanceByIncrement ;
66+ penalty = Math . floor ( penaltyNumeratorByIncrement / totalBalanceByIncrement ) * increment ;
67+ } else {
68+ penalty = penaltyPerEffectiveBalanceIncrement * effectiveBalanceIncrement ;
69+ }
6270 penaltiesByEffectiveBalanceIncrement . set ( effectiveBalanceIncrement , penalty ) ;
6371 }
6472
You can’t perform that action at this time.
0 commit comments