diff --git a/x/ccv/provider/keeper/relay_test.go b/x/ccv/provider/keeper/relay_test.go index 219bd46939..2f7837c089 100644 --- a/x/ccv/provider/keeper/relay_test.go +++ b/x/ccv/provider/keeper/relay_test.go @@ -4,14 +4,13 @@ import ( "strings" "testing" + "cosmossdk.io/math" clienttypes "github.com/cosmos/ibc-go/v8/modules/core/02-client/types" channeltypes "github.com/cosmos/ibc-go/v8/modules/core/04-channel/types" ibctesting "github.com/cosmos/ibc-go/v8/testing" "github.com/golang/mock/gomock" "github.com/stretchr/testify/require" - "cosmossdk.io/math" - cryptocodec "github.com/cosmos/cosmos-sdk/crypto/codec" sdk "github.com/cosmos/cosmos-sdk/types" stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" @@ -148,7 +147,11 @@ func TestOnRecvDowntimeSlashPacket(t *testing.T) { providerAddr := providertypes.NewProviderConsAddress(packetData.Validator.Address) calls := []*gomock.Call{ mocks.MockStakingKeeper.EXPECT().GetValidatorByConsAddr(ctx, providerAddr.ToSdkConsAddr()). - Return(stakingtypes.Validator{}, nil).Times(1), + Return(stakingtypes.Validator{ + // must be a hex string so it can be properly decoded by sdktypes.ValAddressFromHex(val.GetOperator()) + // empty string is fine, as it's not used in this test + OperatorAddress: "557D5BD0FA991DAB8EED2B9DCF98AC1B3200D43D", + }, nil).Times(1), mocks.MockStakingKeeper.EXPECT().GetLastValidatorPower(ctx, gomock.Any()). Return(int64(2), nil).Times(1), } diff --git a/x/ccv/provider/keeper/throttle.go b/x/ccv/provider/keeper/throttle.go index 30b23d0c55..e2dae13020 100644 --- a/x/ccv/provider/keeper/throttle.go +++ b/x/ccv/provider/keeper/throttle.go @@ -28,12 +28,12 @@ func (k Keeper) GetEffectiveValPower(ctx sdktypes.Context, } else { // Otherwise, return the staking keeper's LastValidatorPower value. // NOTE: @MSalopek double check this conversion and see if it's necessary - valAddrBech32, err := sdktypes.ValAddressFromHex(val.GetOperator()) + valAddr, err := sdktypes.ValAddressFromHex(val.GetOperator()) if err != nil { return math.ZeroInt() } - power, err := k.stakingKeeper.GetLastValidatorPower(ctx, valAddrBech32) + power, err := k.stakingKeeper.GetLastValidatorPower(ctx, valAddr) if err != nil { return math.ZeroInt() }