chore(all)!: use gogoproto/any instead of codec/types/any (#21013)
This commit is contained in:
parent
71d14f9370
commit
9ab162de6d
@ -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
|
||||
|
||||
|
||||
@ -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)
|
||||
|
||||
@ -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)
|
||||
}
|
||||
|
||||
@ -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 {
|
||||
|
||||
@ -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"
|
||||
|
||||
@ -14,47 +15,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
|
||||
@ -65,7 +29,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
|
||||
|
||||
|
||||
@ -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,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,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
|
||||
}
|
||||
|
||||
@ -4,15 +4,15 @@ import (
|
||||
"context"
|
||||
"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"
|
||||
@ -22,8 +22,8 @@ import (
|
||||
)
|
||||
|
||||
var (
|
||||
_ ServiceServer = queryServer{}
|
||||
_ codectypes.UnpackInterfacesMessage = &GetLatestValidatorSetResponse{}
|
||||
_ ServiceServer = queryServer{}
|
||||
_ gogoprotoany.UnpackInterfacesMessage = &GetLatestValidatorSetResponse{}
|
||||
)
|
||||
|
||||
const (
|
||||
@ -136,7 +136,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)
|
||||
|
||||
15
testutil/testdata/animal.go
vendored
15
testutil/testdata/animal.go
vendored
@ -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)
|
||||
}
|
||||
|
||||
9
testutil/testdata/grpc_query.go
vendored
9
testutil/testdata/grpc_query.go
vendored
@ -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)
|
||||
}
|
||||
|
||||
|
||||
@ -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)
|
||||
|
||||
@ -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)
|
||||
}
|
||||
|
||||
@ -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)
|
||||
|
||||
@ -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)
|
||||
|
||||
@ -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))
|
||||
}
|
||||
|
||||
@ -3,13 +3,13 @@ package tx
|
||||
import (
|
||||
"errors"
|
||||
|
||||
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))
|
||||
}
|
||||
|
||||
|
||||
@ -5,6 +5,7 @@ import (
|
||||
"errors"
|
||||
"fmt"
|
||||
|
||||
gogoprotoany "github.com/cosmos/gogoproto/types/any"
|
||||
"sigs.k8s.io/yaml"
|
||||
|
||||
errorsmod "cosmossdk.io/errors"
|
||||
@ -130,7 +131,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)
|
||||
}
|
||||
|
||||
|
||||
@ -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 {
|
||||
|
||||
@ -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 {
|
||||
|
||||
@ -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
|
||||
}
|
||||
|
||||
@ -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)
|
||||
|
||||
@ -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{}
|
||||
|
||||
@ -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)
|
||||
}
|
||||
|
||||
@ -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)
|
||||
}
|
||||
|
||||
@ -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)
|
||||
}
|
||||
|
||||
|
||||
@ -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,
|
||||
|
||||
@ -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)
|
||||
|
||||
@ -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
|
||||
}{
|
||||
{
|
||||
|
||||
@ -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)
|
||||
}
|
||||
|
||||
@ -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)
|
||||
}
|
||||
|
||||
@ -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 {
|
||||
|
||||
@ -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)
|
||||
}
|
||||
|
||||
@ -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)
|
||||
}
|
||||
|
||||
@ -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 {
|
||||
|
||||
@ -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)
|
||||
}
|
||||
|
||||
@ -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 {
|
||||
|
||||
@ -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 {
|
||||
|
||||
@ -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)
|
||||
}
|
||||
|
||||
@ -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 {
|
||||
|
||||
@ -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 {
|
||||
|
||||
@ -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)
|
||||
}
|
||||
|
||||
@ -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)
|
||||
}
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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 {
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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 {
|
||||
|
||||
@ -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)
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user