From 974abde0c4031c1960f697ac1329e0a3025fff20 Mon Sep 17 00:00:00 2001 From: Facundo Medica <14063057+facundomedica@users.noreply.github.com> Date: Tue, 25 Jul 2023 17:50:38 +0200 Subject: [PATCH] fix(x/slashing): ValidatorSignInfo migration to collections was missing length prefix (#17127) --- x/slashing/keeper/keeper.go | 2 +- x/slashing/types/signing_info.go | 7 ------- 2 files changed, 1 insertion(+), 8 deletions(-) diff --git a/x/slashing/keeper/keeper.go b/x/slashing/keeper/keeper.go index 1e622f56eb..0c1182da9f 100644 --- a/x/slashing/keeper/keeper.go +++ b/x/slashing/keeper/keeper.go @@ -45,7 +45,7 @@ func NewKeeper(cdc codec.BinaryCodec, legacyAmino *codec.LegacyAmino, storeServi sb, types.ValidatorSigningInfoKeyPrefix, "validator_signing_info", - sdk.ConsAddressKey, + sdk.LengthPrefixedAddressKey(sdk.ConsAddressKey), // nolint: staticcheck // sdk.LengthPrefixedAddressKey is needed to retain state compatibility codec.CollValue[types.ValidatorSigningInfo](cdc), ), } diff --git a/x/slashing/types/signing_info.go b/x/slashing/types/signing_info.go index 8e9519d51d..18443311aa 100644 --- a/x/slashing/types/signing_info.go +++ b/x/slashing/types/signing_info.go @@ -3,7 +3,6 @@ package types import ( "time" - "github.com/cosmos/cosmos-sdk/codec" sdk "github.com/cosmos/cosmos-sdk/types" ) @@ -21,9 +20,3 @@ func NewValidatorSigningInfo( MissedBlocksCounter: missedBlocksCounter, } } - -// UnmarshalValSigningInfo unmarshals a validator signing info from a store value -func UnmarshalValSigningInfo(cdc codec.Codec, value []byte) (signingInfo ValidatorSigningInfo, err error) { - err = cdc.Unmarshal(value, &signingInfo) - return signingInfo, err -}