From e7c745bd32ae90c162037d987967389c620166b6 Mon Sep 17 00:00:00 2001 From: akhilkumarpilli Date: Fri, 5 Mar 2021 16:52:17 +0530 Subject: [PATCH 1/2] fix multisig account pubkeys migration --- x/auth/legacy/v040/migrate.go | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/x/auth/legacy/v040/migrate.go b/x/auth/legacy/v040/migrate.go index 363ec7ba82df..fcf5418e5e3d 100644 --- a/x/auth/legacy/v040/migrate.go +++ b/x/auth/legacy/v040/migrate.go @@ -2,6 +2,7 @@ package v040 import ( codectypes "github.com/cosmos/cosmos-sdk/codec/types" + multisigtypes "github.com/cosmos/cosmos-sdk/crypto/keys/multisig" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" v039auth "github.com/cosmos/cosmos-sdk/x/auth/legacy/v039" v040auth "github.com/cosmos/cosmos-sdk/x/auth/types" @@ -11,9 +12,15 @@ import ( // convertBaseAccount converts a 0.39 BaseAccount to a 0.40 BaseAccount. func convertBaseAccount(old *v039auth.BaseAccount) *v040auth.BaseAccount { var any *codectypes.Any - // If the old genesis had a pubkey, we pack it inside an Any. Or else, we - // just leave it nil. - if old.PubKey != nil { + + _, ok := old.PubKey.(*multisigtypes.LegacyAminoPubKey) + + // If pubkey is multisig type, then leave it as nil for now + // Else if the old genesis had a pubkey, we pack it inside an Any. + // Or else, we just leave it nil. + if ok { + // TODO migrate multisig public_keys + } else if old.PubKey != nil { var err error any, err = codectypes.NewAnyWithValue(old.PubKey) if err != nil { From 04dae6ab19c1398f242787d90095c8e63a202230 Mon Sep 17 00:00:00 2001 From: akhilkumarpilli Date: Fri, 5 Mar 2021 17:37:31 +0530 Subject: [PATCH 2/2] Add issue link reference --- x/auth/legacy/v040/migrate.go | 1 + 1 file changed, 1 insertion(+) diff --git a/x/auth/legacy/v040/migrate.go b/x/auth/legacy/v040/migrate.go index fcf5418e5e3d..f819a1a33d8b 100644 --- a/x/auth/legacy/v040/migrate.go +++ b/x/auth/legacy/v040/migrate.go @@ -16,6 +16,7 @@ func convertBaseAccount(old *v039auth.BaseAccount) *v040auth.BaseAccount { _, ok := old.PubKey.(*multisigtypes.LegacyAminoPubKey) // If pubkey is multisig type, then leave it as nil for now + // Ref: https://github.com/cosmos/cosmos-sdk/issues/8776#issuecomment-790552126 // Else if the old genesis had a pubkey, we pack it inside an Any. // Or else, we just leave it nil. if ok {