diff --git a/CHANGELOG.md b/CHANGELOG.md index 86eac0cd0d..6384005aca 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -97,6 +97,11 @@ information on how to implement the new `Keyring` interface. * [\#5858](https://github.com/cosmos/cosmos-sdk/pull/5858) Make Keyring store keys by name and address's hexbytes representation. * (x/evidence) [\#5952](https://github.com/cosmos/cosmos-sdk/pull/5952) Remove APIs for getting and setting `x/evidence` parameters. `BaseApp` now uses a `ParamStore` to manage Tendermint consensus parameters which is managed via the `x/params` `Substore` type. * (export) [\#5952](https://github.com/cosmos/cosmos-sdk/pull/5952) `AppExporter` now returns ABCI consensus parameters to be included in marshaled exported state. These parameters must be returned from the application via the `BaseApp`. +* (codec) `*codec.Codec` is now a wrapper around Amino which provides backwards compatibility with protobuf `Any`. +ALL legacy code should use `*codec.Codec` instead of `*amino.Codec` directly +* (x/gov) [\#6147](https://github.com/cosmos/cosmos-sdk/pull/6147) The `Content` field on `Proposal` and `MsgSubmitProposal` +is now `Any` in concordance with [ADR 019](docs/architecture/adr-019-protobuf-state-encoding.md) and `GetContent` should now +be used to retrieve the actual proposal `Content`. Also the `NewMsgSubmitProposal` constructor now may return an `error` ### Features diff --git a/Makefile b/Makefile index e32facd4e1..e060ea27c6 100644 --- a/Makefile +++ b/Makefile @@ -124,7 +124,7 @@ test-race: @VERSION=$(VERSION) go test -mod=readonly -race $(PACKAGES_NOSIMULATION) test-integration: build-sim - BUILDDIR=$(BUILDDIR) go test -mod=readonly -p 4 -tags=-tags='ledger test_ledger_mock cli_test' -run ^TestCLI `go list ./.../cli/...` + BUILDDIR=$(BUILDDIR) go test -mod=readonly -p 4 -tags='ledger test_ledger_mock cli_test' -run ^TestCLI `go list ./.../cli/...` .PHONY: test test-all test-ledger-mock test-ledger test-unit test-race diff --git a/codec/amino.go b/codec/amino.go index c0936e7046..53587808e6 100644 --- a/codec/amino.go +++ b/codec/amino.go @@ -8,6 +8,8 @@ import ( amino "github.com/tendermint/go-amino" cryptoamino "github.com/tendermint/tendermint/crypto/encoding/amino" tmtypes "github.com/tendermint/tendermint/types" + + "github.com/cosmos/cosmos-sdk/codec/types" ) // Cdc defines a global generic sealed Amino codec to be used throughout sdk. It @@ -17,29 +19,38 @@ import ( var Cdc *Codec func init() { - cdc := New() - RegisterCrypto(cdc) - RegisterEvidences(cdc) - Cdc = cdc.Seal() + Cdc = New() + RegisterCrypto(Cdc) + RegisterEvidences(Cdc) + Cdc.Seal() +} + +// deprecated: Codec defines a wrapper for an Amino codec that properly handles protobuf +// types with Any's +type Codec struct { + Amino *amino.Codec } -// Codec defines a type alias for an Amino codec. -type Codec = amino.Codec +var _ JSONMarshaler = &Codec{} + +func (cdc *Codec) Seal() { + cdc.Amino.Seal() +} func New() *Codec { - return amino.NewCodec() + return &Codec{amino.NewCodec()} } // RegisterCrypto registers all crypto dependency types with the provided Amino // codec. func RegisterCrypto(cdc *Codec) { - cryptoamino.RegisterAmino(cdc) + cryptoamino.RegisterAmino(cdc.Amino) } // RegisterEvidences registers Tendermint evidence types with the provided Amino // codec. func RegisterEvidences(cdc *Codec) { - tmtypes.RegisterEvidences(cdc) + tmtypes.RegisterEvidences(cdc.Amino) } // MarshalJSONIndent provides a utility for indented JSON encoding of an object @@ -68,3 +79,132 @@ func MustMarshalJSONIndent(m JSONMarshaler, obj interface{}) []byte { return bz } + +func (cdc *Codec) marshalAnys(o interface{}) error { + return types.UnpackInterfaces(o, types.AminoPacker{Cdc: cdc.Amino}) +} + +func (cdc *Codec) unmarshalAnys(o interface{}) error { + return types.UnpackInterfaces(o, types.AminoUnpacker{Cdc: cdc.Amino}) +} + +func (cdc *Codec) jsonMarshalAnys(o interface{}) error { + return types.UnpackInterfaces(o, types.AminoJSONPacker{Cdc: cdc.Amino}) +} + +func (cdc *Codec) jsonUnmarshalAnys(o interface{}) error { + return types.UnpackInterfaces(o, types.AminoJSONUnpacker{Cdc: cdc.Amino}) +} + +func (cdc *Codec) MarshalBinaryBare(o interface{}) ([]byte, error) { + err := cdc.marshalAnys(o) + if err != nil { + return nil, err + } + return cdc.Amino.MarshalBinaryBare(o) +} + +func (cdc *Codec) MustMarshalBinaryBare(o interface{}) []byte { + bz, err := cdc.MarshalBinaryBare(o) + if err != nil { + panic(err) + } + return bz +} + +func (cdc *Codec) MarshalBinaryLengthPrefixed(o interface{}) ([]byte, error) { + err := cdc.marshalAnys(o) + if err != nil { + return nil, err + } + return cdc.Amino.MarshalBinaryLengthPrefixed(o) +} + +func (cdc *Codec) MustMarshalBinaryLengthPrefixed(o interface{}) []byte { + bz, err := cdc.MarshalBinaryLengthPrefixed(o) + if err != nil { + panic(err) + } + return bz +} + +func (cdc *Codec) UnmarshalBinaryBare(bz []byte, ptr interface{}) error { + err := cdc.Amino.UnmarshalBinaryBare(bz, ptr) + if err != nil { + return err + } + return cdc.unmarshalAnys(ptr) +} + +func (cdc *Codec) MustUnmarshalBinaryBare(bz []byte, ptr interface{}) { + err := cdc.UnmarshalBinaryBare(bz, ptr) + if err != nil { + panic(err) + } +} + +func (cdc *Codec) UnmarshalBinaryLengthPrefixed(bz []byte, ptr interface{}) error { + err := cdc.Amino.UnmarshalBinaryLengthPrefixed(bz, ptr) + if err != nil { + return err + } + return cdc.unmarshalAnys(ptr) +} + +func (cdc *Codec) MustUnmarshalBinaryLengthPrefixed(bz []byte, ptr interface{}) { + err := cdc.UnmarshalBinaryLengthPrefixed(bz, ptr) + if err != nil { + panic(err) + } +} + +func (cdc *Codec) MarshalJSON(o interface{}) ([]byte, error) { + err := cdc.jsonMarshalAnys(o) + if err != nil { + return nil, err + } + return cdc.Amino.MarshalJSON(o) +} + +func (cdc *Codec) MustMarshalJSON(o interface{}) []byte { + bz, err := cdc.MarshalJSON(o) + if err != nil { + panic(err) + } + return bz +} + +func (cdc *Codec) UnmarshalJSON(bz []byte, ptr interface{}) error { + err := cdc.Amino.UnmarshalJSON(bz, ptr) + if err != nil { + return err + } + return cdc.jsonUnmarshalAnys(ptr) +} + +func (cdc *Codec) MustUnmarshalJSON(bz []byte, ptr interface{}) { + err := cdc.UnmarshalJSON(bz, ptr) + if err != nil { + panic(err) + } +} + +func (*Codec) UnpackAny(*types.Any, interface{}) error { + return fmt.Errorf("AminoCodec can't handle unpack protobuf Any's") +} + +func (cdc *Codec) RegisterInterface(ptr interface{}, iopts *amino.InterfaceOptions) { + cdc.Amino.RegisterInterface(ptr, iopts) +} + +func (cdc *Codec) RegisterConcrete(o interface{}, name string, copts *amino.ConcreteOptions) { + cdc.Amino.RegisterConcrete(o, name, copts) +} + +func (cdc *Codec) MarshalJSONIndent(o interface{}, prefix, indent string) ([]byte, error) { + err := cdc.jsonMarshalAnys(o) + if err != nil { + panic(err) + } + return cdc.Amino.MarshalJSONIndent(o, prefix, indent) +} diff --git a/codec/amino_codec.go b/codec/amino_codec.go index 57dfdf4691..a7cf476bae 100644 --- a/codec/amino_codec.go +++ b/codec/amino_codec.go @@ -1,133 +1,45 @@ package codec -import ( - "fmt" - - "github.com/cosmos/cosmos-sdk/codec/types" -) - -// AminoCodec defines a codec that utilizes Amino for both binary and JSON +// AminoCodec defines a codec that utilizes Codec for both binary and JSON // encoding. type AminoCodec struct { - amino *Codec -} - -func NewAminoCodec(amino *Codec) Marshaler { - return &AminoCodec{amino} -} - -func (ac *AminoCodec) marshalAnys(o ProtoMarshaler) error { - return types.UnpackInterfaces(o, types.AminoPacker{Cdc: ac.amino}) + *Codec } -func (ac *AminoCodec) unmarshalAnys(o ProtoMarshaler) error { - return types.UnpackInterfaces(o, types.AminoUnpacker{Cdc: ac.amino}) -} +var _ Marshaler = &AminoCodec{} -func (ac *AminoCodec) jsonMarshalAnys(o interface{}) error { - return types.UnpackInterfaces(o, types.AminoJSONPacker{Cdc: ac.amino}) -} - -func (ac *AminoCodec) jsonUnmarshalAnys(o interface{}) error { - return types.UnpackInterfaces(o, types.AminoJSONUnpacker{Cdc: ac.amino}) +func NewAminoCodec(codec *Codec) *AminoCodec { + return &AminoCodec{Codec: codec} } func (ac *AminoCodec) MarshalBinaryBare(o ProtoMarshaler) ([]byte, error) { - err := ac.marshalAnys(o) - if err != nil { - return nil, err - } - return ac.amino.MarshalBinaryBare(o) + return ac.Codec.MarshalBinaryBare(o) } func (ac *AminoCodec) MustMarshalBinaryBare(o ProtoMarshaler) []byte { - err := ac.marshalAnys(o) - if err != nil { - panic(err) - } - return ac.amino.MustMarshalBinaryBare(o) + return ac.Codec.MustMarshalBinaryBare(o) } func (ac *AminoCodec) MarshalBinaryLengthPrefixed(o ProtoMarshaler) ([]byte, error) { - err := ac.marshalAnys(o) - if err != nil { - return nil, err - } - return ac.amino.MarshalBinaryLengthPrefixed(o) + return ac.Codec.MarshalBinaryLengthPrefixed(o) } func (ac *AminoCodec) MustMarshalBinaryLengthPrefixed(o ProtoMarshaler) []byte { - err := ac.marshalAnys(o) - if err != nil { - panic(err) - } - return ac.amino.MustMarshalBinaryLengthPrefixed(o) + return ac.Codec.MustMarshalBinaryLengthPrefixed(o) } func (ac *AminoCodec) UnmarshalBinaryBare(bz []byte, ptr ProtoMarshaler) error { - err := ac.amino.UnmarshalBinaryBare(bz, ptr) - if err != nil { - return err - } - return ac.unmarshalAnys(ptr) + return ac.Codec.UnmarshalBinaryBare(bz, ptr) } func (ac *AminoCodec) MustUnmarshalBinaryBare(bz []byte, ptr ProtoMarshaler) { - ac.amino.MustUnmarshalBinaryBare(bz, ptr) - err := ac.unmarshalAnys(ptr) - if err != nil { - panic(err) - } + ac.Codec.MustUnmarshalBinaryBare(bz, ptr) } func (ac *AminoCodec) UnmarshalBinaryLengthPrefixed(bz []byte, ptr ProtoMarshaler) error { - err := ac.amino.UnmarshalBinaryLengthPrefixed(bz, ptr) - if err != nil { - return err - } - return ac.unmarshalAnys(ptr) + return ac.Codec.UnmarshalBinaryLengthPrefixed(bz, ptr) } func (ac *AminoCodec) MustUnmarshalBinaryLengthPrefixed(bz []byte, ptr ProtoMarshaler) { - ac.amino.MustUnmarshalBinaryLengthPrefixed(bz, ptr) - err := ac.unmarshalAnys(ptr) - if err != nil { - panic(err) - } -} - -func (ac *AminoCodec) MarshalJSON(o interface{}) ([]byte, error) { - err := ac.jsonMarshalAnys(o) - if err != nil { - return nil, err - } - return ac.amino.MarshalJSON(o) -} - -func (ac *AminoCodec) MustMarshalJSON(o interface{}) []byte { - err := ac.jsonMarshalAnys(o) - if err != nil { - panic(err) - } - return ac.amino.MustMarshalJSON(o) -} - -func (ac *AminoCodec) UnmarshalJSON(bz []byte, ptr interface{}) error { - err := ac.amino.UnmarshalJSON(bz, ptr) - if err != nil { - return err - } - return ac.jsonUnmarshalAnys(ptr) -} - -func (ac *AminoCodec) MustUnmarshalJSON(bz []byte, ptr interface{}) { - ac.amino.MustUnmarshalJSON(bz, ptr) - err := ac.jsonUnmarshalAnys(ptr) - if err != nil { - panic(err) - } -} - -func (*AminoCodec) UnpackAny(*types.Any, interface{}) error { - return fmt.Errorf("AminoCodec can't handle unpack protobuf Any's") + ac.Codec.MustUnmarshalBinaryLengthPrefixed(bz, ptr) } diff --git a/codec/amino_codec_test.go b/codec/amino_codec_test.go index ff0a85efa5..48f5830adb 100644 --- a/codec/amino_codec_test.go +++ b/codec/amino_codec_test.go @@ -6,14 +6,13 @@ import ( "github.com/cosmos/cosmos-sdk/codec/types" "github.com/stretchr/testify/require" - amino "github.com/tendermint/go-amino" "github.com/cosmos/cosmos-sdk/codec" "github.com/cosmos/cosmos-sdk/codec/testdata" ) -func createTestCodec() *amino.Codec { - cdc := amino.NewCodec() +func createTestCodec() *codec.Codec { + cdc := codec.New() cdc.RegisterInterface((*testdata.Animal)(nil), nil) cdc.RegisterConcrete(testdata.Dog{}, "testdata/Dog", nil) diff --git a/codec/types/amino_compat.go b/codec/types/amino_compat.go index 5bb7be3f9a..6cb1223510 100644 --- a/codec/types/amino_compat.go +++ b/codec/types/amino_compat.go @@ -3,6 +3,9 @@ package types import ( "fmt" "reflect" + "runtime/debug" + + "github.com/gogo/protobuf/proto" amino "github.com/tendermint/go-amino" ) @@ -13,10 +16,27 @@ type aminoCompat struct { err error } +var Debug = false + +func aminoCompatError(errType string, x interface{}) error { + if Debug { + debug.PrintStack() + } + return fmt.Errorf( + "amino %s Any marshaling error for %+v, this is likely because "+ + "amino is being used directly (instead of codec.Codec which is preferred) "+ + "or UnpackInterfacesMessage is not defined for some type which contains "+ + "a protobuf Any either directly or via one of its members. To see a "+ + "stacktrace of where the error is coming from, set the var Debug = true "+ + "in codec/types/amino_compat.go", + errType, x, + ) +} + func (any Any) MarshalAmino() ([]byte, error) { ac := any.aminoCompat if ac == nil { - return nil, fmt.Errorf("can't amino unmarshal") + return nil, aminoCompatError("binary unmarshal", any) } return ac.bz, ac.err } @@ -32,7 +52,7 @@ func (any *Any) UnmarshalAmino(bz []byte) error { func (any Any) MarshalJSON() ([]byte, error) { ac := any.aminoCompat if ac == nil { - return nil, fmt.Errorf("can't JSON marshal") + return nil, aminoCompatError("JSON marshal", any) } return ac.jsonBz, ac.err } @@ -56,7 +76,7 @@ var _ AnyUnpacker = AminoUnpacker{} func (a AminoUnpacker) UnpackAny(any *Any, iface interface{}) error { ac := any.aminoCompat if ac == nil { - return fmt.Errorf("can't amino unmarshal %T", iface) + return aminoCompatError("binary unmarshal", reflect.TypeOf(iface)) } err := a.Cdc.UnmarshalBinaryBare(ac.bz, iface) if err != nil { @@ -67,7 +87,19 @@ func (a AminoUnpacker) UnpackAny(any *Any, iface interface{}) error { if err != nil { return err } - any.cachedValue = val + if m, ok := val.(proto.Message); ok { + err := any.Pack(m) + if err != nil { + return err + } + } else { + any.cachedValue = val + } + + // this is necessary for tests that use reflect.DeepEqual and compare + // proto vs amino marshaled values + any.aminoCompat = nil + return nil } @@ -103,7 +135,7 @@ var _ AnyUnpacker = AminoJSONUnpacker{} func (a AminoJSONUnpacker) UnpackAny(any *Any, iface interface{}) error { ac := any.aminoCompat if ac == nil { - return fmt.Errorf("can't amino unmarshal %T", iface) + return aminoCompatError("JSON unmarshal", reflect.TypeOf(iface)) } err := a.Cdc.UnmarshalJSON(ac.jsonBz, iface) if err != nil { @@ -114,7 +146,19 @@ func (a AminoJSONUnpacker) UnpackAny(any *Any, iface interface{}) error { if err != nil { return err } - any.cachedValue = val + if m, ok := val.(proto.Message); ok { + err := any.Pack(m) + if err != nil { + return err + } + } else { + any.cachedValue = val + } + + // this is necessary for tests that use reflect.DeepEqual and compare + // proto vs amino marshaled values + any.aminoCompat = nil + return nil } diff --git a/codec/types/interface_registry.go b/codec/types/interface_registry.go index d83800d445..01df46834c 100644 --- a/codec/types/interface_registry.go +++ b/codec/types/interface_registry.go @@ -112,6 +112,11 @@ func (registry *interfaceRegistry) RegisterImplementations(iface interface{}, im } func (registry *interfaceRegistry) UnpackAny(any *Any, iface interface{}) error { + if any.TypeUrl == "" { + // if TypeUrl is empty return nil because without it we can't actually unpack anything + return nil + } + rv := reflect.ValueOf(iface) if rv.Kind() != reflect.Ptr { return fmt.Errorf("UnpackAny expects a pointer") diff --git a/crypto/keyring/codec.go b/crypto/keyring/codec.go index 35860e71ce..4dd78c6e84 100644 --- a/crypto/keyring/codec.go +++ b/crypto/keyring/codec.go @@ -12,7 +12,7 @@ var CryptoCdc *codec.Codec func init() { CryptoCdc = codec.New() - cryptoAmino.RegisterAmino(CryptoCdc) + cryptoAmino.RegisterAmino(CryptoCdc.Amino) RegisterCodec(CryptoCdc) CryptoCdc.Seal() } diff --git a/docs/architecture/adr-019-protobuf-state-encoding.md b/docs/architecture/adr-019-protobuf-state-encoding.md index 079c07ac3b..3abddd7921 100644 --- a/docs/architecture/adr-019-protobuf-state-encoding.md +++ b/docs/architecture/adr-019-protobuf-state-encoding.md @@ -5,6 +5,7 @@ - 2020 Feb 15: Initial Draft - 2020 Feb 24: Updates to handle messages with interface fields - 2020 Apr 27: Convert usages of `oneof` for interfaces to `Any` +- 2020 May 15: Describe `cosmos_proto` extensions and amino compatibility ## Status @@ -176,6 +177,14 @@ type InterfaceRegistry interface { In addition to serving as a whitelist, `InterfaceRegistry` can also serve to communicate the list of concrete types that satisfy an interface to clients. +In .proto files: +* fields which accept interfaces should be annotated with `cosmos_proto.accepts_interface` +using the same full-qualified name passed as `protoName` to `InterfaceRegistry.RegisterInterface` +* interface implementations should be annotated with `cosmos_proto.implements_interface` +using the same full-qualified name passed as `protoName` to `InterfaceRegistry.RegisterInterface` + +In the future, `protoName`, `cosmos_proto.accepts_interface`, `cosmos_proto.implements_interface` +may be used via code generation, reflection &/or static linting. The same struct that implements `InterfaceRegistry` will also implement an interface `InterfaceUnpacker` to be used for unpacking `Any`s: @@ -299,6 +308,21 @@ func (msg MsgSubmitEvidence) GetEvidence() eviexported.Evidence { } ``` +### Amino Compatibility + +Our custom implementation of `Any` can be used transparently with Amino if used +with the proper codec instance. What this means is that interfaces packed within +`Any`s will be amino marshaled like regular Amino interfaces (assuming they +have been registered properly with Amino). + +In order for this functionality to work: +* **all legacy code must use `*codec.Codec` instead of `*amino.Codec` which is +now a wrapper which properly handles `Any`** +* **all new code should use `Marshaler` which is compatible with both amino and +protobuf** + +Also, before v0.39, `codec.Codec` will be renamed to `codec.LegacyAmino`. + ### Why Wasn't X Chosen Instead For a more complete comparison to alternative protocols, see [here](https://codeburst.io/json-vs-protocol-buffers-vs-flatbuffers-a4247f8bda6f). diff --git a/simapp/cmd/simcli/main.go b/simapp/cmd/simcli/main.go index 337fa166e3..d2207f31dd 100644 --- a/simapp/cmd/simcli/main.go +++ b/simapp/cmd/simcli/main.go @@ -5,9 +5,10 @@ import ( "os" "path" + "github.com/cosmos/cosmos-sdk/codec" + "github.com/spf13/cobra" "github.com/spf13/viper" - "github.com/tendermint/go-amino" "github.com/tendermint/tendermint/libs/cli" "github.com/cosmos/cosmos-sdk/client" @@ -81,7 +82,7 @@ func main() { } } -func queryCmd(cdc *amino.Codec) *cobra.Command { +func queryCmd(cdc *codec.Codec) *cobra.Command { queryCmd := &cobra.Command{ Use: "query", Aliases: []string{"q"}, @@ -107,7 +108,7 @@ func queryCmd(cdc *amino.Codec) *cobra.Command { return queryCmd } -func txCmd(cdc *amino.Codec) *cobra.Command { +func txCmd(cdc *codec.Codec) *cobra.Command { txCmd := &cobra.Command{ Use: "tx", Short: "Transactions subcommands", diff --git a/simapp/cmd/simd/genaccounts.go b/simapp/cmd/simd/genaccounts.go index 98efeedc7e..0a6015104d 100644 --- a/simapp/cmd/simd/genaccounts.go +++ b/simapp/cmd/simd/genaccounts.go @@ -5,12 +5,13 @@ import ( "errors" "fmt" + "github.com/cosmos/cosmos-sdk/codec" + "github.com/cosmos/cosmos-sdk/std" "github.com/spf13/cobra" "github.com/spf13/viper" - "github.com/tendermint/go-amino" "github.com/tendermint/tendermint/libs/cli" "github.com/cosmos/cosmos-sdk/client/flags" @@ -33,7 +34,7 @@ const ( // AddGenesisAccountCmd returns add-genesis-account cobra Command. func AddGenesisAccountCmd( - ctx *server.Context, depCdc *amino.Codec, cdc *std.Codec, defaultNodeHome, defaultClientHome string, + ctx *server.Context, depCdc *codec.Codec, cdc *std.Codec, defaultNodeHome, defaultClientHome string, ) *cobra.Command { cmd := &cobra.Command{ diff --git a/std/codec.go b/std/codec.go index 95cb3786ad..d0d2047dff 100644 --- a/std/codec.go +++ b/std/codec.go @@ -8,12 +8,10 @@ import ( "github.com/cosmos/cosmos-sdk/x/auth" authexported "github.com/cosmos/cosmos-sdk/x/auth/exported" "github.com/cosmos/cosmos-sdk/x/auth/vesting" - gov "github.com/cosmos/cosmos-sdk/x/gov/types" ) var ( _ auth.Codec = (*Codec)(nil) - _ gov.Codec = (*Codec)(nil) ) // Codec defines the application-level codec. This codec contains all the @@ -71,33 +69,6 @@ func (c *Codec) UnmarshalAccountJSON(bz []byte) (authexported.Account, error) { return acc.GetAccount(), nil } -// MarshalProposal marshals a Proposal. It accepts a Proposal defined by the x/gov -// module and uses the application-level Proposal type which has the concrete -// Content implementation to serialize. -func (c *Codec) MarshalProposal(p gov.Proposal) ([]byte, error) { - proposal := &Proposal{ProposalBase: p.ProposalBase} - if err := proposal.Content.SetContent(p.Content); err != nil { - return nil, err - } - - return c.Marshaler.MarshalBinaryBare(proposal) -} - -// UnmarshalProposal decodes a Proposal defined by the x/gov module and uses the -// application-level Proposal type which has the concrete Content implementation -// to deserialize. -func (c *Codec) UnmarshalProposal(bz []byte) (gov.Proposal, error) { - proposal := &Proposal{} - if err := c.Marshaler.UnmarshalBinaryBare(bz, proposal); err != nil { - return gov.Proposal{}, err - } - - return gov.Proposal{ - Content: proposal.Content.GetContent(), - ProposalBase: proposal.ProposalBase, - }, nil -} - // ---------------------------------------------------------------------------- // necessary types and interfaces registered. This codec is provided to all the // modules the application depends on. diff --git a/std/codec.pb.go b/std/codec.pb.go index ba55855d94..4b5f1c0932 100644 --- a/std/codec.pb.go +++ b/std/codec.pb.go @@ -6,19 +6,16 @@ package std import ( fmt "fmt" github_com_cosmos_cosmos_sdk_types "github.com/cosmos/cosmos-sdk/types" - types9 "github.com/cosmos/cosmos-sdk/types" + types8 "github.com/cosmos/cosmos-sdk/types" github_com_cosmos_cosmos_sdk_x_auth_exported "github.com/cosmos/cosmos-sdk/x/auth/exported" types "github.com/cosmos/cosmos-sdk/x/auth/types" types1 "github.com/cosmos/cosmos-sdk/x/auth/vesting/types" - types5 "github.com/cosmos/cosmos-sdk/x/bank/types" - types6 "github.com/cosmos/cosmos-sdk/x/crisis/types" + types2 "github.com/cosmos/cosmos-sdk/x/bank/types" + types3 "github.com/cosmos/cosmos-sdk/x/crisis/types" types4 "github.com/cosmos/cosmos-sdk/x/distribution/types" - github_com_cosmos_cosmos_sdk_x_gov_types "github.com/cosmos/cosmos-sdk/x/gov/types" - types2 "github.com/cosmos/cosmos-sdk/x/gov/types" - proposal "github.com/cosmos/cosmos-sdk/x/params/types/proposal" - types7 "github.com/cosmos/cosmos-sdk/x/slashing/types" - types8 "github.com/cosmos/cosmos-sdk/x/staking/types" - types3 "github.com/cosmos/cosmos-sdk/x/upgrade/types" + types5 "github.com/cosmos/cosmos-sdk/x/gov/types" + types6 "github.com/cosmos/cosmos-sdk/x/slashing/types" + types7 "github.com/cosmos/cosmos-sdk/x/staking/types" _ "github.com/gogo/protobuf/gogoproto" proto "github.com/gogo/protobuf/proto" _ "github.com/regen-network/cosmos-proto" @@ -165,223 +162,6 @@ func (*Account) XXX_OneofWrappers() []interface{} { } } -// MsgSubmitProposal defines the application-level message type for handling -// governance proposals. -type MsgSubmitProposal struct { - types2.MsgSubmitProposalBase `protobuf:"bytes,1,opt,name=base,proto3,embedded=base" json:"base"` - Content *Content `protobuf:"bytes,2,opt,name=content,proto3" json:"content,omitempty"` -} - -func (m *MsgSubmitProposal) Reset() { *m = MsgSubmitProposal{} } -func (m *MsgSubmitProposal) String() string { return proto.CompactTextString(m) } -func (*MsgSubmitProposal) ProtoMessage() {} -func (*MsgSubmitProposal) Descriptor() ([]byte, []int) { - return fileDescriptor_ff851c3a98ef46f7, []int{1} -} -func (m *MsgSubmitProposal) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *MsgSubmitProposal) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_MsgSubmitProposal.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *MsgSubmitProposal) XXX_Merge(src proto.Message) { - xxx_messageInfo_MsgSubmitProposal.Merge(m, src) -} -func (m *MsgSubmitProposal) XXX_Size() int { - return m.Size() -} -func (m *MsgSubmitProposal) XXX_DiscardUnknown() { - xxx_messageInfo_MsgSubmitProposal.DiscardUnknown(m) -} - -var xxx_messageInfo_MsgSubmitProposal proto.InternalMessageInfo - -// Proposal defines the application-level concrete proposal type used in -// governance proposals. -type Proposal struct { - types2.ProposalBase `protobuf:"bytes,1,opt,name=base,proto3,embedded=base" json:"base"` - Content Content `protobuf:"bytes,2,opt,name=content,proto3" json:"content"` -} - -func (m *Proposal) Reset() { *m = Proposal{} } -func (m *Proposal) String() string { return proto.CompactTextString(m) } -func (*Proposal) ProtoMessage() {} -func (*Proposal) Descriptor() ([]byte, []int) { - return fileDescriptor_ff851c3a98ef46f7, []int{2} -} -func (m *Proposal) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *Proposal) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_Proposal.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *Proposal) XXX_Merge(src proto.Message) { - xxx_messageInfo_Proposal.Merge(m, src) -} -func (m *Proposal) XXX_Size() int { - return m.Size() -} -func (m *Proposal) XXX_DiscardUnknown() { - xxx_messageInfo_Proposal.DiscardUnknown(m) -} - -var xxx_messageInfo_Proposal proto.InternalMessageInfo - -func (m *Proposal) GetContent() Content { - if m != nil { - return m.Content - } - return Content{} -} - -// Content defines the application-level allowed Content to be included in a -// governance proposal. -type Content struct { - // sum defines a set of all acceptable concrete governance proposal Content - // types. - // - // Types that are valid to be assigned to Sum: - // *Content_Text - // *Content_ParameterChange - // *Content_SoftwareUpgrade - // *Content_CancelSoftwareUpgrade - // *Content_CommunityPoolSpend - Sum isContent_Sum `protobuf_oneof:"sum"` -} - -func (m *Content) Reset() { *m = Content{} } -func (m *Content) String() string { return proto.CompactTextString(m) } -func (*Content) ProtoMessage() {} -func (*Content) Descriptor() ([]byte, []int) { - return fileDescriptor_ff851c3a98ef46f7, []int{3} -} -func (m *Content) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *Content) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_Content.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *Content) XXX_Merge(src proto.Message) { - xxx_messageInfo_Content.Merge(m, src) -} -func (m *Content) XXX_Size() int { - return m.Size() -} -func (m *Content) XXX_DiscardUnknown() { - xxx_messageInfo_Content.DiscardUnknown(m) -} - -var xxx_messageInfo_Content proto.InternalMessageInfo - -type isContent_Sum interface { - isContent_Sum() - Equal(interface{}) bool - MarshalTo([]byte) (int, error) - Size() int -} - -type Content_Text struct { - Text *types2.TextProposal `protobuf:"bytes,1,opt,name=text,proto3,oneof" json:"text,omitempty"` -} -type Content_ParameterChange struct { - ParameterChange *proposal.ParameterChangeProposal `protobuf:"bytes,2,opt,name=parameter_change,json=parameterChange,proto3,oneof" json:"parameter_change,omitempty"` -} -type Content_SoftwareUpgrade struct { - SoftwareUpgrade *types3.SoftwareUpgradeProposal `protobuf:"bytes,3,opt,name=software_upgrade,json=softwareUpgrade,proto3,oneof" json:"software_upgrade,omitempty"` -} -type Content_CancelSoftwareUpgrade struct { - CancelSoftwareUpgrade *types3.CancelSoftwareUpgradeProposal `protobuf:"bytes,4,opt,name=cancel_software_upgrade,json=cancelSoftwareUpgrade,proto3,oneof" json:"cancel_software_upgrade,omitempty"` -} -type Content_CommunityPoolSpend struct { - CommunityPoolSpend *types4.CommunityPoolSpendProposal `protobuf:"bytes,5,opt,name=community_pool_spend,json=communityPoolSpend,proto3,oneof" json:"community_pool_spend,omitempty"` -} - -func (*Content_Text) isContent_Sum() {} -func (*Content_ParameterChange) isContent_Sum() {} -func (*Content_SoftwareUpgrade) isContent_Sum() {} -func (*Content_CancelSoftwareUpgrade) isContent_Sum() {} -func (*Content_CommunityPoolSpend) isContent_Sum() {} - -func (m *Content) GetSum() isContent_Sum { - if m != nil { - return m.Sum - } - return nil -} - -func (m *Content) GetText() *types2.TextProposal { - if x, ok := m.GetSum().(*Content_Text); ok { - return x.Text - } - return nil -} - -func (m *Content) GetParameterChange() *proposal.ParameterChangeProposal { - if x, ok := m.GetSum().(*Content_ParameterChange); ok { - return x.ParameterChange - } - return nil -} - -func (m *Content) GetSoftwareUpgrade() *types3.SoftwareUpgradeProposal { - if x, ok := m.GetSum().(*Content_SoftwareUpgrade); ok { - return x.SoftwareUpgrade - } - return nil -} - -func (m *Content) GetCancelSoftwareUpgrade() *types3.CancelSoftwareUpgradeProposal { - if x, ok := m.GetSum().(*Content_CancelSoftwareUpgrade); ok { - return x.CancelSoftwareUpgrade - } - return nil -} - -func (m *Content) GetCommunityPoolSpend() *types4.CommunityPoolSpendProposal { - if x, ok := m.GetSum().(*Content_CommunityPoolSpend); ok { - return x.CommunityPoolSpend - } - return nil -} - -// XXX_OneofWrappers is for the internal use of the proto package. -func (*Content) XXX_OneofWrappers() []interface{} { - return []interface{}{ - (*Content_Text)(nil), - (*Content_ParameterChange)(nil), - (*Content_SoftwareUpgrade)(nil), - (*Content_CancelSoftwareUpgrade)(nil), - (*Content_CommunityPoolSpend)(nil), - } -} - // Transaction defines the application-level transaction that can be signed and // processed by the state-machine. It contains a base of common fields and // repeated set of Message types. @@ -394,7 +174,7 @@ func (m *Transaction) Reset() { *m = Transaction{} } func (m *Transaction) String() string { return proto.CompactTextString(m) } func (*Transaction) ProtoMessage() {} func (*Transaction) Descriptor() ([]byte, []int) { - return fileDescriptor_ff851c3a98ef46f7, []int{4} + return fileDescriptor_ff851c3a98ef46f7, []int{1} } func (m *Transaction) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -436,7 +216,6 @@ type Message struct { // *Message_MsgWithdrawDelegatorReward // *Message_MsgWithdrawValidatorCommission // *Message_MsgFundCommunityPool - // *Message_MsgSubmitProposal // *Message_MsgVote // *Message_MsgDeposit // *Message_MsgUnjail @@ -452,7 +231,7 @@ func (m *Message) Reset() { *m = Message{} } func (m *Message) String() string { return proto.CompactTextString(m) } func (*Message) ProtoMessage() {} func (*Message) Descriptor() ([]byte, []int) { - return fileDescriptor_ff851c3a98ef46f7, []int{5} + return fileDescriptor_ff851c3a98ef46f7, []int{2} } func (m *Message) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -488,13 +267,13 @@ type isMessage_Sum interface { } type Message_MsgSend struct { - MsgSend *types5.MsgSend `protobuf:"bytes,1,opt,name=msg_send,json=msgSend,proto3,oneof" json:"msg_send,omitempty"` + MsgSend *types2.MsgSend `protobuf:"bytes,1,opt,name=msg_send,json=msgSend,proto3,oneof" json:"msg_send,omitempty"` } type Message_MsgMultiSend struct { - MsgMultiSend *types5.MsgMultiSend `protobuf:"bytes,2,opt,name=msg_multi_send,json=msgMultiSend,proto3,oneof" json:"msg_multi_send,omitempty"` + MsgMultiSend *types2.MsgMultiSend `protobuf:"bytes,2,opt,name=msg_multi_send,json=msgMultiSend,proto3,oneof" json:"msg_multi_send,omitempty"` } type Message_MsgVerifyInvariant struct { - MsgVerifyInvariant *types6.MsgVerifyInvariant `protobuf:"bytes,3,opt,name=msg_verify_invariant,json=msgVerifyInvariant,proto3,oneof" json:"msg_verify_invariant,omitempty"` + MsgVerifyInvariant *types3.MsgVerifyInvariant `protobuf:"bytes,3,opt,name=msg_verify_invariant,json=msgVerifyInvariant,proto3,oneof" json:"msg_verify_invariant,omitempty"` } type Message_MsgSetWithdrawAddress struct { MsgSetWithdrawAddress *types4.MsgSetWithdrawAddress `protobuf:"bytes,4,opt,name=msg_set_withdraw_address,json=msgSetWithdrawAddress,proto3,oneof" json:"msg_set_withdraw_address,omitempty"` @@ -508,32 +287,29 @@ type Message_MsgWithdrawValidatorCommission struct { type Message_MsgFundCommunityPool struct { MsgFundCommunityPool *types4.MsgFundCommunityPool `protobuf:"bytes,7,opt,name=msg_fund_community_pool,json=msgFundCommunityPool,proto3,oneof" json:"msg_fund_community_pool,omitempty"` } -type Message_MsgSubmitProposal struct { - MsgSubmitProposal *MsgSubmitProposal `protobuf:"bytes,9,opt,name=msg_submit_proposal,json=msgSubmitProposal,proto3,oneof" json:"msg_submit_proposal,omitempty"` -} type Message_MsgVote struct { - MsgVote *types2.MsgVote `protobuf:"bytes,10,opt,name=msg_vote,json=msgVote,proto3,oneof" json:"msg_vote,omitempty"` + MsgVote *types5.MsgVote `protobuf:"bytes,10,opt,name=msg_vote,json=msgVote,proto3,oneof" json:"msg_vote,omitempty"` } type Message_MsgDeposit struct { - MsgDeposit *types2.MsgDeposit `protobuf:"bytes,11,opt,name=msg_deposit,json=msgDeposit,proto3,oneof" json:"msg_deposit,omitempty"` + MsgDeposit *types5.MsgDeposit `protobuf:"bytes,11,opt,name=msg_deposit,json=msgDeposit,proto3,oneof" json:"msg_deposit,omitempty"` } type Message_MsgUnjail struct { - MsgUnjail *types7.MsgUnjail `protobuf:"bytes,12,opt,name=msg_unjail,json=msgUnjail,proto3,oneof" json:"msg_unjail,omitempty"` + MsgUnjail *types6.MsgUnjail `protobuf:"bytes,12,opt,name=msg_unjail,json=msgUnjail,proto3,oneof" json:"msg_unjail,omitempty"` } type Message_MsgCreateValidator struct { - MsgCreateValidator *types8.MsgCreateValidator `protobuf:"bytes,13,opt,name=msg_create_validator,json=msgCreateValidator,proto3,oneof" json:"msg_create_validator,omitempty"` + MsgCreateValidator *types7.MsgCreateValidator `protobuf:"bytes,13,opt,name=msg_create_validator,json=msgCreateValidator,proto3,oneof" json:"msg_create_validator,omitempty"` } type Message_MsgEditValidator struct { - MsgEditValidator *types8.MsgEditValidator `protobuf:"bytes,14,opt,name=msg_edit_validator,json=msgEditValidator,proto3,oneof" json:"msg_edit_validator,omitempty"` + MsgEditValidator *types7.MsgEditValidator `protobuf:"bytes,14,opt,name=msg_edit_validator,json=msgEditValidator,proto3,oneof" json:"msg_edit_validator,omitempty"` } type Message_MsgDelegate struct { - MsgDelegate *types8.MsgDelegate `protobuf:"bytes,15,opt,name=msg_delegate,json=msgDelegate,proto3,oneof" json:"msg_delegate,omitempty"` + MsgDelegate *types7.MsgDelegate `protobuf:"bytes,15,opt,name=msg_delegate,json=msgDelegate,proto3,oneof" json:"msg_delegate,omitempty"` } type Message_MsgBeginRedelegate struct { - MsgBeginRedelegate *types8.MsgBeginRedelegate `protobuf:"bytes,16,opt,name=msg_begin_redelegate,json=msgBeginRedelegate,proto3,oneof" json:"msg_begin_redelegate,omitempty"` + MsgBeginRedelegate *types7.MsgBeginRedelegate `protobuf:"bytes,16,opt,name=msg_begin_redelegate,json=msgBeginRedelegate,proto3,oneof" json:"msg_begin_redelegate,omitempty"` } type Message_MsgUndelegate struct { - MsgUndelegate *types8.MsgUndelegate `protobuf:"bytes,17,opt,name=msg_undelegate,json=msgUndelegate,proto3,oneof" json:"msg_undelegate,omitempty"` + MsgUndelegate *types7.MsgUndelegate `protobuf:"bytes,17,opt,name=msg_undelegate,json=msgUndelegate,proto3,oneof" json:"msg_undelegate,omitempty"` } func (*Message_MsgSend) isMessage_Sum() {} @@ -543,7 +319,6 @@ func (*Message_MsgSetWithdrawAddress) isMessage_Sum() {} func (*Message_MsgWithdrawDelegatorReward) isMessage_Sum() {} func (*Message_MsgWithdrawValidatorCommission) isMessage_Sum() {} func (*Message_MsgFundCommunityPool) isMessage_Sum() {} -func (*Message_MsgSubmitProposal) isMessage_Sum() {} func (*Message_MsgVote) isMessage_Sum() {} func (*Message_MsgDeposit) isMessage_Sum() {} func (*Message_MsgUnjail) isMessage_Sum() {} @@ -560,21 +335,21 @@ func (m *Message) GetSum() isMessage_Sum { return nil } -func (m *Message) GetMsgSend() *types5.MsgSend { +func (m *Message) GetMsgSend() *types2.MsgSend { if x, ok := m.GetSum().(*Message_MsgSend); ok { return x.MsgSend } return nil } -func (m *Message) GetMsgMultiSend() *types5.MsgMultiSend { +func (m *Message) GetMsgMultiSend() *types2.MsgMultiSend { if x, ok := m.GetSum().(*Message_MsgMultiSend); ok { return x.MsgMultiSend } return nil } -func (m *Message) GetMsgVerifyInvariant() *types6.MsgVerifyInvariant { +func (m *Message) GetMsgVerifyInvariant() *types3.MsgVerifyInvariant { if x, ok := m.GetSum().(*Message_MsgVerifyInvariant); ok { return x.MsgVerifyInvariant } @@ -609,63 +384,56 @@ func (m *Message) GetMsgFundCommunityPool() *types4.MsgFundCommunityPool { return nil } -func (m *Message) GetMsgSubmitProposal() *MsgSubmitProposal { - if x, ok := m.GetSum().(*Message_MsgSubmitProposal); ok { - return x.MsgSubmitProposal - } - return nil -} - -func (m *Message) GetMsgVote() *types2.MsgVote { +func (m *Message) GetMsgVote() *types5.MsgVote { if x, ok := m.GetSum().(*Message_MsgVote); ok { return x.MsgVote } return nil } -func (m *Message) GetMsgDeposit() *types2.MsgDeposit { +func (m *Message) GetMsgDeposit() *types5.MsgDeposit { if x, ok := m.GetSum().(*Message_MsgDeposit); ok { return x.MsgDeposit } return nil } -func (m *Message) GetMsgUnjail() *types7.MsgUnjail { +func (m *Message) GetMsgUnjail() *types6.MsgUnjail { if x, ok := m.GetSum().(*Message_MsgUnjail); ok { return x.MsgUnjail } return nil } -func (m *Message) GetMsgCreateValidator() *types8.MsgCreateValidator { +func (m *Message) GetMsgCreateValidator() *types7.MsgCreateValidator { if x, ok := m.GetSum().(*Message_MsgCreateValidator); ok { return x.MsgCreateValidator } return nil } -func (m *Message) GetMsgEditValidator() *types8.MsgEditValidator { +func (m *Message) GetMsgEditValidator() *types7.MsgEditValidator { if x, ok := m.GetSum().(*Message_MsgEditValidator); ok { return x.MsgEditValidator } return nil } -func (m *Message) GetMsgDelegate() *types8.MsgDelegate { +func (m *Message) GetMsgDelegate() *types7.MsgDelegate { if x, ok := m.GetSum().(*Message_MsgDelegate); ok { return x.MsgDelegate } return nil } -func (m *Message) GetMsgBeginRedelegate() *types8.MsgBeginRedelegate { +func (m *Message) GetMsgBeginRedelegate() *types7.MsgBeginRedelegate { if x, ok := m.GetSum().(*Message_MsgBeginRedelegate); ok { return x.MsgBeginRedelegate } return nil } -func (m *Message) GetMsgUndelegate() *types8.MsgUndelegate { +func (m *Message) GetMsgUndelegate() *types7.MsgUndelegate { if x, ok := m.GetSum().(*Message_MsgUndelegate); ok { return x.MsgUndelegate } @@ -682,7 +450,6 @@ func (*Message) XXX_OneofWrappers() []interface{} { (*Message_MsgWithdrawDelegatorReward)(nil), (*Message_MsgWithdrawValidatorCommission)(nil), (*Message_MsgFundCommunityPool)(nil), - (*Message_MsgSubmitProposal)(nil), (*Message_MsgVote)(nil), (*Message_MsgDeposit)(nil), (*Message_MsgUnjail)(nil), @@ -705,7 +472,7 @@ func (m *SignDoc) Reset() { *m = SignDoc{} } func (m *SignDoc) String() string { return proto.CompactTextString(m) } func (*SignDoc) ProtoMessage() {} func (*SignDoc) Descriptor() ([]byte, []int) { - return fileDescriptor_ff851c3a98ef46f7, []int{6} + return fileDescriptor_ff851c3a98ef46f7, []int{3} } func (m *SignDoc) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -753,7 +520,7 @@ func (m *StdFee) Reset() { *m = StdFee{} } func (m *StdFee) String() string { return proto.CompactTextString(m) } func (*StdFee) ProtoMessage() {} func (*StdFee) Descriptor() ([]byte, []int) { - return fileDescriptor_ff851c3a98ef46f7, []int{7} + return fileDescriptor_ff851c3a98ef46f7, []int{4} } func (m *StdFee) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -793,7 +560,7 @@ func (m *StdSignature) Reset() { *m = StdSignature{} } func (m *StdSignature) String() string { return proto.CompactTextString(m) } func (*StdSignature) ProtoMessage() {} func (*StdSignature) Descriptor() ([]byte, []int) { - return fileDescriptor_ff851c3a98ef46f7, []int{8} + return fileDescriptor_ff851c3a98ef46f7, []int{5} } func (m *StdSignature) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -834,7 +601,7 @@ func (m *StdTxBase) Reset() { *m = StdTxBase{} } func (m *StdTxBase) String() string { return proto.CompactTextString(m) } func (*StdTxBase) ProtoMessage() {} func (*StdTxBase) Descriptor() ([]byte, []int) { - return fileDescriptor_ff851c3a98ef46f7, []int{9} + return fileDescriptor_ff851c3a98ef46f7, []int{6} } func (m *StdTxBase) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -898,7 +665,7 @@ func (m *StdSignDocBase) Reset() { *m = StdSignDocBase{} } func (m *StdSignDocBase) String() string { return proto.CompactTextString(m) } func (*StdSignDocBase) ProtoMessage() {} func (*StdSignDocBase) Descriptor() ([]byte, []int) { - return fileDescriptor_ff851c3a98ef46f7, []int{10} + return fileDescriptor_ff851c3a98ef46f7, []int{7} } func (m *StdSignDocBase) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -964,9 +731,6 @@ func (m *StdSignDocBase) GetFee() StdFee { func init() { proto.RegisterType((*Account)(nil), "cosmos_sdk.std.v1.Account") - proto.RegisterType((*MsgSubmitProposal)(nil), "cosmos_sdk.std.v1.MsgSubmitProposal") - proto.RegisterType((*Proposal)(nil), "cosmos_sdk.std.v1.Proposal") - proto.RegisterType((*Content)(nil), "cosmos_sdk.std.v1.Content") proto.RegisterType((*Transaction)(nil), "cosmos_sdk.std.v1.Transaction") proto.RegisterType((*Message)(nil), "cosmos_sdk.std.v1.Message") proto.RegisterType((*SignDoc)(nil), "cosmos_sdk.std.v1.SignDoc") @@ -979,117 +743,100 @@ func init() { func init() { proto.RegisterFile("std/codec.proto", fileDescriptor_ff851c3a98ef46f7) } var fileDescriptor_ff851c3a98ef46f7 = []byte{ - // 1600 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x57, 0xcd, 0x6f, 0x1b, 0xc7, - 0x15, 0x27, 0x2d, 0x5a, 0x94, 0x46, 0xd4, 0xd7, 0xd8, 0xae, 0x68, 0xd5, 0x26, 0x65, 0xba, 0x30, - 0x5c, 0xbb, 0x22, 0x2d, 0xdb, 0xfd, 0x30, 0x51, 0xb4, 0x35, 0x25, 0x0b, 0x54, 0x5b, 0xb5, 0xc6, - 0xca, 0x56, 0xd1, 0xa2, 0xed, 0x62, 0xb8, 0x3b, 0x5a, 0x4d, 0xc5, 0xd9, 0xd9, 0xee, 0xcc, 0x52, - 0x64, 0x81, 0x9e, 0x92, 0x43, 0x7c, 0x08, 0x90, 0x6b, 0x0e, 0x01, 0x9c, 0x6b, 0xce, 0x3e, 0xe5, - 0x2f, 0x30, 0x7c, 0xf2, 0x31, 0x27, 0x25, 0x90, 0x2f, 0x81, 0x4f, 0x81, 0xff, 0x82, 0x60, 0x66, - 0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e0, 0xee, 0x7b, 0x03, 0xd8, 0x0e, 0x5c, 0x7b, 0x60, 0x68, 0x9b, 0x19, 0x43, 0xf6, 0xcb, 0x88, - 0x1c, 0xee, 0x83, 0x0b, 0xaa, 0xce, 0x6a, 0x0b, 0x99, 0xd1, 0xc3, 0xa9, 0x38, 0xab, 0x1c, 0xfd, - 0x2c, 0x6d, 0x4c, 0x86, 0x57, 0x56, 0x33, 0x63, 0x2c, 0xd3, 0x91, 0xed, 0xf7, 0x20, 0x9c, 0x93, - 0x0e, 0x13, 0xb8, 0x08, 0x46, 0x67, 0x36, 0xb9, 0x01, 0xf7, 0x99, 0xc0, 0x7a, 0x4c, 0xe4, 0x27, - 0x6c, 0x80, 0x39, 0x09, 0xb5, 0xb1, 0xc7, 0x38, 0x11, 0xc5, 0x39, 0x85, 0x2e, 0x8f, 0x43, 0x6f, - 0x85, 0x66, 0xcd, 0x8c, 0x01, 0x68, 0x7c, 0x82, 0x5b, 0x40, 0x9e, 0xcc, 0xc0, 0xfd, 0x0f, 0x22, - 0xed, 0x62, 0x21, 0xed, 0x79, 0x10, 0x3d, 0x36, 0x35, 0xcf, 0x53, 0x65, 0xda, 0xcc, 0x18, 0xb3, - 0x34, 0x3a, 0x40, 0x33, 0x1c, 0x32, 0xcb, 0xc7, 0x48, 0xe0, 0x7e, 0x4b, 0x14, 0xe7, 0x15, 0xdf, - 0xed, 0x21, 0xbe, 0xf0, 0x79, 0xaa, 0xe9, 0x36, 0x15, 0x26, 0x2e, 0xaf, 0x9e, 0xb2, 0x21, 0x29, - 0xfc, 0x3b, 0x90, 0x52, 0x13, 0xdb, 0x44, 0x24, 0xe8, 0x17, 0x14, 0xfd, 0xcf, 0x27, 0xd1, 0x3f, - 0xb2, 0x89, 0x48, 0x92, 0x2f, 0xd1, 0x21, 0x19, 0xdc, 0x01, 0x85, 0x30, 0x8b, 0xaa, 0xd1, 0x71, - 0x71, 0x71, 0xb4, 0xa2, 0xc3, 0xa4, 0x7a, 0x28, 0x64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, 0x65, 0xbf, 0x39, 0x2d, 0x65, 0x3f, 0x79, 0x53, 0xca, 0xbc, 0x7e, 0x53, - 0xca, 0x7c, 0xf5, 0xa6, 0x94, 0xf9, 0xc7, 0xda, 0xc4, 0x96, 0xe3, 0xc2, 0x6e, 0x4d, 0xab, 0x7f, - 0xae, 0xef, 0x7d, 0x1f, 0x00, 0x00, 0xff, 0xff, 0x62, 0xc1, 0x70, 0xf7, 0x14, 0x11, 0x00, 0x00, -} - -func (this *MsgSubmitProposal) Equal(that interface{}) bool { + // 1317 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x56, 0xcf, 0x6f, 0x1b, 0xc5, + 0x17, 0x5f, 0x37, 0x6e, 0xdc, 0x8c, 0x9d, 0xb4, 0x99, 0x6f, 0xfb, 0xad, 0x6b, 0x5a, 0x3b, 0x35, + 0xa8, 0x2a, 0x2d, 0xb1, 0xe9, 0x0f, 0x10, 0xb5, 0x10, 0xa2, 0x4e, 0x1a, 0x39, 0x40, 0xa1, 0xda, + 0xb4, 0x45, 0x20, 0xc1, 0x6a, 0xbc, 0x33, 0xdd, 0x0c, 0xf1, 0xec, 0x2c, 0x3b, 0xb3, 0xae, 0x8d, + 0xc4, 0x09, 0x0e, 0x94, 0x13, 0x57, 0x6e, 0x3d, 0x73, 0xee, 0x89, 0xbf, 0xa0, 0xea, 0xa9, 0x47, + 0x4e, 0x06, 0xa5, 0x17, 0xd4, 0x13, 0xea, 0x5f, 0x80, 0x66, 0x76, 0x76, 0xed, 0xc4, 0x1b, 0xb7, + 0x07, 0x2e, 0xab, 0x79, 0x3f, 0x3e, 0x9f, 0xf7, 0xf6, 0xbd, 0x37, 0xfb, 0x16, 0x1c, 0x15, 0x12, + 0x37, 0x5d, 0x8e, 0x89, 0xdb, 0x08, 0x42, 0x2e, 0x39, 0x5c, 0x76, 0xb9, 0x60, 0x5c, 0x38, 0x02, + 0xef, 0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5, 0x62, 0x54, 0x3b, 0x11, 0xa3, 0xf6, + 0xda, 0xeb, 0xf6, 0xa2, 0x51, 0x7c, 0xaa, 0x65, 0x58, 0x01, 0x47, 0x04, 0xf9, 0x36, 0x22, 0xbe, + 0x4b, 0x74, 0x9e, 0x79, 0x3b, 0x95, 0xd3, 0xfc, 0xf3, 0xe3, 0xfc, 0x93, 0x6a, 0x1e, 0x7e, 0xf5, + 0x6a, 0xb6, 0x5b, 0x8f, 0x77, 0xab, 0xb9, 0xa7, 0xbb, 0xd5, 0xdc, 0x5f, 0xbb, 0xd5, 0xdc, 0x2f, + 0xcf, 0xaa, 0xd6, 0xd3, 0x67, 0x55, 0xeb, 0x8f, 0x67, 0x55, 0xeb, 0xcb, 0x95, 0x99, 0x23, 0x27, + 0x24, 0xee, 0xce, 0xeb, 0x1f, 0xf6, 0x2b, 0xff, 0x06, 0x00, 0x00, 0xff, 0xff, 0x5e, 0x75, 0x49, + 0x67, 0x26, 0x0d, 0x00, 0x00, +} + +func (this *StdFee) Equal(that interface{}) bool { if that == nil { return this == nil } - that1, ok := that.(*MsgSubmitProposal) + that1, ok := that.(*StdFee) if !ok { - that2, ok := that.(MsgSubmitProposal) + that2, ok := that.(StdFee) if ok { that1 = &that2 } else { @@ -1101,335 +848,84 @@ func (this *MsgSubmitProposal) Equal(that interface{}) bool { } else if this == nil { return false } - if !this.MsgSubmitProposalBase.Equal(&that1.MsgSubmitProposalBase) { + if len(this.Amount) != len(that1.Amount) { return false } - if !this.Content.Equal(that1.Content) { + for i := range this.Amount { + if !this.Amount[i].Equal(&that1.Amount[i]) { + return false + } + } + if this.Gas != that1.Gas { return false } return true } -func (this *Proposal) Equal(that interface{}) bool { - if that == nil { - return this == nil +func (this *Account) GetAccount() github_com_cosmos_cosmos_sdk_x_auth_exported.Account { + if x := this.GetBaseAccount(); x != nil { + return x } - - that1, ok := that.(*Proposal) - if !ok { - that2, ok := that.(Proposal) - if ok { - that1 = &that2 - } else { - return false - } + if x := this.GetContinuousVestingAccount(); x != nil { + return x } - if that1 == nil { - return this == nil - } else if this == nil { - return false + if x := this.GetDelayedVestingAccount(); x != nil { + return x } - if !this.ProposalBase.Equal(&that1.ProposalBase) { - return false + if x := this.GetPeriodicVestingAccount(); x != nil { + return x } - if !this.Content.Equal(&that1.Content) { - return false + if x := this.GetModuleAccount(); x != nil { + return x } - return true + return nil } -func (this *Content) Equal(that interface{}) bool { - if that == nil { - return this == nil - } - that1, ok := that.(*Content) - if !ok { - that2, ok := that.(Content) - if ok { - that1 = &that2 - } else { - return false - } - } - if that1 == nil { - return this == nil - } else if this == nil { - return false +func (this *Account) SetAccount(value github_com_cosmos_cosmos_sdk_x_auth_exported.Account) error { + if value == nil { + this.Sum = nil + return nil } - if that1.Sum == nil { - if this.Sum != nil { - return false - } - } else if this.Sum == nil { - return false - } else if !this.Sum.Equal(that1.Sum) { - return false + switch vt := value.(type) { + case *types.BaseAccount: + this.Sum = &Account_BaseAccount{vt} + return nil + case *types1.ContinuousVestingAccount: + this.Sum = &Account_ContinuousVestingAccount{vt} + return nil + case *types1.DelayedVestingAccount: + this.Sum = &Account_DelayedVestingAccount{vt} + return nil + case *types1.PeriodicVestingAccount: + this.Sum = &Account_PeriodicVestingAccount{vt} + return nil + case *types.ModuleAccount: + this.Sum = &Account_ModuleAccount{vt} + return nil } - return true + return fmt.Errorf("can't encode value of type %T as message Account", value) } -func (this *Content_Text) Equal(that interface{}) bool { - if that == nil { - return this == nil - } - that1, ok := that.(*Content_Text) - if !ok { - that2, ok := that.(Content_Text) - if ok { - that1 = &that2 - } else { - return false - } +func (this *Message) GetMsg() github_com_cosmos_cosmos_sdk_types.Msg { + if x := this.GetMsgSend(); x != nil { + return x } - if that1 == nil { - return this == nil - } else if this == nil { - return false + if x := this.GetMsgMultiSend(); x != nil { + return x } - if !this.Text.Equal(that1.Text) { - return false + if x := this.GetMsgVerifyInvariant(); x != nil { + return x } - return true -} -func (this *Content_ParameterChange) Equal(that interface{}) bool { - if that == nil { - return this == nil + if x := this.GetMsgSetWithdrawAddress(); x != nil { + return x } - - that1, ok := that.(*Content_ParameterChange) - if !ok { - that2, ok := that.(Content_ParameterChange) - if ok { - that1 = &that2 - } else { - return false - } + if x := this.GetMsgWithdrawDelegatorReward(); x != nil { + return x } - if that1 == nil { - return this == nil - } else if this == nil { - return false + if x := this.GetMsgWithdrawValidatorCommission(); x != nil { + return x } - if !this.ParameterChange.Equal(that1.ParameterChange) { - return false - } - return true -} -func (this *Content_SoftwareUpgrade) Equal(that interface{}) bool { - if that == nil { - return this == nil - } - - that1, ok := that.(*Content_SoftwareUpgrade) - if !ok { - that2, ok := that.(Content_SoftwareUpgrade) - if ok { - that1 = &that2 - } else { - return false - } - } - if that1 == nil { - return this == nil - } else if this == nil { - return false - } - if !this.SoftwareUpgrade.Equal(that1.SoftwareUpgrade) { - return false - } - return true -} -func (this *Content_CancelSoftwareUpgrade) Equal(that interface{}) bool { - if that == nil { - return this == nil - } - - that1, ok := that.(*Content_CancelSoftwareUpgrade) - if !ok { - that2, ok := that.(Content_CancelSoftwareUpgrade) - if ok { - that1 = &that2 - } else { - return false - } - } - if that1 == nil { - return this == nil - } else if this == nil { - return false - } - if !this.CancelSoftwareUpgrade.Equal(that1.CancelSoftwareUpgrade) { - return false - } - return true -} -func (this *Content_CommunityPoolSpend) Equal(that interface{}) bool { - if that == nil { - return this == nil - } - - that1, ok := that.(*Content_CommunityPoolSpend) - if !ok { - that2, ok := that.(Content_CommunityPoolSpend) - if ok { - that1 = &that2 - } else { - return false - } - } - if that1 == nil { - return this == nil - } else if this == nil { - return false - } - if !this.CommunityPoolSpend.Equal(that1.CommunityPoolSpend) { - return false - } - return true -} -func (this *StdFee) Equal(that interface{}) bool { - if that == nil { - return this == nil - } - - that1, ok := that.(*StdFee) - if !ok { - that2, ok := that.(StdFee) - if ok { - that1 = &that2 - } else { - return false - } - } - if that1 == nil { - return this == nil - } else if this == nil { - return false - } - if len(this.Amount) != len(that1.Amount) { - return false - } - for i := range this.Amount { - if !this.Amount[i].Equal(&that1.Amount[i]) { - return false - } - } - if this.Gas != that1.Gas { - return false - } - return true -} -func (this *Account) GetAccount() github_com_cosmos_cosmos_sdk_x_auth_exported.Account { - if x := this.GetBaseAccount(); x != nil { - return x - } - if x := this.GetContinuousVestingAccount(); x != nil { - return x - } - if x := this.GetDelayedVestingAccount(); x != nil { - return x - } - if x := this.GetPeriodicVestingAccount(); x != nil { - return x - } - if x := this.GetModuleAccount(); x != nil { - return x - } - return nil -} - -func (this *Account) SetAccount(value github_com_cosmos_cosmos_sdk_x_auth_exported.Account) error { - if value == nil { - this.Sum = nil - return nil - } - switch vt := value.(type) { - case *types.BaseAccount: - this.Sum = &Account_BaseAccount{vt} - return nil - case *types1.ContinuousVestingAccount: - this.Sum = &Account_ContinuousVestingAccount{vt} - return nil - case *types1.DelayedVestingAccount: - this.Sum = &Account_DelayedVestingAccount{vt} - return nil - case *types1.PeriodicVestingAccount: - this.Sum = &Account_PeriodicVestingAccount{vt} - return nil - case *types.ModuleAccount: - this.Sum = &Account_ModuleAccount{vt} - return nil - } - return fmt.Errorf("can't encode value of type %T as message Account", value) -} - -func (this *Content) GetContent() github_com_cosmos_cosmos_sdk_x_gov_types.Content { - if x := this.GetText(); x != nil { - return x - } - if x := this.GetParameterChange(); x != nil { - return x - } - if x := this.GetSoftwareUpgrade(); x != nil { - return x - } - if x := this.GetCancelSoftwareUpgrade(); x != nil { - return x - } - if x := this.GetCommunityPoolSpend(); x != nil { - return x - } - return nil -} - -func (this *Content) SetContent(value github_com_cosmos_cosmos_sdk_x_gov_types.Content) error { - if value == nil { - this.Sum = nil - return nil - } - switch vt := value.(type) { - case *types2.TextProposal: - this.Sum = &Content_Text{vt} - return nil - case *proposal.ParameterChangeProposal: - this.Sum = &Content_ParameterChange{vt} - return nil - case *types3.SoftwareUpgradeProposal: - this.Sum = &Content_SoftwareUpgrade{vt} - return nil - case *types3.CancelSoftwareUpgradeProposal: - this.Sum = &Content_CancelSoftwareUpgrade{vt} - return nil - case *types4.CommunityPoolSpendProposal: - this.Sum = &Content_CommunityPoolSpend{vt} - return nil - } - return fmt.Errorf("can't encode value of type %T as message Content", value) -} - -func (this *Message) GetMsg() github_com_cosmos_cosmos_sdk_types.Msg { - if x := this.GetMsgSend(); x != nil { - return x - } - if x := this.GetMsgMultiSend(); x != nil { - return x - } - if x := this.GetMsgVerifyInvariant(); x != nil { - return x - } - if x := this.GetMsgSetWithdrawAddress(); x != nil { - return x - } - if x := this.GetMsgWithdrawDelegatorReward(); x != nil { - return x - } - if x := this.GetMsgWithdrawValidatorCommission(); x != nil { - return x - } - if x := this.GetMsgFundCommunityPool(); x != nil { - return x - } - if x := this.GetMsgSubmitProposal(); x != nil { - return x + if x := this.GetMsgFundCommunityPool(); x != nil { + return x } if x := this.GetMsgVote(); x != nil { return x @@ -1464,22 +960,22 @@ func (this *Message) SetMsg(value github_com_cosmos_cosmos_sdk_types.Msg) error return nil } switch vt := value.(type) { - case *types5.MsgSend: + case *types2.MsgSend: this.Sum = &Message_MsgSend{vt} return nil - case types5.MsgSend: + case types2.MsgSend: this.Sum = &Message_MsgSend{&vt} return nil - case *types5.MsgMultiSend: + case *types2.MsgMultiSend: this.Sum = &Message_MsgMultiSend{vt} return nil - case types5.MsgMultiSend: + case types2.MsgMultiSend: this.Sum = &Message_MsgMultiSend{&vt} return nil - case *types6.MsgVerifyInvariant: + case *types3.MsgVerifyInvariant: this.Sum = &Message_MsgVerifyInvariant{vt} return nil - case types6.MsgVerifyInvariant: + case types3.MsgVerifyInvariant: this.Sum = &Message_MsgVerifyInvariant{&vt} return nil case *types4.MsgSetWithdrawAddress: @@ -1506,58 +1002,52 @@ func (this *Message) SetMsg(value github_com_cosmos_cosmos_sdk_types.Msg) error case types4.MsgFundCommunityPool: this.Sum = &Message_MsgFundCommunityPool{&vt} return nil - case *MsgSubmitProposal: - this.Sum = &Message_MsgSubmitProposal{vt} - return nil - case MsgSubmitProposal: - this.Sum = &Message_MsgSubmitProposal{&vt} - return nil - case *types2.MsgVote: + case *types5.MsgVote: this.Sum = &Message_MsgVote{vt} return nil - case types2.MsgVote: + case types5.MsgVote: this.Sum = &Message_MsgVote{&vt} return nil - case *types2.MsgDeposit: + case *types5.MsgDeposit: this.Sum = &Message_MsgDeposit{vt} return nil - case types2.MsgDeposit: + case types5.MsgDeposit: this.Sum = &Message_MsgDeposit{&vt} return nil - case *types7.MsgUnjail: + case *types6.MsgUnjail: this.Sum = &Message_MsgUnjail{vt} return nil - case types7.MsgUnjail: + case types6.MsgUnjail: this.Sum = &Message_MsgUnjail{&vt} return nil - case *types8.MsgCreateValidator: + case *types7.MsgCreateValidator: this.Sum = &Message_MsgCreateValidator{vt} return nil - case types8.MsgCreateValidator: + case types7.MsgCreateValidator: this.Sum = &Message_MsgCreateValidator{&vt} return nil - case *types8.MsgEditValidator: + case *types7.MsgEditValidator: this.Sum = &Message_MsgEditValidator{vt} return nil - case types8.MsgEditValidator: + case types7.MsgEditValidator: this.Sum = &Message_MsgEditValidator{&vt} return nil - case *types8.MsgDelegate: + case *types7.MsgDelegate: this.Sum = &Message_MsgDelegate{vt} return nil - case types8.MsgDelegate: + case types7.MsgDelegate: this.Sum = &Message_MsgDelegate{&vt} return nil - case *types8.MsgBeginRedelegate: + case *types7.MsgBeginRedelegate: this.Sum = &Message_MsgBeginRedelegate{vt} return nil - case types8.MsgBeginRedelegate: + case types7.MsgBeginRedelegate: this.Sum = &Message_MsgBeginRedelegate{&vt} return nil - case *types8.MsgUndelegate: + case *types7.MsgUndelegate: this.Sum = &Message_MsgUndelegate{vt} return nil - case types8.MsgUndelegate: + case types7.MsgUndelegate: this.Sum = &Message_MsgUndelegate{&vt} return nil } @@ -1701,7 +1191,7 @@ func (m *Account_ModuleAccount) MarshalToSizedBuffer(dAtA []byte) (int, error) { } return len(dAtA) - i, nil } -func (m *MsgSubmitProposal) Marshal() (dAtA []byte, err error) { +func (m *Transaction) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -1711,73 +1201,32 @@ func (m *MsgSubmitProposal) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *MsgSubmitProposal) MarshalTo(dAtA []byte) (int, error) { +func (m *Transaction) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *MsgSubmitProposal) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *Transaction) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int _ = l - if m.Content != nil { - { - size, err := m.Content.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err + if len(m.Msgs) > 0 { + for iNdEx := len(m.Msgs) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Msgs[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintCodec(dAtA, i, uint64(size)) } - i -= size - i = encodeVarintCodec(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - } - { - size, err := m.MsgSubmitProposalBase.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintCodec(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - return len(dAtA) - i, nil -} - -func (m *Proposal) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *Proposal) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *Proposal) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - { - size, err := m.Content.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err + i-- + dAtA[i] = 0x12 } - i -= size - i = encodeVarintCodec(dAtA, i, uint64(size)) } - i-- - dAtA[i] = 0x12 { - size, err := m.ProposalBase.MarshalToSizedBuffer(dAtA[:i]) + size, err := m.StdTxBase.MarshalToSizedBuffer(dAtA[:i]) if err != nil { return 0, err } @@ -1789,7 +1238,7 @@ func (m *Proposal) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } -func (m *Content) Marshal() (dAtA []byte, err error) { +func (m *Message) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -1799,12 +1248,12 @@ func (m *Content) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *Content) MarshalTo(dAtA []byte) (int, error) { +func (m *Message) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *Content) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *Message) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int @@ -1821,16 +1270,16 @@ func (m *Content) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } -func (m *Content_Text) MarshalTo(dAtA []byte) (int, error) { +func (m *Message_MsgSend) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *Content_Text) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *Message_MsgSend) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) - if m.Text != nil { + if m.MsgSend != nil { { - size, err := m.Text.MarshalToSizedBuffer(dAtA[:i]) + size, err := m.MsgSend.MarshalToSizedBuffer(dAtA[:i]) if err != nil { return 0, err } @@ -1842,198 +1291,14 @@ func (m *Content_Text) MarshalToSizedBuffer(dAtA []byte) (int, error) { } return len(dAtA) - i, nil } -func (m *Content_ParameterChange) MarshalTo(dAtA []byte) (int, error) { +func (m *Message_MsgMultiSend) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *Content_ParameterChange) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *Message_MsgMultiSend) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) - if m.ParameterChange != nil { - { - size, err := m.ParameterChange.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintCodec(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - } - return len(dAtA) - i, nil -} -func (m *Content_SoftwareUpgrade) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *Content_SoftwareUpgrade) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - if m.SoftwareUpgrade != nil { - { - size, err := m.SoftwareUpgrade.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintCodec(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x1a - } - return len(dAtA) - i, nil -} -func (m *Content_CancelSoftwareUpgrade) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *Content_CancelSoftwareUpgrade) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - if m.CancelSoftwareUpgrade != nil { - { - size, err := m.CancelSoftwareUpgrade.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintCodec(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x22 - } - return len(dAtA) - i, nil -} -func (m *Content_CommunityPoolSpend) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *Content_CommunityPoolSpend) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - if m.CommunityPoolSpend != nil { - { - size, err := m.CommunityPoolSpend.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintCodec(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x2a - } - return len(dAtA) - i, nil -} -func (m *Transaction) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *Transaction) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *Transaction) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.Msgs) > 0 { - for iNdEx := len(m.Msgs) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.Msgs[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintCodec(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - } - } - { - size, err := m.StdTxBase.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintCodec(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - return len(dAtA) - i, nil -} - -func (m *Message) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *Message) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *Message) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.Sum != nil { - { - size := m.Sum.Size() - i -= size - if _, err := m.Sum.MarshalTo(dAtA[i:]); err != nil { - return 0, err - } - } - } - return len(dAtA) - i, nil -} - -func (m *Message_MsgSend) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *Message_MsgSend) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - if m.MsgSend != nil { - { - size, err := m.MsgSend.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintCodec(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} -func (m *Message_MsgMultiSend) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *Message_MsgMultiSend) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - if m.MsgMultiSend != nil { + if m.MsgMultiSend != nil { { size, err := m.MsgMultiSend.MarshalToSizedBuffer(dAtA[:i]) if err != nil { @@ -2152,27 +1417,6 @@ func (m *Message_MsgFundCommunityPool) MarshalToSizedBuffer(dAtA []byte) (int, e } return len(dAtA) - i, nil } -func (m *Message_MsgSubmitProposal) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *Message_MsgSubmitProposal) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - if m.MsgSubmitProposal != nil { - { - size, err := m.MsgSubmitProposal.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintCodec(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x4a - } - return len(dAtA) - i, nil -} func (m *Message_MsgVote) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) @@ -2665,35 +1909,24 @@ func (m *Account_ModuleAccount) Size() (n int) { } return n } -func (m *MsgSubmitProposal) Size() (n int) { +func (m *Transaction) Size() (n int) { if m == nil { return 0 } var l int _ = l - l = m.MsgSubmitProposalBase.Size() + l = m.StdTxBase.Size() n += 1 + l + sovCodec(uint64(l)) - if m.Content != nil { - l = m.Content.Size() - n += 1 + l + sovCodec(uint64(l)) - } - return n -} - -func (m *Proposal) Size() (n int) { - if m == nil { - return 0 + if len(m.Msgs) > 0 { + for _, e := range m.Msgs { + l = e.Size() + n += 1 + l + sovCodec(uint64(l)) + } } - var l int - _ = l - l = m.ProposalBase.Size() - n += 1 + l + sovCodec(uint64(l)) - l = m.Content.Size() - n += 1 + l + sovCodec(uint64(l)) return n } -func (m *Content) Size() (n int) { +func (m *Message) Size() (n int) { if m == nil { return 0 } @@ -2705,216 +1938,115 @@ func (m *Content) Size() (n int) { return n } -func (m *Content_Text) Size() (n int) { +func (m *Message_MsgSend) Size() (n int) { if m == nil { return 0 } var l int _ = l - if m.Text != nil { - l = m.Text.Size() + if m.MsgSend != nil { + l = m.MsgSend.Size() n += 1 + l + sovCodec(uint64(l)) } return n } -func (m *Content_ParameterChange) Size() (n int) { +func (m *Message_MsgMultiSend) Size() (n int) { if m == nil { return 0 } var l int _ = l - if m.ParameterChange != nil { - l = m.ParameterChange.Size() + if m.MsgMultiSend != nil { + l = m.MsgMultiSend.Size() n += 1 + l + sovCodec(uint64(l)) } return n } -func (m *Content_SoftwareUpgrade) Size() (n int) { +func (m *Message_MsgVerifyInvariant) Size() (n int) { if m == nil { return 0 } var l int _ = l - if m.SoftwareUpgrade != nil { - l = m.SoftwareUpgrade.Size() + if m.MsgVerifyInvariant != nil { + l = m.MsgVerifyInvariant.Size() n += 1 + l + sovCodec(uint64(l)) } return n } -func (m *Content_CancelSoftwareUpgrade) Size() (n int) { +func (m *Message_MsgSetWithdrawAddress) Size() (n int) { if m == nil { return 0 } var l int _ = l - if m.CancelSoftwareUpgrade != nil { - l = m.CancelSoftwareUpgrade.Size() + if m.MsgSetWithdrawAddress != nil { + l = m.MsgSetWithdrawAddress.Size() n += 1 + l + sovCodec(uint64(l)) } return n } -func (m *Content_CommunityPoolSpend) Size() (n int) { +func (m *Message_MsgWithdrawDelegatorReward) Size() (n int) { if m == nil { return 0 } var l int _ = l - if m.CommunityPoolSpend != nil { - l = m.CommunityPoolSpend.Size() + if m.MsgWithdrawDelegatorReward != nil { + l = m.MsgWithdrawDelegatorReward.Size() n += 1 + l + sovCodec(uint64(l)) } return n } -func (m *Transaction) Size() (n int) { +func (m *Message_MsgWithdrawValidatorCommission) Size() (n int) { if m == nil { return 0 } var l int _ = l - l = m.StdTxBase.Size() - n += 1 + l + sovCodec(uint64(l)) - if len(m.Msgs) > 0 { - for _, e := range m.Msgs { - l = e.Size() - n += 1 + l + sovCodec(uint64(l)) - } + if m.MsgWithdrawValidatorCommission != nil { + l = m.MsgWithdrawValidatorCommission.Size() + n += 1 + l + sovCodec(uint64(l)) } return n } - -func (m *Message) Size() (n int) { +func (m *Message_MsgFundCommunityPool) Size() (n int) { if m == nil { return 0 } var l int _ = l - if m.Sum != nil { - n += m.Sum.Size() + if m.MsgFundCommunityPool != nil { + l = m.MsgFundCommunityPool.Size() + n += 1 + l + sovCodec(uint64(l)) } return n } - -func (m *Message_MsgSend) Size() (n int) { +func (m *Message_MsgVote) Size() (n int) { if m == nil { return 0 } var l int _ = l - if m.MsgSend != nil { - l = m.MsgSend.Size() + if m.MsgVote != nil { + l = m.MsgVote.Size() n += 1 + l + sovCodec(uint64(l)) } return n } -func (m *Message_MsgMultiSend) Size() (n int) { +func (m *Message_MsgDeposit) Size() (n int) { if m == nil { return 0 } var l int _ = l - if m.MsgMultiSend != nil { - l = m.MsgMultiSend.Size() + if m.MsgDeposit != nil { + l = m.MsgDeposit.Size() n += 1 + l + sovCodec(uint64(l)) } return n } -func (m *Message_MsgVerifyInvariant) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.MsgVerifyInvariant != nil { - l = m.MsgVerifyInvariant.Size() - n += 1 + l + sovCodec(uint64(l)) - } - return n -} -func (m *Message_MsgSetWithdrawAddress) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.MsgSetWithdrawAddress != nil { - l = m.MsgSetWithdrawAddress.Size() - n += 1 + l + sovCodec(uint64(l)) - } - return n -} -func (m *Message_MsgWithdrawDelegatorReward) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.MsgWithdrawDelegatorReward != nil { - l = m.MsgWithdrawDelegatorReward.Size() - n += 1 + l + sovCodec(uint64(l)) - } - return n -} -func (m *Message_MsgWithdrawValidatorCommission) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.MsgWithdrawValidatorCommission != nil { - l = m.MsgWithdrawValidatorCommission.Size() - n += 1 + l + sovCodec(uint64(l)) - } - return n -} -func (m *Message_MsgFundCommunityPool) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.MsgFundCommunityPool != nil { - l = m.MsgFundCommunityPool.Size() - n += 1 + l + sovCodec(uint64(l)) - } - return n -} -func (m *Message_MsgSubmitProposal) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.MsgSubmitProposal != nil { - l = m.MsgSubmitProposal.Size() - n += 1 + l + sovCodec(uint64(l)) - } - return n -} -func (m *Message_MsgVote) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.MsgVote != nil { - l = m.MsgVote.Size() - n += 1 + l + sovCodec(uint64(l)) - } - return n -} -func (m *Message_MsgDeposit) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.MsgDeposit != nil { - l = m.MsgDeposit.Size() - n += 1 + l + sovCodec(uint64(l)) - } - return n -} -func (m *Message_MsgUnjail) Size() (n int) { +func (m *Message_MsgUnjail) Size() (n int) { if m == nil { return 0 } @@ -2983,583 +2115,114 @@ func (m *Message_MsgUndelegate) Size() (n int) { if m.MsgUndelegate != nil { l = m.MsgUndelegate.Size() n += 2 + l + sovCodec(uint64(l)) - } - return n -} -func (m *SignDoc) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = m.StdSignDocBase.Size() - n += 1 + l + sovCodec(uint64(l)) - if len(m.Msgs) > 0 { - for _, e := range m.Msgs { - l = e.Size() - n += 1 + l + sovCodec(uint64(l)) - } - } - return n -} - -func (m *StdFee) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if len(m.Amount) > 0 { - for _, e := range m.Amount { - l = e.Size() - n += 1 + l + sovCodec(uint64(l)) - } - } - if m.Gas != 0 { - n += 1 + sovCodec(uint64(m.Gas)) - } - return n -} - -func (m *StdSignature) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.PubKey) - if l > 0 { - n += 1 + l + sovCodec(uint64(l)) - } - l = len(m.Signature) - if l > 0 { - n += 1 + l + sovCodec(uint64(l)) - } - return n -} - -func (m *StdTxBase) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = m.Fee.Size() - n += 1 + l + sovCodec(uint64(l)) - if len(m.Signatures) > 0 { - for _, e := range m.Signatures { - l = e.Size() - n += 1 + l + sovCodec(uint64(l)) - } - } - l = len(m.Memo) - if l > 0 { - n += 1 + l + sovCodec(uint64(l)) - } - return n -} - -func (m *StdSignDocBase) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.ChainID) - if l > 0 { - n += 1 + l + sovCodec(uint64(l)) - } - if m.AccountNumber != 0 { - n += 1 + sovCodec(uint64(m.AccountNumber)) - } - if m.Sequence != 0 { - n += 1 + sovCodec(uint64(m.Sequence)) - } - l = len(m.Memo) - if l > 0 { - n += 1 + l + sovCodec(uint64(l)) - } - l = m.Fee.Size() - n += 1 + l + sovCodec(uint64(l)) - return n -} - -func sovCodec(x uint64) (n int) { - return (math_bits.Len64(x|1) + 6) / 7 -} -func sozCodec(x uint64) (n int) { - return sovCodec(uint64((x << 1) ^ uint64((int64(x) >> 63)))) -} -func (m *Account) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowCodec - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: Account: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: Account: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field BaseAccount", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowCodec - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthCodec - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthCodec - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - v := &types.BaseAccount{} - if err := v.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - m.Sum = &Account_BaseAccount{v} - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ContinuousVestingAccount", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowCodec - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthCodec - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthCodec - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - v := &types1.ContinuousVestingAccount{} - if err := v.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - m.Sum = &Account_ContinuousVestingAccount{v} - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field DelayedVestingAccount", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowCodec - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthCodec - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthCodec - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - v := &types1.DelayedVestingAccount{} - if err := v.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - m.Sum = &Account_DelayedVestingAccount{v} - iNdEx = postIndex - case 4: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field PeriodicVestingAccount", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowCodec - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthCodec - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthCodec - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - v := &types1.PeriodicVestingAccount{} - if err := v.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - m.Sum = &Account_PeriodicVestingAccount{v} - iNdEx = postIndex - case 5: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ModuleAccount", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowCodec - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthCodec - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthCodec - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - v := &types.ModuleAccount{} - if err := v.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - m.Sum = &Account_ModuleAccount{v} - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipCodec(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthCodec - } - if (iNdEx + skippy) < 0 { - return ErrInvalidLengthCodec - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *MsgSubmitProposal) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowCodec - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: MsgSubmitProposal: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: MsgSubmitProposal: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field MsgSubmitProposalBase", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowCodec - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthCodec - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthCodec - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.MsgSubmitProposalBase.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Content", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowCodec - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthCodec - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthCodec - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Content == nil { - m.Content = &Content{} - } - if err := m.Content.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipCodec(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthCodec - } - if (iNdEx + skippy) < 0 { - return ErrInvalidLengthCodec - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy + } + return n +} +func (m *SignDoc) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.StdSignDocBase.Size() + n += 1 + l + sovCodec(uint64(l)) + if len(m.Msgs) > 0 { + for _, e := range m.Msgs { + l = e.Size() + n += 1 + l + sovCodec(uint64(l)) } } + return n +} - if iNdEx > l { - return io.ErrUnexpectedEOF +func (m *StdFee) Size() (n int) { + if m == nil { + return 0 } - return nil -} -func (m *Proposal) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowCodec - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: Proposal: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: Proposal: illegal tag %d (wire type %d)", fieldNum, wire) + var l int + _ = l + if len(m.Amount) > 0 { + for _, e := range m.Amount { + l = e.Size() + n += 1 + l + sovCodec(uint64(l)) } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ProposalBase", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowCodec - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthCodec - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthCodec - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.ProposalBase.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Content", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowCodec - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthCodec - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthCodec - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.Content.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipCodec(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthCodec - } - if (iNdEx + skippy) < 0 { - return ErrInvalidLengthCodec - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy + } + if m.Gas != 0 { + n += 1 + sovCodec(uint64(m.Gas)) + } + return n +} + +func (m *StdSignature) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.PubKey) + if l > 0 { + n += 1 + l + sovCodec(uint64(l)) + } + l = len(m.Signature) + if l > 0 { + n += 1 + l + sovCodec(uint64(l)) + } + return n +} + +func (m *StdTxBase) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.Fee.Size() + n += 1 + l + sovCodec(uint64(l)) + if len(m.Signatures) > 0 { + for _, e := range m.Signatures { + l = e.Size() + n += 1 + l + sovCodec(uint64(l)) } } + l = len(m.Memo) + if l > 0 { + n += 1 + l + sovCodec(uint64(l)) + } + return n +} - if iNdEx > l { - return io.ErrUnexpectedEOF +func (m *StdSignDocBase) Size() (n int) { + if m == nil { + return 0 } - return nil + var l int + _ = l + l = len(m.ChainID) + if l > 0 { + n += 1 + l + sovCodec(uint64(l)) + } + if m.AccountNumber != 0 { + n += 1 + sovCodec(uint64(m.AccountNumber)) + } + if m.Sequence != 0 { + n += 1 + sovCodec(uint64(m.Sequence)) + } + l = len(m.Memo) + if l > 0 { + n += 1 + l + sovCodec(uint64(l)) + } + l = m.Fee.Size() + n += 1 + l + sovCodec(uint64(l)) + return n } -func (m *Content) Unmarshal(dAtA []byte) error { + +func sovCodec(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozCodec(x uint64) (n int) { + return sovCodec(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *Account) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -3582,15 +2245,15 @@ func (m *Content) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: Content: wiretype end group for non-group") + return fmt.Errorf("proto: Account: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: Content: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: Account: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Text", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field BaseAccount", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -3617,15 +2280,15 @@ func (m *Content) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - v := &types2.TextProposal{} + v := &types.BaseAccount{} if err := v.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } - m.Sum = &Content_Text{v} + m.Sum = &Account_BaseAccount{v} iNdEx = postIndex case 2: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ParameterChange", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field ContinuousVestingAccount", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -3652,15 +2315,15 @@ func (m *Content) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - v := &proposal.ParameterChangeProposal{} + v := &types1.ContinuousVestingAccount{} if err := v.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } - m.Sum = &Content_ParameterChange{v} + m.Sum = &Account_ContinuousVestingAccount{v} iNdEx = postIndex case 3: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field SoftwareUpgrade", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field DelayedVestingAccount", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -3687,15 +2350,15 @@ func (m *Content) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - v := &types3.SoftwareUpgradeProposal{} + v := &types1.DelayedVestingAccount{} if err := v.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } - m.Sum = &Content_SoftwareUpgrade{v} + m.Sum = &Account_DelayedVestingAccount{v} iNdEx = postIndex case 4: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field CancelSoftwareUpgrade", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field PeriodicVestingAccount", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -3722,15 +2385,15 @@ func (m *Content) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - v := &types3.CancelSoftwareUpgradeProposal{} + v := &types1.PeriodicVestingAccount{} if err := v.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } - m.Sum = &Content_CancelSoftwareUpgrade{v} + m.Sum = &Account_PeriodicVestingAccount{v} iNdEx = postIndex case 5: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field CommunityPoolSpend", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field ModuleAccount", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -3757,11 +2420,11 @@ func (m *Content) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - v := &types4.CommunityPoolSpendProposal{} + v := &types.ModuleAccount{} if err := v.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } - m.Sum = &Content_CommunityPoolSpend{v} + m.Sum = &Account_ModuleAccount{v} iNdEx = postIndex default: iNdEx = preIndex @@ -3965,7 +2628,7 @@ func (m *Message) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - v := &types5.MsgSend{} + v := &types2.MsgSend{} if err := v.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } @@ -4000,7 +2663,7 @@ func (m *Message) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - v := &types5.MsgMultiSend{} + v := &types2.MsgMultiSend{} if err := v.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } @@ -4035,7 +2698,7 @@ func (m *Message) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - v := &types6.MsgVerifyInvariant{} + v := &types3.MsgVerifyInvariant{} if err := v.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } @@ -4181,41 +2844,6 @@ func (m *Message) Unmarshal(dAtA []byte) error { } m.Sum = &Message_MsgFundCommunityPool{v} iNdEx = postIndex - case 9: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field MsgSubmitProposal", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowCodec - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthCodec - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthCodec - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - v := &MsgSubmitProposal{} - if err := v.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - m.Sum = &Message_MsgSubmitProposal{v} - iNdEx = postIndex case 10: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field MsgVote", wireType) @@ -4245,7 +2873,7 @@ func (m *Message) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - v := &types2.MsgVote{} + v := &types5.MsgVote{} if err := v.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } @@ -4280,7 +2908,7 @@ func (m *Message) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - v := &types2.MsgDeposit{} + v := &types5.MsgDeposit{} if err := v.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } @@ -4315,7 +2943,7 @@ func (m *Message) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - v := &types7.MsgUnjail{} + v := &types6.MsgUnjail{} if err := v.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } @@ -4350,7 +2978,7 @@ func (m *Message) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - v := &types8.MsgCreateValidator{} + v := &types7.MsgCreateValidator{} if err := v.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } @@ -4385,7 +3013,7 @@ func (m *Message) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - v := &types8.MsgEditValidator{} + v := &types7.MsgEditValidator{} if err := v.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } @@ -4420,7 +3048,7 @@ func (m *Message) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - v := &types8.MsgDelegate{} + v := &types7.MsgDelegate{} if err := v.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } @@ -4455,7 +3083,7 @@ func (m *Message) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - v := &types8.MsgBeginRedelegate{} + v := &types7.MsgBeginRedelegate{} if err := v.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } @@ -4490,7 +3118,7 @@ func (m *Message) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - v := &types8.MsgUndelegate{} + v := &types7.MsgUndelegate{} if err := v.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } @@ -4698,7 +3326,7 @@ func (m *StdFee) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.Amount = append(m.Amount, types9.Coin{}) + m.Amount = append(m.Amount, types8.Coin{}) if err := m.Amount[len(m.Amount)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } diff --git a/std/codec.proto b/std/codec.proto index 0c41b0a49e..338e0ac32f 100644 --- a/std/codec.proto +++ b/std/codec.proto @@ -12,8 +12,6 @@ import "x/distribution/types/types.proto"; import "x/gov/types/types.proto"; import "x/slashing/types/types.proto"; import "x/staking/types/types.proto"; -import "x/params/types/proposal/types.proto"; -import "x/upgrade/types/types.proto"; option go_package = "github.com/cosmos/cosmos-sdk/std"; @@ -31,41 +29,6 @@ message Account { } } -// MsgSubmitProposal defines the application-level message type for handling -// governance proposals. -message MsgSubmitProposal { - option (gogoproto.equal) = true; - option (gogoproto.goproto_getters) = false; - - cosmos_sdk.x.gov.v1.MsgSubmitProposalBase base = 1 [(gogoproto.nullable) = false, (gogoproto.embed) = true]; - Content content = 2; -} - -// Proposal defines the application-level concrete proposal type used in -// governance proposals. -message Proposal { - option (gogoproto.equal) = true; - - cosmos_sdk.x.gov.v1.ProposalBase base = 1 [(gogoproto.embed) = true, (gogoproto.nullable) = false]; - Content content = 2 [(gogoproto.nullable) = false]; -} - -// Content defines the application-level allowed Content to be included in a -// governance proposal. -message Content { - option (gogoproto.equal) = true; - option (cosmos_proto.interface_type) = "*github.com/cosmos/cosmos-sdk/x/gov/types.Content"; - - // sum defines a set of all acceptable concrete governance proposal Content - // types. - oneof sum { - cosmos_sdk.x.gov.v1.TextProposal text = 1; - cosmos_sdk.x.params.v1.ParameterChangeProposal parameter_change = 2; - cosmos_sdk.x.upgrade.v1.SoftwareUpgradeProposal software_upgrade = 3; - cosmos_sdk.x.upgrade.v1.CancelSoftwareUpgradeProposal cancel_software_upgrade = 4; - cosmos_sdk.x.distribution.v1.CommunityPoolSpendProposal community_pool_spend = 5; - } -} // Transaction defines the application-level transaction that can be signed and // processed by the state-machine. It contains a base of common fields and @@ -91,7 +54,6 @@ message Message { cosmos_sdk.x.distribution.v1.MsgWithdrawDelegatorReward msg_withdraw_delegator_reward = 5; cosmos_sdk.x.distribution.v1.MsgWithdrawValidatorCommission msg_withdraw_validator_commission = 6; cosmos_sdk.x.distribution.v1.MsgFundCommunityPool msg_fund_community_pool = 7; - MsgSubmitProposal msg_submit_proposal = 9; cosmos_sdk.x.gov.v1.MsgVote msg_vote = 10; cosmos_sdk.x.gov.v1.MsgDeposit msg_deposit = 11; cosmos_sdk.x.slashing.v1.MsgUnjail msg_unjail = 12; diff --git a/std/msgs.go b/std/msgs.go deleted file mode 100644 index 5d34ceed03..0000000000 --- a/std/msgs.go +++ /dev/null @@ -1,54 +0,0 @@ -package std - -import ( - sdk "github.com/cosmos/cosmos-sdk/types" - sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" - gov "github.com/cosmos/cosmos-sdk/x/gov/types" -) - -var ( - _ gov.MsgSubmitProposalI = &MsgSubmitProposal{} -) - -// NewMsgSubmitProposal returns a new MsgSubmitProposal. -func NewMsgSubmitProposal(c gov.Content, d sdk.Coins, p sdk.AccAddress) (gov.MsgSubmitProposalI, error) { - content := &Content{} - if err := content.SetContent(c); err != nil { - return nil, err - } - - return &MsgSubmitProposal{ - Content: content, - MsgSubmitProposalBase: gov.NewMsgSubmitProposalBase(d, p), - }, nil -} - -// ValidateBasic performs basic (non-state-dependant) validation on a -// MsgSubmitProposal. -func (msg MsgSubmitProposal) ValidateBasic() error { - if err := msg.MsgSubmitProposalBase.ValidateBasic(); err != nil { - return nil - } - if msg.Content == nil { - return sdkerrors.Wrap(gov.ErrInvalidProposalContent, "missing content") - } - if !gov.IsValidProposalType(msg.Content.GetContent().ProposalType()) { - return sdkerrors.Wrap(gov.ErrInvalidProposalType, msg.Content.GetContent().ProposalType()) - } - if err := msg.Content.GetContent().ValidateBasic(); err != nil { - return err - } - - return nil -} - -func (msg *MsgSubmitProposal) GetContent() gov.Content { return msg.Content.GetContent() } -func (msg *MsgSubmitProposal) SetContent(content gov.Content) error { - stdContent := &Content{} - err := stdContent.SetContent(content) - if err != nil { - return err - } - msg.Content = stdContent - return nil -} diff --git a/std/msgs_test.go b/std/msgs_test.go deleted file mode 100644 index a034c65a21..0000000000 --- a/std/msgs_test.go +++ /dev/null @@ -1,55 +0,0 @@ -package std_test - -import ( - "testing" - - gov "github.com/cosmos/cosmos-sdk/x/gov/types" - - "github.com/stretchr/testify/require" - - "github.com/cosmos/cosmos-sdk/std" - sdk "github.com/cosmos/cosmos-sdk/types" -) - -type invalidProposal struct { - *gov.TextProposal -} - -func TestMsgSubmitProposal(t *testing.T) { - p := sdk.AccAddress("foo") - d := sdk.NewCoins(sdk.NewInt64Coin("stake", 1000)) - c := gov.NewTextProposal("title", "description") - - // - // test constructor - // - - msg, err := std.NewMsgSubmitProposal(c, d, p) - require.NoError(t, err) - require.Equal(t, msg.GetContent(), c) - require.Equal(t, msg.GetProposer(), p) - require.Equal(t, msg.GetInitialDeposit(), d) - require.NoError(t, msg.ValidateBasic()) - - _, err = std.NewMsgSubmitProposal(invalidProposal{}, d, p) - require.Error(t, err) - - // - // test setter methods - // - - msg = &std.MsgSubmitProposal{} - msg.SetProposer(p) - msg.SetInitialDeposit(d) - err = msg.SetContent(c) - require.NoError(t, err) - require.Equal(t, msg.GetContent(), c) - require.Equal(t, msg.GetProposer(), p) - require.Equal(t, msg.GetInitialDeposit(), d) - require.NoError(t, msg.ValidateBasic()) - - msg = &std.MsgSubmitProposal{} - err = msg.SetContent(invalidProposal{}) - require.Error(t, err) - -} diff --git a/tests/util.go b/tests/util.go index 4435d77d41..8fa138aef8 100644 --- a/tests/util.go +++ b/tests/util.go @@ -229,7 +229,7 @@ func NewTestCaseDir(t NamedTestingT) (string, func()) { var cdc = codec.New() func init() { - ctypes.RegisterAmino(cdc) + ctypes.RegisterAmino(cdc.Amino) } //DONTCOVER diff --git a/types/result.go b/types/result.go index 41fad03b0c..1c53408197 100644 --- a/types/result.go +++ b/types/result.go @@ -10,6 +10,7 @@ import ( yaml "gopkg.in/yaml.v2" "github.com/cosmos/cosmos-sdk/codec" + "github.com/cosmos/cosmos-sdk/codec/types" ctypes "github.com/tendermint/tendermint/rpc/core/types" ) @@ -264,3 +265,24 @@ func ParseABCILogs(logs string) (res ABCIMessageLogs, err error) { err = json.Unmarshal([]byte(logs), &res) return res, err } + +var _, _ types.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 types.AnyUnpacker) error { + for _, tx := range s.Txs { + err := types.UnpackInterfaces(tx, unpacker) + if err != nil { + return err + } + } + return nil +} + +// UnpackInterfaces implements UnpackInterfacesMessage.UnpackInterfaces +func (r TxResponse) UnpackInterfaces(unpacker types.AnyUnpacker) error { + return types.UnpackInterfaces(r.Tx, unpacker) +} diff --git a/x/auth/client/cli/broadcast_test.go b/x/auth/client/cli/broadcast_test.go index d75a0b0c89..11d41df89e 100644 --- a/x/auth/client/cli/broadcast_test.go +++ b/x/auth/client/cli/broadcast_test.go @@ -7,15 +7,15 @@ import ( "github.com/spf13/viper" "github.com/stretchr/testify/require" - "github.com/tendermint/go-amino" "github.com/cosmos/cosmos-sdk/client/flags" + "github.com/cosmos/cosmos-sdk/codec" "github.com/cosmos/cosmos-sdk/tests" ) func TestGetBroadcastCommand_OfflineFlag(t *testing.T) { - codec := amino.NewCodec() - cmd := GetBroadcastCommand(codec) + cdc := codec.New() + cmd := GetBroadcastCommand(cdc) viper.Set(flags.FlagOffline, true) @@ -24,8 +24,8 @@ func TestGetBroadcastCommand_OfflineFlag(t *testing.T) { } func TestGetBroadcastCommand_WithoutOfflineFlag(t *testing.T) { - codec := amino.NewCodec() - cmd := GetBroadcastCommand(codec) + cdc := codec.New() + cmd := GetBroadcastCommand(cdc) viper.Set(flags.FlagOffline, false) diff --git a/x/auth/client/cli/decode.go b/x/auth/client/cli/decode.go index f4eb7e954f..9e12507e4b 100644 --- a/x/auth/client/cli/decode.go +++ b/x/auth/client/cli/decode.go @@ -6,10 +6,10 @@ import ( "github.com/spf13/cobra" "github.com/spf13/viper" - "github.com/tendermint/go-amino" "github.com/cosmos/cosmos-sdk/client/context" "github.com/cosmos/cosmos-sdk/client/flags" + "github.com/cosmos/cosmos-sdk/codec" authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" ) @@ -17,7 +17,7 @@ const flagHex = "hex" // GetDecodeCommand returns the decode command to take Amino-serialized bytes // and turn it into a JSONified transaction. -func GetDecodeCommand(codec *amino.Codec) *cobra.Command { +func GetDecodeCommand(codec *codec.Codec) *cobra.Command { cmd := &cobra.Command{ Use: "decode [amino-byte-string]", Short: "Decode an amino-encoded transaction string.", @@ -29,7 +29,7 @@ func GetDecodeCommand(codec *amino.Codec) *cobra.Command { return flags.PostCommands(cmd)[0] } -func runDecodeTxString(codec *amino.Codec) func(cmd *cobra.Command, args []string) (err error) { +func runDecodeTxString(codec *codec.Codec) func(cmd *cobra.Command, args []string) (err error) { return func(cmd *cobra.Command, args []string) (err error) { cliCtx := context.NewCLIContext().WithCodec(codec).WithOutput(cmd.OutOrStdout()) var txBytes []byte diff --git a/x/auth/types/stdsignmsg.go b/x/auth/types/stdsignmsg.go index e018dac400..8576b0de70 100644 --- a/x/auth/types/stdsignmsg.go +++ b/x/auth/types/stdsignmsg.go @@ -1,6 +1,7 @@ package types import ( + "github.com/cosmos/cosmos-sdk/codec/types" sdk "github.com/cosmos/cosmos-sdk/types" ) @@ -20,3 +21,15 @@ type StdSignMsg struct { func (msg StdSignMsg) Bytes() []byte { return StdSignBytes(msg.ChainID, msg.AccountNumber, msg.Sequence, msg.Fee, msg.Msgs, msg.Memo) } + +var _ types.UnpackInterfacesMessage = StdSignMsg{} + +func (msg StdSignMsg) UnpackInterfaces(unpacker types.AnyUnpacker) error { + for _, m := range msg.Msgs { + err := types.UnpackInterfaces(m, unpacker) + if err != nil { + return err + } + } + return nil +} diff --git a/x/auth/types/stdtx.go b/x/auth/types/stdtx.go index 16d7f31940..3f5eb1e410 100644 --- a/x/auth/types/stdtx.go +++ b/x/auth/types/stdtx.go @@ -9,6 +9,7 @@ import ( yaml "gopkg.in/yaml.v2" "github.com/cosmos/cosmos-sdk/codec" + codectypes "github.com/cosmos/cosmos-sdk/codec/types" sdk "github.com/cosmos/cosmos-sdk/types" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" "github.com/cosmos/cosmos-sdk/x/auth/exported" @@ -343,3 +344,15 @@ func DefaultTxEncoder(cdc *codec.Codec) sdk.TxEncoder { return cdc.MarshalBinaryBare(tx) } } + +var _ codectypes.UnpackInterfacesMessage = StdTx{} + +func (tx StdTx) UnpackInterfaces(unpacker codectypes.AnyUnpacker) error { + for _, m := range tx.Msgs { + err := codectypes.UnpackInterfaces(m, unpacker) + if err != nil { + return err + } + } + return nil +} diff --git a/x/bank/keeper/invariants.go b/x/bank/keeper/invariants.go index 4f573c582b..f06cde0111 100644 --- a/x/bank/keeper/invariants.go +++ b/x/bank/keeper/invariants.go @@ -49,7 +49,7 @@ func NonnegativeBalanceInvariant(k ViewKeeper) sdk.Invariant { // TotalSupply checks that the total supply reflects all the coins held in accounts func TotalSupply(k Keeper) sdk.Invariant { return func(ctx sdk.Context) (string, bool) { - var expectedTotal sdk.Coins + expectedTotal := sdk.Coins{} supply := k.GetSupply(ctx) k.IterateAllBalances(ctx, func(_ sdk.AccAddress, balance sdk.Coin) bool { diff --git a/x/bank/keeper/keeper.go b/x/bank/keeper/keeper.go index 4134459327..d506555669 100644 --- a/x/bank/keeper/keeper.go +++ b/x/bank/keeper/keeper.go @@ -4,6 +4,8 @@ import ( "fmt" "time" + "github.com/gogo/protobuf/proto" + "github.com/cosmos/cosmos-sdk/codec" codectypes "github.com/cosmos/cosmos-sdk/codec/types" sdk "github.com/cosmos/cosmos-sdk/types" @@ -13,7 +15,6 @@ import ( "github.com/cosmos/cosmos-sdk/x/bank/exported" "github.com/cosmos/cosmos-sdk/x/bank/types" paramtypes "github.com/cosmos/cosmos-sdk/x/params/types" - "github.com/gogo/protobuf/proto" ) var _ Keeper = (*BaseKeeper)(nil) diff --git a/x/distribution/client/cli/tx.go b/x/distribution/client/cli/tx.go index e6df78fcc0..6f67ed21ac 100644 --- a/x/distribution/client/cli/tx.go +++ b/x/distribution/client/cli/tx.go @@ -481,7 +481,10 @@ Where proposal.json contains: if err != nil { return err } - msg := gov.NewMsgSubmitProposal(content, deposit, from) + msg, err := gov.NewMsgSubmitProposal(content, deposit, from) + if err != nil { + return err + } if err := msg.ValidateBasic(); err != nil { return err } diff --git a/x/distribution/client/rest/rest.go b/x/distribution/client/rest/rest.go index 2e71d77cbd..f8d1fa91a1 100644 --- a/x/distribution/client/rest/rest.go +++ b/x/distribution/client/rest/rest.go @@ -50,7 +50,10 @@ func postProposalHandlerFn(cliCtx context.CLIContext) http.HandlerFunc { content := types.NewCommunityPoolSpendProposal(req.Title, req.Description, req.Recipient, req.Amount) - msg := gov.NewMsgSubmitProposal(content, req.Deposit, req.Proposer) + msg, err := gov.NewMsgSubmitProposal(content, req.Deposit, req.Proposer) + if rest.CheckBadRequestError(w, err) { + return + } if rest.CheckBadRequestError(w, msg.ValidateBasic()) { return } diff --git a/x/distribution/module.go b/x/distribution/module.go index ee32db9231..b350294214 100644 --- a/x/distribution/module.go +++ b/x/distribution/module.go @@ -5,6 +5,8 @@ import ( "fmt" "math/rand" + cdctypes "github.com/cosmos/cosmos-sdk/codec/types" + "github.com/gorilla/mux" "github.com/spf13/cobra" abci "github.com/tendermint/tendermint/abci/types" @@ -25,6 +27,7 @@ var ( _ module.AppModule = AppModule{} _ module.AppModuleBasic = AppModuleBasic{} _ module.AppModuleSimulation = AppModule{} + _ module.InterfaceModule = AppModuleBasic{} ) // AppModuleBasic defines the basic application module used by the distribution module. @@ -73,6 +76,11 @@ func (AppModuleBasic) GetQueryCmd(cdc *codec.Codec) *cobra.Command { return cli.GetQueryCmd(StoreKey, cdc) } +// RegisterInterfaceTypes implements InterfaceModule +func (b AppModuleBasic) RegisterInterfaceTypes(registry cdctypes.InterfaceRegistry) { + types.RegisterInterfaces(registry) +} + //____________________________________________________________________________ // AppModule implements an application module for the distribution module. diff --git a/x/distribution/types/codec.go b/x/distribution/types/codec.go index 72e0357aa2..d0d329c9bc 100644 --- a/x/distribution/types/codec.go +++ b/x/distribution/types/codec.go @@ -3,6 +3,8 @@ package types import ( "github.com/cosmos/cosmos-sdk/codec" "github.com/cosmos/cosmos-sdk/codec/types" + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/cosmos/cosmos-sdk/x/gov" ) // RegisterCodec registers the necessary x/distribution interfaces and concrete types @@ -15,6 +17,19 @@ func RegisterCodec(cdc *codec.Codec) { cdc.RegisterConcrete(&CommunityPoolSpendProposal{}, "cosmos-sdk/CommunityPoolSpendProposal", nil) } +func RegisterInterfaces(registry types.InterfaceRegistry) { + registry.RegisterImplementations( + (*sdk.Msg)(nil), + &MsgWithdrawDelegatorReward{}, + &MsgWithdrawValidatorCommission{}, + &MsgSetWithdrawAddress{}, + ) + registry.RegisterImplementations( + (*gov.Content)(nil), + &CommunityPoolSpendProposal{}, + ) +} + var ( amino = codec.New() diff --git a/x/gov/abci.go b/x/gov/abci.go index fa990acbf0..a79f80d1ca 100644 --- a/x/gov/abci.go +++ b/x/gov/abci.go @@ -54,7 +54,7 @@ func EndBlocker(ctx sdk.Context, keeper Keeper) { // The proposal handler may execute state mutating logic depending // on the proposal content. If the handler fails, no state mutation // is written and the error message is logged. - err := handler(cacheCtx, proposal.Content) + err := handler(cacheCtx, proposal.GetContent()) if err == nil { proposal.Status = StatusPassed tagValue = types.AttributeValueProposalPassed diff --git a/x/gov/abci_test.go b/x/gov/abci_test.go index 7fd04b6edb..505b9269fc 100644 --- a/x/gov/abci_test.go +++ b/x/gov/abci_test.go @@ -4,8 +4,6 @@ import ( "testing" "time" - "github.com/cosmos/cosmos-sdk/std" - "github.com/stretchr/testify/require" abci "github.com/tendermint/tendermint/abci/types" @@ -29,7 +27,7 @@ func TestTickExpiredDepositPeriod(t *testing.T) { require.False(t, inactiveQueue.Valid()) inactiveQueue.Close() - newProposalMsg, err := std.NewMsgSubmitProposal( + newProposalMsg, err := gov.NewMsgSubmitProposal( gov.ContentFromProposalType("test", "test", gov.ProposalTypeText), sdk.Coins{sdk.NewInt64Coin(sdk.DefaultBondDenom, 5)}, addrs[0], @@ -81,7 +79,7 @@ func TestTickMultipleExpiredDepositPeriod(t *testing.T) { require.False(t, inactiveQueue.Valid()) inactiveQueue.Close() - newProposalMsg, err := std.NewMsgSubmitProposal( + newProposalMsg, err := gov.NewMsgSubmitProposal( gov.ContentFromProposalType("test", "test", gov.ProposalTypeText), sdk.Coins{sdk.NewInt64Coin(sdk.DefaultBondDenom, 5)}, addrs[0], @@ -104,7 +102,7 @@ func TestTickMultipleExpiredDepositPeriod(t *testing.T) { require.False(t, inactiveQueue.Valid()) inactiveQueue.Close() - newProposalMsg2, err := std.NewMsgSubmitProposal( + newProposalMsg2, err := gov.NewMsgSubmitProposal( gov.ContentFromProposalType("test2", "test2", gov.ProposalTypeText), sdk.Coins{sdk.NewInt64Coin(sdk.DefaultBondDenom, 5)}, addrs[0], @@ -161,7 +159,7 @@ func TestTickPassedDepositPeriod(t *testing.T) { require.False(t, activeQueue.Valid()) activeQueue.Close() - newProposalMsg, err := std.NewMsgSubmitProposal( + newProposalMsg, err := gov.NewMsgSubmitProposal( gov.ContentFromProposalType("test2", "test2", gov.ProposalTypeText), sdk.Coins{sdk.NewInt64Coin(sdk.DefaultBondDenom, 5)}, addrs[0], @@ -217,7 +215,7 @@ func TestTickPassedVotingPeriod(t *testing.T) { activeQueue.Close() proposalCoins := sdk.Coins{sdk.NewCoin(sdk.DefaultBondDenom, sdk.TokensFromConsensusPower(5))} - newProposalMsg, err := std.NewMsgSubmitProposal(TestProposal, proposalCoins, addrs[0]) + newProposalMsg, err := gov.NewMsgSubmitProposal(TestProposal, proposalCoins, addrs[0]) require.NoError(t, err) res, err := govHandler(ctx, newProposalMsg) diff --git a/x/gov/alias.go b/x/gov/alias.go index 02160c78a1..af2d3f9ebf 100644 --- a/x/gov/alias.go +++ b/x/gov/alias.go @@ -81,7 +81,6 @@ var ( SplitKeyDeposit = types.SplitKeyDeposit SplitKeyVote = types.SplitKeyVote NewMsgSubmitProposal = types.NewMsgSubmitProposal - NewMsgSubmitProposalBase = types.NewMsgSubmitProposalBase NewMsgDeposit = types.NewMsgDeposit NewMsgVote = types.NewMsgVote ParamKeyTable = types.ParamKeyTable @@ -124,34 +123,32 @@ var ( ) type ( - Keeper = keeper.Keeper - Content = types.Content - Handler = types.Handler - Deposit = types.Deposit - Deposits = types.Deposits - GenesisState = types.GenesisState - MsgSubmitProposalI = types.MsgSubmitProposalI - MsgSubmitProposal = types.MsgSubmitProposal - MsgSubmitProposalBase = types.MsgSubmitProposalBase - MsgDeposit = types.MsgDeposit - MsgVote = types.MsgVote - DepositParams = types.DepositParams - TallyParams = types.TallyParams - VotingParams = types.VotingParams - Params = types.Params - Proposal = types.Proposal - Proposals = types.Proposals - ProposalQueue = types.ProposalQueue - ProposalStatus = types.ProposalStatus - TextProposal = types.TextProposal - QueryProposalParams = types.QueryProposalParams - QueryDepositParams = types.QueryDepositParams - QueryVoteParams = types.QueryVoteParams - QueryProposalsParams = types.QueryProposalsParams - ValidatorGovInfo = types.ValidatorGovInfo - TallyResult = types.TallyResult - Vote = types.Vote - Votes = types.Votes - VoteOption = types.VoteOption - Codec = types.Codec + Keeper = keeper.Keeper + Content = types.Content + Handler = types.Handler + Deposit = types.Deposit + Deposits = types.Deposits + GenesisState = types.GenesisState + MsgSubmitProposalI = types.MsgSubmitProposalI + MsgSubmitProposal = types.MsgSubmitProposal + MsgDeposit = types.MsgDeposit + MsgVote = types.MsgVote + DepositParams = types.DepositParams + TallyParams = types.TallyParams + VotingParams = types.VotingParams + Params = types.Params + Proposal = types.Proposal + Proposals = types.Proposals + ProposalQueue = types.ProposalQueue + ProposalStatus = types.ProposalStatus + TextProposal = types.TextProposal + QueryProposalParams = types.QueryProposalParams + QueryDepositParams = types.QueryDepositParams + QueryVoteParams = types.QueryVoteParams + QueryProposalsParams = types.QueryProposalsParams + ValidatorGovInfo = types.ValidatorGovInfo + TallyResult = types.TallyResult + Vote = types.Vote + Votes = types.Votes + VoteOption = types.VoteOption ) diff --git a/x/gov/client/cli/tx.go b/x/gov/client/cli/tx.go index dc8f0eac5a..e35ccd4ae6 100644 --- a/x/gov/client/cli/tx.go +++ b/x/gov/client/cli/tx.go @@ -6,6 +6,8 @@ import ( "strconv" "strings" + "github.com/cosmos/cosmos-sdk/types/errors" + "github.com/spf13/cobra" "github.com/cosmos/cosmos-sdk/client" @@ -326,7 +328,10 @@ $ %s tx gov submit-proposal --title="Test Proposal" --description="My awesome pr content := types.ContentFromProposalType(proposal.Title, proposal.Description, proposal.Type) - msg := types.NewMsgSubmitProposal(content, amount, cliCtx.GetFromAddress()) + msg, err := types.NewMsgSubmitProposal(content, amount, cliCtx.GetFromAddress()) + if err != nil { + return errors.Wrap(err, "can't create new MsgSubmitProposal") + } if err := msg.ValidateBasic(); err != nil { return err } diff --git a/x/gov/client/rest/tx.go b/x/gov/client/rest/tx.go index 22d6ff9242..5fc94d1e8e 100644 --- a/x/gov/client/rest/tx.go +++ b/x/gov/client/rest/tx.go @@ -162,7 +162,10 @@ func postProposalHandlerFn(cliCtx context.CLIContext) http.HandlerFunc { proposalType := gcutils.NormalizeProposalType(req.ProposalType) content := types.ContentFromProposalType(req.Title, req.Description, proposalType) - msg := types.NewMsgSubmitProposal(content, req.InitialDeposit, req.Proposer) + msg, err := types.NewMsgSubmitProposal(content, req.InitialDeposit, req.Proposer) + if rest.CheckBadRequestError(w, err) { + return + } if rest.CheckBadRequestError(w, msg.ValidateBasic()) { return } diff --git a/x/gov/genesis_test.go b/x/gov/genesis_test.go index 5f838c1f53..7dacb7a47b 100644 --- a/x/gov/genesis_test.go +++ b/x/gov/genesis_test.go @@ -55,9 +55,9 @@ func TestImportExportQueues(t *testing.T) { govGenState := gov.ExportGenesis(ctx, app.GovKeeper) genesisState := simapp.NewDefaultGenesisState() - genesisState[auth.ModuleName] = app.Codec().MustMarshalJSON(authGenState) - genesisState[bank.ModuleName] = app.Codec().MustMarshalJSON(bankGenState) - genesisState[gov.ModuleName] = app.Codec().MustMarshalJSON(govGenState) + genesisState[auth.ModuleName] = app.AppCodec().MustMarshalJSON(authGenState) + genesisState[bank.ModuleName] = app.AppCodec().MustMarshalJSON(bankGenState) + genesisState[gov.ModuleName] = app.AppCodec().MustMarshalJSON(govGenState) stateBytes, err := codec.MarshalJSONIndent(app.Codec(), genesisState) if err != nil { diff --git a/x/gov/keeper/keeper.go b/x/gov/keeper/keeper.go index 04795c70f6..b892febfff 100644 --- a/x/gov/keeper/keeper.go +++ b/x/gov/keeper/keeper.go @@ -6,6 +6,7 @@ import ( "github.com/tendermint/tendermint/libs/log" + "github.com/cosmos/cosmos-sdk/codec" sdk "github.com/cosmos/cosmos-sdk/types" authexported "github.com/cosmos/cosmos-sdk/x/auth/exported" "github.com/cosmos/cosmos-sdk/x/gov/types" @@ -26,7 +27,7 @@ type Keeper struct { storeKey sdk.StoreKey // The codec codec for binary encoding/decoding. - cdc types.Codec + cdc codec.Marshaler // Proposal router router types.Router @@ -40,7 +41,7 @@ type Keeper struct { // // CONTRACT: the parameter Subspace must have the param key table already initialized func NewKeeper( - cdc types.Codec, key sdk.StoreKey, paramSpace types.ParamSubspace, + cdc codec.Marshaler, key sdk.StoreKey, paramSpace types.ParamSubspace, authKeeper types.AccountKeeper, bankKeeper types.BankKeeper, sk types.StakingKeeper, rtr types.Router, ) Keeper { diff --git a/x/gov/keeper/proposal.go b/x/gov/keeper/proposal.go index 3055af8750..51a17dc37e 100644 --- a/x/gov/keeper/proposal.go +++ b/x/gov/keeper/proposal.go @@ -32,7 +32,10 @@ func (keeper Keeper) SubmitProposal(ctx sdk.Context, content types.Content) (typ submitTime := ctx.BlockHeader().Time depositPeriod := keeper.GetDepositParams(ctx).MaxDepositPeriod - proposal := types.NewProposal(content, proposalID, submitTime, submitTime.Add(depositPeriod)) + proposal, err := types.NewProposal(content, proposalID, submitTime, submitTime.Add(depositPeriod)) + if err != nil { + return types.Proposal{}, err + } keeper.SetProposal(ctx, proposal) keeper.InsertInactiveProposalQueue(ctx, proposalID, proposal.DepositEndTime) @@ -57,10 +60,8 @@ func (keeper Keeper) GetProposal(ctx sdk.Context, proposalID uint64) (types.Prop return types.Proposal{}, false } - proposal, err := keeper.cdc.UnmarshalProposal(bz) - if err != nil { - panic(err) - } + var proposal types.Proposal + keeper.MustUnmarshalProposal(bz, &proposal) return proposal, true } @@ -69,10 +70,7 @@ func (keeper Keeper) GetProposal(ctx sdk.Context, proposalID uint64) (types.Prop func (keeper Keeper) SetProposal(ctx sdk.Context, proposal types.Proposal) { store := ctx.KVStore(keeper.storeKey) - bz, err := keeper.cdc.MarshalProposal(proposal) - if err != nil { - panic(err) - } + bz := keeper.MustMarshalProposal(proposal) store.Set(types.ProposalKey(proposal.ProposalID), bz) } @@ -97,7 +95,8 @@ func (keeper Keeper) IterateProposals(ctx sdk.Context, cb func(proposal types.Pr defer iterator.Close() for ; iterator.Valid(); iterator.Next() { - proposal, err := keeper.cdc.UnmarshalProposal(iterator.Value()) + var proposal types.Proposal + err := keeper.UnmarshalProposal(iterator.Value(), &proposal) if err != nil { panic(err) } @@ -126,7 +125,7 @@ func (keeper Keeper) GetProposals(ctx sdk.Context) (proposals types.Proposals) { // // NOTE: If no filters are provided, all proposals will be returned in paginated // form. -func (keeper Keeper) GetProposalsFiltered(ctx sdk.Context, params types.QueryProposalsParams) []types.Proposal { +func (keeper Keeper) GetProposalsFiltered(ctx sdk.Context, params types.QueryProposalsParams) types.Proposals { proposals := keeper.GetProposals(ctx) filteredProposals := make([]types.Proposal, 0, len(proposals)) @@ -191,3 +190,34 @@ func (keeper Keeper) ActivateVotingPeriod(ctx sdk.Context, proposal types.Propos keeper.RemoveFromInactiveProposalQueue(ctx, proposal.ProposalID, proposal.DepositEndTime) keeper.InsertActiveProposalQueue(ctx, proposal.ProposalID, proposal.VotingEndTime) } + +func (keeper Keeper) MarshalProposal(proposal types.Proposal) ([]byte, error) { + bz, err := keeper.cdc.MarshalBinaryBare(&proposal) + if err != nil { + return nil, err + } + return bz, nil +} + +func (keeper Keeper) UnmarshalProposal(bz []byte, proposal *types.Proposal) error { + err := keeper.cdc.UnmarshalBinaryBare(bz, proposal) + if err != nil { + return err + } + return nil +} + +func (keeper Keeper) MustMarshalProposal(proposal types.Proposal) []byte { + bz, err := keeper.MarshalProposal(proposal) + if err != nil { + panic(err) + } + return bz +} + +func (keeper Keeper) MustUnmarshalProposal(bz []byte, proposal *types.Proposal) { + err := keeper.UnmarshalProposal(bz, proposal) + if err != nil { + panic(err) + } +} diff --git a/x/gov/keeper/proposal_test.go b/x/gov/keeper/proposal_test.go index aa176b473a..4f29a6748d 100644 --- a/x/gov/keeper/proposal_test.go +++ b/x/gov/keeper/proposal_test.go @@ -93,7 +93,9 @@ func TestGetProposalsFiltered(t *testing.T) { for _, s := range status { for i := 0; i < 50; i++ { - p := types.NewProposal(TestProposal, proposalID, time.Now(), time.Now()) + p, err := types.NewProposal(TestProposal, proposalID, time.Now(), time.Now()) + require.NoError(t, err) + p.Status = s if i%2 == 0 { diff --git a/x/gov/keeper/querier_test.go b/x/gov/keeper/querier_test.go index dd842af293..f517874244 100644 --- a/x/gov/keeper/querier_test.go +++ b/x/gov/keeper/querier_test.go @@ -297,10 +297,8 @@ func TestPaginatedVotesQuery(t *testing.T) { appCodec := app.AppCodec() proposal := types.Proposal{ - ProposalBase: types.ProposalBase{ - ProposalID: 100, - Status: types.StatusVotingPeriod, - }, + ProposalID: 100, + Status: types.StatusVotingPeriod, } app.GovKeeper.SetProposal(ctx, proposal) diff --git a/x/gov/module.go b/x/gov/module.go index 63fecf1440..54d7e3817c 100644 --- a/x/gov/module.go +++ b/x/gov/module.go @@ -14,6 +14,7 @@ import ( "github.com/cosmos/cosmos-sdk/client/context" "github.com/cosmos/cosmos-sdk/codec" + codectypes "github.com/cosmos/cosmos-sdk/codec/types" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/types/module" simtypes "github.com/cosmos/cosmos-sdk/types/simulation" @@ -28,11 +29,12 @@ var ( _ module.AppModule = AppModule{} _ module.AppModuleBasic = AppModuleBasic{} _ module.AppModuleSimulation = AppModule{} + _ module.InterfaceModule = AppModuleBasic{} ) // AppModuleBasic defines the basic application module used by the gov module. type AppModuleBasic struct { - cdc Codec + cdc codec.Marshaler proposalHandlers []client.ProposalHandler // proposal handlers which live in governance cli and rest } @@ -95,6 +97,11 @@ func (AppModuleBasic) GetQueryCmd(cdc *codec.Codec) *cobra.Command { return cli.GetQueryCmd(StoreKey, cdc) } +// RegisterInterfaceTypes implements InterfaceModule.RegisterInterfaceTypes +func (a AppModuleBasic) RegisterInterfaceTypes(registry codectypes.InterfaceRegistry) { + types.RegisterInterfaces(registry) +} + //____________________________________________________________________________ // AppModule implements an application module for the gov module. @@ -107,7 +114,7 @@ type AppModule struct { } // NewAppModule creates a new AppModule object -func NewAppModule(cdc Codec, keeper Keeper, ak types.AccountKeeper, bk types.BankKeeper) AppModule { +func NewAppModule(cdc codec.Marshaler, keeper Keeper, ak types.AccountKeeper, bk types.BankKeeper) AppModule { return AppModule{ AppModuleBasic: AppModuleBasic{cdc: cdc}, keeper: keeper, diff --git a/x/gov/simulation/decoder.go b/x/gov/simulation/decoder.go index 1faeb9145d..1433761a11 100644 --- a/x/gov/simulation/decoder.go +++ b/x/gov/simulation/decoder.go @@ -7,20 +7,23 @@ import ( tmkv "github.com/tendermint/tendermint/libs/kv" + "github.com/cosmos/cosmos-sdk/codec" "github.com/cosmos/cosmos-sdk/x/gov/types" ) // NewDecodeStore returns a decoder function closure that unmarshals the KVPair's // Value to the corresponding gov type. -func NewDecodeStore(cdc types.Codec) func(kvA, kvB tmkv.Pair) string { +func NewDecodeStore(cdc codec.Marshaler) func(kvA, kvB tmkv.Pair) string { return func(kvA, kvB tmkv.Pair) string { switch { case bytes.Equal(kvA.Key[:1], types.ProposalsKeyPrefix): - proposalA, err := cdc.UnmarshalProposal(kvA.Value) + var proposalA types.Proposal + err := cdc.UnmarshalBinaryBare(kvA.Value, &proposalA) if err != nil { panic(err) } - proposalB, err := cdc.UnmarshalProposal(kvB.Value) + var proposalB types.Proposal + err = cdc.UnmarshalBinaryBare(kvA.Value, &proposalB) if err != nil { panic(err) } diff --git a/x/gov/simulation/decoder_test.go b/x/gov/simulation/decoder_test.go index 5a11ab0304..20087f4a11 100644 --- a/x/gov/simulation/decoder_test.go +++ b/x/gov/simulation/decoder_test.go @@ -29,13 +29,15 @@ func TestDecodeStore(t *testing.T) { endTime := time.Now().UTC() content := types.ContentFromProposalType("test", "test", types.ProposalTypeText) - proposal := types.NewProposal(content, 1, endTime, endTime.Add(24*time.Hour)) + proposal, err := types.NewProposal(content, 1, endTime, endTime.Add(24*time.Hour)) + require.NoError(t, err) + proposalIDBz := make([]byte, 8) binary.LittleEndian.PutUint64(proposalIDBz, 1) deposit := types.NewDeposit(1, delAddr1, sdk.NewCoins(sdk.NewCoin(sdk.DefaultBondDenom, sdk.OneInt()))) vote := types.NewVote(1, delAddr1, types.OptionYes) - proposalBz, err := cdc.MarshalProposal(proposal) + proposalBz, err := cdc.MarshalBinaryBare(&proposal) require.NoError(t, err) kvPairs := tmkv.Pairs{ diff --git a/x/gov/simulation/operations.go b/x/gov/simulation/operations.go index 5c82f235e5..05d47bee7e 100644 --- a/x/gov/simulation/operations.go +++ b/x/gov/simulation/operations.go @@ -9,7 +9,6 @@ import ( "github.com/cosmos/cosmos-sdk/codec" "github.com/cosmos/cosmos-sdk/simapp/helpers" simappparams "github.com/cosmos/cosmos-sdk/simapp/params" - std "github.com/cosmos/cosmos-sdk/std" sdk "github.com/cosmos/cosmos-sdk/types" simtypes "github.com/cosmos/cosmos-sdk/types/simulation" "github.com/cosmos/cosmos-sdk/x/gov/keeper" @@ -126,7 +125,7 @@ func SimulateSubmitProposal( return simtypes.NoOpMsg(types.ModuleName), nil, err } - msg, err := std.NewMsgSubmitProposal(content, deposit, simAccount.Address) + msg, err := types.NewMsgSubmitProposal(content, deposit, simAccount.Address) if err != nil { return simtypes.NoOpMsg(types.ModuleName), nil, err } diff --git a/x/gov/types/codec.go b/x/gov/types/codec.go index 7a6b4c0b97..2397c1f87d 100644 --- a/x/gov/types/codec.go +++ b/x/gov/types/codec.go @@ -3,27 +3,32 @@ package types import ( "github.com/cosmos/cosmos-sdk/codec" "github.com/cosmos/cosmos-sdk/codec/types" + sdk "github.com/cosmos/cosmos-sdk/types" ) -// Codec defines the interface required to serialize custom x/gov types. -type Codec interface { - codec.Marshaler - - MarshalProposal(Proposal) ([]byte, error) - UnmarshalProposal([]byte) (Proposal, error) -} - // RegisterCodec registers all the necessary types and interfaces for the // governance module. func RegisterCodec(cdc *codec.Codec) { cdc.RegisterInterface((*Content)(nil), nil) - cdc.RegisterConcrete(MsgSubmitProposalBase{}, "cosmos-sdk/MsgSubmitProposalBase", nil) cdc.RegisterConcrete(&MsgSubmitProposal{}, "cosmos-sdk/MsgSubmitProposal", nil) cdc.RegisterConcrete(MsgDeposit{}, "cosmos-sdk/MsgDeposit", nil) cdc.RegisterConcrete(MsgVote{}, "cosmos-sdk/MsgVote", nil) cdc.RegisterConcrete(&TextProposal{}, "cosmos-sdk/TextProposal", nil) } +func RegisterInterfaces(registry types.InterfaceRegistry) { + registry.RegisterImplementations((*sdk.Msg)(nil), + &MsgSubmitProposal{}, + &MsgVote{}, + &MsgDeposit{}, + ) + registry.RegisterInterface( + "cosmos_sdk.gov.v1.Content", + (*Content)(nil), + &TextProposal{}, + ) +} + // RegisterProposalTypeCodec registers an external proposal content type defined // in another module for the internal ModuleCdc. This allows the MsgSubmitProposal // to be correctly Amino encoded and decoded. diff --git a/x/gov/types/genesis.go b/x/gov/types/genesis.go index 7099cb9590..45c8e21ad7 100644 --- a/x/gov/types/genesis.go +++ b/x/gov/types/genesis.go @@ -3,6 +3,7 @@ package types import ( "fmt" + "github.com/cosmos/cosmos-sdk/codec/types" sdk "github.com/cosmos/cosmos-sdk/types" ) @@ -73,3 +74,16 @@ func ValidateGenesis(data GenesisState) error { return nil } + +var _ types.UnpackInterfacesMessage = GenesisState{} + +// UnpackInterfaces implements UnpackInterfacesMessage.UnpackInterfaces +func (data GenesisState) UnpackInterfaces(unpacker types.AnyUnpacker) error { + for _, p := range data.Proposals { + err := p.UnpackInterfaces(unpacker) + if err != nil { + return err + } + } + return nil +} diff --git a/x/gov/types/msgs.go b/x/gov/types/msgs.go index 5c76700045..a818ee2a3c 100644 --- a/x/gov/types/msgs.go +++ b/x/gov/types/msgs.go @@ -1,8 +1,13 @@ package types import ( - "gopkg.in/yaml.v2" + "fmt" + yaml "gopkg.in/yaml.v2" + + "github.com/gogo/protobuf/proto" + + "github.com/cosmos/cosmos-sdk/codec/types" sdk "github.com/cosmos/cosmos-sdk/types" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" ) @@ -14,7 +19,11 @@ const ( TypeMsgSubmitProposal = "submit_proposal" ) -var _, _, _ sdk.Msg = MsgSubmitProposalBase{}, MsgDeposit{}, MsgVote{} +var ( + _, _, _ sdk.Msg = MsgSubmitProposal{}, MsgDeposit{}, MsgVote{} + _ MsgSubmitProposalI = &MsgSubmitProposal{} + _ types.UnpackInterfacesMessage = MsgSubmitProposal{} +) // MsgSubmitProposalI defines the specific interface a concrete message must // implement in order to process governance proposals. The concrete MsgSubmitProposal @@ -32,64 +41,107 @@ type MsgSubmitProposalI interface { SetProposer(sdk.AccAddress) } -// NewMsgSubmitProposalBase creates a new MsgSubmitProposalBase. -func NewMsgSubmitProposalBase(initialDeposit sdk.Coins, proposer sdk.AccAddress) MsgSubmitProposalBase { - return MsgSubmitProposalBase{ +// NewMsgSubmitProposal creates a new MsgSubmitProposal. +func NewMsgSubmitProposal(content Content, initialDeposit sdk.Coins, proposer sdk.AccAddress) (*MsgSubmitProposal, error) { + m := &MsgSubmitProposal{ InitialDeposit: initialDeposit, Proposer: proposer, } + err := m.SetContent(content) + if err != nil { + return nil, err + } + return m, nil } -func (msg *MsgSubmitProposalBase) GetInitialDeposit() sdk.Coins { return msg.InitialDeposit } +func (m *MsgSubmitProposal) GetInitialDeposit() sdk.Coins { return m.InitialDeposit } -func (msg *MsgSubmitProposalBase) GetProposer() sdk.AccAddress { return msg.Proposer } +func (m *MsgSubmitProposal) GetProposer() sdk.AccAddress { return m.Proposer } + +func (m *MsgSubmitProposal) GetContent() Content { + content, ok := m.Content.GetCachedValue().(Content) + if !ok { + return nil + } + return content +} -func (msg *MsgSubmitProposalBase) SetInitialDeposit(coins sdk.Coins) { - msg.InitialDeposit = coins +func (m *MsgSubmitProposal) SetInitialDeposit(coins sdk.Coins) { + m.InitialDeposit = coins } -func (msg *MsgSubmitProposalBase) SetProposer(address sdk.AccAddress) { - msg.Proposer = address +func (m *MsgSubmitProposal) SetProposer(address sdk.AccAddress) { + m.Proposer = address +} + +func (m *MsgSubmitProposal) SetContent(content Content) error { + msg, ok := content.(proto.Message) + if !ok { + return fmt.Errorf("can't proto marshal %T", msg) + } + any, err := types.NewAnyWithValue(msg) + if err != nil { + return err + } + m.Content = any + return nil } // Route implements Msg -func (msg MsgSubmitProposalBase) Route() string { return RouterKey } +func (m MsgSubmitProposal) Route() string { return RouterKey } // Type implements Msg -func (msg MsgSubmitProposalBase) Type() string { return TypeMsgSubmitProposal } +func (m MsgSubmitProposal) Type() string { return TypeMsgSubmitProposal } // ValidateBasic implements Msg -func (msg MsgSubmitProposalBase) ValidateBasic() error { - if msg.Proposer.Empty() { - return sdkerrors.Wrap(sdkerrors.ErrInvalidAddress, msg.Proposer.String()) +func (m MsgSubmitProposal) ValidateBasic() error { + if m.Proposer.Empty() { + return sdkerrors.Wrap(sdkerrors.ErrInvalidAddress, m.Proposer.String()) } - if !msg.InitialDeposit.IsValid() { - return sdkerrors.Wrap(sdkerrors.ErrInvalidCoins, msg.InitialDeposit.String()) + if !m.InitialDeposit.IsValid() { + return sdkerrors.Wrap(sdkerrors.ErrInvalidCoins, m.InitialDeposit.String()) } - if msg.InitialDeposit.IsAnyNegative() { - return sdkerrors.Wrap(sdkerrors.ErrInvalidCoins, msg.InitialDeposit.String()) + if m.InitialDeposit.IsAnyNegative() { + return sdkerrors.Wrap(sdkerrors.ErrInvalidCoins, m.InitialDeposit.String()) + } + + content := m.GetContent() + if content == nil { + return sdkerrors.Wrap(ErrInvalidProposalContent, "missing content") + } + if !IsValidProposalType(content.ProposalType()) { + return sdkerrors.Wrap(ErrInvalidProposalType, content.ProposalType()) + } + if err := content.ValidateBasic(); err != nil { + return err } return nil } // GetSignBytes implements Msg -func (msg MsgSubmitProposalBase) GetSignBytes() []byte { - bz := ModuleCdc.MustMarshalJSON(msg) +func (m MsgSubmitProposal) GetSignBytes() []byte { + bz := ModuleCdc.MustMarshalJSON(m) return sdk.MustSortJSON(bz) } // GetSigners implements Msg -func (msg MsgSubmitProposalBase) GetSigners() []sdk.AccAddress { - return []sdk.AccAddress{msg.Proposer} +func (m MsgSubmitProposal) GetSigners() []sdk.AccAddress { + return []sdk.AccAddress{m.Proposer} } // String implements the Stringer interface -func (msg MsgSubmitProposalBase) String() string { - out, _ := yaml.Marshal(msg) +func (m MsgSubmitProposal) String() string { + out, _ := yaml.Marshal(m) return string(out) } +// UnpackInterfaces implements UnpackInterfacesMessage.UnpackInterfaces +func (m MsgSubmitProposal) UnpackInterfaces(unpacker types.AnyUnpacker) error { + var content Content + return unpacker.UnpackAny(m.Content, &content) +} + // NewMsgDeposit creates a new MsgDeposit instance func NewMsgDeposit(depositor sdk.AccAddress, proposalID uint64, amount sdk.Coins) MsgDeposit { return MsgDeposit{proposalID, depositor, amount} @@ -172,75 +224,3 @@ func (msg MsgVote) GetSignBytes() []byte { func (msg MsgVote) GetSigners() []sdk.AccAddress { return []sdk.AccAddress{msg.Voter} } - -// --------------------------------------------------------------------------- -// Deprecated -// -// TODO: Remove once client-side Protobuf migration has been completed. -// --------------------------------------------------------------------------- - -// MsgSubmitProposal defines a (deprecated) message to create/submit a governance -// proposal. -// -// TODO: Remove once client-side Protobuf migration has been completed. -type MsgSubmitProposal struct { - Content Content `json:"content" yaml:"content"` - InitialDeposit sdk.Coins `json:"initial_deposit" yaml:"initial_deposit"` // Initial deposit paid by sender. Must be strictly positive - Proposer sdk.AccAddress `json:"proposer" yaml:"proposer"` // Address of the proposer -} - -var _ MsgSubmitProposalI = &MsgSubmitProposal{} - -// NewMsgSubmitProposal returns a (deprecated) MsgSubmitProposal message. -// -// TODO: Remove once client-side Protobuf migration has been completed. -func NewMsgSubmitProposal(content Content, initialDeposit sdk.Coins, proposer sdk.AccAddress) *MsgSubmitProposal { - return &MsgSubmitProposal{content, initialDeposit, proposer} -} - -// ValidateBasic implements Msg -func (msg MsgSubmitProposal) ValidateBasic() error { - if msg.Content == nil { - return sdkerrors.Wrap(ErrInvalidProposalContent, "missing content") - } - if msg.Proposer.Empty() { - return sdkerrors.Wrap(sdkerrors.ErrInvalidAddress, msg.Proposer.String()) - } - if !msg.InitialDeposit.IsValid() { - return sdkerrors.Wrap(sdkerrors.ErrInvalidCoins, msg.InitialDeposit.String()) - } - if msg.InitialDeposit.IsAnyNegative() { - return sdkerrors.Wrap(sdkerrors.ErrInvalidCoins, msg.InitialDeposit.String()) - } - if !IsValidProposalType(msg.Content.ProposalType()) { - return sdkerrors.Wrap(ErrInvalidProposalType, msg.Content.ProposalType()) - } - - return msg.Content.ValidateBasic() -} - -// GetSignBytes implements Msg -func (msg MsgSubmitProposal) GetSignBytes() []byte { - bz := ModuleCdc.MustMarshalJSON(msg) - return sdk.MustSortJSON(bz) -} - -func (msg MsgSubmitProposal) GetSigners() []sdk.AccAddress { return []sdk.AccAddress{msg.Proposer} } -func (msg MsgSubmitProposal) Route() string { return RouterKey } -func (msg MsgSubmitProposal) Type() string { return TypeMsgSubmitProposal } -func (msg MsgSubmitProposal) GetContent() Content { return msg.Content } -func (msg MsgSubmitProposal) GetInitialDeposit() sdk.Coins { return msg.InitialDeposit } -func (msg MsgSubmitProposal) GetProposer() sdk.AccAddress { return msg.Proposer } - -func (msg *MsgSubmitProposal) SetContent(content Content) error { - msg.Content = content - return nil -} - -func (msg *MsgSubmitProposal) SetInitialDeposit(deposit sdk.Coins) { - msg.InitialDeposit = deposit -} - -func (msg *MsgSubmitProposal) SetProposer(proposer sdk.AccAddress) { - msg.Proposer = proposer -} diff --git a/x/gov/types/msgs_test.go b/x/gov/types/msgs_test.go index 54bb3fa484..9d7d6a3682 100644 --- a/x/gov/types/msgs_test.go +++ b/x/gov/types/msgs_test.go @@ -43,12 +43,14 @@ func TestMsgSubmitProposal(t *testing.T) { } for i, tc := range tests { - msg := NewMsgSubmitProposal( + msg, err := NewMsgSubmitProposal( ContentFromProposalType(tc.title, tc.description, tc.proposalType), tc.initialDeposit, tc.proposerAddr, ) + require.NoError(t, err) + if tc.expectPass { require.NoError(t, msg.ValidateBasic(), "test: %v", i) } else { @@ -115,3 +117,16 @@ func TestMsgVote(t *testing.T) { } } } + +// this tests that Amino JSON MsgSubmitProposal.GetSignBytes() still works with Content as Any using the ModuleCdc +func TestMsgSubmitProposal_GetSignBytes(t *testing.T) { + msg, err := NewMsgSubmitProposal(NewTextProposal("test", "abcd"), sdk.NewCoins(), sdk.AccAddress{}) + require.NoError(t, err) + var bz []byte + require.NotPanics(t, func() { + bz = msg.GetSignBytes() + }) + require.Equal(t, + `{"type":"cosmos-sdk/MsgSubmitProposal","value":{"content":{"type":"cosmos-sdk/TextProposal","value":{"description":"abcd","title":"test"}},"initial_deposit":[]}}`, + string(bz)) +} diff --git a/x/gov/types/proposal.go b/x/gov/types/proposal.go index 60f888d30e..f550e881a5 100644 --- a/x/gov/types/proposal.go +++ b/x/gov/types/proposal.go @@ -6,8 +6,10 @@ import ( "strings" "time" - "gopkg.in/yaml.v2" + "github.com/gogo/protobuf/proto" + yaml "gopkg.in/yaml.v2" + "github.com/cosmos/cosmos-sdk/codec/types" sdk "github.com/cosmos/cosmos-sdk/types" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" ) @@ -15,31 +17,30 @@ import ( // DefaultStartingProposalID is 1 const DefaultStartingProposalID uint64 = 1 -// Proposal defines a struct used by the governance module to allow for voting -// on network changes. -type Proposal struct { - Content `json:"content" yaml:"content"` // Proposal content interface - ProposalBase -} - // NewProposal creates a new Proposal instance -func NewProposal(content Content, id uint64, submitTime, depositEndTime time.Time) Proposal { - return Proposal{ - Content: content, - ProposalBase: ProposalBase{ - ProposalID: id, - Status: StatusDepositPeriod, - FinalTallyResult: EmptyTallyResult(), - TotalDeposit: sdk.NewCoins(), - SubmitTime: submitTime, - DepositEndTime: depositEndTime, - }, +func NewProposal(content Content, id uint64, submitTime, depositEndTime time.Time) (Proposal, error) { + p := Proposal{ + ProposalID: id, + Status: StatusDepositPeriod, + FinalTallyResult: EmptyTallyResult(), + TotalDeposit: sdk.NewCoins(), + SubmitTime: submitTime, + DepositEndTime: depositEndTime, } -} -// Equal returns true if two Proposal types are equal. -func (p Proposal) Equal(other Proposal) bool { - return p.ProposalBase.Equal(other.ProposalBase) && p.Content.String() == other.Content.String() + msg, ok := content.(proto.Message) + if !ok { + return Proposal{}, fmt.Errorf("%T does not implement proto.Message", content) + } + + any, err := types.NewAnyWithValue(msg) + if err != nil { + return Proposal{}, err + } + + p.Content = any + + return p, nil } // String implements stringer interface @@ -48,9 +49,50 @@ func (p Proposal) String() string { return string(out) } +// GetContent returns the proposal Content +func (p Proposal) GetContent() Content { + content, ok := p.Content.GetCachedValue().(Content) + if !ok { + return nil + } + return content +} + +func (p Proposal) ProposalType() string { + content := p.GetContent() + if content == nil { + return "" + } + return content.ProposalType() +} + +func (p Proposal) ProposalRoute() string { + content := p.GetContent() + if content == nil { + return "" + } + return content.ProposalRoute() +} + +func (p Proposal) GetTitle() string { + content := p.GetContent() + if content == nil { + return "" + } + return content.GetTitle() +} + +// UnpackInterfaces implements UnpackInterfacesMessage.UnpackInterfaces +func (p Proposal) UnpackInterfaces(unpacker types.AnyUnpacker) error { + var content Content + return unpacker.UnpackAny(p.Content, &content) +} + // Proposals is an array of proposal type Proposals []Proposal +var _ types.UnpackInterfacesMessage = Proposals{} + // Equal returns true if two slices (order-dependant) of proposals are equal. func (p Proposals) Equal(other Proposals) bool { if len(p) != len(other) { @@ -77,6 +119,17 @@ func (p Proposals) String() string { return strings.TrimSpace(out) } +// UnpackInterfaces implements UnpackInterfacesMessage.UnpackInterfaces +func (p Proposals) UnpackInterfaces(unpacker types.AnyUnpacker) error { + for _, x := range p { + err := x.UnpackInterfaces(unpacker) + if err != nil { + return err + } + } + return nil +} + type ( // ProposalQueue defines a queue for proposal ids ProposalQueue []uint64 diff --git a/x/gov/types/types.pb.go b/x/gov/types/types.pb.go index 038f3297d7..590f19869d 100644 --- a/x/gov/types/types.pb.go +++ b/x/gov/types/types.pb.go @@ -6,13 +6,14 @@ package types import ( bytes "bytes" fmt "fmt" + types "github.com/cosmos/cosmos-sdk/codec/types" github_com_cosmos_cosmos_sdk_types "github.com/cosmos/cosmos-sdk/types" - types "github.com/cosmos/cosmos-sdk/types" + types1 "github.com/cosmos/cosmos-sdk/types" _ "github.com/gogo/protobuf/gogoproto" - github_com_gogo_protobuf_proto "github.com/gogo/protobuf/proto" proto "github.com/gogo/protobuf/proto" github_com_gogo_protobuf_types "github.com/gogo/protobuf/types" _ "github.com/golang/protobuf/ptypes/timestamp" + _ "github.com/regen-network/cosmos-proto" io "io" math "math" math_bits "math/bits" @@ -107,29 +108,25 @@ func (ProposalStatus) EnumDescriptor() ([]byte, []int) { return fileDescriptor_a5ae5e91b5b3fb03, []int{1} } -// MsgSubmitProposalBase defines an sdk.Msg type that supports submitting arbitrary +// MsgSubmitProposal defines an sdk.Msg type that supports submitting arbitrary // proposal Content. -// -// Note, this message type provides the basis for which a true MsgSubmitProposal -// can be constructed. Since the Content submitted in the message can be arbitrary, -// assuming it fulfills the Content interface, it must be defined at the -// application-level and extend MsgSubmitProposalBase. -type MsgSubmitProposalBase struct { - InitialDeposit github_com_cosmos_cosmos_sdk_types.Coins `protobuf:"bytes,1,rep,name=initial_deposit,json=initialDeposit,proto3,castrepeated=github.com/cosmos/cosmos-sdk/types.Coins" json:"initial_deposit" yaml:"initial_deposit"` - Proposer github_com_cosmos_cosmos_sdk_types.AccAddress `protobuf:"bytes,2,opt,name=proposer,proto3,casttype=github.com/cosmos/cosmos-sdk/types.AccAddress" json:"proposer,omitempty"` -} - -func (m *MsgSubmitProposalBase) Reset() { *m = MsgSubmitProposalBase{} } -func (*MsgSubmitProposalBase) ProtoMessage() {} -func (*MsgSubmitProposalBase) Descriptor() ([]byte, []int) { +type MsgSubmitProposal struct { + Content *types.Any `protobuf:"bytes,1,opt,name=content,proto3" json:"content,omitempty"` + InitialDeposit github_com_cosmos_cosmos_sdk_types.Coins `protobuf:"bytes,2,rep,name=initial_deposit,json=initialDeposit,proto3,castrepeated=github.com/cosmos/cosmos-sdk/types.Coins" json:"initial_deposit" yaml:"initial_deposit"` + Proposer github_com_cosmos_cosmos_sdk_types.AccAddress `protobuf:"bytes,3,opt,name=proposer,proto3,casttype=github.com/cosmos/cosmos-sdk/types.AccAddress" json:"proposer,omitempty"` +} + +func (m *MsgSubmitProposal) Reset() { *m = MsgSubmitProposal{} } +func (*MsgSubmitProposal) ProtoMessage() {} +func (*MsgSubmitProposal) Descriptor() ([]byte, []int) { return fileDescriptor_a5ae5e91b5b3fb03, []int{0} } -func (m *MsgSubmitProposalBase) XXX_Unmarshal(b []byte) error { +func (m *MsgSubmitProposal) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } -func (m *MsgSubmitProposalBase) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { +func (m *MsgSubmitProposal) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { - return xxx_messageInfo_MsgSubmitProposalBase.Marshal(b, m, deterministic) + return xxx_messageInfo_MsgSubmitProposal.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) @@ -139,17 +136,17 @@ func (m *MsgSubmitProposalBase) XXX_Marshal(b []byte, deterministic bool) ([]byt return b[:n], nil } } -func (m *MsgSubmitProposalBase) XXX_Merge(src proto.Message) { - xxx_messageInfo_MsgSubmitProposalBase.Merge(m, src) +func (m *MsgSubmitProposal) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgSubmitProposal.Merge(m, src) } -func (m *MsgSubmitProposalBase) XXX_Size() int { +func (m *MsgSubmitProposal) XXX_Size() int { return m.Size() } -func (m *MsgSubmitProposalBase) XXX_DiscardUnknown() { - xxx_messageInfo_MsgSubmitProposalBase.DiscardUnknown(m) +func (m *MsgSubmitProposal) XXX_DiscardUnknown() { + xxx_messageInfo_MsgSubmitProposal.DiscardUnknown(m) } -var xxx_messageInfo_MsgSubmitProposalBase proto.InternalMessageInfo +var xxx_messageInfo_MsgSubmitProposal proto.InternalMessageInfo // MsgVote defines a message to cast a vote type MsgVote struct { @@ -307,32 +304,30 @@ func (m *Deposit) XXX_DiscardUnknown() { var xxx_messageInfo_Deposit proto.InternalMessageInfo -// ProposalBase defines the core field members of a governance proposal. It includes -// all static fields (i.e fields excluding the dynamic Content). A full proposal -// extends the ProposalBase with Content. -type ProposalBase struct { +// Proposal defines the core field members of a governance proposal +type Proposal struct { ProposalID uint64 `protobuf:"varint,1,opt,name=proposal_id,json=proposalId,proto3" json:"id" yaml:"id"` - Status ProposalStatus `protobuf:"varint,2,opt,name=status,proto3,enum=cosmos_sdk.x.gov.v1.ProposalStatus" json:"status,omitempty" yaml:"proposal_status"` - FinalTallyResult TallyResult `protobuf:"bytes,3,opt,name=final_tally_result,json=finalTallyResult,proto3" json:"final_tally_result" yaml:"final_tally_result"` - SubmitTime time.Time `protobuf:"bytes,4,opt,name=submit_time,json=submitTime,proto3,stdtime" json:"submit_time" yaml:"submit_time"` - DepositEndTime time.Time `protobuf:"bytes,5,opt,name=deposit_end_time,json=depositEndTime,proto3,stdtime" json:"deposit_end_time" yaml:"deposit_end_time"` - TotalDeposit github_com_cosmos_cosmos_sdk_types.Coins `protobuf:"bytes,6,rep,name=total_deposit,json=totalDeposit,proto3,castrepeated=github.com/cosmos/cosmos-sdk/types.Coins" json:"total_deposit" yaml:"total_deposit"` - VotingStartTime time.Time `protobuf:"bytes,7,opt,name=voting_start_time,json=votingStartTime,proto3,stdtime" json:"voting_start_time" yaml:"voting_start_time"` - VotingEndTime time.Time `protobuf:"bytes,8,opt,name=voting_end_time,json=votingEndTime,proto3,stdtime" json:"voting_end_time" yaml:"voting_end_time"` -} - -func (m *ProposalBase) Reset() { *m = ProposalBase{} } -func (m *ProposalBase) String() string { return proto.CompactTextString(m) } -func (*ProposalBase) ProtoMessage() {} -func (*ProposalBase) Descriptor() ([]byte, []int) { + Content *types.Any `protobuf:"bytes,2,opt,name=content,proto3" json:"content,omitempty"` + Status ProposalStatus `protobuf:"varint,3,opt,name=status,proto3,enum=cosmos_sdk.x.gov.v1.ProposalStatus" json:"status,omitempty" yaml:"proposal_status"` + FinalTallyResult TallyResult `protobuf:"bytes,4,opt,name=final_tally_result,json=finalTallyResult,proto3" json:"final_tally_result" yaml:"final_tally_result"` + SubmitTime time.Time `protobuf:"bytes,5,opt,name=submit_time,json=submitTime,proto3,stdtime" json:"submit_time" yaml:"submit_time"` + DepositEndTime time.Time `protobuf:"bytes,6,opt,name=deposit_end_time,json=depositEndTime,proto3,stdtime" json:"deposit_end_time" yaml:"deposit_end_time"` + TotalDeposit github_com_cosmos_cosmos_sdk_types.Coins `protobuf:"bytes,7,rep,name=total_deposit,json=totalDeposit,proto3,castrepeated=github.com/cosmos/cosmos-sdk/types.Coins" json:"total_deposit" yaml:"total_deposit"` + VotingStartTime time.Time `protobuf:"bytes,8,opt,name=voting_start_time,json=votingStartTime,proto3,stdtime" json:"voting_start_time" yaml:"voting_start_time"` + VotingEndTime time.Time `protobuf:"bytes,9,opt,name=voting_end_time,json=votingEndTime,proto3,stdtime" json:"voting_end_time" yaml:"voting_end_time"` +} + +func (m *Proposal) Reset() { *m = Proposal{} } +func (*Proposal) ProtoMessage() {} +func (*Proposal) Descriptor() ([]byte, []int) { return fileDescriptor_a5ae5e91b5b3fb03, []int{5} } -func (m *ProposalBase) XXX_Unmarshal(b []byte) error { +func (m *Proposal) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } -func (m *ProposalBase) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { +func (m *Proposal) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { - return xxx_messageInfo_ProposalBase.Marshal(b, m, deterministic) + return xxx_messageInfo_Proposal.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) @@ -342,17 +337,17 @@ func (m *ProposalBase) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) return b[:n], nil } } -func (m *ProposalBase) XXX_Merge(src proto.Message) { - xxx_messageInfo_ProposalBase.Merge(m, src) +func (m *Proposal) XXX_Merge(src proto.Message) { + xxx_messageInfo_Proposal.Merge(m, src) } -func (m *ProposalBase) XXX_Size() int { +func (m *Proposal) XXX_Size() int { return m.Size() } -func (m *ProposalBase) XXX_DiscardUnknown() { - xxx_messageInfo_ProposalBase.DiscardUnknown(m) +func (m *Proposal) XXX_DiscardUnknown() { + xxx_messageInfo_Proposal.DiscardUnknown(m) } -var xxx_messageInfo_ProposalBase proto.InternalMessageInfo +var xxx_messageInfo_Proposal proto.InternalMessageInfo // TallyResult defines a standard tally for a proposal type TallyResult struct { @@ -437,12 +432,12 @@ var xxx_messageInfo_Vote proto.InternalMessageInfo func init() { proto.RegisterEnum("cosmos_sdk.x.gov.v1.VoteOption", VoteOption_name, VoteOption_value) proto.RegisterEnum("cosmos_sdk.x.gov.v1.ProposalStatus", ProposalStatus_name, ProposalStatus_value) - proto.RegisterType((*MsgSubmitProposalBase)(nil), "cosmos_sdk.x.gov.v1.MsgSubmitProposalBase") + proto.RegisterType((*MsgSubmitProposal)(nil), "cosmos_sdk.x.gov.v1.MsgSubmitProposal") proto.RegisterType((*MsgVote)(nil), "cosmos_sdk.x.gov.v1.MsgVote") proto.RegisterType((*MsgDeposit)(nil), "cosmos_sdk.x.gov.v1.MsgDeposit") proto.RegisterType((*TextProposal)(nil), "cosmos_sdk.x.gov.v1.TextProposal") proto.RegisterType((*Deposit)(nil), "cosmos_sdk.x.gov.v1.Deposit") - proto.RegisterType((*ProposalBase)(nil), "cosmos_sdk.x.gov.v1.ProposalBase") + proto.RegisterType((*Proposal)(nil), "cosmos_sdk.x.gov.v1.Proposal") proto.RegisterType((*TallyResult)(nil), "cosmos_sdk.x.gov.v1.TallyResult") proto.RegisterType((*Vote)(nil), "cosmos_sdk.x.gov.v1.Vote") } @@ -450,94 +445,97 @@ func init() { func init() { proto.RegisterFile("x/gov/types/types.proto", fileDescriptor_a5ae5e91b5b3fb03) } var fileDescriptor_a5ae5e91b5b3fb03 = []byte{ - // 1230 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xdc, 0x57, 0xcf, 0x8f, 0xd3, 0x46, - 0x14, 0x8e, 0xb3, 0xbf, 0xd8, 0x49, 0x36, 0x6b, 0x66, 0x29, 0x9b, 0xba, 0x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54, - 0x55, 0xcb, 0xae, 0xea, 0x75, 0x3e, 0x2f, 0x1c, 0xee, 0xf6, 0xe4, 0x19, 0x8a, 0xab, 0xb2, 0x99, - 0x90, 0x41, 0x29, 0x8b, 0xad, 0x1b, 0xfc, 0x98, 0x50, 0xec, 0xf6, 0xe4, 0x43, 0x14, 0x56, 0x47, - 0x70, 0x09, 0x94, 0x87, 0x11, 0xce, 0x0d, 0xdd, 0xbe, 0xe2, 0xac, 0x68, 0xb6, 0xc1, 0x8f, 0x0b, - 0x47, 0xba, 0x3d, 0x99, 0x4f, 0xb1, 0xe9, 0x06, 0x0a, 0xc5, 0xbb, 0xdf, 0x88, 0xb9, 0x47, 0x0f, - 0xc5, 0xdc, 0x77, 0x0f, 0xc5, 0xdc, 0xa9, 0x1f, 0xf2, 0xa0, 0x34, 0x6c, 0xf7, 0x50, 0x01, 0xef, - 0x34, 0x4c, 0xa3, 0x61, 0x58, 0xd5, 0x6b, 0x8e, 0x65, 0x57, 0xed, 0xeb, 0xd6, 0x48, 0xe1, 0x49, - 0x49, 0x14, 0x5c, 0x0f, 0x23, 0xf8, 0x01, 0x10, 0x47, 0xf1, 0x35, 0xad, 0x61, 0x58, 0xba, 0xed, - 0x34, 0x34, 0x53, 0x37, 0x6a, 0x3c, 0x27, 0xcc, 0x77, 0x7b, 0xf2, 0x1c, 0xa5, 0x30, 0xc7, 0x69, - 0xf8, 0xed, 0x10, 0x79, 0xf0, 0x7d, 0xf0, 0xee, 0x28, 0x79, 0xc5, 0xb0, 0xf5, 0xfa, 0xe5, 0x94, - 0x9b, 0x17, 0x8e, 0x76, 0x7b, 0x32, 0xa4, 0xdc, 0x95, 0xe4, 0x74, 0x33, 0xea, 0x69, 0x70, 0x74, - 0x94, 0xda, 0xa8, 0x5a, 0x96, 0x56, 0xe3, 0xc7, 0x04, 0xbe, 0xdb, 0x93, 0x8b, 0x94, 0xd3, 0x70, - 0x31, 0xf6, 0x3d, 0x78, 0x16, 0x94, 0x47, 0xd1, 0xa6, 0x76, 0x55, 0xbb, 0x68, 0x6b, 0x35, 0x7e, - 0x5c, 0x80, 0xdd, 0x9e, 0x5c, 0xa2, 0x78, 0xd3, 0xff, 0xcc, 0x5f, 0x23, 0xfe, 0x9e, 0xfa, 0x97, - 0xaa, 0xfa, 0x35, 0xad, 0xc6, 0x4f, 0x64, 0xf5, 0x2f, 0xb9, 0x61, 0xe4, 0x7b, 0xc3, 0x6d, 0x55, - 0xeb, 0x5b, 0xcf, 0xc4, 0xdc, 0x93, 0x67, 0x62, 0xee, 0xcb, 0x6d, 0x31, 0xb7, 0xb5, 0x2d, 0x72, - 0x8f, 0xb7, 0x45, 0xee, 0xe7, 0x6d, 0x91, 0xbb, 0xf7, 0x5c, 0xcc, 0x3d, 0x7e, 0x2e, 0xe6, 0x9e, - 0x3c, 0x17, 0x73, 0x1f, 0xff, 0xbd, 0x59, 0x67, 0xfe, 0xdf, 0xac, 0x4e, 0x26, 0x7e, 0x78, 0xfe, - 0xaf, 0x00, 0x00, 0x00, 0xff, 0xff, 0xc7, 0x53, 0x05, 0xd1, 0xf5, 0x0c, 0x00, 0x00, -} - -func (this *MsgSubmitProposalBase) Equal(that interface{}) bool { + // 1275 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xdc, 0x57, 0xbd, 0x6f, 0xdb, 0xd6, + 0x17, 0x15, 0xe9, 0x0f, 0xd9, 0x4f, 0xb2, 0x4d, 0x3f, 0x1b, 0xb1, 0xc2, 0x1f, 0x7e, 0x24, 0xa3, + 0x04, 0x81, 0x91, 0x26, 0x74, 0xe2, 0x0c, 0x45, 0x53, 0xa0, 0xa8, 0x64, 0x31, 0x89, 0x82, 0x58, + 0x12, 0x28, 0xc6, 0x46, 0x5a, 0x14, 0x04, 0x2d, 0xbe, 0xc8, 0x6c, 0x24, 0x3e, 0x55, 0xef, 0x59, + 0x8d, 0xb6, 0xa0, 0x43, 0x11, 0x68, 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, 0x33, 0x95, 0xac, 0xc9, 0xe5, 0xe0, + 0x47, 0x00, 0xde, 0xf2, 0x7c, 0xa7, 0x61, 0x53, 0xa7, 0xd1, 0xe8, 0xda, 0x6d, 0x44, 0x76, 0x1a, + 0x34, 0x33, 0x1e, 0x1e, 0x50, 0x3b, 0x34, 0x89, 0x15, 0x00, 0xcd, 0x10, 0x97, 0x3f, 0xc1, 0x97, + 0xe7, 0x71, 0x96, 0xe5, 0xa0, 0x52, 0xd6, 0x94, 0xc2, 0x60, 0x8c, 0x04, 0xdf, 0x07, 0x29, 0x12, + 0xee, 0x7b, 0x3b, 0x78, 0x51, 0x64, 0x26, 0xc2, 0x5c, 0xf2, 0x01, 0x33, 0xac, 0xe8, 0x2d, 0x92, + 0x57, 0x78, 0x16, 0xde, 0x68, 0x31, 0x72, 0xf6, 0xfe, 0x13, 0x55, 0x30, 0x01, 0x8b, 0x04, 0x04, + 0xe8, 0x01, 0x89, 0x37, 0x8a, 0x8d, 0x7c, 0x97, 0x65, 0x98, 0x7c, 0x65, 0x86, 0x93, 0x3c, 0xc3, + 0x12, 0xcb, 0x30, 0xaa, 0xc0, 0xd2, 0xcc, 0xf2, 0xb0, 0xe1, 0xbb, 0x61, 0xaa, 0x4f, 0x04, 0x30, + 0x43, 0x31, 0x8d, 0xbd, 0x66, 0x92, 0x2f, 0x6f, 0xc7, 0xab, 0x3c, 0xc3, 0x22, 0xcb, 0xb0, 0x8f, + 0x77, 0xb4, 0x97, 0x4c, 0x3a, 0xe4, 0x46, 0x33, 0xda, 0x00, 0xf3, 0x1d, 0x4c, 0x3d, 0xbf, 0x1e, + 0x3c, 0xd9, 0x36, 0xb7, 0x74, 0xea, 0x95, 0x05, 0x9f, 0xe2, 0xc7, 0xc9, 0xb0, 0xe3, 0x1c, 0x90, + 0x60, 0x15, 0xcf, 0xb1, 0x78, 0x35, 0x08, 0x87, 0x25, 0xdf, 0x02, 0x3c, 0x34, 0x34, 0x77, 0xfa, + 0x95, 0xb9, 0x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0x42, 0x90, + 0x0b, 0xcf, 0x83, 0xcc, 0x28, 0xda, 0x34, 0xae, 0x19, 0x6b, 0x96, 0x51, 0x90, 0xc6, 0x65, 0xd8, + 0xeb, 0x6b, 0xb3, 0x0c, 0x6f, 0xa2, 0x0f, 0x51, 0x8d, 0xa2, 0x43, 0xf5, 0x2f, 0xe7, 0x8a, 0xd7, + 0x8d, 0x82, 0x34, 0x11, 0xd7, 0xbf, 0xec, 0x78, 0x0d, 0xe4, 0xee, 0xb7, 0x35, 0x5f, 0xda, 0x7d, + 0xaa, 0x24, 0x1e, 0x3f, 0x55, 0x12, 0x77, 0xf7, 0x94, 0xc4, 0xee, 0x9e, 0x22, 0x3c, 0xda, 0x53, + 0x84, 0x1f, 0xf7, 0x14, 0xe1, 0xfe, 0x33, 0x25, 0xf1, 0xe8, 0x99, 0x92, 0x78, 0xfc, 0x4c, 0x49, + 0xbc, 0xf7, 0xc7, 0x4b, 0x3a, 0xf6, 0xe3, 0x6c, 0x6b, 0x32, 0xdc, 0x83, 0x17, 0x7f, 0x0f, 0x00, + 0x00, 0xff, 0xff, 0xd6, 0x34, 0x18, 0x2d, 0xb2, 0x0d, 0x00, 0x00, +} + +func (this *MsgSubmitProposal) Equal(that interface{}) bool { if that == nil { return this == nil } - that1, ok := that.(*MsgSubmitProposalBase) + that1, ok := that.(*MsgSubmitProposal) if !ok { - that2, ok := that.(MsgSubmitProposalBase) + that2, ok := that.(MsgSubmitProposal) if ok { that1 = &that2 } else { @@ -549,6 +547,9 @@ func (this *MsgSubmitProposalBase) Equal(that interface{}) bool { } else if this == nil { return false } + if !this.Content.Equal(that1.Content) { + return false + } if len(this.InitialDeposit) != len(that1.InitialDeposit) { return false } @@ -689,14 +690,14 @@ func (this *Deposit) Equal(that interface{}) bool { } return true } -func (this *ProposalBase) Equal(that interface{}) bool { +func (this *Proposal) Equal(that interface{}) bool { if that == nil { return this == nil } - that1, ok := that.(*ProposalBase) + that1, ok := that.(*Proposal) if !ok { - that2, ok := that.(ProposalBase) + that2, ok := that.(Proposal) if ok { that1 = &that2 } else { @@ -711,6 +712,9 @@ func (this *ProposalBase) Equal(that interface{}) bool { if this.ProposalID != that1.ProposalID { return false } + if !this.Content.Equal(that1.Content) { + return false + } if this.Status != that1.Status { return false } @@ -802,73 +806,7 @@ func (this *Vote) Equal(that interface{}) bool { } return true } - -type ProposalBaseFace interface { - Proto() github_com_gogo_protobuf_proto.Message - GetProposalID() uint64 - GetStatus() ProposalStatus - GetFinalTallyResult() TallyResult - GetSubmitTime() time.Time - GetDepositEndTime() time.Time - GetTotalDeposit() github_com_cosmos_cosmos_sdk_types.Coins - GetVotingStartTime() time.Time - GetVotingEndTime() time.Time -} - -func (this *ProposalBase) Proto() github_com_gogo_protobuf_proto.Message { - return this -} - -func (this *ProposalBase) TestProto() github_com_gogo_protobuf_proto.Message { - return NewProposalBaseFromFace(this) -} - -func (this *ProposalBase) GetProposalID() uint64 { - return this.ProposalID -} - -func (this *ProposalBase) GetStatus() ProposalStatus { - return this.Status -} - -func (this *ProposalBase) GetFinalTallyResult() TallyResult { - return this.FinalTallyResult -} - -func (this *ProposalBase) GetSubmitTime() time.Time { - return this.SubmitTime -} - -func (this *ProposalBase) GetDepositEndTime() time.Time { - return this.DepositEndTime -} - -func (this *ProposalBase) GetTotalDeposit() github_com_cosmos_cosmos_sdk_types.Coins { - return this.TotalDeposit -} - -func (this *ProposalBase) GetVotingStartTime() time.Time { - return this.VotingStartTime -} - -func (this *ProposalBase) GetVotingEndTime() time.Time { - return this.VotingEndTime -} - -func NewProposalBaseFromFace(that ProposalBaseFace) *ProposalBase { - this := &ProposalBase{} - this.ProposalID = that.GetProposalID() - this.Status = that.GetStatus() - this.FinalTallyResult = that.GetFinalTallyResult() - this.SubmitTime = that.GetSubmitTime() - this.DepositEndTime = that.GetDepositEndTime() - this.TotalDeposit = that.GetTotalDeposit() - this.VotingStartTime = that.GetVotingStartTime() - this.VotingEndTime = that.GetVotingEndTime() - return this -} - -func (m *MsgSubmitProposalBase) Marshal() (dAtA []byte, err error) { +func (m *MsgSubmitProposal) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -878,12 +816,12 @@ func (m *MsgSubmitProposalBase) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *MsgSubmitProposalBase) MarshalTo(dAtA []byte) (int, error) { +func (m *MsgSubmitProposal) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *MsgSubmitProposalBase) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *MsgSubmitProposal) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int @@ -893,7 +831,7 @@ func (m *MsgSubmitProposalBase) MarshalToSizedBuffer(dAtA []byte) (int, error) { copy(dAtA[i:], m.Proposer) i = encodeVarintTypes(dAtA, i, uint64(len(m.Proposer))) i-- - dAtA[i] = 0x12 + dAtA[i] = 0x1a } if len(m.InitialDeposit) > 0 { for iNdEx := len(m.InitialDeposit) - 1; iNdEx >= 0; iNdEx-- { @@ -906,9 +844,21 @@ func (m *MsgSubmitProposalBase) MarshalToSizedBuffer(dAtA []byte) (int, error) { i = encodeVarintTypes(dAtA, i, uint64(size)) } i-- - dAtA[i] = 0xa + dAtA[i] = 0x12 } } + if m.Content != nil { + { + size, err := m.Content.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTypes(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } return len(dAtA) - i, nil } @@ -1087,7 +1037,7 @@ func (m *Deposit) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } -func (m *ProposalBase) Marshal() (dAtA []byte, err error) { +func (m *Proposal) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -1097,32 +1047,32 @@ func (m *ProposalBase) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *ProposalBase) MarshalTo(dAtA []byte) (int, error) { +func (m *Proposal) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *ProposalBase) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *Proposal) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int _ = l - n1, err1 := github_com_gogo_protobuf_types.StdTimeMarshalTo(m.VotingEndTime, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdTime(m.VotingEndTime):]) - if err1 != nil { - return 0, err1 - } - i -= n1 - i = encodeVarintTypes(dAtA, i, uint64(n1)) - i-- - dAtA[i] = 0x42 - n2, err2 := github_com_gogo_protobuf_types.StdTimeMarshalTo(m.VotingStartTime, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdTime(m.VotingStartTime):]) + n2, err2 := github_com_gogo_protobuf_types.StdTimeMarshalTo(m.VotingEndTime, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdTime(m.VotingEndTime):]) if err2 != nil { return 0, err2 } i -= n2 i = encodeVarintTypes(dAtA, i, uint64(n2)) i-- - dAtA[i] = 0x3a + dAtA[i] = 0x4a + n3, err3 := github_com_gogo_protobuf_types.StdTimeMarshalTo(m.VotingStartTime, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdTime(m.VotingStartTime):]) + if err3 != nil { + return 0, err3 + } + i -= n3 + i = encodeVarintTypes(dAtA, i, uint64(n3)) + i-- + dAtA[i] = 0x42 if len(m.TotalDeposit) > 0 { for iNdEx := len(m.TotalDeposit) - 1; iNdEx >= 0; iNdEx-- { { @@ -1134,25 +1084,25 @@ func (m *ProposalBase) MarshalToSizedBuffer(dAtA []byte) (int, error) { i = encodeVarintTypes(dAtA, i, uint64(size)) } i-- - dAtA[i] = 0x32 + dAtA[i] = 0x3a } } - n3, err3 := github_com_gogo_protobuf_types.StdTimeMarshalTo(m.DepositEndTime, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdTime(m.DepositEndTime):]) - if err3 != nil { - return 0, err3 - } - i -= n3 - i = encodeVarintTypes(dAtA, i, uint64(n3)) - i-- - dAtA[i] = 0x2a - n4, err4 := github_com_gogo_protobuf_types.StdTimeMarshalTo(m.SubmitTime, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdTime(m.SubmitTime):]) + n4, err4 := github_com_gogo_protobuf_types.StdTimeMarshalTo(m.DepositEndTime, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdTime(m.DepositEndTime):]) if err4 != nil { return 0, err4 } i -= n4 i = encodeVarintTypes(dAtA, i, uint64(n4)) i-- - dAtA[i] = 0x22 + dAtA[i] = 0x32 + n5, err5 := github_com_gogo_protobuf_types.StdTimeMarshalTo(m.SubmitTime, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdTime(m.SubmitTime):]) + if err5 != nil { + return 0, err5 + } + i -= n5 + i = encodeVarintTypes(dAtA, i, uint64(n5)) + i-- + dAtA[i] = 0x2a { size, err := m.FinalTallyResult.MarshalToSizedBuffer(dAtA[:i]) if err != nil { @@ -1162,11 +1112,23 @@ func (m *ProposalBase) MarshalToSizedBuffer(dAtA []byte) (int, error) { i = encodeVarintTypes(dAtA, i, uint64(size)) } i-- - dAtA[i] = 0x1a + dAtA[i] = 0x22 if m.Status != 0 { i = encodeVarintTypes(dAtA, i, uint64(m.Status)) i-- - dAtA[i] = 0x10 + dAtA[i] = 0x18 + } + if m.Content != nil { + { + size, err := m.Content.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTypes(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 } if m.ProposalID != 0 { i = encodeVarintTypes(dAtA, i, uint64(m.ProposalID)) @@ -1290,12 +1252,16 @@ func encodeVarintTypes(dAtA []byte, offset int, v uint64) int { dAtA[offset] = uint8(v) return base } -func (m *MsgSubmitProposalBase) Size() (n int) { +func (m *MsgSubmitProposal) Size() (n int) { if m == nil { return 0 } var l int _ = l + if m.Content != nil { + l = m.Content.Size() + n += 1 + l + sovTypes(uint64(l)) + } if len(m.InitialDeposit) > 0 { for _, e := range m.InitialDeposit { l = e.Size() @@ -1389,7 +1355,7 @@ func (m *Deposit) Size() (n int) { return n } -func (m *ProposalBase) Size() (n int) { +func (m *Proposal) Size() (n int) { if m == nil { return 0 } @@ -1398,6 +1364,10 @@ func (m *ProposalBase) Size() (n int) { if m.ProposalID != 0 { n += 1 + sovTypes(uint64(m.ProposalID)) } + if m.Content != nil { + l = m.Content.Size() + n += 1 + l + sovTypes(uint64(l)) + } if m.Status != 0 { n += 1 + sovTypes(uint64(m.Status)) } @@ -1462,7 +1432,7 @@ func sovTypes(x uint64) (n int) { func sozTypes(x uint64) (n int) { return sovTypes(uint64((x << 1) ^ uint64((int64(x) >> 63)))) } -func (m *MsgSubmitProposalBase) Unmarshal(dAtA []byte) error { +func (m *MsgSubmitProposal) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -1485,13 +1455,49 @@ func (m *MsgSubmitProposalBase) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: MsgSubmitProposalBase: wiretype end group for non-group") + return fmt.Errorf("proto: MsgSubmitProposal: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: MsgSubmitProposalBase: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: MsgSubmitProposal: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Content", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Content == nil { + m.Content = &types.Any{} + } + if err := m.Content.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field InitialDeposit", wireType) } @@ -1520,12 +1526,12 @@ func (m *MsgSubmitProposalBase) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.InitialDeposit = append(m.InitialDeposit, types.Coin{}) + m.InitialDeposit = append(m.InitialDeposit, types1.Coin{}) if err := m.InitialDeposit[len(m.InitialDeposit)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex - case 2: + case 3: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Proposer", wireType) } @@ -1819,7 +1825,7 @@ func (m *MsgDeposit) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.Amount = append(m.Amount, types.Coin{}) + m.Amount = append(m.Amount, types1.Coin{}) if err := m.Amount[len(m.Amount)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } @@ -2076,7 +2082,7 @@ func (m *Deposit) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.Amount = append(m.Amount, types.Coin{}) + m.Amount = append(m.Amount, types1.Coin{}) if err := m.Amount[len(m.Amount)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } @@ -2105,7 +2111,7 @@ func (m *Deposit) Unmarshal(dAtA []byte) error { } return nil } -func (m *ProposalBase) Unmarshal(dAtA []byte) error { +func (m *Proposal) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -2128,10 +2134,10 @@ func (m *ProposalBase) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: ProposalBase: wiretype end group for non-group") + return fmt.Errorf("proto: Proposal: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: ProposalBase: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: Proposal: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: @@ -2154,6 +2160,42 @@ func (m *ProposalBase) Unmarshal(dAtA []byte) error { } } case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Content", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Content == nil { + m.Content = &types.Any{} + } + if err := m.Content.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 3: if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field Status", wireType) } @@ -2172,7 +2214,7 @@ func (m *ProposalBase) Unmarshal(dAtA []byte) error { break } } - case 3: + case 4: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field FinalTallyResult", wireType) } @@ -2205,7 +2247,7 @@ func (m *ProposalBase) Unmarshal(dAtA []byte) error { return err } iNdEx = postIndex - case 4: + case 5: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field SubmitTime", wireType) } @@ -2238,7 +2280,7 @@ func (m *ProposalBase) Unmarshal(dAtA []byte) error { return err } iNdEx = postIndex - case 5: + case 6: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field DepositEndTime", wireType) } @@ -2271,7 +2313,7 @@ func (m *ProposalBase) Unmarshal(dAtA []byte) error { return err } iNdEx = postIndex - case 6: + case 7: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field TotalDeposit", wireType) } @@ -2300,12 +2342,12 @@ func (m *ProposalBase) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.TotalDeposit = append(m.TotalDeposit, types.Coin{}) + m.TotalDeposit = append(m.TotalDeposit, types1.Coin{}) if err := m.TotalDeposit[len(m.TotalDeposit)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex - case 7: + case 8: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field VotingStartTime", wireType) } @@ -2338,7 +2380,7 @@ func (m *ProposalBase) Unmarshal(dAtA []byte) error { return err } iNdEx = postIndex - case 8: + case 9: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field VotingEndTime", wireType) } diff --git a/x/gov/types/types.proto b/x/gov/types/types.proto index ea6da041a1..307ea24572 100644 --- a/x/gov/types/types.proto +++ b/x/gov/types/types.proto @@ -3,29 +3,27 @@ package cosmos_sdk.x.gov.v1; import "types/types.proto"; import "third_party/proto/gogoproto/gogo.proto"; +import "third_party/proto/cosmos-proto/cosmos.proto"; import "google/protobuf/timestamp.proto"; +import "google/protobuf/any.proto"; option go_package = "github.com/cosmos/cosmos-sdk/x/gov/types"; option (gogoproto.goproto_stringer_all) = false; option (gogoproto.stringer_all) = false; option (gogoproto.goproto_getters_all) = false; -// MsgSubmitProposalBase defines an sdk.Msg type that supports submitting arbitrary +// MsgSubmitProposal defines an sdk.Msg type that supports submitting arbitrary // proposal Content. -// -// Note, this message type provides the basis for which a true MsgSubmitProposal -// can be constructed. Since the Content submitted in the message can be arbitrary, -// assuming it fulfills the Content interface, it must be defined at the -// application-level and extend MsgSubmitProposalBase. -message MsgSubmitProposalBase { +message MsgSubmitProposal { option (gogoproto.equal) = true; - repeated cosmos_sdk.v1.Coin initial_deposit = 1 [ + google.protobuf.Any content = 1 [(cosmos_proto.accepts_interface) = "Content"]; + repeated cosmos_sdk.v1.Coin initial_deposit = 2 [ (gogoproto.nullable) = false, (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins", (gogoproto.moretags) = "yaml:\"initial_deposit\"" ]; - bytes proposer = 2 [(gogoproto.casttype) = "github.com/cosmos/cosmos-sdk/types.AccAddress"]; + bytes proposer = 3 [(gogoproto.casttype) = "github.com/cosmos/cosmos-sdk/types.AccAddress"]; } // MsgVote defines a message to cast a vote @@ -76,6 +74,8 @@ enum VoteOption { // TextProposal defines a standard text proposal whose changes need to be // manually updated in case of approval message TextProposal { + option (cosmos_proto.implements_interface) = "Content"; + option (gogoproto.equal) = true; string title = 1; @@ -92,31 +92,28 @@ message Deposit { [(gogoproto.nullable) = false, (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins"]; } -// ProposalBase defines the core field members of a governance proposal. It includes -// all static fields (i.e fields excluding the dynamic Content). A full proposal -// extends the ProposalBase with Content. -message ProposalBase { +// Proposal defines the core field members of a governance proposal +message Proposal { option (gogoproto.equal) = true; - option (gogoproto.goproto_stringer) = true; - option (gogoproto.face) = true; uint64 proposal_id = 1 [(gogoproto.customname) = "ProposalID", (gogoproto.jsontag) = "id", (gogoproto.moretags) = "yaml:\"id\""]; - ProposalStatus status = 2 [(gogoproto.moretags) = "yaml:\"proposal_status\""]; - TallyResult final_tally_result = 3 + google.protobuf.Any content = 2 [(cosmos_proto.accepts_interface) = "Content"]; + ProposalStatus status = 3 [(gogoproto.moretags) = "yaml:\"proposal_status\""]; + TallyResult final_tally_result = 4 [(gogoproto.nullable) = false, (gogoproto.moretags) = "yaml:\"final_tally_result\""]; - google.protobuf.Timestamp submit_time = 4 + google.protobuf.Timestamp submit_time = 5 [(gogoproto.stdtime) = true, (gogoproto.nullable) = false, (gogoproto.moretags) = "yaml:\"submit_time\""]; - google.protobuf.Timestamp deposit_end_time = 5 + google.protobuf.Timestamp deposit_end_time = 6 [(gogoproto.stdtime) = true, (gogoproto.nullable) = false, (gogoproto.moretags) = "yaml:\"deposit_end_time\""]; - repeated cosmos_sdk.v1.Coin total_deposit = 6 [ + repeated cosmos_sdk.v1.Coin total_deposit = 7 [ (gogoproto.nullable) = false, (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins", (gogoproto.moretags) = "yaml:\"total_deposit\"" ]; - google.protobuf.Timestamp voting_start_time = 7 + google.protobuf.Timestamp voting_start_time = 8 [(gogoproto.stdtime) = true, (gogoproto.nullable) = false, (gogoproto.moretags) = "yaml:\"voting_start_time\""]; - google.protobuf.Timestamp voting_end_time = 8 + google.protobuf.Timestamp voting_end_time = 9 [(gogoproto.stdtime) = true, (gogoproto.nullable) = false, (gogoproto.moretags) = "yaml:\"voting_end_time\""]; } diff --git a/x/params/client/cli/tx.go b/x/params/client/cli/tx.go index 020854f2a1..839875f09b 100644 --- a/x/params/client/cli/tx.go +++ b/x/params/client/cli/tx.go @@ -80,7 +80,10 @@ Where proposal.json contains: return err } - msg := govtypes.NewMsgSubmitProposal(content, deposit, from) + msg, err := govtypes.NewMsgSubmitProposal(content, deposit, from) + if err != nil { + return err + } if err := msg.ValidateBasic(); err != nil { return err } @@ -160,7 +163,10 @@ Where proposal.json contains: return err } - msg := govtypes.NewMsgSubmitProposal(content, deposit, from) + msg, err := govtypes.NewMsgSubmitProposal(content, deposit, from) + if err != nil { + return err + } if err := msg.ValidateBasic(); err != nil { return err } diff --git a/x/params/client/rest/rest.go b/x/params/client/rest/rest.go index 59c5a4cd3d..0893a0bbd5 100644 --- a/x/params/client/rest/rest.go +++ b/x/params/client/rest/rest.go @@ -36,7 +36,10 @@ func postProposalHandlerFn(cliCtx context.CLIContext) http.HandlerFunc { content := proposal.NewParameterChangeProposal(req.Title, req.Description, req.Changes.ToParamChanges()) - msg := govtypes.NewMsgSubmitProposal(content, req.Deposit, req.Proposer) + msg, err := govtypes.NewMsgSubmitProposal(content, req.Deposit, req.Proposer) + if rest.CheckBadRequestError(w, err) { + return + } if rest.CheckBadRequestError(w, msg.ValidateBasic()) { return } diff --git a/x/params/module.go b/x/params/module.go index c2a6f5860e..628b1c8365 100644 --- a/x/params/module.go +++ b/x/params/module.go @@ -4,6 +4,8 @@ import ( "encoding/json" "math/rand" + "github.com/cosmos/cosmos-sdk/codec/types" + "github.com/gorilla/mux" "github.com/spf13/cobra" abci "github.com/tendermint/tendermint/abci/types" @@ -21,6 +23,7 @@ var ( _ module.AppModule = AppModule{} _ module.AppModuleBasic = AppModuleBasic{} _ module.AppModuleSimulation = AppModule{} + _ module.InterfaceModule = AppModuleBasic{} ) // AppModuleBasic defines the basic application module used by the params module. @@ -52,6 +55,10 @@ func (AppModuleBasic) GetTxCmd(_ *codec.Codec) *cobra.Command { return nil } // GetQueryCmd returns no root query command for the params module. func (AppModuleBasic) GetQueryCmd(_ *codec.Codec) *cobra.Command { return nil } +func (am AppModuleBasic) RegisterInterfaceTypes(registry types.InterfaceRegistry) { + proposal.RegisterInterfaces(registry) +} + //____________________________________________________________________________ // AppModule implements an application module for the distribution module. diff --git a/x/params/types/proposal/codec.go b/x/params/types/proposal/codec.go index 959ec4a369..225b0c946d 100644 --- a/x/params/types/proposal/codec.go +++ b/x/params/types/proposal/codec.go @@ -3,6 +3,7 @@ package proposal import ( "github.com/cosmos/cosmos-sdk/codec" "github.com/cosmos/cosmos-sdk/codec/types" + "github.com/cosmos/cosmos-sdk/x/gov" ) type Codec struct { @@ -31,3 +32,10 @@ func init() { func RegisterCodec(cdc *codec.Codec) { cdc.RegisterConcrete(&ParameterChangeProposal{}, "cosmos-sdk/ParameterChangeProposal", nil) } + +func RegisterInterfaces(registry types.InterfaceRegistry) { + registry.RegisterImplementations( + (*gov.Content)(nil), + &ParameterChangeProposal{}, + ) +} diff --git a/x/simulation/params.go b/x/simulation/params.go index 8a0a80352f..6363846a09 100644 --- a/x/simulation/params.go +++ b/x/simulation/params.go @@ -7,7 +7,6 @@ import ( "github.com/tendermint/tendermint/types" - "github.com/tendermint/go-amino" abci "github.com/tendermint/tendermint/abci/types" "github.com/cosmos/cosmos-sdk/codec" @@ -156,7 +155,7 @@ func (w WeightedProposalContent) ContentSimulatorFn() simulation.ContentSimulato // RandomParams returns random simulation consensus parameters, it extracts the Evidence from the Staking genesis state. func RandomConsensusParams(r *rand.Rand, appState json.RawMessage) *abci.ConsensusParams { - cdc := amino.NewCodec() + cdc := codec.New() var genesisState map[string]json.RawMessage diff --git a/x/upgrade/client/cli/tx.go b/x/upgrade/client/cli/tx.go index 27df5c3ec3..cf302463ea 100644 --- a/x/upgrade/client/cli/tx.go +++ b/x/upgrade/client/cli/tx.go @@ -224,7 +224,10 @@ func GetCmdSubmitUpgradeProposal(cdc *codec.Codec) *cobra.Command { return err } - msg := gov.NewMsgSubmitProposal(content, deposit, from) + msg, err := gov.NewMsgSubmitProposal(content, deposit, from) + if err != nil { + return err + } if err := msg.ValidateBasic(); err != nil { return err } @@ -277,7 +280,10 @@ func GetCmdSubmitCancelUpgradeProposal(cdc *codec.Codec) *cobra.Command { content := types.NewCancelSoftwareUpgradeProposal(title, description) - msg := gov.NewMsgSubmitProposal(content, deposit, from) + msg, err := gov.NewMsgSubmitProposal(content, deposit, from) + if err != nil { + return err + } if err := msg.ValidateBasic(); err != nil { return err } diff --git a/x/upgrade/client/rest/tx.go b/x/upgrade/client/rest/tx.go index f04e4d07ab..3e0ab0119a 100644 --- a/x/upgrade/client/rest/tx.go +++ b/x/upgrade/client/rest/tx.go @@ -169,7 +169,10 @@ func postPlanHandler(cliCtx context.CLIContext) http.HandlerFunc { plan := types.Plan{Name: req.UpgradeName, Time: t, Height: req.UpgradeHeight, Info: req.UpgradeInfo} content := types.NewSoftwareUpgradeProposal(req.Title, req.Description, plan) - msg := gov.NewMsgSubmitProposal(content, req.Deposit, fromAddr) + msg, err := gov.NewMsgSubmitProposal(content, req.Deposit, fromAddr) + if rest.CheckBadRequestError(w, err) { + return + } if rest.CheckBadRequestError(w, msg.ValidateBasic()) { return } @@ -197,7 +200,10 @@ func cancelPlanHandler(cliCtx context.CLIContext) http.HandlerFunc { } content := types.NewCancelSoftwareUpgradeProposal(req.Title, req.Description) - msg := gov.NewMsgSubmitProposal(content, req.Deposit, fromAddr) + msg, err := gov.NewMsgSubmitProposal(content, req.Deposit, fromAddr) + if rest.CheckBadRequestError(w, err) { + return + } if rest.CheckBadRequestError(w, msg.ValidateBasic()) { return } diff --git a/x/upgrade/module.go b/x/upgrade/module.go index f5a9b461ef..f2c94d7627 100644 --- a/x/upgrade/module.go +++ b/x/upgrade/module.go @@ -11,10 +11,12 @@ import ( "github.com/cosmos/cosmos-sdk/client/context" "github.com/cosmos/cosmos-sdk/client/flags" "github.com/cosmos/cosmos-sdk/codec" + codectypes "github.com/cosmos/cosmos-sdk/codec/types" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/types/module" "github.com/cosmos/cosmos-sdk/x/upgrade/client/cli" "github.com/cosmos/cosmos-sdk/x/upgrade/client/rest" + types "github.com/cosmos/cosmos-sdk/x/upgrade/types" ) // module codec @@ -25,8 +27,9 @@ func init() { } var ( - _ module.AppModule = AppModule{} - _ module.AppModuleBasic = AppModuleBasic{} + _ module.AppModule = AppModule{} + _ module.AppModuleBasic = AppModuleBasic{} + _ module.InterfaceModule = AppModuleBasic{} ) // AppModuleBasic implements the sdk.AppModuleBasic interface @@ -71,6 +74,10 @@ func (AppModuleBasic) GetTxCmd(cdc *codec.Codec) *cobra.Command { return txCmd } +func (b AppModuleBasic) RegisterInterfaceTypes(registry codectypes.InterfaceRegistry) { + types.RegisterInterfaces(registry) +} + // AppModule implements the sdk.AppModule interface type AppModule struct { AppModuleBasic diff --git a/x/upgrade/types/codec.go b/x/upgrade/types/codec.go index 78ad0af013..c363d050f3 100644 --- a/x/upgrade/types/codec.go +++ b/x/upgrade/types/codec.go @@ -2,6 +2,8 @@ package types import ( "github.com/cosmos/cosmos-sdk/codec" + "github.com/cosmos/cosmos-sdk/codec/types" + "github.com/cosmos/cosmos-sdk/x/gov" ) // RegisterCodec registers concrete types on the Amino codec @@ -10,3 +12,11 @@ func RegisterCodec(cdc *codec.Codec) { cdc.RegisterConcrete(&SoftwareUpgradeProposal{}, "cosmos-sdk/SoftwareUpgradeProposal", nil) cdc.RegisterConcrete(&CancelSoftwareUpgradeProposal{}, "cosmos-sdk/CancelSoftwareUpgradeProposal", nil) } + +func RegisterInterfaces(registry types.InterfaceRegistry) { + registry.RegisterImplementations( + (*gov.Content)(nil), + &SoftwareUpgradeProposal{}, + &CancelSoftwareUpgradeProposal{}, + ) +}