chore(all)!: use gogoproto/any instead of codec/types/any (#21013)

This commit is contained in:
Facundo Medica
2024-07-22 11:23:51 +00:00
committed by GitHub
parent 71d14f9370
commit 9ab162de6d
48 changed files with 222 additions and 191 deletions
+3 -1
View File
@@ -4,6 +4,8 @@ import (
"errors"
"fmt"
gogoprotoany "github.com/cosmos/gogoproto/types/any"
"github.com/cosmos/cosmos-sdk/codec/legacy"
codectypes "github.com/cosmos/cosmos-sdk/codec/types"
"github.com/cosmos/cosmos-sdk/crypto/hd"
@@ -218,7 +220,7 @@ func (i LegacyMultiInfo) GetPath() (*hd.BIP44Params, error) {
}
// UnpackInterfaces implements UnpackInterfacesMessage.UnpackInterfaces
func (i LegacyMultiInfo) UnpackInterfaces(unpacker codectypes.AnyUnpacker) error {
func (i LegacyMultiInfo) UnpackInterfaces(unpacker gogoprotoany.AnyUnpacker) error {
multiPK := i.PubKey.(*multisig.LegacyAminoPubKey)
return codectypes.UnpackInterfaces(multiPK, unpacker)
+3 -1
View File
@@ -3,6 +3,8 @@ package keyring
import (
"errors"
gogoprotoany "github.com/cosmos/gogoproto/types/any"
errorsmod "cosmossdk.io/errors"
codectypes "github.com/cosmos/cosmos-sdk/codec/types"
@@ -103,7 +105,7 @@ func (k Record) GetType() KeyType {
}
// UnpackInterfaces implements UnpackInterfacesMessage.UnpackInterfaces
func (k *Record) UnpackInterfaces(unpacker codectypes.AnyUnpacker) error {
func (k *Record) UnpackInterfaces(unpacker gogoprotoany.AnyUnpacker) error {
var pk cryptotypes.PubKey
if err := unpacker.UnpackAny(k.PubKey, &pk); err != nil {
return err
+4 -8
View File
@@ -4,6 +4,7 @@ import (
"fmt"
cmtcrypto "github.com/cometbft/cometbft/crypto"
gogoprotoany "github.com/cosmos/gogoproto/types/any"
"github.com/cosmos/cosmos-sdk/codec/types"
cryptotypes "github.com/cosmos/cosmos-sdk/crypto/types"
@@ -12,8 +13,8 @@ import (
)
var (
_ multisigtypes.PubKey = &LegacyAminoPubKey{}
_ types.UnpackInterfacesMessage = &LegacyAminoPubKey{}
_ multisigtypes.PubKey = &LegacyAminoPubKey{}
_ gogoprotoany.UnpackInterfacesMessage = &LegacyAminoPubKey{}
)
// NewLegacyAminoPubKey returns a new LegacyAminoPubKey.
@@ -149,7 +150,7 @@ func (m *LegacyAminoPubKey) Type() string {
}
// UnpackInterfaces implements UnpackInterfacesMessage.UnpackInterfaces
func (m *LegacyAminoPubKey) UnpackInterfaces(unpacker types.AnyUnpacker) error {
func (m *LegacyAminoPubKey) UnpackInterfaces(unpacker gogoprotoany.AnyUnpacker) error {
for _, any := range m.PubKeys {
var pk cryptotypes.PubKey
err := unpacker.UnpackAny(any, &pk)
@@ -169,11 +170,6 @@ func packPubKeys(pubKeys []cryptotypes.PubKey) ([]*types.Any, error) {
return nil, err
}
anyPubKeys[i] = any
// sets the compat.aminoBz value
if err := anyPubKeys[i].UnmarshalAmino(pubKeys[i].Bytes()); err != nil {
return nil, err
}
}
return anyPubKeys, nil
}