From 1cdf7e39aea41bcb325e969ba526e062f0f66784 Mon Sep 17 00:00:00 2001 From: Robert Zaremba Date: Sat, 18 Sep 2021 08:03:34 +0200 Subject: [PATCH] fix: revert \#10169 (amino multisig key unmarshalling) (#10193) * Revert "fix: unmarshalling issue with multisig keys in master (backport #10061) (#10169)" This reverts commit fcaff727292dd4e1d94591e67c7ea9ab81524a4e. * Update CHANGELOG.md Co-authored-by: Amaury <1293565+amaurym@users.noreply.github.com> Co-authored-by: Amaury <1293565+amaurym@users.noreply.github.com> --- CHANGELOG.md | 1 - crypto/keys/multisig/amino.go | 2 -- crypto/keys/multisig/multisig_test.go | 8 -------- 3 files changed, 11 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 42d32a0cab8d..591085192ff6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -49,7 +49,6 @@ Ref: https://keepachangelog.com/en/1.0.0/ * [\#9969](https://github.com/cosmos/cosmos-sdk/pull/9969) fix: use keyring in config for add-genesis-account cmd. * (x/genutil) [#10104](https://github.com/cosmos/cosmos-sdk/pull/10104) Ensure the `init` command reads the `--home` flag value correctly. -* [\#10061](https://github.com/cosmos/cosmos-sdk/pull/10061) Ensure that `LegacyAminoPubKey` struct correctly unmarshals from JSON * (x/feegrant) [\#10049](https://github.com/cosmos/cosmos-sdk/issues/10049) Fixed the error message when `period` or `period-limit` flag is not set on a feegrant grant transaction. ### Client Breaking Changes diff --git a/crypto/keys/multisig/amino.go b/crypto/keys/multisig/amino.go index 78ead799939b..78816743dbd5 100644 --- a/crypto/keys/multisig/amino.go +++ b/crypto/keys/multisig/amino.go @@ -80,9 +80,7 @@ func (m *LegacyAminoPubKey) UnmarshalAminoJSON(tmPk tmMultisig) error { // Instead of just doing `*m = *protoPk`, we prefer to modify in-place the // existing Anys inside `m` (instead of allocating new Anys), as so not to // break the `.compat` fields in the existing Anys. - m.PubKeys = make([]*types.Any, len(protoPk.PubKeys)) for i := range m.PubKeys { - m.PubKeys[i] = &types.Any{} m.PubKeys[i].TypeUrl = protoPk.PubKeys[i].TypeUrl m.PubKeys[i].Value = protoPk.PubKeys[i].Value } diff --git a/crypto/keys/multisig/multisig_test.go b/crypto/keys/multisig/multisig_test.go index 5fbed807344b..17c23c954744 100644 --- a/crypto/keys/multisig/multisig_test.go +++ b/crypto/keys/multisig/multisig_test.go @@ -444,14 +444,6 @@ func TestAminoUnmarshalJSON(t *testing.T) { require.NoError(t, err) lpk := pk.(*kmultisig.LegacyAminoPubKey) require.Equal(t, uint32(3), lpk.Threshold) - require.Equal(t, 5, len(pk.(*kmultisig.LegacyAminoPubKey).PubKeys)) - - for _, key := range pk.(*kmultisig.LegacyAminoPubKey).PubKeys { - require.NotNil(t, key) - pk := secp256k1.PubKey{} - err := pk.Unmarshal(key.Value) - require.NoError(t, err) - } } func TestProtoMarshalJSON(t *testing.T) {