Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: unmarshalling issue with multisig keys in master #10061

Merged
merged 4 commits into from
Sep 10, 2021
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@ Ref: https://keepachangelog.com/en/1.0.0/
* [\#9829](https://github.com/cosmos/cosmos-sdk/pull/9829) Fixed Coin denom sorting not being checked during `Balance.Validate` check. Refactored the Validation logic to use `Coins.Validate` for `Balance.Coins`.
+ [\#9965](https://github.com/cosmos/cosmos-sdk/pull/9965) Fixed `simd version` command output to report the right release tag.
+ [\#9980](https://github.com/cosmos/cosmos-sdk/pull/9980) Returning the error when the invalid argument is passed to bank query total supply cli.
+ [\#10061](https://github.com/cosmos/cosmos-sdk/pull/10061) Ensure that `LegacyAminoPubKey` struct correctly unmarshals from JSON.

### State Machine Breaking

Expand Down
2 changes: 2 additions & 0 deletions crypto/keys/multisig/amino.go
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,9 @@ 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
}
Expand Down
8 changes: 8 additions & 0 deletions crypto/keys/multisig/multisig_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -428,6 +428,14 @@ 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) {
Expand Down