Skip to content

Commit

Permalink
comment fix
Browse files Browse the repository at this point in the history
  • Loading branch information
stana-miric committed Nov 26, 2024
1 parent 6d9f644 commit 544331e
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 12 deletions.
2 changes: 1 addition & 1 deletion testutil/keeper/expectations.go
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ func GetMocksForDeleteConsumerChain(ctx sdk.Context, mocks *MockedKeepers) []*go

func GetMocksForHandleSlashPacket(ctx sdk.Context, mocks MockedKeepers,
expectedProviderValConsAddr providertypes.ProviderConsAddress,
valToReturn stakingtypes.Validator, expectJailing bool, valAddr []byte,
valToReturn stakingtypes.Validator, expectJailing bool,
) []*gomock.Call {
// These first two calls are always made.
calls := []*gomock.Call{
Expand Down
4 changes: 2 additions & 2 deletions x/ccv/provider/keeper/infraction_parameters.go
Original file line number Diff line number Diff line change
Expand Up @@ -162,8 +162,8 @@ func (k Keeper) RemoveConsumerInfractionQueuedData(ctx sdk.Context, consumerId s

// UpdateQueuedInfractionParams updates the infraction parameters in the time queue.
// Parameters for the specific consumer already exist in the queue:
// - If the new parameters are the same as the current queued parameters, the existing entry is removed to cancel the update.
// - If the new parameters are different, the existing entry is removed and new entry is added to the queue to schedule the update.
// - If the new parameters are the same as the current infraction parameters, the existing queued entry is removed to cancel the update.
// - If the new parameters are different from both queued and current parameters, the existing entry is removed and new entry is added to the queue to schedule the update.
//
// Parameters for the specific consumer do not exist in the update queue and the new parameters differ from the consumer current infraction parameters,
// a new entry is added to the queue to schedule the update.
Expand Down
12 changes: 3 additions & 9 deletions x/ccv/provider/keeper/relay_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import (
"testing"
"time"

authcodec "github.com/cosmos/cosmos-sdk/x/auth/codec"
capabilitytypes "github.com/cosmos/ibc-go/modules/capability/types"
clienttypes "github.com/cosmos/ibc-go/v8/modules/core/02-client/types"
channeltypes "github.com/cosmos/ibc-go/v8/modules/core/04-channel/types"
Expand Down Expand Up @@ -208,8 +207,6 @@ func TestOnRecvDowntimeSlashPacket(t *testing.T) {
// Mock call to GetEffectiveValPower, so that it returns 2.
providerAddr := providertypes.NewProviderConsAddress(packetData.Validator.Address)
valAddr := sdk.ValAddress(packetData.Validator.Address).String()
valOper, err := providerKeeper.ValidatorAddressCodec().StringToBytes(valAddr)
require.NoError(t, err)
calls := []*gomock.Call{
mocks.MockStakingKeeper.EXPECT().GetValidatorByConsAddr(ctx, providerAddr.ToSdkConsAddr()).
Return(stakingtypes.Validator{
Expand All @@ -224,7 +221,7 @@ func TestOnRecvDowntimeSlashPacket(t *testing.T) {
// Add mocks for slash packet handling
calls = append(calls,
testkeeper.GetMocksForHandleSlashPacket(
ctx, mocks, providerAddr, stakingtypes.Validator{Jailed: false, OperatorAddress: valAddr}, true, valOper)...,
ctx, mocks, providerAddr, stakingtypes.Validator{Jailed: false, OperatorAddress: valAddr}, true)...,
)
gomock.InOrder(calls...)

Expand Down Expand Up @@ -354,9 +351,6 @@ func TestHandleSlashPacket(t *testing.T) {
consumerConsAddr := cryptotestutil.NewCryptoIdentityFromIntSeed(784987634).ConsumerConsAddress()

valOperAddr := cryptotestutil.NewCryptoIdentityFromIntSeed(7842334).SDKValOpAddressString()
valAddrCodec := authcodec.NewBech32Codec(sdk.GetConfig().GetBech32ValidatorAddrPrefix())
valOperAddrBytes, err := valAddrCodec.StringToBytes(valOperAddr)
require.NoError(t, err)

testCases := []struct {
name string
Expand Down Expand Up @@ -449,7 +443,7 @@ func TestHandleSlashPacket(t *testing.T) {
providerConsAddr, // expected provider cons addr returned from GetProviderAddrFromConsumerAddr
stakingtypes.Validator{Jailed: false, OperatorAddress: valOperAddr}, // staking keeper val to return
true, // expectJailing = true
valOperAddrBytes)
)
},
1,
consumerConsAddr,
Expand All @@ -468,7 +462,7 @@ func TestHandleSlashPacket(t *testing.T) {
providerConsAddr, // expected provider cons addr returned from GetProviderAddrFromConsumerAddr
stakingtypes.Validator{Jailed: true, OperatorAddress: valOperAddr}, // staking keeper val to return
false, // expectJailing = false, validator is already jailed.
valOperAddrBytes)
)
},
1,
consumerConsAddr,
Expand Down

0 comments on commit 544331e

Please sign in to comment.