@@ -575,18 +575,23 @@ func TestMisbehaviourProofsWrongBlockEpoch(t *testing.T) {
575
575
require .ErrorIs (err , heavycheck .ErrUnknownEpochBVs )
576
576
577
577
goodEpochMp := copyMP (correctMp )
578
- goodEpochMp .WrongBlockVote .Pals [0 ].Val .Epoch = env .store .FindBlockEpoch (goodEpochMp .WrongBlockVote .Block )
579
- goodEpochMp .WrongBlockVote .Pals [1 ].Val .Epoch = env .store .FindBlockEpoch (goodEpochMp .WrongBlockVote .Block )
578
+ // Get epoch number when vote will occur
579
+ epoch := env .store .FindBlockEpoch (goodEpochMp .WrongBlockVote .Block )
580
+ goodEpochMp .WrongBlockVote .Pals [0 ].Val .Epoch = epoch - 1
581
+ goodEpochMp .WrongBlockVote .Pals [1 ].Val .Epoch = epoch - 1
580
582
err = env .ApplyMPs (nextEpoch , goodEpochMp )
581
583
require .ErrorIs (err , heavycheck .ErrWrongPayloadHash )
582
584
sign (& goodEpochMp )
583
585
err = env .ApplyMPs (nextEpoch , goodEpochMp )
584
586
require .NoError (err )
585
- require .Equal (idx .Validator (3 ), env .store .GetValidators ().Len ())
587
+ // Get epoch state, before validators penalty
588
+ epochState := env .store .GetHistoryEpochState (epoch )
589
+ require .Equal (idx .Validator (3 ), epochState .Validators .Len ())
586
590
587
591
err = env .ApplyMPs (nextEpoch , correctMp )
588
592
require .NoError (err )
589
- require .Equal (idx .Validator (1 ), env .store .GetValidators ().Len ())
593
+ epochState = env .store .GetHistoryEpochState (epoch + 1 )
594
+ require .Equal (idx .Validator (1 ), epochState .Validators .Len ())
590
595
require .False (env .store .GetValidators ().Exists (1 ))
591
596
require .False (env .store .GetValidators ().Exists (2 ))
592
597
}
0 commit comments