diff --git a/UPGRADING.md b/UPGRADING.md index 64f8b56780d9..37d701b2e496 100644 --- a/UPGRADING.md +++ b/UPGRADING.md @@ -170,7 +170,9 @@ There is no longer a need for the Cosmos SDK to host these protos for itself and That package containing proto v2 generated code, but the SDK now uses [buf generated go SDK instead](https://buf.build/docs/bsr/generated-sdks/go). If you were depending on `cosmossdk.io/api/tendermint`, please use the buf generated go SDK instead, or ask CometBFT host the generated proto v2 code. -The `codectypes.Any` has moved to `github.com/cosmos/gogoproto/types/any`. Module developers can update the `buf.gen.gogo.yaml` configuration files by adjusting the corresponding `opt` option to `Mgoogle/protobuf/any.proto=github.com/cosmos/gogoproto/types/any` for directly mapping the`Any` type to its new location. This change is optional as `codectypes.Any` is aliased to `gogoproto.Any` in the SDK. +The `codectypes.Any` has moved to `github.com/cosmos/gogoproto/types/any`. Module developers need to update the `buf.gen.gogo.yaml` configuration files by adjusting the corresponding `opt` option to `Mgoogle/protobuf/any.proto=github.com/cosmos/gogoproto/types/any` for directly mapping the`Any` type to its new location. This change is optional, but recommended, as `codectypes.Any` is aliased to `gogoproto.Any` in the SDK. + +Also, any usages of the interfaces `AnyUnpacker` and `UnpackInterfacesMessage` must be replaced with the interfaces of the same name in the `github.com/cosmos/gogoproto/types/any` package. ### Modules diff --git a/client/grpc/cmtservice/service.go b/client/grpc/cmtservice/service.go index ad307984c0e5..05eeeb6ecc43 100644 --- a/client/grpc/cmtservice/service.go +++ b/client/grpc/cmtservice/service.go @@ -5,6 +5,7 @@ import ( abci "github.com/cometbft/cometbft/api/cometbft/abci/v1" gogogrpc "github.com/cosmos/gogoproto/grpc" + gogoprotoany "github.com/cosmos/gogoproto/types/any" "github.com/grpc-ecosystem/grpc-gateway/runtime" "google.golang.org/grpc/codes" "google.golang.org/grpc/status" @@ -20,8 +21,8 @@ import ( ) var ( - _ ServiceServer = queryServer{} - _ codectypes.UnpackInterfacesMessage = &GetLatestValidatorSetResponse{} + _ ServiceServer = queryServer{} + _ gogoprotoany.UnpackInterfacesMessage = &GetLatestValidatorSetResponse{} ) type ( @@ -112,7 +113,7 @@ func (s queryServer) GetLatestValidatorSet(ctx context.Context, req *GetLatestVa return ValidatorsOutput(ctx, s.clientCtx, nil, page, limit) } -func (m *GetLatestValidatorSetResponse) UnpackInterfaces(unpacker codectypes.AnyUnpacker) error { +func (m *GetLatestValidatorSetResponse) UnpackInterfaces(unpacker gogoprotoany.AnyUnpacker) error { var pubKey cryptotypes.PubKey for _, val := range m.Validators { err := unpacker.UnpackAny(val.PubKey, &pubKey) diff --git a/client/keys/output_test.go b/client/keys/output_test.go index c88f93b8752a..b56a30c7a083 100644 --- a/client/keys/output_test.go +++ b/client/keys/output_test.go @@ -8,6 +8,7 @@ import ( "github.com/cosmos/cosmos-sdk/codec" addresscodec "github.com/cosmos/cosmos-sdk/codec/address" + codectestutil "github.com/cosmos/cosmos-sdk/codec/testutil" codectypes "github.com/cosmos/cosmos-sdk/codec/types" cryptocodec "github.com/cosmos/cosmos-sdk/crypto/codec" "github.com/cosmos/cosmos-sdk/crypto/keyring" @@ -15,6 +16,7 @@ import ( "github.com/cosmos/cosmos-sdk/crypto/keys/secp256k1" "github.com/cosmos/cosmos-sdk/crypto/types" sdk "github.com/cosmos/cosmos-sdk/types" + moduletestutil "github.com/cosmos/cosmos-sdk/types/module/testutil" ) func generatePubKeys(n int) []types.PubKey { @@ -100,3 +102,24 @@ func TestProtoMarshalJSON(t *testing.T) { require.Equal(ko.Address, expectedOutput) require.Equal(ko.PubKey, string(bz)) } + +func TestNestedMultisigOutput(t *testing.T) { + cdc := moduletestutil.MakeTestEncodingConfig(codectestutil.CodecOptions{}).Codec + + sk := secp256k1.PrivKey{Key: []byte{154, 49, 3, 117, 55, 232, 249, 20, 205, 216, 102, 7, 136, 72, 177, 2, 131, 202, 234, 81, 31, 208, 46, 244, 179, 192, 167, 163, 142, 117, 246, 13}} + tmpKey := sk.PubKey() + multisigPk := kmultisig.NewLegacyAminoPubKey(1, []types.PubKey{tmpKey}) + multisigPk2 := kmultisig.NewLegacyAminoPubKey(1, []types.PubKey{tmpKey, multisigPk}) + + kb, err := keyring.New(t.Name(), keyring.BackendTest, t.TempDir(), nil, cdc) + require.NoError(t, err) + + _, err = kb.SaveMultisig("multisig", multisigPk2) + require.NoError(t, err) + + k, err := kb.Key("multisig") + require.NoError(t, err) + + _, err = MkAccKeyOutput(k, addresscodec.NewBech32Codec("cosmos")) + require.NoError(t, err) +} diff --git a/codec/codec.go b/codec/codec.go index c8c5844ac04b..3d9cfd771bc0 100644 --- a/codec/codec.go +++ b/codec/codec.go @@ -2,6 +2,7 @@ package codec import ( "github.com/cosmos/gogoproto/proto" + gogoprotoany "github.com/cosmos/gogoproto/types/any" "google.golang.org/grpc/encoding" "google.golang.org/protobuf/reflect/protoreflect" @@ -76,7 +77,7 @@ type ( // is not registered in codec, or is not compatible with the serialized data UnmarshalInterface(bz []byte, ptr interface{}) error - types.AnyUnpacker + gogoprotoany.AnyUnpacker } JSONCodec interface { diff --git a/codec/types/interface_registry.go b/codec/types/interface_registry.go index ca1d1e61e60b..ff0c23a9d14f 100644 --- a/codec/types/interface_registry.go +++ b/codec/types/interface_registry.go @@ -7,6 +7,7 @@ import ( "github.com/cosmos/gogoproto/jsonpb" "github.com/cosmos/gogoproto/proto" + gogoprotoany "github.com/cosmos/gogoproto/types/any" "google.golang.org/protobuf/reflect/protodesc" "google.golang.org/protobuf/reflect/protoreflect" "google.golang.org/protobuf/runtime/protoiface" @@ -15,47 +16,10 @@ import ( "cosmossdk.io/x/tx/signing" ) -// AnyUnpacker is an interface which allows safely unpacking types packed -// in Any's against a whitelist of registered types -type AnyUnpacker interface { - // UnpackAny unpacks the value in any to the interface pointer passed in as - // iface. Note that the type in any must have been registered in the - // underlying whitelist registry as a concrete type for that interface - // Ex: - // var msg sdk.Msg - // err := cdc.UnpackAny(any, &msg) - // ... - UnpackAny(any *Any, iface interface{}) error -} - -// UnpackInterfacesMessage is meant to extend protobuf types (which implement -// proto.Message) to support a post-deserialization phase which unpacks -// types packed within Any's using the whitelist provided by AnyUnpacker -type UnpackInterfacesMessage interface { - // UnpackInterfaces is implemented in order to unpack values packed within - // Any's using the AnyUnpacker. It should generally be implemented as - // follows: - // func (s *MyStruct) UnpackInterfaces(unpacker AnyUnpacker) error { - // var x AnyInterface - // // where X is an Any field on MyStruct - // err := unpacker.UnpackAny(s.X, &x) - // if err != nil { - // return nil - // } - // // where Y is a field on MyStruct that implements UnpackInterfacesMessage itself - // err = s.Y.UnpackInterfaces(unpacker) - // if err != nil { - // return nil - // } - // return nil - // } - UnpackInterfaces(unpacker AnyUnpacker) error -} - // UnpackInterfaces is a convenience function that calls UnpackInterfaces // on x if x implements UnpackInterfacesMessage -func UnpackInterfaces(x interface{}, unpacker AnyUnpacker) error { - if msg, ok := x.(UnpackInterfacesMessage); ok { +func UnpackInterfaces(x interface{}, unpacker gogoprotoany.AnyUnpacker) error { + if msg, ok := x.(gogoprotoany.UnpackInterfacesMessage); ok { return msg.UnpackInterfaces(unpacker) } return nil @@ -66,7 +30,7 @@ var protoMessageType = reflect.TypeOf((*proto.Message)(nil)).Elem() // InterfaceRegistry provides a mechanism for registering interfaces and // implementations that can be safely unpacked from Any type InterfaceRegistry interface { - AnyUnpacker + gogoprotoany.AnyUnpacker jsonpb.AnyResolver registry.InterfaceRegistrar diff --git a/crypto/keyring/legacy_info.go b/crypto/keyring/legacy_info.go index 47cbe3e9a920..48e5d664f11f 100644 --- a/crypto/keyring/legacy_info.go +++ b/crypto/keyring/legacy_info.go @@ -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) diff --git a/crypto/keyring/record.go b/crypto/keyring/record.go index 96141e4c906e..2e19c5b91576 100644 --- a/crypto/keyring/record.go +++ b/crypto/keyring/record.go @@ -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 diff --git a/crypto/keys/multisig/multisig.go b/crypto/keys/multisig/multisig.go index 623f25516164..1fc3f8e28098 100644 --- a/crypto/keys/multisig/multisig.go +++ b/crypto/keys/multisig/multisig.go @@ -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 } diff --git a/server/v2/cometbft/client/grpc/cmtservice/service.go b/server/v2/cometbft/client/grpc/cmtservice/service.go index 096889a5a2ae..05f65d4657be 100644 --- a/server/v2/cometbft/client/grpc/cmtservice/service.go +++ b/server/v2/cometbft/client/grpc/cmtservice/service.go @@ -5,15 +5,15 @@ import ( "fmt" "strings" + "cosmossdk.io/server/v2/cometbft/client/rpc" abci "github.com/cometbft/cometbft/api/cometbft/abci/v1" coretypes "github.com/cometbft/cometbft/rpc/core/types" gogogrpc "github.com/cosmos/gogoproto/grpc" + gogoprotoany "github.com/cosmos/gogoproto/types/any" "github.com/grpc-ecosystem/grpc-gateway/runtime" "google.golang.org/grpc/codes" "google.golang.org/grpc/status" - "cosmossdk.io/server/v2/cometbft/client/rpc" - codectypes "github.com/cosmos/cosmos-sdk/codec/types" cryptocodec "github.com/cosmos/cosmos-sdk/crypto/codec" cryptotypes "github.com/cosmos/cosmos-sdk/crypto/types" @@ -23,8 +23,8 @@ import ( ) var ( - _ ServiceServer = queryServer{} - _ codectypes.UnpackInterfacesMessage = &GetLatestValidatorSetResponse{} + _ ServiceServer = queryServer{} + _ gogoprotoany.UnpackInterfacesMessage = &GetLatestValidatorSetResponse{} ) type ( @@ -131,7 +131,7 @@ func (s queryServer) GetLatestValidatorSet( return ValidatorsOutput(ctx, s.client, nil, page, limit) } -func (m *GetLatestValidatorSetResponse) UnpackInterfaces(unpacker codectypes.AnyUnpacker) error { +func (m *GetLatestValidatorSetResponse) UnpackInterfaces(unpacker gogoprotoany.AnyUnpacker) error { var pubKey cryptotypes.PubKey for _, val := range m.Validators { err := unpacker.UnpackAny(val.PubKey, &pubKey) diff --git a/testutil/testdata/animal.go b/testutil/testdata/animal.go index 7d5afa615280..327b8851e1ea 100644 --- a/testutil/testdata/animal.go +++ b/testutil/testdata/animal.go @@ -4,8 +4,7 @@ import ( "fmt" "github.com/cosmos/gogoproto/proto" - - "github.com/cosmos/cosmos-sdk/codec/types" + gogoprotoany "github.com/cosmos/gogoproto/types/any" ) type Animal interface { @@ -32,9 +31,9 @@ func (d Dog) Greet() string { return fmt.Sprintf("Roof, my name is %s", d.Name) } -var _ types.UnpackInterfacesMessage = HasAnimal{} +var _ gogoprotoany.UnpackInterfacesMessage = HasAnimal{} -func (m HasAnimal) UnpackInterfaces(unpacker types.AnyUnpacker) error { +func (m HasAnimal) UnpackInterfaces(unpacker gogoprotoany.AnyUnpacker) error { var animal Animal return unpacker.UnpackAny(m.Animal, &animal) } @@ -59,9 +58,9 @@ func (m HasHasAnimal) TheHasAnimal() HasAnimalI { return m.HasAnimal.GetCachedValue().(HasAnimalI) } -var _ types.UnpackInterfacesMessage = HasHasAnimal{} +var _ gogoprotoany.UnpackInterfacesMessage = HasHasAnimal{} -func (m HasHasAnimal) UnpackInterfaces(unpacker types.AnyUnpacker) error { +func (m HasHasAnimal) UnpackInterfaces(unpacker gogoprotoany.AnyUnpacker) error { var animal HasAnimalI return unpacker.UnpackAny(m.HasAnimal, &animal) } @@ -76,9 +75,9 @@ func (m HasHasHasAnimal) TheHasHasAnimal() HasHasAnimalI { return m.HasHasAnimal.GetCachedValue().(HasHasAnimalI) } -var _ types.UnpackInterfacesMessage = HasHasHasAnimal{} +var _ gogoprotoany.UnpackInterfacesMessage = HasHasHasAnimal{} -func (m HasHasHasAnimal) UnpackInterfaces(unpacker types.AnyUnpacker) error { +func (m HasHasHasAnimal) UnpackInterfaces(unpacker gogoprotoany.AnyUnpacker) error { var animal HasHasAnimalI return unpacker.UnpackAny(m.HasHasAnimal, &animal) } diff --git a/testutil/testdata/grpc_query.go b/testutil/testdata/grpc_query.go index 1078f60b8b81..d4ca6c73d888 100644 --- a/testutil/testdata/grpc_query.go +++ b/testutil/testdata/grpc_query.go @@ -5,6 +5,7 @@ import ( "fmt" "testing" + gogoprotoany "github.com/cosmos/gogoproto/types/any" "github.com/cosmos/gogoproto/types/any/test" "github.com/cosmos/gogoproto/proto" @@ -49,16 +50,16 @@ func (e QueryImpl) SayHello(_ context.Context, request *SayHelloRequest) (*SayHe return &SayHelloResponse{Greeting: greeting}, nil } -var _ types.UnpackInterfacesMessage = &TestAnyRequest{} +var _ gogoprotoany.UnpackInterfacesMessage = &TestAnyRequest{} -func (m *TestAnyRequest) UnpackInterfaces(unpacker types.AnyUnpacker) error { +func (m *TestAnyRequest) UnpackInterfaces(unpacker gogoprotoany.AnyUnpacker) error { var animal test.Animal return unpacker.UnpackAny(m.AnyAnimal, &animal) } -var _ types.UnpackInterfacesMessage = &TestAnyResponse{} +var _ gogoprotoany.UnpackInterfacesMessage = &TestAnyResponse{} -func (m *TestAnyResponse) UnpackInterfaces(unpacker types.AnyUnpacker) error { +func (m *TestAnyResponse) UnpackInterfaces(unpacker gogoprotoany.AnyUnpacker) error { return m.HasAnimal.UnpackInterfaces(unpacker) } diff --git a/types/result.go b/types/result.go index 148847eecf2b..b4724151e9da 100644 --- a/types/result.go +++ b/types/result.go @@ -7,6 +7,7 @@ import ( cmtproto "github.com/cometbft/cometbft/api/cometbft/types/v1" coretypes "github.com/cometbft/cometbft/rpc/core/types" + gogoprotoany "github.com/cosmos/gogoproto/types/any" "github.com/cosmos/cosmos-sdk/codec" codectypes "github.com/cosmos/cosmos-sdk/codec/types" @@ -159,13 +160,13 @@ func ParseABCILogs(logs string) (res ABCIMessageLogs, err error) { return res, err } -var _, _ codectypes.UnpackInterfacesMessage = SearchTxsResult{}, TxResponse{} +var _, _ gogoprotoany.UnpackInterfacesMessage = SearchTxsResult{}, TxResponse{} // UnpackInterfaces implements UnpackInterfacesMessage.UnpackInterfaces // // types.UnpackInterfaces needs to be called for each nested Tx because // there are generally interfaces to unpack in Tx's -func (s SearchTxsResult) UnpackInterfaces(unpacker codectypes.AnyUnpacker) error { +func (s SearchTxsResult) UnpackInterfaces(unpacker gogoprotoany.AnyUnpacker) error { for _, tx := range s.Txs { err := codectypes.UnpackInterfaces(tx, unpacker) if err != nil { @@ -176,7 +177,7 @@ func (s SearchTxsResult) UnpackInterfaces(unpacker codectypes.AnyUnpacker) error } // UnpackInterfaces implements UnpackInterfacesMessage.UnpackInterfaces -func (r TxResponse) UnpackInterfaces(unpacker codectypes.AnyUnpacker) error { +func (r TxResponse) UnpackInterfaces(unpacker gogoprotoany.AnyUnpacker) error { if r.Tx != nil { var tx HasMsgs return unpacker.UnpackAny(r.Tx, &tx) diff --git a/types/tx/direct_aux.go b/types/tx/direct_aux.go index 52c9fc214a8e..d685a837ad29 100644 --- a/types/tx/direct_aux.go +++ b/types/tx/direct_aux.go @@ -1,7 +1,8 @@ package tx import ( - codectypes "github.com/cosmos/cosmos-sdk/codec/types" + gogoprotoany "github.com/cosmos/gogoproto/types/any" + cryptotypes "github.com/cosmos/cosmos-sdk/crypto/types" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" "github.com/cosmos/cosmos-sdk/types/tx/signing" @@ -21,7 +22,7 @@ func (s *SignDocDirectAux) ValidateBasic() error { } // UnpackInterfaces implements the UnpackInterfaceMessages.UnpackInterfaces method -func (s *SignDocDirectAux) UnpackInterfaces(unpacker codectypes.AnyUnpacker) error { +func (s *SignDocDirectAux) UnpackInterfaces(unpacker gogoprotoany.AnyUnpacker) error { return unpacker.UnpackAny(s.PublicKey, new(cryptotypes.PubKey)) } @@ -60,6 +61,6 @@ func (a *AuxSignerData) GetSignatureV2() (signing.SignatureV2, error) { } // UnpackInterfaces implements the UnpackInterfaceMessages.UnpackInterfaces method -func (a *AuxSignerData) UnpackInterfaces(unpacker codectypes.AnyUnpacker) error { +func (a *AuxSignerData) UnpackInterfaces(unpacker gogoprotoany.AnyUnpacker) error { return a.GetSignDoc().UnpackInterfaces(unpacker) } diff --git a/types/tx/ext.go b/types/tx/ext.go index fb2e1ed448bc..e51be337d5b1 100644 --- a/types/tx/ext.go +++ b/types/tx/ext.go @@ -1,6 +1,8 @@ package tx import ( + gogoprotoany "github.com/cosmos/gogoproto/types/any" + "github.com/cosmos/cosmos-sdk/codec/types" ) @@ -8,7 +10,7 @@ import ( type TxExtensionOptionI interface{} // unpackTxExtensionOptionsI unpacks Any's to TxExtensionOptionI's. -func unpackTxExtensionOptionsI(unpacker types.AnyUnpacker, anys []*types.Any) error { +func unpackTxExtensionOptionsI(unpacker gogoprotoany.AnyUnpacker, anys []*types.Any) error { for _, any := range anys { var opt TxExtensionOptionI err := unpacker.UnpackAny(any, &opt) diff --git a/types/tx/msgs.go b/types/tx/msgs.go index 2f2f9a80f912..036f9a2414c8 100644 --- a/types/tx/msgs.go +++ b/types/tx/msgs.go @@ -3,6 +3,8 @@ package tx import ( "fmt" + gogoprotoany "github.com/cosmos/gogoproto/types/any" + "github.com/cosmos/cosmos-sdk/codec/types" sdk "github.com/cosmos/cosmos-sdk/types" ) @@ -53,7 +55,7 @@ func GetMsgs(anys []*types.Any, name string) ([]sdk.Msg, error) { } // UnpackInterfaces unpacks Any's to sdk.Msg's. -func UnpackInterfaces(unpacker types.AnyUnpacker, anys []*types.Any) error { +func UnpackInterfaces(unpacker gogoprotoany.AnyUnpacker, anys []*types.Any) error { for _, any := range anys { var msg sdk.Msg err := unpacker.UnpackAny(any, &msg) diff --git a/types/tx/signing/signature.go b/types/tx/signing/signature.go index a9549bab9a12..a27ea27b86eb 100644 --- a/types/tx/signing/signature.go +++ b/types/tx/signing/signature.go @@ -3,7 +3,8 @@ package signing import ( "fmt" - codectypes "github.com/cosmos/cosmos-sdk/codec/types" + gogoprotoany "github.com/cosmos/gogoproto/types/any" + cryptotypes "github.com/cosmos/cosmos-sdk/crypto/types" ) @@ -86,10 +87,10 @@ func SignatureDataFromProto(descData *SignatureDescriptor_Data) SignatureData { } } -var _, _ codectypes.UnpackInterfacesMessage = &SignatureDescriptors{}, &SignatureDescriptor{} +var _, _ gogoprotoany.UnpackInterfacesMessage = &SignatureDescriptors{}, &SignatureDescriptor{} // UnpackInterfaces implements the UnpackInterfaceMessages.UnpackInterfaces method -func (sds *SignatureDescriptors) UnpackInterfaces(unpacker codectypes.AnyUnpacker) error { +func (sds *SignatureDescriptors) UnpackInterfaces(unpacker gogoprotoany.AnyUnpacker) error { for _, sig := range sds.Signatures { err := sig.UnpackInterfaces(unpacker) if err != nil { @@ -101,6 +102,6 @@ func (sds *SignatureDescriptors) UnpackInterfaces(unpacker codectypes.AnyUnpacke } // UnpackInterfaces implements the UnpackInterfaceMessages.UnpackInterfaces method -func (sd *SignatureDescriptor) UnpackInterfaces(unpacker codectypes.AnyUnpacker) error { +func (sd *SignatureDescriptor) UnpackInterfaces(unpacker gogoprotoany.AnyUnpacker) error { return unpacker.UnpackAny(sd.PublicKey, new(cryptotypes.PubKey)) } diff --git a/types/tx/types.go b/types/tx/types.go index c5a2e91ef37e..cc64047393cf 100644 --- a/types/tx/types.go +++ b/types/tx/types.go @@ -3,13 +3,13 @@ package tx import ( "fmt" + gogoprotoany "github.com/cosmos/gogoproto/types/any" "google.golang.org/protobuf/reflect/protoreflect" "cosmossdk.io/core/registry" errorsmod "cosmossdk.io/errors" "github.com/cosmos/cosmos-sdk/codec" - codectypes "github.com/cosmos/cosmos-sdk/codec/types" cryptotypes "github.com/cosmos/cosmos-sdk/crypto/types" sdk "github.com/cosmos/cosmos-sdk/types" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" @@ -20,7 +20,7 @@ const MaxGasWanted = uint64((1 << 63) - 1) // Interface implementation checks. var ( - _, _, _, _ codectypes.UnpackInterfacesMessage = &Tx{}, &TxBody{}, &AuthInfo{}, &SignerInfo{} + _, _, _, _ gogoprotoany.UnpackInterfacesMessage = &Tx{}, &TxBody{}, &AuthInfo{}, &SignerInfo{} ) // GetMsgs implements the GetMsgs method on sdk.Tx. @@ -177,7 +177,7 @@ func (t *Tx) FeeGranter(cdc codec.Codec) []byte { } // UnpackInterfaces implements the UnpackInterfaceMessages.UnpackInterfaces method -func (t *Tx) UnpackInterfaces(unpacker codectypes.AnyUnpacker) error { +func (t *Tx) UnpackInterfaces(unpacker gogoprotoany.AnyUnpacker) error { if t.Body != nil { if err := t.Body.UnpackInterfaces(unpacker); err != nil { return err @@ -192,7 +192,7 @@ func (t *Tx) UnpackInterfaces(unpacker codectypes.AnyUnpacker) error { } // UnpackInterfaces implements the UnpackInterfaceMessages.UnpackInterfaces method -func (m *TxBody) UnpackInterfaces(unpacker codectypes.AnyUnpacker) error { +func (m *TxBody) UnpackInterfaces(unpacker gogoprotoany.AnyUnpacker) error { if err := UnpackInterfaces(unpacker, m.Messages); err != nil { return err } @@ -209,7 +209,7 @@ func (m *TxBody) UnpackInterfaces(unpacker codectypes.AnyUnpacker) error { } // UnpackInterfaces implements the UnpackInterfaceMessages.UnpackInterfaces method -func (m *AuthInfo) UnpackInterfaces(unpacker codectypes.AnyUnpacker) error { +func (m *AuthInfo) UnpackInterfaces(unpacker gogoprotoany.AnyUnpacker) error { for _, signerInfo := range m.SignerInfos { err := signerInfo.UnpackInterfaces(unpacker) if err != nil { @@ -220,7 +220,7 @@ func (m *AuthInfo) UnpackInterfaces(unpacker codectypes.AnyUnpacker) error { } // UnpackInterfaces implements the UnpackInterfaceMessages.UnpackInterfaces method -func (m *SignerInfo) UnpackInterfaces(unpacker codectypes.AnyUnpacker) error { +func (m *SignerInfo) UnpackInterfaces(unpacker gogoprotoany.AnyUnpacker) error { return unpacker.UnpackAny(m.PublicKey, new(cryptotypes.PubKey)) } diff --git a/x/auth/migrations/legacytx/stdsign.go b/x/auth/migrations/legacytx/stdsign.go index e8d00f67594c..04e131768ac2 100644 --- a/x/auth/migrations/legacytx/stdsign.go +++ b/x/auth/migrations/legacytx/stdsign.go @@ -4,6 +4,7 @@ import ( "encoding/json" "fmt" + gogoprotoany "github.com/cosmos/gogoproto/types/any" "sigs.k8s.io/yaml" "cosmossdk.io/errors" @@ -129,7 +130,7 @@ func (ss StdSignature) MarshalYAML() (interface{}, error) { return string(bz), err } -func (ss StdSignature) UnpackInterfaces(unpacker codectypes.AnyUnpacker) error { +func (ss StdSignature) UnpackInterfaces(unpacker gogoprotoany.AnyUnpacker) error { return codectypes.UnpackInterfaces(ss.PubKey, unpacker) } diff --git a/x/auth/migrations/legacytx/stdsignmsg.go b/x/auth/migrations/legacytx/stdsignmsg.go index 561a64463f50..1fd8c585015f 100644 --- a/x/auth/migrations/legacytx/stdsignmsg.go +++ b/x/auth/migrations/legacytx/stdsignmsg.go @@ -1,11 +1,13 @@ package legacytx import ( + gogoprotoany "github.com/cosmos/gogoproto/types/any" + "github.com/cosmos/cosmos-sdk/codec/types" sdk "github.com/cosmos/cosmos-sdk/types" ) -var _ types.UnpackInterfacesMessage = StdSignMsg{} +var _ gogoprotoany.UnpackInterfacesMessage = StdSignMsg{} // StdSignMsg is a convenience structure for passing along a Msg with the other // requirements for a StdSignDoc before it is signed. For use in the CLI. @@ -19,7 +21,7 @@ type StdSignMsg struct { Memo string `json:"memo" yaml:"memo"` } -func (msg StdSignMsg) UnpackInterfaces(unpacker types.AnyUnpacker) error { +func (msg StdSignMsg) UnpackInterfaces(unpacker gogoprotoany.AnyUnpacker) error { for _, m := range msg.Msgs { err := types.UnpackInterfaces(m, unpacker) if err != nil { diff --git a/x/auth/migrations/legacytx/stdtx.go b/x/auth/migrations/legacytx/stdtx.go index dc5dba098860..5e67518716d5 100644 --- a/x/auth/migrations/legacytx/stdtx.go +++ b/x/auth/migrations/legacytx/stdtx.go @@ -1,6 +1,8 @@ package legacytx import ( + gogoprotoany "github.com/cosmos/gogoproto/types/any" + errorsmod "cosmossdk.io/errors" "cosmossdk.io/math" @@ -13,9 +15,9 @@ import ( // Interface implementation checks var ( - _ codectypes.UnpackInterfacesMessage = (*StdTx)(nil) + _ gogoprotoany.UnpackInterfacesMessage = (*StdTx)(nil) - _ codectypes.UnpackInterfacesMessage = (*StdSignature)(nil) + _ gogoprotoany.UnpackInterfacesMessage = (*StdSignature)(nil) ) // StdFee includes the amount of coins paid in fees and the maximum @@ -169,7 +171,7 @@ func (tx StdTx) FeeGranter() sdk.AccAddress { return nil } -func (tx StdTx) UnpackInterfaces(unpacker codectypes.AnyUnpacker) error { +func (tx StdTx) UnpackInterfaces(unpacker gogoprotoany.AnyUnpacker) error { for _, m := range tx.Msgs { err := codectypes.UnpackInterfaces(m, unpacker) if err != nil { diff --git a/x/auth/types/account.go b/x/auth/types/account.go index 791803174b5c..f2147d75bd54 100644 --- a/x/auth/types/account.go +++ b/x/auth/types/account.go @@ -7,6 +7,8 @@ import ( "fmt" "strings" + gogoprotoany "github.com/cosmos/gogoproto/types/any" + codectypes "github.com/cosmos/cosmos-sdk/codec/types" cryptotypes "github.com/cosmos/cosmos-sdk/crypto/types" sdk "github.com/cosmos/cosmos-sdk/types" @@ -14,11 +16,11 @@ import ( ) var ( - _ sdk.AccountI = (*BaseAccount)(nil) - _ GenesisAccount = (*BaseAccount)(nil) - _ codectypes.UnpackInterfacesMessage = (*BaseAccount)(nil) - _ GenesisAccount = (*ModuleAccount)(nil) - _ sdk.ModuleAccountI = (*ModuleAccount)(nil) + _ sdk.AccountI = (*BaseAccount)(nil) + _ GenesisAccount = (*BaseAccount)(nil) + _ gogoprotoany.UnpackInterfacesMessage = (*BaseAccount)(nil) + _ GenesisAccount = (*ModuleAccount)(nil) + _ sdk.ModuleAccountI = (*ModuleAccount)(nil) ) // NewBaseAccount creates a new BaseAccount object. @@ -132,7 +134,7 @@ func (acc BaseAccount) Validate() error { } // UnpackInterfaces implements UnpackInterfacesMessage.UnpackInterfaces -func (acc BaseAccount) UnpackInterfaces(unpacker codectypes.AnyUnpacker) error { +func (acc BaseAccount) UnpackInterfaces(unpacker gogoprotoany.AnyUnpacker) error { if acc.PubKey == nil { return nil } diff --git a/x/auth/types/genesis.go b/x/auth/types/genesis.go index b31c686bc43f..d0b6db9dbefd 100644 --- a/x/auth/types/genesis.go +++ b/x/auth/types/genesis.go @@ -7,6 +7,7 @@ import ( "sort" "github.com/cosmos/gogoproto/proto" + gogoprotoany "github.com/cosmos/gogoproto/types/any" "github.com/cosmos/cosmos-sdk/codec" "github.com/cosmos/cosmos-sdk/codec/types" @@ -14,7 +15,7 @@ import ( "github.com/cosmos/cosmos-sdk/types/module" ) -var _ types.UnpackInterfacesMessage = GenesisState{} +var _ gogoprotoany.UnpackInterfacesMessage = GenesisState{} // RandomGenesisAccountsFn defines the function required to generate custom account types type RandomGenesisAccountsFn func(simState *module.SimulationState) GenesisAccounts @@ -32,7 +33,7 @@ func NewGenesisState(params Params, accounts GenesisAccounts) *GenesisState { } // UnpackInterfaces implements UnpackInterfacesMessage.UnpackInterfaces -func (g GenesisState) UnpackInterfaces(unpacker types.AnyUnpacker) error { +func (g GenesisState) UnpackInterfaces(unpacker gogoprotoany.AnyUnpacker) error { for _, any := range g.Accounts { var account GenesisAccount err := unpacker.UnpackAny(any, &account) diff --git a/x/auth/types/query.go b/x/auth/types/query.go index 8ab9df38f9f0..96b089e18a74 100644 --- a/x/auth/types/query.go +++ b/x/auth/types/query.go @@ -1,13 +1,14 @@ package types import ( - codectypes "github.com/cosmos/cosmos-sdk/codec/types" + gogoprotoany "github.com/cosmos/gogoproto/types/any" + sdk "github.com/cosmos/cosmos-sdk/types" ) -func (m *QueryAccountResponse) UnpackInterfaces(unpacker codectypes.AnyUnpacker) error { +func (m *QueryAccountResponse) UnpackInterfaces(unpacker gogoprotoany.AnyUnpacker) error { var account sdk.AccountI return unpacker.UnpackAny(m.Account, &account) } -var _ codectypes.UnpackInterfacesMessage = &QueryAccountResponse{} +var _ gogoprotoany.UnpackInterfacesMessage = &QueryAccountResponse{} diff --git a/x/authz/authorization_grant.go b/x/authz/authorization_grant.go index 9dd8aced3791..c054eb081403 100644 --- a/x/authz/authorization_grant.go +++ b/x/authz/authorization_grant.go @@ -4,10 +4,10 @@ import ( "time" "github.com/cosmos/gogoproto/proto" + gogoprotoany "github.com/cosmos/gogoproto/types/any" errorsmod "cosmossdk.io/errors" - cdctypes "github.com/cosmos/cosmos-sdk/codec/types" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" ) @@ -22,7 +22,7 @@ func NewGrant(blockTime time.Time, a Authorization, expiration *time.Time) (Gran if !ok { return Grant{}, sdkerrors.ErrPackAny.Wrapf("cannot proto marshal %T", a) } - any, err := cdctypes.NewAnyWithValue(msg) + any, err := gogoprotoany.NewAnyWithCacheWithValue(msg) if err != nil { return Grant{}, err } @@ -32,10 +32,10 @@ func NewGrant(blockTime time.Time, a Authorization, expiration *time.Time) (Gran }, nil } -var _ cdctypes.UnpackInterfacesMessage = &Grant{} +var _ gogoprotoany.UnpackInterfacesMessage = &Grant{} // UnpackInterfaces implements UnpackInterfacesMessage.UnpackInterfaces -func (g Grant) UnpackInterfaces(unpacker cdctypes.AnyUnpacker) error { +func (g Grant) UnpackInterfaces(unpacker gogoprotoany.AnyUnpacker) error { var authorization Authorization return unpacker.UnpackAny(g.Authorization, &authorization) } diff --git a/x/authz/genesis.go b/x/authz/genesis.go index 2e7dde1b7260..f2afc47cad91 100644 --- a/x/authz/genesis.go +++ b/x/authz/genesis.go @@ -3,7 +3,7 @@ package authz import ( "fmt" - cdctypes "github.com/cosmos/cosmos-sdk/codec/types" + gogoprotoany "github.com/cosmos/gogoproto/types/any" ) // NewGenesisState creates new GenesisState object @@ -32,10 +32,10 @@ func DefaultGenesisState() *GenesisState { return &GenesisState{} } -var _ cdctypes.UnpackInterfacesMessage = GenesisState{} +var _ gogoprotoany.UnpackInterfacesMessage = GenesisState{} // UnpackInterfaces implements UnpackInterfacesMessage.UnpackInterfaces -func (data GenesisState) UnpackInterfaces(unpacker cdctypes.AnyUnpacker) error { +func (data GenesisState) UnpackInterfaces(unpacker gogoprotoany.AnyUnpacker) error { for _, a := range data.Authorization { err := a.UnpackInterfaces(unpacker) if err != nil { @@ -46,7 +46,7 @@ func (data GenesisState) UnpackInterfaces(unpacker cdctypes.AnyUnpacker) error { } // UnpackInterfaces implements UnpackInterfacesMessage.UnpackInterfaces -func (msg GrantAuthorization) UnpackInterfaces(unpacker cdctypes.AnyUnpacker) error { +func (msg GrantAuthorization) UnpackInterfaces(unpacker gogoprotoany.AnyUnpacker) error { var a Authorization return unpacker.UnpackAny(msg.Authorization, &a) } diff --git a/x/authz/msgs.go b/x/authz/msgs.go index 0964f45cb34b..b7c7c6c9cd30 100644 --- a/x/authz/msgs.go +++ b/x/authz/msgs.go @@ -4,6 +4,7 @@ import ( "time" "github.com/cosmos/gogoproto/proto" + gogoprotoany "github.com/cosmos/gogoproto/types/any" cdctypes "github.com/cosmos/cosmos-sdk/codec/types" sdk "github.com/cosmos/cosmos-sdk/types" @@ -15,8 +16,8 @@ var ( _ sdk.Msg = &MsgRevoke{} _ sdk.Msg = &MsgExec{} - _ cdctypes.UnpackInterfacesMessage = &MsgGrant{} - _ cdctypes.UnpackInterfacesMessage = &MsgExec{} + _ gogoprotoany.UnpackInterfacesMessage = &MsgGrant{} + _ gogoprotoany.UnpackInterfacesMessage = &MsgExec{} ) // NewMsgGrant creates a new MsgGrant @@ -44,7 +45,7 @@ func (msg *MsgGrant) SetAuthorization(a Authorization) error { if !ok { return sdkerrors.ErrPackAny.Wrapf("can't proto marshal %T", m) } - any, err := cdctypes.NewAnyWithValue(m) + any, err := gogoprotoany.NewAnyWithCacheWithValue(m) if err != nil { return err } @@ -53,7 +54,7 @@ func (msg *MsgGrant) SetAuthorization(a Authorization) error { } // UnpackInterfaces implements UnpackInterfacesMessage.UnpackInterfaces -func (msg MsgExec) UnpackInterfaces(unpacker cdctypes.AnyUnpacker) error { +func (msg MsgExec) UnpackInterfaces(unpacker gogoprotoany.AnyUnpacker) error { for _, x := range msg.Msgs { var msgExecAuthorized sdk.Msg err := unpacker.UnpackAny(x, &msgExecAuthorized) @@ -66,7 +67,7 @@ func (msg MsgExec) UnpackInterfaces(unpacker cdctypes.AnyUnpacker) error { } // UnpackInterfaces implements UnpackInterfacesMessage.UnpackInterfaces -func (msg MsgGrant) UnpackInterfaces(unpacker cdctypes.AnyUnpacker) error { +func (msg MsgGrant) UnpackInterfaces(unpacker gogoprotoany.AnyUnpacker) error { return msg.Grant.UnpackInterfaces(unpacker) } diff --git a/x/authz/simulation/operations.go b/x/authz/simulation/operations.go index ec62f5196b2f..374a451cfc23 100644 --- a/x/authz/simulation/operations.go +++ b/x/authz/simulation/operations.go @@ -5,6 +5,8 @@ import ( "math/rand" "time" + gogoprotoany "github.com/cosmos/gogoproto/types/any" + "cosmossdk.io/core/address" "cosmossdk.io/core/appmodule" corecontext "cosmossdk.io/core/context" @@ -260,7 +262,7 @@ func SimulateMsgExec( ak authz.AccountKeeper, bk authz.BankKeeper, k keeper.Keeper, - unpacker cdctypes.AnyUnpacker, + unpacker gogoprotoany.AnyUnpacker, ) simtypes.Operation { return func( r *rand.Rand, app *baseapp.BaseApp, ctx sdk.Context, accs []simtypes.Account, chainID string, diff --git a/x/evidence/types/genesis.go b/x/evidence/types/genesis.go index d9ccaefbe729..e5c683831663 100644 --- a/x/evidence/types/genesis.go +++ b/x/evidence/types/genesis.go @@ -4,13 +4,14 @@ import ( "fmt" "github.com/cosmos/gogoproto/proto" + gogoprotoany "github.com/cosmos/gogoproto/types/any" "cosmossdk.io/x/evidence/exported" "github.com/cosmos/cosmos-sdk/codec/types" ) -var _ types.UnpackInterfacesMessage = GenesisState{} +var _ gogoprotoany.UnpackInterfacesMessage = GenesisState{} // NewGenesisState creates a new genesis state for the evidence module. func NewGenesisState(e []exported.Evidence) *GenesisState { @@ -55,7 +56,7 @@ func (gs GenesisState) Validate() error { } // UnpackInterfaces implements UnpackInterfacesMessage.UnpackInterfaces -func (gs GenesisState) UnpackInterfaces(unpacker types.AnyUnpacker) error { +func (gs GenesisState) UnpackInterfaces(unpacker gogoprotoany.AnyUnpacker) error { for _, any := range gs.Evidence { var evi exported.Evidence err := unpacker.UnpackAny(any, &evi) diff --git a/x/evidence/types/genesis_test.go b/x/evidence/types/genesis_test.go index 20b5967ac2eb..786b2103f762 100644 --- a/x/evidence/types/genesis_test.go +++ b/x/evidence/types/genesis_test.go @@ -5,6 +5,7 @@ import ( "testing" "time" + gogoprotoany "github.com/cosmos/gogoproto/types/any" "github.com/stretchr/testify/require" "cosmossdk.io/x/evidence/exported" @@ -130,7 +131,7 @@ func TestUnpackInterfaces(t *testing.T) { testCases := []struct { msg string - unpacker codectypes.AnyUnpacker + unpacker gogoprotoany.AnyUnpacker expPass bool }{ { diff --git a/x/evidence/types/msgs.go b/x/evidence/types/msgs.go index 92df414692a5..03e70b5ab7df 100644 --- a/x/evidence/types/msgs.go +++ b/x/evidence/types/msgs.go @@ -4,6 +4,7 @@ import ( "fmt" "github.com/cosmos/gogoproto/proto" + gogoprotoany "github.com/cosmos/gogoproto/types/any" "cosmossdk.io/x/evidence/exported" @@ -12,9 +13,9 @@ import ( ) var ( - _ sdk.Msg = &MsgSubmitEvidence{} - _ types.UnpackInterfacesMessage = MsgSubmitEvidence{} - _ exported.MsgSubmitEvidenceI = &MsgSubmitEvidence{} + _ sdk.Msg = &MsgSubmitEvidence{} + _ gogoprotoany.UnpackInterfacesMessage = MsgSubmitEvidence{} + _ exported.MsgSubmitEvidenceI = &MsgSubmitEvidence{} ) // NewMsgSubmitEvidence returns a new MsgSubmitEvidence with a signer/submitter. @@ -51,7 +52,7 @@ func (m MsgSubmitEvidence) GetSubmitter() sdk.AccAddress { return accAddr } -func (m MsgSubmitEvidence) UnpackInterfaces(ctx types.AnyUnpacker) error { +func (m MsgSubmitEvidence) UnpackInterfaces(ctx gogoprotoany.AnyUnpacker) error { var evi exported.Evidence return ctx.UnpackAny(m.Evidence, &evi) } diff --git a/x/feegrant/filtered_fee.go b/x/feegrant/filtered_fee.go index 6e001ef947e9..a6c0d537a3f6 100644 --- a/x/feegrant/filtered_fee.go +++ b/x/feegrant/filtered_fee.go @@ -6,6 +6,7 @@ import ( "time" "github.com/cosmos/gogoproto/proto" + gogoprotoany "github.com/cosmos/gogoproto/types/any" "cosmossdk.io/core/appmodule" corecontext "cosmossdk.io/core/context" @@ -23,12 +24,12 @@ const ( ) var ( - _ FeeAllowanceI = (*AllowedMsgAllowance)(nil) - _ types.UnpackInterfacesMessage = (*AllowedMsgAllowance)(nil) + _ FeeAllowanceI = (*AllowedMsgAllowance)(nil) + _ gogoprotoany.UnpackInterfacesMessage = (*AllowedMsgAllowance)(nil) ) // UnpackInterfaces implements UnpackInterfacesMessage.UnpackInterfaces -func (a *AllowedMsgAllowance) UnpackInterfaces(unpacker types.AnyUnpacker) error { +func (a *AllowedMsgAllowance) UnpackInterfaces(unpacker gogoprotoany.AnyUnpacker) error { var allowance FeeAllowanceI return unpacker.UnpackAny(a.Allowance, &allowance) } diff --git a/x/feegrant/genesis.go b/x/feegrant/genesis.go index 83b29baeb85d..71ddf943a3e3 100644 --- a/x/feegrant/genesis.go +++ b/x/feegrant/genesis.go @@ -1,10 +1,10 @@ package feegrant import ( - "github.com/cosmos/cosmos-sdk/codec/types" + gogoprotoany "github.com/cosmos/gogoproto/types/any" ) -var _ types.UnpackInterfacesMessage = GenesisState{} +var _ gogoprotoany.UnpackInterfacesMessage = GenesisState{} // NewGenesisState creates new GenesisState object func NewGenesisState(entries []Grant) *GenesisState { @@ -34,7 +34,7 @@ func DefaultGenesisState() *GenesisState { } // UnpackInterfaces implements UnpackInterfacesMessage.UnpackInterfaces -func (data GenesisState) UnpackInterfaces(unpacker types.AnyUnpacker) error { +func (data GenesisState) UnpackInterfaces(unpacker gogoprotoany.AnyUnpacker) error { for _, f := range data.Allowances { err := f.UnpackInterfaces(unpacker) if err != nil { diff --git a/x/feegrant/grant.go b/x/feegrant/grant.go index 0fb85dd5a226..a483475c6b41 100644 --- a/x/feegrant/grant.go +++ b/x/feegrant/grant.go @@ -2,6 +2,7 @@ package feegrant import ( "github.com/cosmos/gogoproto/proto" + gogoprotoany "github.com/cosmos/gogoproto/types/any" errorsmod "cosmossdk.io/errors" @@ -9,7 +10,7 @@ import ( sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" ) -var _ types.UnpackInterfacesMessage = &Grant{} +var _ gogoprotoany.UnpackInterfacesMessage = &Grant{} // NewGrant creates a new FeeAllowanceGrant. func NewGrant(granter, grantee string, feeAllowance FeeAllowanceI) (Grant, error) { @@ -62,7 +63,7 @@ func (a Grant) GetGrant() (FeeAllowanceI, error) { } // UnpackInterfaces implements UnpackInterfacesMessage.UnpackInterfaces -func (a Grant) UnpackInterfaces(unpacker types.AnyUnpacker) error { +func (a Grant) UnpackInterfaces(unpacker gogoprotoany.AnyUnpacker) error { var allowance FeeAllowanceI return unpacker.UnpackAny(a.Allowance, &allowance) } diff --git a/x/feegrant/msgs.go b/x/feegrant/msgs.go index c049c73d4f3f..e79c5ce39ab9 100644 --- a/x/feegrant/msgs.go +++ b/x/feegrant/msgs.go @@ -2,6 +2,7 @@ package feegrant import ( "github.com/cosmos/gogoproto/proto" + gogoprotoany "github.com/cosmos/gogoproto/types/any" errorsmod "cosmossdk.io/errors" @@ -11,8 +12,8 @@ import ( ) var ( - _, _ sdk.Msg = &MsgGrantAllowance{}, &MsgRevokeAllowance{} - _ types.UnpackInterfacesMessage = &MsgGrantAllowance{} + _, _ sdk.Msg = &MsgGrantAllowance{}, &MsgRevokeAllowance{} + _ gogoprotoany.UnpackInterfacesMessage = &MsgGrantAllowance{} ) // NewMsgGrantAllowance creates a new MsgGrantAllowance. @@ -44,7 +45,7 @@ func (msg MsgGrantAllowance) GetFeeAllowanceI() (FeeAllowanceI, error) { } // UnpackInterfaces implements UnpackInterfacesMessage.UnpackInterfaces -func (msg MsgGrantAllowance) UnpackInterfaces(unpacker types.AnyUnpacker) error { +func (msg MsgGrantAllowance) UnpackInterfaces(unpacker gogoprotoany.AnyUnpacker) error { var allowance FeeAllowanceI return unpacker.UnpackAny(msg.Allowance, &allowance) } diff --git a/x/gov/types/v1/genesis.go b/x/gov/types/v1/genesis.go index 21721e4b024e..e4a8ae280509 100644 --- a/x/gov/types/v1/genesis.go +++ b/x/gov/types/v1/genesis.go @@ -4,11 +4,10 @@ import ( "errors" "fmt" + gogoprotoany "github.com/cosmos/gogoproto/types/any" "golang.org/x/sync/errgroup" "cosmossdk.io/core/address" - - "github.com/cosmos/cosmos-sdk/codec/types" ) // NewGenesisState creates a new genesis state for the governance module @@ -107,10 +106,10 @@ func ValidateGenesis(ac address.Codec, data *GenesisState) error { return errGroup.Wait() } -var _ types.UnpackInterfacesMessage = GenesisState{} +var _ gogoprotoany.UnpackInterfacesMessage = GenesisState{} // UnpackInterfaces implements UnpackInterfacesMessage.UnpackInterfaces -func (data GenesisState) UnpackInterfaces(unpacker types.AnyUnpacker) error { +func (data GenesisState) UnpackInterfaces(unpacker gogoprotoany.AnyUnpacker) error { for _, p := range data.Proposals { err := p.UnpackInterfaces(unpacker) if err != nil { diff --git a/x/gov/types/v1/msgs.go b/x/gov/types/v1/msgs.go index d25a9ed33aad..70b4b90c5c73 100644 --- a/x/gov/types/v1/msgs.go +++ b/x/gov/types/v1/msgs.go @@ -4,6 +4,8 @@ import ( "errors" "fmt" + gogoprotoany "github.com/cosmos/gogoproto/types/any" + "cosmossdk.io/x/gov/types/v1beta1" codectypes "github.com/cosmos/cosmos-sdk/codec/types" @@ -12,8 +14,8 @@ import ( ) var ( - _, _, _, _, _, _, _, _ sdk.Msg = &MsgSubmitProposal{}, &MsgDeposit{}, &MsgVote{}, &MsgVoteWeighted{}, &MsgExecLegacyContent{}, &MsgUpdateParams{}, &MsgCancelProposal{}, &MsgSubmitMultipleChoiceProposal{} - _, _ codectypes.UnpackInterfacesMessage = &MsgSubmitProposal{}, &MsgExecLegacyContent{} + _, _, _, _, _, _, _, _ sdk.Msg = &MsgSubmitProposal{}, &MsgDeposit{}, &MsgVote{}, &MsgVoteWeighted{}, &MsgExecLegacyContent{}, &MsgUpdateParams{}, &MsgCancelProposal{}, &MsgSubmitMultipleChoiceProposal{} + _, _ gogoprotoany.UnpackInterfacesMessage = &MsgSubmitProposal{}, &MsgExecLegacyContent{} ) // NewMsgSubmitProposal creates a new MsgSubmitProposal. @@ -60,7 +62,7 @@ func (m *MsgSubmitProposal) SetMsgs(msgs []sdk.Msg) error { } // UnpackInterfaces implements UnpackInterfacesMessage.UnpackInterfaces -func (m MsgSubmitProposal) UnpackInterfaces(unpacker codectypes.AnyUnpacker) error { +func (m MsgSubmitProposal) UnpackInterfaces(unpacker gogoprotoany.AnyUnpacker) error { return sdktx.UnpackInterfaces(unpacker, m.Messages) } @@ -120,7 +122,7 @@ func (c MsgExecLegacyContent) ValidateBasic() error { } // UnpackInterfaces implements UnpackInterfacesMessage.UnpackInterfaces -func (c MsgExecLegacyContent) UnpackInterfaces(unpacker codectypes.AnyUnpacker) error { +func (c MsgExecLegacyContent) UnpackInterfaces(unpacker gogoprotoany.AnyUnpacker) error { var content v1beta1.Content return unpacker.UnpackAny(c.Content, &content) } diff --git a/x/gov/types/v1/proposal.go b/x/gov/types/v1/proposal.go index be5931c217ae..e9a901934c58 100644 --- a/x/gov/types/v1/proposal.go +++ b/x/gov/types/v1/proposal.go @@ -5,7 +5,8 @@ import ( "strings" "time" - codectypes "github.com/cosmos/cosmos-sdk/codec/types" + gogoprotoany "github.com/cosmos/gogoproto/types/any" + sdk "github.com/cosmos/cosmos-sdk/types" sdktx "github.com/cosmos/cosmos-sdk/types/tx" ) @@ -74,14 +75,14 @@ func (p Proposal) GetMinDepositFromParams(params Params) sdk.Coins { } // UnpackInterfaces implements UnpackInterfacesMessage.UnpackInterfaces -func (p Proposal) UnpackInterfaces(unpacker codectypes.AnyUnpacker) error { +func (p Proposal) UnpackInterfaces(unpacker gogoprotoany.AnyUnpacker) error { return sdktx.UnpackInterfaces(unpacker, p.Messages) } // Proposals is an array of proposal type Proposals []*Proposal -var _ codectypes.UnpackInterfacesMessage = Proposals{} +var _ gogoprotoany.UnpackInterfacesMessage = Proposals{} // String implements stringer interface func (p Proposals) String() string { @@ -94,7 +95,7 @@ func (p Proposals) String() string { } // UnpackInterfaces implements UnpackInterfacesMessage.UnpackInterfaces -func (p Proposals) UnpackInterfaces(unpacker codectypes.AnyUnpacker) error { +func (p Proposals) UnpackInterfaces(unpacker gogoprotoany.AnyUnpacker) error { for _, x := range p { err := x.UnpackInterfaces(unpacker) if err != nil { diff --git a/x/gov/types/v1beta1/genesis.go b/x/gov/types/v1beta1/genesis.go index d71c008d8860..d2c288574db6 100644 --- a/x/gov/types/v1beta1/genesis.go +++ b/x/gov/types/v1beta1/genesis.go @@ -3,9 +3,9 @@ package v1beta1 import ( "fmt" - "cosmossdk.io/math" + gogoprotoany "github.com/cosmos/gogoproto/types/any" - "github.com/cosmos/cosmos-sdk/codec/types" + "cosmossdk.io/math" ) // NewGenesisState creates a new genesis state for the governance module @@ -66,10 +66,10 @@ func ValidateGenesis(data *GenesisState) error { return nil } -var _ types.UnpackInterfacesMessage = GenesisState{} +var _ gogoprotoany.UnpackInterfacesMessage = GenesisState{} // UnpackInterfaces implements UnpackInterfacesMessage.UnpackInterfaces -func (data GenesisState) UnpackInterfaces(unpacker types.AnyUnpacker) error { +func (data GenesisState) UnpackInterfaces(unpacker gogoprotoany.AnyUnpacker) error { for _, p := range data.Proposals { err := p.UnpackInterfaces(unpacker) if err != nil { diff --git a/x/gov/types/v1beta1/msgs.go b/x/gov/types/v1beta1/msgs.go index 298f26c592eb..984bed150093 100644 --- a/x/gov/types/v1beta1/msgs.go +++ b/x/gov/types/v1beta1/msgs.go @@ -4,6 +4,7 @@ import ( "fmt" "github.com/cosmos/gogoproto/proto" + gogoprotoany "github.com/cosmos/gogoproto/types/any" codectypes "github.com/cosmos/cosmos-sdk/codec/types" sdk "github.com/cosmos/cosmos-sdk/types" @@ -20,7 +21,7 @@ const ( var ( _, _, _, _ sdk.Msg = &MsgSubmitProposal{}, &MsgDeposit{}, &MsgVote{}, &MsgVoteWeighted{} - _ codectypes.UnpackInterfacesMessage = &MsgSubmitProposal{} + _ gogoprotoany.UnpackInterfacesMessage = &MsgSubmitProposal{} ) // NewMsgSubmitProposal creates a new MsgSubmitProposal. @@ -73,7 +74,7 @@ func (m *MsgSubmitProposal) SetContent(content Content) error { } // UnpackInterfaces implements UnpackInterfacesMessage.UnpackInterfaces -func (m MsgSubmitProposal) UnpackInterfaces(unpacker codectypes.AnyUnpacker) error { +func (m MsgSubmitProposal) UnpackInterfaces(unpacker gogoprotoany.AnyUnpacker) error { var content Content return unpacker.UnpackAny(m.Content, &content) } diff --git a/x/gov/types/v1beta1/proposal.go b/x/gov/types/v1beta1/proposal.go index b29753edb33b..814301406861 100644 --- a/x/gov/types/v1beta1/proposal.go +++ b/x/gov/types/v1beta1/proposal.go @@ -7,6 +7,7 @@ import ( "time" "github.com/cosmos/gogoproto/proto" + gogoprotoany "github.com/cosmos/gogoproto/types/any" errorsmod "cosmossdk.io/errors" "cosmossdk.io/x/gov/types" @@ -81,7 +82,7 @@ func (p Proposal) GetTitle() string { } // UnpackInterfaces implements UnpackInterfacesMessage.UnpackInterfaces -func (p Proposal) UnpackInterfaces(unpacker codectypes.AnyUnpacker) error { +func (p Proposal) UnpackInterfaces(unpacker gogoprotoany.AnyUnpacker) error { var content Content return unpacker.UnpackAny(p.Content, &content) } @@ -89,7 +90,7 @@ func (p Proposal) UnpackInterfaces(unpacker codectypes.AnyUnpacker) error { // Proposals is an array of proposal type Proposals []Proposal -var _ codectypes.UnpackInterfacesMessage = Proposals{} +var _ gogoprotoany.UnpackInterfacesMessage = Proposals{} // Equal returns true if two slices (order-dependant) of proposals are equal. func (p Proposals) Equal(other Proposals) bool { @@ -118,7 +119,7 @@ func (p Proposals) String() string { } // UnpackInterfaces implements UnpackInterfacesMessage.UnpackInterfaces -func (p Proposals) UnpackInterfaces(unpacker codectypes.AnyUnpacker) error { +func (p Proposals) UnpackInterfaces(unpacker gogoprotoany.AnyUnpacker) error { for _, x := range p { err := x.UnpackInterfaces(unpacker) if err != nil { diff --git a/x/group/genesis.go b/x/group/genesis.go index eccf1f941e05..2a7e073890ba 100644 --- a/x/group/genesis.go +++ b/x/group/genesis.go @@ -3,9 +3,10 @@ package group import ( "fmt" + gogoprotoany "github.com/cosmos/gogoproto/types/any" + errorsmod "cosmossdk.io/errors" - "github.com/cosmos/cosmos-sdk/codec/types" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" ) @@ -83,7 +84,7 @@ func (s GenesisState) Validate() error { } // UnpackInterfaces implements UnpackInterfacesMessage.UnpackInterfaces -func (s GenesisState) UnpackInterfaces(unpacker types.AnyUnpacker) error { +func (s GenesisState) UnpackInterfaces(unpacker gogoprotoany.AnyUnpacker) error { for _, g := range s.GroupPolicies { err := g.UnpackInterfaces(unpacker) if err != nil { diff --git a/x/group/msgs.go b/x/group/msgs.go index d9aad25d63b3..a9e36c207f48 100644 --- a/x/group/msgs.go +++ b/x/group/msgs.go @@ -2,6 +2,7 @@ package group import ( "github.com/cosmos/gogoproto/proto" + gogoprotoany "github.com/cosmos/gogoproto/types/any" "github.com/cosmos/cosmos-sdk/codec/types" sdk "github.com/cosmos/cosmos-sdk/types" @@ -27,9 +28,9 @@ var ( _ sdk.Msg = &MsgSubmitProposal{} _ sdk.Msg = &MsgCreateGroupPolicy{} - _ types.UnpackInterfacesMessage = MsgCreateGroupPolicy{} - _ types.UnpackInterfacesMessage = MsgUpdateGroupPolicyDecisionPolicy{} - _ types.UnpackInterfacesMessage = MsgCreateGroupWithPolicy{} + _ gogoprotoany.UnpackInterfacesMessage = MsgCreateGroupPolicy{} + _ gogoprotoany.UnpackInterfacesMessage = MsgUpdateGroupPolicyDecisionPolicy{} + _ gogoprotoany.UnpackInterfacesMessage = MsgCreateGroupWithPolicy{} ) // GetGroupID gets the group id of the MsgUpdateGroupMetadata. @@ -83,7 +84,7 @@ func (m *MsgCreateGroupWithPolicy) SetDecisionPolicy(decisionPolicy DecisionPoli } // UnpackInterfaces implements UnpackInterfacesMessage.UnpackInterfaces -func (m MsgCreateGroupWithPolicy) UnpackInterfaces(unpacker types.AnyUnpacker) error { +func (m MsgCreateGroupWithPolicy) UnpackInterfaces(unpacker gogoprotoany.AnyUnpacker) error { var decisionPolicy DecisionPolicy return unpacker.UnpackAny(m.DecisionPolicy, &decisionPolicy) } @@ -126,7 +127,7 @@ func (m *MsgUpdateGroupPolicyDecisionPolicy) GetDecisionPolicy() (DecisionPolicy } // UnpackInterfaces implements UnpackInterfacesMessage.UnpackInterfaces -func (m MsgUpdateGroupPolicyDecisionPolicy) UnpackInterfaces(unpacker types.AnyUnpacker) error { +func (m MsgUpdateGroupPolicyDecisionPolicy) UnpackInterfaces(unpacker gogoprotoany.AnyUnpacker) error { var decisionPolicy DecisionPolicy return unpacker.UnpackAny(m.DecisionPolicy, &decisionPolicy) } @@ -180,7 +181,7 @@ func (m *MsgCreateGroupPolicy) SetDecisionPolicy(decisionPolicy DecisionPolicy) } // UnpackInterfaces implements UnpackInterfacesMessage.UnpackInterfaces -func (m MsgCreateGroupPolicy) UnpackInterfaces(unpacker types.AnyUnpacker) error { +func (m MsgCreateGroupPolicy) UnpackInterfaces(unpacker gogoprotoany.AnyUnpacker) error { var decisionPolicy DecisionPolicy return unpacker.UnpackAny(m.DecisionPolicy, &decisionPolicy) } @@ -218,6 +219,6 @@ func (m MsgSubmitProposal) GetMsgs() ([]sdk.Msg, error) { } // UnpackInterfaces implements UnpackInterfacesMessage.UnpackInterfaces -func (m MsgSubmitProposal) UnpackInterfaces(unpacker types.AnyUnpacker) error { +func (m MsgSubmitProposal) UnpackInterfaces(unpacker gogoprotoany.AnyUnpacker) error { return tx.UnpackInterfaces(unpacker, m.Messages) } diff --git a/x/group/proposal.go b/x/group/proposal.go index a47ee5115c3b..642e8981a487 100644 --- a/x/group/proposal.go +++ b/x/group/proposal.go @@ -1,7 +1,8 @@ package group import ( - "github.com/cosmos/cosmos-sdk/codec/types" + gogoprotoany "github.com/cosmos/gogoproto/types/any" + sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/types/tx" ) @@ -22,6 +23,6 @@ func (p *Proposal) SetMsgs(msgs []sdk.Msg) error { } // UnpackInterfaces implements UnpackInterfacesMessage.UnpackInterfaces -func (p Proposal) UnpackInterfaces(unpacker types.AnyUnpacker) error { +func (p Proposal) UnpackInterfaces(unpacker gogoprotoany.AnyUnpacker) error { return tx.UnpackInterfaces(unpacker, p.Messages) } diff --git a/x/group/simulation/operations.go b/x/group/simulation/operations.go index 2a90842681dc..d0eb1b8f7989 100644 --- a/x/group/simulation/operations.go +++ b/x/group/simulation/operations.go @@ -8,6 +8,8 @@ import ( "sync/atomic" "time" + gogoprotoany "github.com/cosmos/gogoproto/types/any" + "cosmossdk.io/core/address" "cosmossdk.io/x/group" "cosmossdk.io/x/group/keeper" @@ -104,7 +106,7 @@ func WeightedOperations( registry cdctypes.InterfaceRegistry, appParams simtypes.AppParams, cdc codec.JSONCodec, txGen client.TxConfig, ak group.AccountKeeper, bk group.BankKeeper, k keeper.Keeper, - appCdc cdctypes.AnyUnpacker, + appCdc gogoprotoany.AnyUnpacker, ) simulation.WeightedOperations { var ( weightMsgCreateGroup int diff --git a/x/group/types.go b/x/group/types.go index 4a8b2cd7d564..d91d4fd89704 100644 --- a/x/group/types.go +++ b/x/group/types.go @@ -5,6 +5,7 @@ import ( "time" "github.com/cosmos/gogoproto/proto" + gogoprotoany "github.com/cosmos/gogoproto/types/any" "cosmossdk.io/core/address" errorsmod "cosmossdk.io/errors" @@ -286,7 +287,7 @@ func (g GroupPolicyInfo) GetDecisionPolicy() (DecisionPolicy, error) { } // UnpackInterfaces implements UnpackInterfacesMessage.UnpackInterfaces -func (g GroupPolicyInfo) UnpackInterfaces(unpacker codectypes.AnyUnpacker) error { +func (g GroupPolicyInfo) UnpackInterfaces(unpacker gogoprotoany.AnyUnpacker) error { var decisionPolicy DecisionPolicy return unpacker.UnpackAny(g.DecisionPolicy, &decisionPolicy) } @@ -458,16 +459,16 @@ func (v Vote) ValidateBasic() error { } // UnpackInterfaces implements UnpackInterfacesMessage.UnpackInterfaces -func (q QueryGroupPoliciesByGroupResponse) UnpackInterfaces(unpacker codectypes.AnyUnpacker) error { +func (q QueryGroupPoliciesByGroupResponse) UnpackInterfaces(unpacker gogoprotoany.AnyUnpacker) error { return unpackGroupPolicies(unpacker, q.GroupPolicies) } // UnpackInterfaces implements UnpackInterfacesMessage.UnpackInterfaces -func (q QueryGroupPoliciesByAdminResponse) UnpackInterfaces(unpacker codectypes.AnyUnpacker) error { +func (q QueryGroupPoliciesByAdminResponse) UnpackInterfaces(unpacker gogoprotoany.AnyUnpacker) error { return unpackGroupPolicies(unpacker, q.GroupPolicies) } -func unpackGroupPolicies(unpacker codectypes.AnyUnpacker, accs []*GroupPolicyInfo) error { +func unpackGroupPolicies(unpacker gogoprotoany.AnyUnpacker, accs []*GroupPolicyInfo) error { for _, g := range accs { err := g.UnpackInterfaces(unpacker) if err != nil { diff --git a/x/staking/types/genesis.go b/x/staking/types/genesis.go index e144661afe55..e3534fc4ea58 100644 --- a/x/staking/types/genesis.go +++ b/x/staking/types/genesis.go @@ -3,8 +3,9 @@ package types import ( "encoding/json" + gogoprotoany "github.com/cosmos/gogoproto/types/any" + "github.com/cosmos/cosmos-sdk/codec" - codectypes "github.com/cosmos/cosmos-sdk/codec/types" ) // NewGenesisState creates a new GenesisState instance @@ -36,7 +37,7 @@ func GetGenesisStateFromAppState(cdc codec.JSONCodec, appState map[string]json.R } // UnpackInterfaces implements UnpackInterfacesMessage.UnpackInterfaces -func (g GenesisState) UnpackInterfaces(c codectypes.AnyUnpacker) error { +func (g GenesisState) UnpackInterfaces(c gogoprotoany.AnyUnpacker) error { for i := range g.Validators { if err := g.Validators[i].UnpackInterfaces(c); err != nil { return err diff --git a/x/staking/types/msg.go b/x/staking/types/msg.go index 3effad961f14..782183ff0684 100644 --- a/x/staking/types/msg.go +++ b/x/staking/types/msg.go @@ -1,6 +1,8 @@ package types import ( + gogoprotoany "github.com/cosmos/gogoproto/types/any" + "cosmossdk.io/core/address" coretransaction "cosmossdk.io/core/transaction" errorsmod "cosmossdk.io/errors" @@ -13,14 +15,14 @@ import ( ) var ( - _ coretransaction.Msg = &MsgCreateValidator{} - _ codectypes.UnpackInterfacesMessage = (*MsgCreateValidator)(nil) - _ coretransaction.Msg = &MsgEditValidator{} - _ coretransaction.Msg = &MsgDelegate{} - _ coretransaction.Msg = &MsgUndelegate{} - _ coretransaction.Msg = &MsgBeginRedelegate{} - _ coretransaction.Msg = &MsgCancelUnbondingDelegation{} - _ coretransaction.Msg = &MsgUpdateParams{} + _ coretransaction.Msg = &MsgCreateValidator{} + _ gogoprotoany.UnpackInterfacesMessage = (*MsgCreateValidator)(nil) + _ coretransaction.Msg = &MsgEditValidator{} + _ coretransaction.Msg = &MsgDelegate{} + _ coretransaction.Msg = &MsgUndelegate{} + _ coretransaction.Msg = &MsgBeginRedelegate{} + _ coretransaction.Msg = &MsgCancelUnbondingDelegation{} + _ coretransaction.Msg = &MsgUpdateParams{} ) // NewMsgCreateValidator creates a new MsgCreateValidator instance. @@ -89,7 +91,7 @@ func (msg MsgCreateValidator) Validate(ac address.Codec) error { } // UnpackInterfaces implements UnpackInterfacesMessage.UnpackInterfaces -func (msg MsgCreateValidator) UnpackInterfaces(unpacker codectypes.AnyUnpacker) error { +func (msg MsgCreateValidator) UnpackInterfaces(unpacker gogoprotoany.AnyUnpacker) error { var pubKey cryptotypes.PubKey return unpacker.UnpackAny(msg.Pubkey, &pubKey) } @@ -160,13 +162,13 @@ func NewMsgRotateConsPubKey(valAddr string, pubKey cryptotypes.PubKey) (*MsgRota } // UnpackInterfaces implements UnpackInterfacesMessage.UnpackInterfaces -func (msg MsgRotateConsPubKey) UnpackInterfaces(unpacker codectypes.AnyUnpacker) error { +func (msg MsgRotateConsPubKey) UnpackInterfaces(unpacker gogoprotoany.AnyUnpacker) error { var pubKey cryptotypes.PubKey return unpacker.UnpackAny(msg.NewPubkey, &pubKey) } // UnpackInterfaces implements UnpackInterfacesMessage.UnpackInterfaces -func (hi ConsPubKeyRotationHistory) UnpackInterfaces(unpacker codectypes.AnyUnpacker) error { +func (hi ConsPubKeyRotationHistory) UnpackInterfaces(unpacker gogoprotoany.AnyUnpacker) error { var oldPubKey cryptotypes.PubKey err := unpacker.UnpackAny(hi.OldConsPubkey, &oldPubKey) if err != nil { diff --git a/x/staking/types/validator.go b/x/staking/types/validator.go index 9906bc2b8009..c2e442d4c55a 100644 --- a/x/staking/types/validator.go +++ b/x/staking/types/validator.go @@ -7,6 +7,8 @@ import ( "strings" "time" + gogoprotoany "github.com/cosmos/gogoproto/types/any" + "cosmossdk.io/core/address" "cosmossdk.io/core/appmodule" "cosmossdk.io/errors" @@ -138,7 +140,7 @@ func (valz ValidatorsByVotingPower) Swap(i, j int) { } // UnpackInterfaces implements UnpackInterfacesMessage.UnpackInterfaces -func (v Validators) UnpackInterfaces(c codectypes.AnyUnpacker) error { +func (v Validators) UnpackInterfaces(c gogoprotoany.AnyUnpacker) error { for i := range v.Validators { if err := v.Validators[i].UnpackInterfaces(c); err != nil { return err @@ -494,7 +496,7 @@ func (v Validator) GetMinSelfDelegation() math.Int { return v.MinSelfDelegat func (v Validator) GetDelegatorShares() math.LegacyDec { return v.DelegatorShares } // UnpackInterfaces implements UnpackInterfacesMessage.UnpackInterfaces -func (v Validator) UnpackInterfaces(unpacker codectypes.AnyUnpacker) error { +func (v Validator) UnpackInterfaces(unpacker gogoprotoany.AnyUnpacker) error { var pk cryptotypes.PubKey return unpacker.UnpackAny(v.ConsensusPubkey, &pk) }