diff --git a/tests/integration/double_vote.go b/tests/integration/double_vote.go index 3f7120edaf..f22338301c 100644 --- a/tests/integration/double_vote.go +++ b/tests/integration/double_vote.go @@ -127,7 +127,7 @@ func (s *CCVTestSuite) TestHandleConsumerDoubleVoting() { // we create two votes that only differ by their Block IDs and // signed them using the same validator private key and chain ID // of the consumer chain - "valid double voting evidence - should pass", + "valid double voting evidence 1 - should pass", &tmtypes.DuplicateVoteEvidence{ VoteA: consuVote, VoteB: consuBadVote, @@ -141,7 +141,7 @@ func (s *CCVTestSuite) TestHandleConsumerDoubleVoting() { }, { // create a double voting evidence using the provider validator key - "valid double voting evidence - should not pass because validator tombstoned in the previous test case", + "valid double voting evidence 2 - should pass", &tmtypes.DuplicateVoteEvidence{ VoteA: provVote, VoteB: provBadVote, @@ -151,7 +151,7 @@ func (s *CCVTestSuite) TestHandleConsumerDoubleVoting() { }, s.consumerChain.ChainID, provVal.PubKey, - false, + true, }, } @@ -190,10 +190,10 @@ func (s *CCVTestSuite) TestHandleConsumerDoubleVoting() { s.Require().True(s.providerApp.GetTestStakingKeeper().IsValidatorJailed(provCtx, provAddr.ToSdkConsAddr())) s.Require().True(s.providerApp.GetTestSlashingKeeper().IsTombstoned(provCtx, provAddr.ToSdkConsAddr())) - // verifies that the validator gets slashed and has fewer tokens after the slashing - validator, _ := s.providerApp.GetTestStakingKeeper().GetValidator(provCtx, provAddr.ToSdkConsAddr().Bytes()) + // verifies that the val gets slashed and has fewer tokens after the slashing + val, _ := s.providerApp.GetTestStakingKeeper().GetValidator(provCtx, provAddr.ToSdkConsAddr().Bytes()) slashFraction := s.providerApp.GetTestSlashingKeeper().SlashFractionDoubleSign(provCtx) - actualTokens := validator.GetTokens().ToDec() + actualTokens := val.GetTokens().ToDec() s.Require().True(initialTokens.Sub(initialTokens.Mul(slashFraction)).Equal(actualTokens)) } else { s.Require().Error(err) diff --git a/x/ccv/provider/keeper/punish_validator_test.go b/x/ccv/provider/keeper/punish_validator_test.go index b3ed24a744..1166fbf063 100644 --- a/x/ccv/provider/keeper/punish_validator_test.go +++ b/x/ccv/provider/keeper/punish_validator_test.go @@ -329,17 +329,9 @@ func TestComputePowerToSlash(t *testing.T) { }).AnyTimes(), ) - tokensBeforeCall := validator.GetTokens() - delegatorSharesBeforeCall := validator.GetDelegatorShares() - actualPower := providerKeeper.ComputePowerToSlash(ctx, validator, tc.undelegations, tc.redelegations, tc.power, tc.powerReduction) - // safeguard check that validator remains unmodified after a call to `ComputePowerToSlash` - // `ComputePowerToSlash` only computes the power and does not modify the state of the system in any way - require.Equal(t, tokensBeforeCall, validator.GetTokens()) - require.Equal(t, delegatorSharesBeforeCall, validator.GetDelegatorShares()) - if tc.expectedPower != actualPower { require.Fail(t, fmt.Sprintf("\"%s\" failed", tc.name), "expected is %d but actual is %d", tc.expectedPower, actualPower)