diff --git a/CHANGELOG.md b/CHANGELOG.md index 9c98d0ea7..19934bee5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -136,6 +136,13 @@ serialization instead of Amino. Buffers for state serialization instead of Amino. * The `internal` sub-package has been removed in order to expose the types proto file. * The `x/upgrade` module now accepts a `codec.Marshaler` interface. +* (x/gov) [\#5737](https://github.com/cosmos/cosmos-sdk/pull/5737) Migrate the `x/gov` module to use Protocol +Buffers for state serialization instead of Amino. + * `MsgSubmitProposal` will be removed in favor of the application-level proto-defined `MsgSubmitProposal` which + implements the `MsgSubmitProposalI` interface. Applications should extend the `NewMsgSubmitProposalBase` type + to define their own concrete `MsgSubmitProposal` types. + * The module now accepts a `Codec` interface which extends the `codec.Marshaler` interface by + requiring a concrete codec to know how to serialize `Proposal` types. ### Improvements diff --git a/simapp/app.go b/simapp/app.go index 67b6d9e11..5408bcfe9 100644 --- a/simapp/app.go +++ b/simapp/app.go @@ -207,7 +207,7 @@ func NewSimApp( AddRoute(distr.RouterKey, distr.NewCommunityPoolSpendProposalHandler(app.DistrKeeper)). AddRoute(upgrade.RouterKey, upgrade.NewSoftwareUpgradeProposalHandler(app.UpgradeKeeper)) app.GovKeeper = gov.NewKeeper( - app.cdc, keys[gov.StoreKey], app.subspaces[gov.ModuleName], app.SupplyKeeper, + appCodec, keys[gov.StoreKey], app.subspaces[gov.ModuleName], app.SupplyKeeper, &stakingKeeper, govRouter, ) diff --git a/simapp/codec/codec.go b/simapp/codec/codec.go index abcd8752d..75dd59fb3 100644 --- a/simapp/codec/codec.go +++ b/simapp/codec/codec.go @@ -9,6 +9,7 @@ import ( "github.com/cosmos/cosmos-sdk/x/auth/vesting" "github.com/cosmos/cosmos-sdk/x/evidence" eviexported "github.com/cosmos/cosmos-sdk/x/evidence/exported" + "github.com/cosmos/cosmos-sdk/x/gov" "github.com/cosmos/cosmos-sdk/x/supply" supplyexported "github.com/cosmos/cosmos-sdk/x/supply/exported" ) @@ -17,6 +18,7 @@ var ( _ auth.Codec = (*Codec)(nil) _ supply.Codec = (*Codec)(nil) _ evidence.Codec = (*Codec)(nil) + _ gov.Codec = (*Codec)(nil) ) // Codec defines the application-level codec. This codec contains all the @@ -151,6 +153,33 @@ func (c *Codec) UnmarshalEvidenceJSON(bz []byte) (eviexported.Evidence, error) { return evidence.GetEvidence(), 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.MarshalBinaryLengthPrefixed(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.UnmarshalBinaryLengthPrefixed(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/simapp/codec/codec.pb.go b/simapp/codec/codec.pb.go index b222403b4..1fff6fa81 100644 --- a/simapp/codec/codec.pb.go +++ b/simapp/codec/codec.pb.go @@ -8,10 +8,15 @@ import ( 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" + types6 "github.com/cosmos/cosmos-sdk/x/distribution/types" github_com_cosmos_cosmos_sdk_x_evidence_exported "github.com/cosmos/cosmos-sdk/x/evidence/exported" types3 "github.com/cosmos/cosmos-sdk/x/evidence/types" + github_com_cosmos_cosmos_sdk_x_gov_types "github.com/cosmos/cosmos-sdk/x/gov/types" + types4 "github.com/cosmos/cosmos-sdk/x/gov/types" + proposal "github.com/cosmos/cosmos-sdk/x/params/types/proposal" github_com_cosmos_cosmos_sdk_x_supply_exported "github.com/cosmos/cosmos-sdk/x/supply/exported" types2 "github.com/cosmos/cosmos-sdk/x/supply/types" + types5 "github.com/cosmos/cosmos-sdk/x/upgrade/types" _ "github.com/gogo/protobuf/gogoproto" proto "github.com/gogo/protobuf/proto" _ "github.com/regen-network/cosmos-proto" @@ -351,55 +356,291 @@ func (m *MsgSubmitEvidence) XXX_DiscardUnknown() { var xxx_messageInfo_MsgSubmitEvidence proto.InternalMessageInfo +// MsgSubmitProposal defines the application-level message type for handling +// governance proposals. +type MsgSubmitProposal struct { + types4.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_3c6d4085e4065f5a, []int{4} +} +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 { + types4.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_3c6d4085e4065f5a, []int{5} +} +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_3c6d4085e4065f5a, []int{6} +} +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 *types4.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 *types5.SoftwareUpgradeProposal `protobuf:"bytes,3,opt,name=software_upgrade,json=softwareUpgrade,proto3,oneof" json:"software_upgrade,omitempty"` +} +type Content_CancelSoftwareUpgrade struct { + CancelSoftwareUpgrade *types5.CancelSoftwareUpgradeProposal `protobuf:"bytes,4,opt,name=cancel_software_upgrade,json=cancelSoftwareUpgrade,proto3,oneof" json:"cancel_software_upgrade,omitempty"` +} +type Content_CommunityPoolSpend struct { + CommunityPoolSpend *types6.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() *types4.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() *types5.SoftwareUpgradeProposal { + if x, ok := m.GetSum().(*Content_SoftwareUpgrade); ok { + return x.SoftwareUpgrade + } + return nil +} + +func (m *Content) GetCancelSoftwareUpgrade() *types5.CancelSoftwareUpgradeProposal { + if x, ok := m.GetSum().(*Content_CancelSoftwareUpgrade); ok { + return x.CancelSoftwareUpgrade + } + return nil +} + +func (m *Content) GetCommunityPoolSpend() *types6.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), + } +} + func init() { proto.RegisterType((*Account)(nil), "cosmos_sdk.simapp.codec.v1.Account") proto.RegisterType((*Supply)(nil), "cosmos_sdk.simapp.codec.v1.Supply") proto.RegisterType((*Evidence)(nil), "cosmos_sdk.simapp.codec.v1.Evidence") proto.RegisterType((*MsgSubmitEvidence)(nil), "cosmos_sdk.simapp.codec.v1.MsgSubmitEvidence") + proto.RegisterType((*MsgSubmitProposal)(nil), "cosmos_sdk.simapp.codec.v1.MsgSubmitProposal") + proto.RegisterType((*Proposal)(nil), "cosmos_sdk.simapp.codec.v1.Proposal") + proto.RegisterType((*Content)(nil), "cosmos_sdk.simapp.codec.v1.Content") } func init() { proto.RegisterFile("simapp/codec/codec.proto", fileDescriptor_3c6d4085e4065f5a) } var fileDescriptor_3c6d4085e4065f5a = []byte{ - // 593 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x84, 0x54, 0x4d, 0x6f, 0xd3, 0x3e, - 0x18, 0x4f, 0xfe, 0xeb, 0xfa, 0xaf, 0xbc, 0x81, 0x44, 0x24, 0xa0, 0xaa, 0x50, 0x3a, 0x26, 0x98, - 0x78, 0x51, 0x13, 0x8d, 0xf1, 0xb6, 0x5e, 0x60, 0x1d, 0x43, 0x45, 0xa2, 0x08, 0x75, 0x12, 0x07, - 0x2e, 0x55, 0x6a, 0x5b, 0xad, 0xb5, 0x26, 0x36, 0xb5, 0x1d, 0xb5, 0xdf, 0x00, 0x71, 0xe2, 0x23, - 0x4c, 0x7c, 0x00, 0x4e, 0x3b, 0xf2, 0x01, 0xa6, 0x9d, 0x7a, 0xe4, 0x34, 0xa1, 0xf6, 0xc2, 0xc7, - 0x40, 0x89, 0x9d, 0xb4, 0x55, 0xda, 0xee, 0x12, 0xd5, 0x7e, 0x7e, 0x6f, 0x76, 0x9f, 0xc7, 0xa0, - 0xc8, 0x89, 0xef, 0x31, 0xe6, 0x42, 0x8a, 0x30, 0x54, 0x5f, 0x87, 0xf5, 0xa9, 0xa0, 0x56, 0x09, - 0x52, 0xee, 0x53, 0xde, 0xe2, 0xe8, 0xc4, 0x51, 0x20, 0x47, 0x95, 0xc3, 0xdd, 0xd2, 0x63, 0xd1, - 0x25, 0x7d, 0xd4, 0x62, 0x5e, 0x5f, 0x0c, 0xdd, 0x18, 0xee, 0x2a, 0x74, 0x65, 0x76, 0xa1, 0x84, - 0x4a, 0x3b, 0x59, 0x70, 0x87, 0x76, 0xe8, 0xf4, 0x97, 0xc6, 0x15, 0x07, 0xae, 0x27, 0x45, 0xd7, - 0x15, 0x43, 0x86, 0xb9, 0xfa, 0xea, 0xca, 0x96, 0xae, 0x84, 0x98, 0x0b, 0x12, 0x74, 0x16, 0x20, - 0x4a, 0x03, 0x97, 0x4b, 0xc6, 0x7a, 0xc3, 0x05, 0xb5, 0x3b, 0x03, 0x17, 0x87, 0x04, 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e, 0x19, 0xdb, 0xe6, 0xf7, 0x89, 0x6d, 0x8c, - 0x26, 0xb6, 0xf1, 0x7b, 0x62, 0x1b, 0x9f, 0x1f, 0xae, 0xbc, 0x8c, 0xd9, 0x97, 0xb5, 0x9d, 0x8f, - 0x5f, 0x9b, 0xbd, 0x7f, 0x01, 0x00, 0x00, 0xff, 0xff, 0x57, 0xb9, 0x47, 0x37, 0x70, 0x05, 0x00, - 0x00, + // 878 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x56, 0x41, 0x6f, 0xdc, 0x44, + 0x14, 0xb6, 0xa9, 0x9b, 0xac, 0xa6, 0x05, 0xca, 0x88, 0x92, 0xd5, 0x82, 0x76, 0xdb, 0x14, 0x2a, + 0x28, 0x8a, 0xdd, 0x52, 0xa0, 0xe9, 0x4a, 0xa8, 0x74, 0x97, 0xa2, 0x45, 0x22, 0x28, 0xda, 0x00, + 0x07, 0x04, 0xb2, 0xbc, 0xe3, 0xc1, 0x6b, 0xd5, 0xf6, 0x0c, 0x9e, 0xb1, 0xf1, 0xfe, 0x03, 0xc4, + 0x89, 0x13, 0xe7, 0x88, 0x03, 0x47, 0x4e, 0x39, 0xf2, 0x03, 0xa2, 0x9c, 0x72, 0xe4, 0x14, 0xa1, + 0xe4, 0xc2, 0xcf, 0x40, 0x9e, 0x19, 0x7b, 0x6d, 0xd9, 0xbb, 0x91, 0x7a, 0xb1, 0xd6, 0xf3, 0xbe, + 0xef, 0x7d, 0xdf, 0x78, 0xe6, 0xbd, 0xb7, 0xa0, 0xcb, 0xfc, 0xd0, 0xa1, 0xd4, 0x42, 0xc4, 0xc5, + 0x48, 0x3e, 0x4d, 0x1a, 0x13, 0x4e, 0x60, 0x0f, 0x11, 0x16, 0x12, 0x66, 0x33, 0xf7, 0xb9, 0x29, + 0x41, 0xa6, 0x0c, 0xa7, 0x0f, 0x7a, 0xef, 0xf3, 0xb9, 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0xb8, 0xe4, + 0x7f, 0x2b, 0x17, 0x97, 0x52, 0x5d, 0xb4, 0x22, 0x06, 0x43, 0xb0, 0xe5, 0xe2, 0xc0, 0x59, 0x60, + 0xb7, 0x21, 0x7a, 0x45, 0x88, 0x3e, 0x5c, 0x2f, 0xfa, 0x99, 0x24, 0x37, 0x14, 0x6f, 0xba, 0x6d, + 0x01, 0x48, 0x41, 0x97, 0xe2, 0xd8, 0x27, 0xae, 0x8f, 0x1a, 0x7a, 0x86, 0xd0, 0xfb, 0x70, 0xbd, + 0xde, 0xbe, 0x62, 0x37, 0x04, 0xdf, 0xa0, 0xad, 0x11, 0xf8, 0x15, 0x78, 0x25, 0x24, 0x6e, 0x12, + 0x2c, 0x8f, 0xe8, 0xaa, 0xd0, 0x79, 0xa7, 0xae, 0x23, 0xef, 0x61, 0xae, 0xb0, 0x27, 0xd0, 0xcb, + 0xc4, 0x2f, 0x87, 0xd5, 0x85, 0xe1, 0xe3, 0x93, 0xa3, 0x9d, 0x8f, 0xee, 0x79, 0x3e, 0x9f, 0x27, + 0x33, 0x13, 0x91, 0x50, 0x55, 0x4d, 0x51, 0x49, 0xcc, 0x7d, 0x6e, 0xa9, 0x7b, 0x8f, 0x33, 0x4a, + 0x62, 0x8e, 0x5d, 0x53, 0x51, 0x47, 0x57, 0xc1, 0x15, 0x96, 0x84, 0xdb, 0xbf, 0xea, 0x60, 0xe3, + 0x40, 0xc8, 0xc1, 0x5d, 0xb0, 0x21, 0x85, 0xd5, 0xbd, 0xe9, 0xaf, 0x32, 0x25, 0xf1, 0x13, 0x6d, + 0xaa, 0xf0, 0xc3, 0x27, 0xff, 0x1d, 0x0e, 0xf4, 0x93, 0xa3, 0x9d, 0x47, 0x97, 0x59, 0x51, 0x05, + 0x56, 0x9a, 0x91, 0x99, 0xbe, 0x28, 0xcc, 0xfc, 0xa1, 0x83, 0xce, 0x33, 0x55, 0x67, 0xf0, 0x4b, + 0x70, 0x1d, 0xff, 0x94, 0xf8, 0x29, 0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87, + 0xff, 0x07, 0x00, 0x00, 0xff, 0xff, 0x70, 0x52, 0xf3, 0x25, 0x52, 0x09, 0x00, 0x00, } func (this *Supply) Equal(that interface{}) bool { @@ -537,6 +778,210 @@ func (this *MsgSubmitEvidence) Equal(that interface{}) bool { } return true } +func (this *MsgSubmitProposal) Equal(that interface{}) bool { + if that == nil { + return this == nil + } + + that1, ok := that.(*MsgSubmitProposal) + if !ok { + that2, ok := that.(MsgSubmitProposal) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + return this == nil + } else if this == nil { + return false + } + if !this.MsgSubmitProposalBase.Equal(&that1.MsgSubmitProposalBase) { + return false + } + if !this.Content.Equal(that1.Content) { + return false + } + return true +} +func (this *Proposal) Equal(that interface{}) bool { + if that == nil { + return this == nil + } + + that1, ok := that.(*Proposal) + if !ok { + that2, ok := that.(Proposal) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + return this == nil + } else if this == nil { + return false + } + if !this.ProposalBase.Equal(&that1.ProposalBase) { + return false + } + if !this.Content.Equal(&that1.Content) { + return false + } + return true +} +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 + } + 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 + } + return true +} +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 + } + } + if that1 == nil { + return this == nil + } else if this == nil { + return false + } + if !this.Text.Equal(that1.Text) { + return false + } + return true +} +func (this *Content_ParameterChange) Equal(that interface{}) bool { + if that == nil { + return this == nil + } + + that1, ok := that.(*Content_ParameterChange) + if !ok { + that2, ok := that.(Content_ParameterChange) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + return this == nil + } else if this == nil { + return false + } + 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 *Account) GetAccount() github_com_cosmos_cosmos_sdk_x_auth_exported.Account { if x := this.GetBaseAccount(); x != nil { return x @@ -624,6 +1069,65 @@ func (this *Evidence) SetEvidence(value github_com_cosmos_cosmos_sdk_x_evidence_ return fmt.Errorf("can't encode value of type %T as message Evidence", 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 *types4.TextProposal: + this.Sum = &Content_Text{vt} + return nil + case types4.TextProposal: + this.Sum = &Content_Text{&vt} + return nil + case *proposal.ParameterChangeProposal: + this.Sum = &Content_ParameterChange{vt} + return nil + case proposal.ParameterChangeProposal: + this.Sum = &Content_ParameterChange{&vt} + return nil + case *types5.SoftwareUpgradeProposal: + this.Sum = &Content_SoftwareUpgrade{vt} + return nil + case types5.SoftwareUpgradeProposal: + this.Sum = &Content_SoftwareUpgrade{&vt} + return nil + case *types5.CancelSoftwareUpgradeProposal: + this.Sum = &Content_CancelSoftwareUpgrade{vt} + return nil + case types5.CancelSoftwareUpgradeProposal: + this.Sum = &Content_CancelSoftwareUpgrade{&vt} + return nil + case *types6.CommunityPoolSpendProposal: + this.Sum = &Content_CommunityPoolSpend{vt} + return nil + case types6.CommunityPoolSpendProposal: + this.Sum = &Content_CommunityPoolSpend{&vt} + return nil + } + return fmt.Errorf("can't encode value of type %T as message Content", value) +} + func (m *Account) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) @@ -912,6 +1416,231 @@ func (m *MsgSubmitEvidence) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } +func (m *MsgSubmitProposal) 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 *MsgSubmitProposal) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgSubmitProposal) 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 + } + 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 -= size + i = encodeVarintCodec(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + { + size, err := m.ProposalBase.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 *Content) 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 *Content) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Content) 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 *Content_Text) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Content_Text) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + if m.Text != nil { + { + size, err := m.Text.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 *Content_ParameterChange) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Content_ParameterChange) 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 encodeVarintCodec(dAtA []byte, offset int, v uint64) int { offset -= sovCodec(v) base := offset @@ -1058,6 +1787,107 @@ func (m *MsgSubmitEvidence) Size() (n int) { return n } +func (m *MsgSubmitProposal) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.MsgSubmitProposalBase.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 + } + 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) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Sum != nil { + n += m.Sum.Size() + } + return n +} + +func (m *Content_Text) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Text != nil { + l = m.Text.Size() + n += 1 + l + sovCodec(uint64(l)) + } + return n +} +func (m *Content_ParameterChange) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.ParameterChange != nil { + l = m.ParameterChange.Size() + n += 1 + l + sovCodec(uint64(l)) + } + return n +} +func (m *Content_SoftwareUpgrade) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.SoftwareUpgrade != nil { + l = m.SoftwareUpgrade.Size() + n += 1 + l + sovCodec(uint64(l)) + } + return n +} +func (m *Content_CancelSoftwareUpgrade) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.CancelSoftwareUpgrade != nil { + l = m.CancelSoftwareUpgrade.Size() + n += 1 + l + sovCodec(uint64(l)) + } + return n +} +func (m *Content_CommunityPoolSpend) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.CommunityPoolSpend != nil { + l = m.CommunityPoolSpend.Size() + n += 1 + l + sovCodec(uint64(l)) + } + return n +} + func sovCodec(x uint64) (n int) { return (math_bits.Len64(x|1) + 6) / 7 } @@ -1590,6 +2420,475 @@ func (m *MsgSubmitEvidence) Unmarshal(dAtA []byte) error { } 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 + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + 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) + } + 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 iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *Content) 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: Content: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Content: 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) + } + 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 := &types4.TextProposal{} + if err := v.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + m.Sum = &Content_Text{v} + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ParameterChange", 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 := &proposal.ParameterChangeProposal{} + if err := v.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + m.Sum = &Content_ParameterChange{v} + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field SoftwareUpgrade", 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 := &types5.SoftwareUpgradeProposal{} + if err := v.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + m.Sum = &Content_SoftwareUpgrade{v} + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field CancelSoftwareUpgrade", 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 := &types5.CancelSoftwareUpgradeProposal{} + if err := v.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + m.Sum = &Content_CancelSoftwareUpgrade{v} + iNdEx = postIndex + case 5: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field CommunityPoolSpend", 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 := &types6.CommunityPoolSpendProposal{} + if err := v.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + m.Sum = &Content_CommunityPoolSpend{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 skipCodec(dAtA []byte) (n int, err error) { l := len(dAtA) iNdEx := 0 diff --git a/simapp/codec/codec.proto b/simapp/codec/codec.proto index 2b68c487a..620370d34 100644 --- a/simapp/codec/codec.proto +++ b/simapp/codec/codec.proto @@ -7,6 +7,10 @@ import "x/auth/types/types.proto"; import "x/auth/vesting/types/types.proto"; import "x/supply/types/types.proto"; import "x/evidence/types/types.proto"; +import "x/gov/types/types.proto"; +import "x/params/types/proposal/types.proto"; +import "x/upgrade/types/types.proto"; +import "x/distribution/types/types.proto"; option go_package = "github.com/cosmos/cosmos-sdk/simapp/codec"; @@ -56,3 +60,38 @@ message MsgSubmitEvidence { Evidence evidence = 1; cosmos_sdk.x.evidence.v1.MsgSubmitEvidenceBase base = 2 [(gogoproto.nullable) = false, (gogoproto.embed) = true]; } + +// 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; + } +} diff --git a/simapp/codec/msgs.go b/simapp/codec/msgs.go index 2ea6c3a3a..5c4599d8d 100644 --- a/simapp/codec/msgs.go +++ b/simapp/codec/msgs.go @@ -5,9 +5,13 @@ import ( sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" "github.com/cosmos/cosmos-sdk/x/evidence" eviexported "github.com/cosmos/cosmos-sdk/x/evidence/exported" + "github.com/cosmos/cosmos-sdk/x/gov" ) -var _ eviexported.MsgSubmitEvidence = MsgSubmitEvidence{} +var ( + _ eviexported.MsgSubmitEvidence = MsgSubmitEvidence{} + _ gov.MsgSubmitProposalI = MsgSubmitProposal{} +) // NewMsgSubmitEvidence returns a new MsgSubmitEvidence. func NewMsgSubmitEvidence(evidenceI eviexported.Evidence, s sdk.AccAddress) (MsgSubmitEvidence, error) { @@ -16,7 +20,10 @@ func NewMsgSubmitEvidence(evidenceI eviexported.Evidence, s sdk.AccAddress) (Msg return MsgSubmitEvidence{}, err } - return MsgSubmitEvidence{Evidence: e, MsgSubmitEvidenceBase: evidence.NewMsgSubmitEvidenceBase(s)}, nil + return MsgSubmitEvidence{ + Evidence: e, + MsgSubmitEvidenceBase: evidence.NewMsgSubmitEvidenceBase(s), + }, nil } // ValidateBasic performs basic (non-state-dependant) validation on a @@ -38,3 +45,40 @@ func (msg MsgSubmitEvidence) ValidateBasic() error { // nolint func (msg MsgSubmitEvidence) GetEvidence() eviexported.Evidence { return msg.Evidence.GetEvidence() } func (msg MsgSubmitEvidence) GetSubmitter() sdk.AccAddress { return msg.Submitter } + +// NewMsgSubmitProposal returns a new MsgSubmitProposal. +func NewMsgSubmitProposal(c gov.Content, d sdk.Coins, p sdk.AccAddress) (MsgSubmitProposal, error) { + content := &Content{} + if err := content.SetContent(c); err != nil { + return MsgSubmitProposal{}, 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 +} + +// nolint +func (msg MsgSubmitProposal) GetContent() gov.Content { return msg.Content.GetContent() } +func (msg MsgSubmitProposal) GetInitialDeposit() sdk.Coins { return msg.InitialDeposit } +func (msg MsgSubmitProposal) GetProposer() sdk.AccAddress { return msg.Proposer } diff --git a/x/distribution/types/types.pb.go b/x/distribution/types/types.pb.go index 4bb5f5538..e8e131f3a 100644 --- a/x/distribution/types/types.pb.go +++ b/x/distribution/types/types.pb.go @@ -747,77 +747,77 @@ func init() { func init() { proto.RegisterFile("x/distribution/types/types.proto", fileDescriptor_9fddf2a8e4a90b09) } var fileDescriptor_9fddf2a8e4a90b09 = []byte{ - // 1113 bytes of a gzipped FileDescriptorProto + // 1116 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xc4, 0x57, 0xcf, 0x6f, 0x1b, 0x45, - 0x14, 0xf6, 0x38, 0x4e, 0x9a, 0x4c, 0xd3, 0xa4, 0xd9, 0xd8, 0x49, 0xe4, 0x14, 0xaf, 0x35, 0x88, - 0x2a, 0x12, 0x8a, 0x43, 0xe8, 0x2d, 0x07, 0xa4, 0x38, 0x3f, 0x04, 0xa8, 0xa1, 0xd1, 0x26, 0x14, - 0x09, 0x09, 0xad, 0xc6, 0xbb, 0x13, 0x7b, 0x94, 0xf5, 0xce, 0x6a, 0x66, 0x6c, 0x27, 0xbd, 0x20, - 0x71, 0x02, 0x01, 0x15, 0x07, 0x04, 0x3d, 0x70, 0xe8, 0x05, 0x09, 0x2a, 0xf1, 0x6f, 0xa0, 0x1e, - 0x7b, 0x03, 0x71, 0x70, 0x51, 0x72, 0xe3, 0x98, 0x1b, 0x9c, 0xd0, 0xee, 0x8c, 0x77, 0x37, 0x8e, - 0x45, 0xe3, 0x48, 0xa5, 0x97, 0x24, 0xf3, 0x66, 0xe6, 0xfb, 0xbe, 0xf9, 0x66, 0xde, 0x7b, 0x1b, - 0x58, 0x3e, 0x5a, 0x71, 0xa9, 0x90, 0x9c, 0xd6, 0x5a, 0x92, 0x32, 0x7f, 0x45, 0x1e, 0x07, 0x44, - 0xa8, 0x9f, 0x95, 0x80, 0x33, 0xc9, 0x8c, 0x5b, 0x0e, 0x13, 0x4d, 0x26, 0x6c, 0xe1, 0x1e, 0x56, - 0x8e, 0x2a, 0xe9, 0xc5, 0x95, 0xf6, 0x6a, 0xf1, 0xb6, 0x6c, 0x50, 0xee, 0xda, 0x01, 0xe6, 0xf2, - 0x78, 0x25, 0xda, 0xb0, 0x52, 0x67, 0x75, 0x96, 0xfc, 0xa5, 0x50, 0x8a, 0x33, 0x17, 0x80, 0xd1, - 0x57, 0x59, 0x58, 0xd8, 0x11, 0xf5, 0x3d, 0x22, 0x3f, 0xa2, 0xb2, 0xe1, 0x72, 0xdc, 0x59, 0x77, - 0x5d, 0x4e, 0x84, 0x30, 0x1e, 0xc0, 0x19, 0x97, 0x78, 0xa4, 0x8e, 0x25, 0xe3, 0x36, 0x56, 0xc1, - 0x05, 0x50, 0x06, 0x4b, 0x93, 0xd5, 0x9d, 0xb3, 0xae, 0xb9, 0x70, 0x8c, 0x9b, 0xde, 0x1a, 0xba, - 0xb0, 0x04, 0xfd, 0xd3, 0x35, 0x97, 0xe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x07, 0x8e, 0xbb, 0x24, 0x60, 0x82, 0x4a, 0xc6, + 0xf5, 0x51, 0xac, 0x0c, 0x7f, 0xd4, 0x09, 0x06, 0xfa, 0x7d, 0x04, 0x8e, 0xee, 0x62, 0x8e, 0x9b, + 0xc2, 0x38, 0x84, 0x37, 0x9d, 0xde, 0x5e, 0x6c, 0x89, 0x8f, 0x22, 0x2f, 0xc7, 0xab, 0x5b, 0xa1, + 0xd8, 0x3f, 0xbb, 0xe6, 0x9d, 0x4b, 0x70, 0x6c, 0x10, 0xe7, 0xac, 0x6b, 0xe6, 0x95, 0xf3, 0xe7, + 0xc0, 0x90, 0x35, 0x11, 0x3f, 0xef, 0xe3, 0x23, 0xe3, 0x33, 0x98, 0xaf, 0x61, 0x41, 0xec, 0x80, + 0xb3, 0x80, 0x09, 0xc2, 0x6d, 0x1e, 0xdd, 0xf7, 0x68, 0x4f, 0xe3, 0xd5, 0xed, 0xa1, 0x39, 0x17, + 0x14, 0xe7, 0x20, 0x4c, 0x64, 0x19, 0x61, 0x78, 0x57, 0x47, 0x75, 0x62, 0x7d, 0x0e, 0x60, 0xa1, + 0xc6, 0xfc, 0x96, 0xb8, 0x20, 0x61, 0x24, 0x92, 0xf0, 0xe1, 0xd0, 0x12, 0x6e, 0x6b, 0x09, 0x83, + 0x40, 0x91, 0x35, 0x13, 0xc5, 0xfb, 0x44, 0xec, 0xc3, 0xc2, 0xb9, 0x9a, 0x62, 0x13, 0x1f, 0xd7, + 0x3c, 0xe2, 0xce, 0xe7, 0xca, 0x60, 0x71, 0xac, 0x5a, 0x4e, 0x50, 0x07, 0x4e, 0x43, 0xd6, 0x4c, + 0xba, 0x9c, 0x6c, 0xaa, 0xe8, 0x6a, 0xee, 0xd1, 0x63, 0x33, 0x83, 0xbe, 0xcc, 0xc2, 0x62, 0x9c, + 0x36, 0xef, 0x51, 0x21, 0x19, 0xa7, 0x0e, 0xf6, 0x14, 0xb3, 0x30, 0x7e, 0x02, 0x70, 0xce, 0x69, + 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, 0x63, 0xa4, 0xfa, + 0x7e, 0xee, 0x15, 0xf4, 0xfd, 0xd5, 0xb1, 0x2f, 0x1e, 0x9b, 0x99, 0xe8, 0xa8, 0xfe, 0x01, 0xb0, + 0x10, 0xbf, 0x24, 0xee, 0x49, 0xcc, 0x25, 0xf5, 0xeb, 0xef, 0xfb, 0x07, 0x51, 0xa5, 0x0c, 0x38, + 0x69, 0x53, 0x16, 0xb6, 0x9f, 0x74, 0x1e, 0xa4, 0x2a, 0x65, 0xdf, 0x04, 0x64, 0x4d, 0xf6, 0x22, + 0x3a, 0x0b, 0xf6, 0xe1, 0x35, 0x21, 0xf1, 0x21, 0xd1, 0x29, 0xf0, 0xee, 0xd0, 0x5d, 0x70, 0x42, + 0x11, 0x45, 0x20, 0xc8, 0x52, 0x60, 0xc6, 0x26, 0x1c, 0x6d, 0x10, 0x5a, 0x6f, 0x28, 0xaf, 0x73, + 0xd5, 0xa5, 0xbf, 0xbb, 0xe6, 0x94, 0xc3, 0x49, 0x58, 0xe1, 0x7d, 0x5b, 0x0d, 0x25, 0x22, 0xfb, + 0x06, 0x90, 0xa5, 0x17, 0x57, 0x77, 0x7e, 0x3e, 0x29, 0x81, 0xa7, 0x27, 0x25, 0xf0, 0xec, 0xa4, + 0x04, 0xfe, 0x3a, 0x29, 0x81, 0x6f, 0x4f, 0x4b, 0x99, 0x67, 0xa7, 0xa5, 0xcc, 0x1f, 0xa7, 0xa5, + 0xcc, 0x27, 0x2b, 0x2f, 0xd4, 0x38, 0xe8, 0x83, 0xa7, 0x36, 0x1a, 0x7d, 0x92, 0xdc, 0xfd, 0x2f, + 0x00, 0x00, 0xff, 0xff, 0x34, 0x5a, 0x18, 0x60, 0x0f, 0x0d, 0x00, 0x00, } func (this *MsgSetWithdrawAddress) Equal(that interface{}) bool { diff --git a/x/distribution/types/types.proto b/x/distribution/types/types.proto index aade33d9d..db6c4e907 100644 --- a/x/distribution/types/types.proto +++ b/x/distribution/types/types.proto @@ -1,7 +1,7 @@ syntax = "proto3"; package cosmos_sdk.x.distribution.v1; -option go_package = "types"; +option go_package = "github.com/cosmos/cosmos-sdk/x/distribution/types"; option (gogoproto.equal_all) = true; import "third_party/proto/gogoproto/gogo.proto"; diff --git a/x/evidence/types/codec.go b/x/evidence/types/codec.go index 6cfd762c3..d0a9d1a5e 100644 --- a/x/evidence/types/codec.go +++ b/x/evidence/types/codec.go @@ -5,7 +5,7 @@ import ( "github.com/cosmos/cosmos-sdk/x/evidence/exported" ) -// EvidenceCodec defines the interface required to serialize evidence +// Codec defines the interface required to serialize evidence type Codec interface { codec.Marshaler diff --git a/x/gov/abci_test.go b/x/gov/abci_test.go index 79db8f81a..c82019be7 100644 --- a/x/gov/abci_test.go +++ b/x/gov/abci_test.go @@ -8,6 +8,7 @@ import ( abci "github.com/tendermint/tendermint/abci/types" "github.com/cosmos/cosmos-sdk/simapp" + simappcodec "github.com/cosmos/cosmos-sdk/simapp/codec" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/x/gov" "github.com/cosmos/cosmos-sdk/x/staking" @@ -27,11 +28,12 @@ func TestTickExpiredDepositPeriod(t *testing.T) { require.False(t, inactiveQueue.Valid()) inactiveQueue.Close() - newProposalMsg := gov.NewMsgSubmitProposal( + newProposalMsg, err := simappcodec.NewMsgSubmitProposal( gov.ContentFromProposalType("test", "test", gov.ProposalTypeText), sdk.Coins{sdk.NewInt64Coin(sdk.DefaultBondDenom, 5)}, addrs[0], ) + require.NoError(t, err) res, err := govHandler(ctx, newProposalMsg) require.NoError(t, err) @@ -78,11 +80,12 @@ func TestTickMultipleExpiredDepositPeriod(t *testing.T) { require.False(t, inactiveQueue.Valid()) inactiveQueue.Close() - newProposalMsg := gov.NewMsgSubmitProposal( + newProposalMsg, err := simappcodec.NewMsgSubmitProposal( gov.ContentFromProposalType("test", "test", gov.ProposalTypeText), sdk.Coins{sdk.NewInt64Coin(sdk.DefaultBondDenom, 5)}, addrs[0], ) + require.NoError(t, err) res, err := govHandler(ctx, newProposalMsg) require.NoError(t, err) @@ -100,11 +103,12 @@ func TestTickMultipleExpiredDepositPeriod(t *testing.T) { require.False(t, inactiveQueue.Valid()) inactiveQueue.Close() - newProposalMsg2 := gov.NewMsgSubmitProposal( + newProposalMsg2, err := simappcodec.NewMsgSubmitProposal( gov.ContentFromProposalType("test2", "test2", gov.ProposalTypeText), sdk.Coins{sdk.NewInt64Coin(sdk.DefaultBondDenom, 5)}, addrs[0], ) + require.NoError(t, err) res, err = govHandler(ctx, newProposalMsg2) require.NoError(t, err) @@ -156,11 +160,12 @@ func TestTickPassedDepositPeriod(t *testing.T) { require.False(t, activeQueue.Valid()) activeQueue.Close() - newProposalMsg := gov.NewMsgSubmitProposal( + newProposalMsg, err := simappcodec.NewMsgSubmitProposal( gov.ContentFromProposalType("test2", "test2", gov.ProposalTypeText), sdk.Coins{sdk.NewInt64Coin(sdk.DefaultBondDenom, 5)}, addrs[0], ) + require.NoError(t, err) res, err := govHandler(ctx, newProposalMsg) require.NoError(t, err) @@ -211,7 +216,8 @@ func TestTickPassedVotingPeriod(t *testing.T) { activeQueue.Close() proposalCoins := sdk.Coins{sdk.NewCoin(sdk.DefaultBondDenom, sdk.TokensFromConsensusPower(5))} - newProposalMsg := gov.NewMsgSubmitProposal(TestProposal, proposalCoins, addrs[0]) + newProposalMsg, err := simappcodec.NewMsgSubmitProposal(TestProposal, proposalCoins, addrs[0]) + require.NoError(t, err) res, err := govHandler(ctx, newProposalMsg) require.NoError(t, err) diff --git a/x/gov/alias.go b/x/gov/alias.go index df5f2cb9c..aad984c2c 100644 --- a/x/gov/alias.go +++ b/x/gov/alias.go @@ -82,6 +82,7 @@ var ( SplitInactiveProposalQueueKey = types.SplitInactiveProposalQueueKey SplitKeyDeposit = types.SplitKeyDeposit SplitKeyVote = types.SplitKeyVote + NewMsgSubmitProposalBase = types.NewMsgSubmitProposalBase NewMsgSubmitProposal = types.NewMsgSubmitProposal NewMsgDeposit = types.NewMsgDeposit NewMsgVote = types.NewMsgVote @@ -125,31 +126,34 @@ var ( ) type ( - Keeper = keeper.Keeper - Content = types.Content - Handler = types.Handler - Deposit = types.Deposit - Deposits = types.Deposits - GenesisState = types.GenesisState - 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 + 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 ) diff --git a/x/gov/common_test.go b/x/gov/common_test.go index 31d4dd168..acb8e8cec 100644 --- a/x/gov/common_test.go +++ b/x/gov/common_test.go @@ -94,9 +94,3 @@ func createValidators(t *testing.T, stakingHandler sdk.Handler, ctx sdk.Context, require.NotNil(t, res) } } - -// ProposalEqual checks if two proposals are equal (note: slow, for tests only) -func ProposalEqual(proposalA types.Proposal, proposalB types.Proposal) bool { - return bytes.Equal(types.ModuleCdc.MustMarshalBinaryBare(proposalA), - types.ModuleCdc.MustMarshalBinaryBare(proposalB)) -} diff --git a/x/gov/genesis_test.go b/x/gov/genesis_test.go index 52ee0c0e1..91cddf795 100644 --- a/x/gov/genesis_test.go +++ b/x/gov/genesis_test.go @@ -124,7 +124,7 @@ func TestEqualProposals(t *testing.T) { // They are similar but their IDs should be different require.NotEqual(t, proposal1, proposal2) - require.False(t, ProposalEqual(proposal1, proposal2)) + require.NotEqual(t, proposal1, proposal2) // Now create two genesis blocks state1 := gov.GenesisState{Proposals: []gov.Proposal{proposal1}} @@ -136,7 +136,7 @@ func TestEqualProposals(t *testing.T) { proposal1.ProposalID = 55 proposal2.ProposalID = 55 require.Equal(t, proposal1, proposal1) - require.True(t, ProposalEqual(proposal1, proposal2)) + require.Equal(t, proposal1, proposal2) // Reassign proposals into state state1.Proposals[0] = proposal1 diff --git a/x/gov/handler.go b/x/gov/handler.go index 4e4aee2c5..b50644a51 100644 --- a/x/gov/handler.go +++ b/x/gov/handler.go @@ -17,7 +17,7 @@ func NewHandler(keeper Keeper) sdk.Handler { case MsgDeposit: return handleMsgDeposit(ctx, keeper, msg) - case MsgSubmitProposal: + case MsgSubmitProposalI: return handleMsgSubmitProposal(ctx, keeper, msg) case MsgVote: @@ -29,13 +29,13 @@ func NewHandler(keeper Keeper) sdk.Handler { } } -func handleMsgSubmitProposal(ctx sdk.Context, keeper Keeper, msg MsgSubmitProposal) (*sdk.Result, error) { - proposal, err := keeper.SubmitProposal(ctx, msg.Content) +func handleMsgSubmitProposal(ctx sdk.Context, keeper Keeper, msg MsgSubmitProposalI) (*sdk.Result, error) { + proposal, err := keeper.SubmitProposal(ctx, msg.GetContent()) if err != nil { return nil, err } - votingStarted, err := keeper.AddDeposit(ctx, proposal.ProposalID, msg.Proposer, msg.InitialDeposit) + votingStarted, err := keeper.AddDeposit(ctx, proposal.ProposalID, msg.GetProposer(), msg.GetInitialDeposit()) if err != nil { return nil, err } @@ -44,16 +44,17 @@ func handleMsgSubmitProposal(ctx sdk.Context, keeper Keeper, msg MsgSubmitPropos sdk.NewEvent( sdk.EventTypeMessage, sdk.NewAttribute(sdk.AttributeKeyModule, types.AttributeValueCategory), - sdk.NewAttribute(sdk.AttributeKeySender, msg.Proposer.String()), + sdk.NewAttribute(sdk.AttributeKeySender, msg.GetProposer().String()), ), ) - submitEvent := sdk.NewEvent(types.EventTypeSubmitProposal, sdk.NewAttribute(types.AttributeKeyProposalType, msg.Content.ProposalType())) + submitEvent := sdk.NewEvent(types.EventTypeSubmitProposal, sdk.NewAttribute(types.AttributeKeyProposalType, msg.GetContent().ProposalType())) if votingStarted { submitEvent = submitEvent.AppendAttributes( sdk.NewAttribute(types.AttributeKeyVotingPeriodStart, fmt.Sprintf("%d", proposal.ProposalID)), ) } + ctx.EventManager().EmitEvent(submitEvent) return &sdk.Result{ diff --git a/x/gov/keeper/common_test.go b/x/gov/keeper/common_test.go index 379659612..e7e9747a0 100644 --- a/x/gov/keeper/common_test.go +++ b/x/gov/keeper/common_test.go @@ -1,34 +1,23 @@ package keeper_test import ( - "bytes" - - "github.com/cosmos/cosmos-sdk/simapp/codec" - "github.com/cosmos/cosmos-sdk/simapp" - + simappcodec "github.com/cosmos/cosmos-sdk/simapp/codec" sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/cosmos/cosmos-sdk/x/staking" - "github.com/cosmos/cosmos-sdk/x/gov/types" + "github.com/cosmos/cosmos-sdk/x/staking" ) var ( TestProposal = types.NewTextProposal("Test", "description") ) -// ProposalEqual checks if two proposals are equal (note: slow, for tests only) -func ProposalEqual(proposalA types.Proposal, proposalB types.Proposal) bool { - return bytes.Equal(types.ModuleCdc.MustMarshalBinaryBare(proposalA), - types.ModuleCdc.MustMarshalBinaryBare(proposalB)) -} - func createValidators(ctx sdk.Context, app *simapp.SimApp, powers []int64) ([]sdk.AccAddress, []sdk.ValAddress) { addrs := simapp.AddTestAddrsIncremental(app, ctx, 5, sdk.NewInt(30000000)) valAddrs := simapp.ConvertAddrsToValAddrs(addrs) pks := simapp.CreateTestPubKeys(5) - appCodec := codec.NewAppCodec(app.Codec()) + appCodec := simappcodec.NewAppCodec(app.Codec()) app.StakingKeeper = staking.NewKeeper( appCodec, app.GetKey(staking.StoreKey), diff --git a/x/gov/keeper/deposit.go b/x/gov/keeper/deposit.go index 4fcf26390..d1a55140d 100644 --- a/x/gov/keeper/deposit.go +++ b/x/gov/keeper/deposit.go @@ -23,7 +23,7 @@ func (keeper Keeper) GetDeposit(ctx sdk.Context, proposalID uint64, depositorAdd // SetDeposit sets a Deposit to the gov store func (keeper Keeper) SetDeposit(ctx sdk.Context, deposit types.Deposit) { store := ctx.KVStore(keeper.storeKey) - bz := keeper.cdc.MustMarshalBinaryLengthPrefixed(deposit) + bz := keeper.cdc.MustMarshalBinaryLengthPrefixed(&deposit) store.Set(types.DepositKey(deposit.ProposalID, deposit.Depositor), bz) } diff --git a/x/gov/keeper/deposit_test.go b/x/gov/keeper/deposit_test.go index 12e152c0a..1f70e9a73 100644 --- a/x/gov/keeper/deposit_test.go +++ b/x/gov/keeper/deposit_test.go @@ -5,7 +5,6 @@ import ( "time" "github.com/stretchr/testify/require" - abci "github.com/tendermint/tendermint/abci/types" "github.com/cosmos/cosmos-sdk/simapp" diff --git a/x/gov/keeper/keeper.go b/x/gov/keeper/keeper.go index 7a51e6e2b..d8983bd41 100644 --- a/x/gov/keeper/keeper.go +++ b/x/gov/keeper/keeper.go @@ -4,7 +4,6 @@ import ( "fmt" "time" - "github.com/cosmos/cosmos-sdk/codec" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/x/gov/types" "github.com/cosmos/cosmos-sdk/x/supply/exported" @@ -27,7 +26,7 @@ type Keeper struct { storeKey sdk.StoreKey // The codec codec for binary encoding/decoding. - cdc *codec.Codec + cdc types.Codec // Proposal router router types.Router @@ -41,7 +40,7 @@ type Keeper struct { // // CONTRACT: the parameter Subspace must have the param key table already initialized func NewKeeper( - cdc *codec.Codec, key sdk.StoreKey, paramSpace types.ParamSubspace, + cdc types.Codec, key sdk.StoreKey, paramSpace types.ParamSubspace, supplyKeeper types.SupplyKeeper, sk types.StakingKeeper, rtr types.Router, ) Keeper { diff --git a/x/gov/keeper/keeper_test.go b/x/gov/keeper/keeper_test.go index b03bd1d11..7bf2899c3 100644 --- a/x/gov/keeper/keeper_test.go +++ b/x/gov/keeper/keeper_test.go @@ -4,7 +4,6 @@ import ( "testing" "github.com/stretchr/testify/require" - abci "github.com/tendermint/tendermint/abci/types" "github.com/cosmos/cosmos-sdk/simapp" @@ -50,7 +49,9 @@ func TestProposalQueues(t *testing.T) { activeIterator := app.GovKeeper.ActiveProposalQueueIterator(ctx, proposal.VotingEndTime) require.True(t, activeIterator.Valid()) - app.Codec().UnmarshalBinaryLengthPrefixed(activeIterator.Value(), &proposalID) + + proposalID, _ = types.SplitActiveProposalQueueKey(activeIterator.Key()) require.Equal(t, proposalID, proposal.ProposalID) + activeIterator.Close() } diff --git a/x/gov/keeper/proposal.go b/x/gov/keeper/proposal.go index 70435ea58..3055af875 100644 --- a/x/gov/keeper/proposal.go +++ b/x/gov/keeper/proposal.go @@ -49,20 +49,31 @@ func (keeper Keeper) SubmitProposal(ctx sdk.Context, content types.Content) (typ } // GetProposal get proposal from store by ProposalID -func (keeper Keeper) GetProposal(ctx sdk.Context, proposalID uint64) (proposal types.Proposal, ok bool) { +func (keeper Keeper) GetProposal(ctx sdk.Context, proposalID uint64) (types.Proposal, bool) { store := ctx.KVStore(keeper.storeKey) + bz := store.Get(types.ProposalKey(proposalID)) if bz == nil { - return + return types.Proposal{}, false } - keeper.cdc.MustUnmarshalBinaryLengthPrefixed(bz, &proposal) + + proposal, err := keeper.cdc.UnmarshalProposal(bz) + if err != nil { + panic(err) + } + return proposal, true } // SetProposal set a proposal to store func (keeper Keeper) SetProposal(ctx sdk.Context, proposal types.Proposal) { store := ctx.KVStore(keeper.storeKey) - bz := keeper.cdc.MustMarshalBinaryLengthPrefixed(proposal) + + bz, err := keeper.cdc.MarshalProposal(proposal) + if err != nil { + panic(err) + } + store.Set(types.ProposalKey(proposal.ProposalID), bz) } @@ -81,12 +92,15 @@ func (keeper Keeper) DeleteProposal(ctx sdk.Context, proposalID uint64) { // IterateProposals iterates over the all the proposals and performs a callback function func (keeper Keeper) IterateProposals(ctx sdk.Context, cb func(proposal types.Proposal) (stop bool)) { store := ctx.KVStore(keeper.storeKey) - iterator := sdk.KVStorePrefixIterator(store, types.ProposalsKeyPrefix) + iterator := sdk.KVStorePrefixIterator(store, types.ProposalsKeyPrefix) defer iterator.Close() + for ; iterator.Valid(); iterator.Next() { - var proposal types.Proposal - keeper.cdc.MustUnmarshalBinaryLengthPrefixed(iterator.Value(), &proposal) + proposal, err := keeper.cdc.UnmarshalProposal(iterator.Value()) + if err != nil { + panic(err) + } if cb(proposal) { break diff --git a/x/gov/keeper/proposal_test.go b/x/gov/keeper/proposal_test.go index 41bc35aab..a02b6da72 100644 --- a/x/gov/keeper/proposal_test.go +++ b/x/gov/keeper/proposal_test.go @@ -6,14 +6,11 @@ import ( "testing" "time" - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/stretchr/testify/require" - abci "github.com/tendermint/tendermint/abci/types" - "github.com/cosmos/cosmos-sdk/codec" "github.com/cosmos/cosmos-sdk/simapp" + sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/x/gov/types" ) @@ -29,7 +26,7 @@ func TestGetSetProposal(t *testing.T) { gotProposal, ok := app.GovKeeper.GetProposal(ctx, proposalID) require.True(t, ok) - require.True(t, ProposalEqual(proposal, gotProposal)) + require.True(t, proposal.Equal(gotProposal)) } func TestActivateVotingPeriod(t *testing.T) { @@ -57,71 +54,26 @@ func TestActivateVotingPeriod(t *testing.T) { activeIterator.Close() } -type validProposal struct{} - -func (validProposal) GetTitle() string { return "title" } -func (validProposal) GetDescription() string { return "description" } -func (validProposal) ProposalRoute() string { return types.RouterKey } -func (validProposal) ProposalType() string { return types.ProposalTypeText } -func (validProposal) String() string { return "" } -func (validProposal) ValidateBasic() error { return nil } - -type invalidProposalTitle1 struct{ validProposal } - -func (invalidProposalTitle1) GetTitle() string { return "" } - -type invalidProposalTitle2 struct{ validProposal } - -func (invalidProposalTitle2) GetTitle() string { return strings.Repeat("1234567890", 100) } - -type invalidProposalDesc1 struct{ validProposal } - -func (invalidProposalDesc1) GetDescription() string { return "" } - -type invalidProposalDesc2 struct{ validProposal } - -func (invalidProposalDesc2) GetDescription() string { return strings.Repeat("1234567890", 1000) } - -type invalidProposalRoute struct{ validProposal } +type invalidProposalRoute struct{ types.TextProposal } func (invalidProposalRoute) ProposalRoute() string { return "nonexistingroute" } -type invalidProposalValidation struct{ validProposal } - -func (invalidProposalValidation) ValidateBasic() error { - return errors.New("invalid proposal") -} - -func registerTestCodec(cdc *codec.Codec) { - cdc.RegisterConcrete(validProposal{}, "test/validproposal", nil) - cdc.RegisterConcrete(invalidProposalTitle1{}, "test/invalidproposalt1", nil) - cdc.RegisterConcrete(invalidProposalTitle2{}, "test/invalidproposalt2", nil) - cdc.RegisterConcrete(invalidProposalDesc1{}, "test/invalidproposald1", nil) - cdc.RegisterConcrete(invalidProposalDesc2{}, "test/invalidproposald2", nil) - cdc.RegisterConcrete(invalidProposalRoute{}, "test/invalidproposalr", nil) - cdc.RegisterConcrete(invalidProposalValidation{}, "test/invalidproposalv", nil) -} - func TestSubmitProposal(t *testing.T) { app := simapp.Setup(false) ctx := app.BaseApp.NewContext(false, abci.Header{}) - registerTestCodec(app.Codec()) - testCases := []struct { content types.Content expectedErr error }{ - {validProposal{}, nil}, + {types.TextProposal{Title: "title", Description: "description"}, nil}, // Keeper does not check the validity of title and description, no error - {invalidProposalTitle1{}, nil}, - {invalidProposalTitle2{}, nil}, - {invalidProposalDesc1{}, nil}, - {invalidProposalDesc2{}, nil}, + {types.TextProposal{Title: "", Description: "description"}, nil}, + {types.TextProposal{Title: strings.Repeat("1234567890", 100), Description: "description"}, nil}, + {types.TextProposal{Title: "title", Description: ""}, nil}, + {types.TextProposal{Title: "title", Description: strings.Repeat("1234567890", 1000)}, nil}, // error only when invalid route {invalidProposalRoute{}, types.ErrNoProposalHandlerExists}, - // Keeper does not call ValidateBasic, msg.ValidateBasic does - {invalidProposalValidation{}, nil}, } for i, tc := range testCases { diff --git a/x/gov/keeper/querier_test.go b/x/gov/keeper/querier_test.go index 368b51e67..918f054a7 100644 --- a/x/gov/keeper/querier_test.go +++ b/x/gov/keeper/querier_test.go @@ -7,11 +7,11 @@ import ( "time" "github.com/stretchr/testify/require" - abci "github.com/tendermint/tendermint/abci/types" "github.com/cosmos/cosmos-sdk/codec" "github.com/cosmos/cosmos-sdk/simapp" + simappcodec "github.com/cosmos/cosmos-sdk/simapp/codec" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/x/gov/keeper" "github.com/cosmos/cosmos-sdk/x/gov/types" @@ -19,7 +19,7 @@ import ( const custom = "custom" -func getQueriedParams(t *testing.T, ctx sdk.Context, cdc *codec.Codec, querier sdk.Querier) (types.DepositParams, types.VotingParams, types.TallyParams) { +func getQueriedParams(t *testing.T, ctx sdk.Context, cdc codec.JSONMarshaler, querier sdk.Querier) (types.DepositParams, types.VotingParams, types.TallyParams) { query := abci.RequestQuery{ Path: strings.Join([]string{custom, types.QuerierRoute, types.QueryParams, types.ParamDeposit}, "/"), Data: []byte{}, @@ -60,7 +60,7 @@ func getQueriedParams(t *testing.T, ctx sdk.Context, cdc *codec.Codec, querier s } func getQueriedProposals( - t *testing.T, ctx sdk.Context, cdc *codec.Codec, querier sdk.Querier, + t *testing.T, ctx sdk.Context, cdc codec.JSONMarshaler, querier sdk.Querier, depositor, voter sdk.AccAddress, status types.ProposalStatus, page, limit int, ) []types.Proposal { @@ -79,7 +79,7 @@ func getQueriedProposals( return proposals } -func getQueriedDeposit(t *testing.T, ctx sdk.Context, cdc *codec.Codec, querier sdk.Querier, proposalID uint64, depositor sdk.AccAddress) types.Deposit { +func getQueriedDeposit(t *testing.T, ctx sdk.Context, cdc codec.JSONMarshaler, querier sdk.Querier, proposalID uint64, depositor sdk.AccAddress) types.Deposit { query := abci.RequestQuery{ Path: strings.Join([]string{custom, types.QuerierRoute, types.QueryDeposit}, "/"), Data: cdc.MustMarshalJSON(types.NewQueryDepositParams(proposalID, depositor)), @@ -95,7 +95,7 @@ func getQueriedDeposit(t *testing.T, ctx sdk.Context, cdc *codec.Codec, querier return deposit } -func getQueriedDeposits(t *testing.T, ctx sdk.Context, cdc *codec.Codec, querier sdk.Querier, proposalID uint64) []types.Deposit { +func getQueriedDeposits(t *testing.T, ctx sdk.Context, cdc codec.JSONMarshaler, querier sdk.Querier, proposalID uint64) []types.Deposit { query := abci.RequestQuery{ Path: strings.Join([]string{custom, types.QuerierRoute, types.QueryDeposits}, "/"), Data: cdc.MustMarshalJSON(types.NewQueryProposalParams(proposalID)), @@ -111,7 +111,7 @@ func getQueriedDeposits(t *testing.T, ctx sdk.Context, cdc *codec.Codec, querier return deposits } -func getQueriedVote(t *testing.T, ctx sdk.Context, cdc *codec.Codec, querier sdk.Querier, proposalID uint64, voter sdk.AccAddress) types.Vote { +func getQueriedVote(t *testing.T, ctx sdk.Context, cdc codec.JSONMarshaler, querier sdk.Querier, proposalID uint64, voter sdk.AccAddress) types.Vote { query := abci.RequestQuery{ Path: strings.Join([]string{custom, types.QuerierRoute, types.QueryVote}, "/"), Data: cdc.MustMarshalJSON(types.NewQueryVoteParams(proposalID, voter)), @@ -127,7 +127,7 @@ func getQueriedVote(t *testing.T, ctx sdk.Context, cdc *codec.Codec, querier sdk return vote } -func getQueriedVotes(t *testing.T, ctx sdk.Context, cdc *codec.Codec, querier sdk.Querier, +func getQueriedVotes(t *testing.T, ctx sdk.Context, cdc codec.JSONMarshaler, querier sdk.Querier, proposalID uint64, page, limit int) []types.Vote { query := abci.RequestQuery{ Path: strings.Join([]string{custom, types.QuerierRoute, types.QueryVote}, "/"), @@ -147,6 +147,7 @@ func getQueriedVotes(t *testing.T, ctx sdk.Context, cdc *codec.Codec, querier sd func TestQueries(t *testing.T) { app := simapp.Setup(false) ctx := app.BaseApp.NewContext(false, abci.Header{}) + appCodec := simappcodec.NewAppCodec(app.Codec()) querier := keeper.NewQuerier(app.GovKeeper) @@ -157,7 +158,7 @@ func TestQueries(t *testing.T) { tp := TestProposal - depositParams, _, _ := getQueriedParams(t, ctx, app.Codec(), querier) + depositParams, _, _ := getQueriedParams(t, ctx, appCodec, querier) // TestAddrs[0] proposes (and deposits) proposals #1 and #2 proposal1, err := app.GovKeeper.SubmitProposal(ctx, tp) @@ -205,35 +206,35 @@ func TestQueries(t *testing.T) { deposit5.Amount = deposit5.Amount.Add(deposit3.Amount...) // check deposits on proposal1 match individual deposits - deposits := getQueriedDeposits(t, ctx, app.Codec(), querier, proposal1.ProposalID) + deposits := getQueriedDeposits(t, ctx, appCodec, querier, proposal1.ProposalID) require.Len(t, deposits, 1) require.Equal(t, deposit1, deposits[0]) - deposit := getQueriedDeposit(t, ctx, app.Codec(), querier, proposal1.ProposalID, TestAddrs[0]) + deposit := getQueriedDeposit(t, ctx, appCodec, querier, proposal1.ProposalID, TestAddrs[0]) require.Equal(t, deposit1, deposit) // check deposits on proposal2 match individual deposits - deposits = getQueriedDeposits(t, ctx, app.Codec(), querier, proposal2.ProposalID) + deposits = getQueriedDeposits(t, ctx, appCodec, querier, proposal2.ProposalID) require.Len(t, deposits, 2) // NOTE order of deposits is determined by the addresses require.Equal(t, deposit2, deposits[0]) require.Equal(t, deposit4, deposits[1]) // check deposits on proposal3 match individual deposits - deposits = getQueriedDeposits(t, ctx, app.Codec(), querier, proposal3.ProposalID) + deposits = getQueriedDeposits(t, ctx, appCodec, querier, proposal3.ProposalID) require.Len(t, deposits, 1) require.Equal(t, deposit5, deposits[0]) - deposit = getQueriedDeposit(t, ctx, app.Codec(), querier, proposal3.ProposalID, TestAddrs[1]) + deposit = getQueriedDeposit(t, ctx, appCodec, querier, proposal3.ProposalID, TestAddrs[1]) require.Equal(t, deposit5, deposit) // Only proposal #1 should be in types.Deposit Period - proposals := getQueriedProposals(t, ctx, app.Codec(), querier, nil, nil, types.StatusDepositPeriod, 1, 0) + proposals := getQueriedProposals(t, ctx, appCodec, querier, nil, nil, types.StatusDepositPeriod, 1, 0) require.Len(t, proposals, 1) require.Equal(t, proposal1, proposals[0]) // Only proposals #2 and #3 should be in Voting Period - proposals = getQueriedProposals(t, ctx, app.Codec(), querier, nil, nil, types.StatusVotingPeriod, 1, 0) + proposals = getQueriedProposals(t, ctx, appCodec, querier, nil, nil, types.StatusVotingPeriod, 1, 0) require.Len(t, proposals, 2) require.Equal(t, proposal2, proposals[0]) require.Equal(t, proposal3, proposals[1]) @@ -249,56 +250,60 @@ func TestQueries(t *testing.T) { app.GovKeeper.SetVote(ctx, vote3) // Test query voted by TestAddrs[0] - proposals = getQueriedProposals(t, ctx, app.Codec(), querier, nil, TestAddrs[0], types.StatusNil, 1, 0) + proposals = getQueriedProposals(t, ctx, appCodec, querier, nil, TestAddrs[0], types.StatusNil, 1, 0) require.Equal(t, proposal2, proposals[0]) require.Equal(t, proposal3, proposals[1]) // Test query votes on types.Proposal 2 - votes := getQueriedVotes(t, ctx, app.Codec(), querier, proposal2.ProposalID, 1, 0) + votes := getQueriedVotes(t, ctx, appCodec, querier, proposal2.ProposalID, 1, 0) require.Len(t, votes, 1) require.Equal(t, vote1, votes[0]) - vote := getQueriedVote(t, ctx, app.Codec(), querier, proposal2.ProposalID, TestAddrs[0]) + vote := getQueriedVote(t, ctx, appCodec, querier, proposal2.ProposalID, TestAddrs[0]) require.Equal(t, vote1, vote) // Test query votes on types.Proposal 3 - votes = getQueriedVotes(t, ctx, app.Codec(), querier, proposal3.ProposalID, 1, 0) + votes = getQueriedVotes(t, ctx, appCodec, querier, proposal3.ProposalID, 1, 0) require.Len(t, votes, 2) require.Equal(t, vote2, votes[0]) require.Equal(t, vote3, votes[1]) // Test query all proposals - proposals = getQueriedProposals(t, ctx, app.Codec(), querier, nil, nil, types.StatusNil, 1, 0) + proposals = getQueriedProposals(t, ctx, appCodec, querier, nil, nil, types.StatusNil, 1, 0) require.Equal(t, proposal1, proposals[0]) require.Equal(t, proposal2, proposals[1]) require.Equal(t, proposal3, proposals[2]) // Test query voted by TestAddrs[1] - proposals = getQueriedProposals(t, ctx, app.Codec(), querier, nil, TestAddrs[1], types.StatusNil, 1, 0) + proposals = getQueriedProposals(t, ctx, appCodec, querier, nil, TestAddrs[1], types.StatusNil, 1, 0) require.Equal(t, proposal3.ProposalID, proposals[0].ProposalID) // Test query deposited by TestAddrs[0] - proposals = getQueriedProposals(t, ctx, app.Codec(), querier, TestAddrs[0], nil, types.StatusNil, 1, 0) + proposals = getQueriedProposals(t, ctx, appCodec, querier, TestAddrs[0], nil, types.StatusNil, 1, 0) require.Equal(t, proposal1.ProposalID, proposals[0].ProposalID) // Test query deposited by addr2 - proposals = getQueriedProposals(t, ctx, app.Codec(), querier, TestAddrs[1], nil, types.StatusNil, 1, 0) + proposals = getQueriedProposals(t, ctx, appCodec, querier, TestAddrs[1], nil, types.StatusNil, 1, 0) require.Equal(t, proposal2.ProposalID, proposals[0].ProposalID) require.Equal(t, proposal3.ProposalID, proposals[1].ProposalID) // Test query voted AND deposited by addr1 - proposals = getQueriedProposals(t, ctx, app.Codec(), querier, TestAddrs[0], TestAddrs[0], types.StatusNil, 1, 0) + proposals = getQueriedProposals(t, ctx, appCodec, querier, TestAddrs[0], TestAddrs[0], types.StatusNil, 1, 0) require.Equal(t, proposal2.ProposalID, proposals[0].ProposalID) } func TestPaginatedVotesQuery(t *testing.T) { app := simapp.Setup(false) ctx := app.BaseApp.NewContext(false, abci.Header{}) + appCodec := simappcodec.NewAppCodec(app.Codec()) proposal := types.Proposal{ - ProposalID: 100, - Status: types.StatusVotingPeriod, + ProposalBase: types.ProposalBase{ + ProposalID: 100, + Status: types.StatusVotingPeriod, + }, } + app.GovKeeper.SetProposal(ctx, proposal) votes := make([]types.Vote, 20) @@ -318,7 +323,7 @@ func TestPaginatedVotesQuery(t *testing.T) { querier := keeper.NewQuerier(app.GovKeeper) // keeper preserves consistent order for each query, but this is not the insertion order - all := getQueriedVotes(t, ctx, app.Codec(), querier, proposal.ProposalID, 1, 0) + all := getQueriedVotes(t, ctx, appCodec, querier, proposal.ProposalID, 1, 0) require.Equal(t, len(all), len(votes)) type testCase struct { @@ -352,7 +357,7 @@ func TestPaginatedVotesQuery(t *testing.T) { } { tc := tc t.Run(tc.description, func(t *testing.T) { - votes := getQueriedVotes(t, ctx, app.Codec(), querier, proposal.ProposalID, tc.page, tc.limit) + votes := getQueriedVotes(t, ctx, appCodec, querier, proposal.ProposalID, tc.page, tc.limit) require.Equal(t, len(tc.votes), len(votes)) for i := range votes { require.Equal(t, tc.votes[i], votes[i]) diff --git a/x/gov/keeper/tally_test.go b/x/gov/keeper/tally_test.go index 3b7ff6958..704aa5d03 100644 --- a/x/gov/keeper/tally_test.go +++ b/x/gov/keeper/tally_test.go @@ -3,15 +3,13 @@ package keeper_test import ( "testing" - "github.com/cosmos/cosmos-sdk/x/staking" - "github.com/stretchr/testify/require" - abci "github.com/tendermint/tendermint/abci/types" "github.com/cosmos/cosmos-sdk/simapp" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/x/gov/types" + "github.com/cosmos/cosmos-sdk/x/staking" ) func TestTallyNoOneVotes(t *testing.T) { diff --git a/x/gov/keeper/vote.go b/x/gov/keeper/vote.go index 309446714..819130e64 100644 --- a/x/gov/keeper/vote.go +++ b/x/gov/keeper/vote.go @@ -69,7 +69,7 @@ func (keeper Keeper) GetVote(ctx sdk.Context, proposalID uint64, voterAddr sdk.A // SetVote sets a Vote to the gov store func (keeper Keeper) SetVote(ctx sdk.Context, vote types.Vote) { store := ctx.KVStore(keeper.storeKey) - bz := keeper.cdc.MustMarshalBinaryLengthPrefixed(vote) + bz := keeper.cdc.MustMarshalBinaryLengthPrefixed(&vote) store.Set(types.VoteKey(vote.ProposalID, vote.Voter), bz) } diff --git a/x/gov/keeper/vote_test.go b/x/gov/keeper/vote_test.go index 8a87cdad6..cc2d92a0a 100644 --- a/x/gov/keeper/vote_test.go +++ b/x/gov/keeper/vote_test.go @@ -3,13 +3,12 @@ package keeper_test import ( "testing" - sdk "github.com/cosmos/cosmos-sdk/types" - - "github.com/cosmos/cosmos-sdk/simapp" + "github.com/stretchr/testify/require" abci "github.com/tendermint/tendermint/abci/types" + "github.com/cosmos/cosmos-sdk/simapp" + sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/x/gov/types" - "github.com/stretchr/testify/require" ) func TestVotes(t *testing.T) { diff --git a/x/gov/types/codec.go b/x/gov/types/codec.go index fc3de0e3f..e4d7e16a3 100644 --- a/x/gov/types/codec.go +++ b/x/gov/types/codec.go @@ -4,29 +4,48 @@ import ( "github.com/cosmos/cosmos-sdk/codec" ) -// module codec -var ModuleCdc = codec.New() +// Codec defines the interface required to serialize custom x/gov types. +type Codec interface { + codec.Marshaler -// RegisterCodec registers all the necessary types and interfaces for -// governance. + 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) } // 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. +// +// NOTE: This should only be used for applications that are still using a concrete +// Amino codec for serialization. func RegisterProposalTypeCodec(o interface{}, name string) { - ModuleCdc.RegisterConcrete(o, name, nil) + amino.RegisterConcrete(o, name, nil) } -// TODO determine a good place to seal this codec +var ( + amino = codec.New() + + // ModuleCdc references the global x/gov module codec. Note, the codec should + // ONLY be used in certain instances of tests and for JSON encoding as Amino is + // still used for that purpose. + // + // The actual codec used for serialization should be provided to x/gov and + // defined at the application level. + ModuleCdc = codec.NewHybridCodec(amino) +) + func init() { - RegisterCodec(ModuleCdc) + RegisterCodec(amino) + codec.RegisterCrypto(amino) } diff --git a/x/gov/types/deposit.go b/x/gov/types/deposit.go index 4d9ff9304..d9f72a83f 100644 --- a/x/gov/types/deposit.go +++ b/x/gov/types/deposit.go @@ -3,29 +3,39 @@ package types import ( "fmt" + "gopkg.in/yaml.v2" + sdk "github.com/cosmos/cosmos-sdk/types" ) -// Deposit defines an amount deposited by an account address to an active proposal -type Deposit struct { - ProposalID uint64 `json:"proposal_id" yaml:"proposal_id"` // proposalID of the proposal - Depositor sdk.AccAddress `json:"depositor" yaml:"depositor"` // Address of the depositor - Amount sdk.Coins `json:"amount" yaml:"amount"` // Deposit amount -} - // NewDeposit creates a new Deposit instance func NewDeposit(proposalID uint64, depositor sdk.AccAddress, amount sdk.Coins) Deposit { return Deposit{proposalID, depositor, amount} } func (d Deposit) String() string { - return fmt.Sprintf("deposit by %s on Proposal %d is for the amount %s", - d.Depositor, d.ProposalID, d.Amount) + out, _ := yaml.Marshal(d) + return string(out) } // Deposits is a collection of Deposit objects type Deposits []Deposit +// Equal returns true if two slices (order-dependant) of deposits are equal. +func (d Deposits) Equal(other Deposits) bool { + if len(d) != len(other) { + return false + } + + for i, deposit := range d { + if !deposit.Equal(other[i]) { + return false + } + } + + return true +} + func (d Deposits) String() string { if len(d) == 0 { return "[]" @@ -37,12 +47,7 @@ func (d Deposits) String() string { return out } -// Equals returns whether two deposits are equal. -func (d Deposit) Equals(comp Deposit) bool { - return d.Depositor.Equals(comp.Depositor) && d.ProposalID == comp.ProposalID && d.Amount.IsEqual(comp.Amount) -} - // Empty returns whether a deposit is empty. func (d Deposit) Empty() bool { - return d.Equals(Deposit{}) + return d.Equal(Deposit{}) } diff --git a/x/gov/types/genesis.go b/x/gov/types/genesis.go index 69f49fa68..7099cb959 100644 --- a/x/gov/types/genesis.go +++ b/x/gov/types/genesis.go @@ -1,7 +1,6 @@ package types import ( - "bytes" "fmt" sdk "github.com/cosmos/cosmos-sdk/types" @@ -38,11 +37,14 @@ func DefaultGenesisState() GenesisState { ) } -// Equal checks whether two gov GenesisState structs are equivalent -func (data GenesisState) Equal(data2 GenesisState) bool { - b1 := ModuleCdc.MustMarshalBinaryBare(data) - b2 := ModuleCdc.MustMarshalBinaryBare(data2) - return bytes.Equal(b1, b2) +func (data GenesisState) Equal(other GenesisState) bool { + return data.StartingProposalID == other.StartingProposalID && + data.Deposits.Equal(other.Deposits) && + data.Votes.Equal(other.Votes) && + data.Proposals.Equal(other.Proposals) && + data.DepositParams.Equal(other.DepositParams) && + data.TallyParams.Equal(other.TallyParams) && + data.VotingParams.Equal(other.VotingParams) } // IsEmpty returns true if a GenesisState is empty diff --git a/x/gov/types/msgs.go b/x/gov/types/msgs.go index 882e0c560..559a343e5 100644 --- a/x/gov/types/msgs.go +++ b/x/gov/types/msgs.go @@ -1,7 +1,7 @@ package types import ( - "fmt" + "gopkg.in/yaml.v2" sdk "github.com/cosmos/cosmos-sdk/types" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" @@ -14,32 +14,35 @@ const ( TypeMsgSubmitProposal = "submit_proposal" ) -var _, _, _ sdk.Msg = MsgSubmitProposal{}, MsgDeposit{}, MsgVote{} +var _, _, _ sdk.Msg = MsgSubmitProposalBase{}, MsgDeposit{}, MsgVote{} -// MsgSubmitProposal defines a message to create a governance proposal with a -// given content and initial deposit -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 +// MsgSubmitProposalI defines the specific interface a concrete message must +// implement in order to process governance proposals. The concrete MsgSubmitProposal +// must be defined at the application-level. +type MsgSubmitProposalI interface { + sdk.Msg + + GetContent() Content + GetInitialDeposit() sdk.Coins + GetProposer() sdk.AccAddress } -// NewMsgSubmitProposal creates a new MsgSubmitProposal instance -func NewMsgSubmitProposal(content Content, initialDeposit sdk.Coins, proposer sdk.AccAddress) MsgSubmitProposal { - return MsgSubmitProposal{content, initialDeposit, proposer} +// NewMsgSubmitProposalBase creates a new MsgSubmitProposalBase. +func NewMsgSubmitProposalBase(initialDeposit sdk.Coins, proposer sdk.AccAddress) MsgSubmitProposalBase { + return MsgSubmitProposalBase{ + InitialDeposit: initialDeposit, + Proposer: proposer, + } } // Route implements Msg -func (msg MsgSubmitProposal) Route() string { return RouterKey } +func (msg MsgSubmitProposalBase) Route() string { return RouterKey } // Type implements Msg -func (msg MsgSubmitProposal) Type() string { return TypeMsgSubmitProposal } +func (msg MsgSubmitProposalBase) Type() string { return TypeMsgSubmitProposal } // ValidateBasic implements Msg -func (msg MsgSubmitProposal) ValidateBasic() error { - if msg.Content == nil { - return sdkerrors.Wrap(ErrInvalidProposalContent, "missing content") - } +func (msg MsgSubmitProposalBase) ValidateBasic() error { if msg.Proposer.Empty() { return sdkerrors.Wrap(sdkerrors.ErrInvalidAddress, msg.Proposer.String()) } @@ -49,37 +52,25 @@ func (msg MsgSubmitProposal) ValidateBasic() error { 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() -} - -// String implements the Stringer interface -func (msg MsgSubmitProposal) String() string { - return fmt.Sprintf(`Submit Proposal Message: - Content: %s - Initial Deposit: %s -`, msg.Content.String(), msg.InitialDeposit) + return nil } // GetSignBytes implements Msg -func (msg MsgSubmitProposal) GetSignBytes() []byte { +func (msg MsgSubmitProposalBase) GetSignBytes() []byte { bz := ModuleCdc.MustMarshalJSON(msg) return sdk.MustSortJSON(bz) } // GetSigners implements Msg -func (msg MsgSubmitProposal) GetSigners() []sdk.AccAddress { +func (msg MsgSubmitProposalBase) GetSigners() []sdk.AccAddress { return []sdk.AccAddress{msg.Proposer} } -// MsgDeposit defines a message to submit a deposit to an existing proposal -type MsgDeposit struct { - ProposalID uint64 `json:"proposal_id" yaml:"proposal_id"` // ID of the proposal - Depositor sdk.AccAddress `json:"depositor" yaml:"depositor"` // Address of the depositor - Amount sdk.Coins `json:"amount" yaml:"amount"` // Coins to add to the proposal's deposit +// String implements the Stringer interface +func (msg MsgSubmitProposalBase) String() string { + out, _ := yaml.Marshal(msg) + return string(out) } // NewMsgDeposit creates a new MsgDeposit instance @@ -110,11 +101,8 @@ func (msg MsgDeposit) ValidateBasic() error { // String implements the Stringer interface func (msg MsgDeposit) String() string { - return fmt.Sprintf(`Deposit Message: - Depositer: %s - Proposal ID: %d - Amount: %s -`, msg.Depositor, msg.ProposalID, msg.Amount) + out, _ := yaml.Marshal(msg) + return string(out) } // GetSignBytes implements Msg @@ -128,13 +116,6 @@ func (msg MsgDeposit) GetSigners() []sdk.AccAddress { return []sdk.AccAddress{msg.Depositor} } -// MsgVote defines a message to cast a vote -type MsgVote struct { - ProposalID uint64 `json:"proposal_id" yaml:"proposal_id"` // ID of the proposal - Voter sdk.AccAddress `json:"voter" yaml:"voter"` // address of the voter - Option VoteOption `json:"option" yaml:"option"` // option from OptionSet chosen by the voter -} - // NewMsgVote creates a message to cast a vote on an active proposal func NewMsgVote(voter sdk.AccAddress, proposalID uint64, option VoteOption) MsgVote { return MsgVote{proposalID, voter, option} @@ -160,10 +141,8 @@ func (msg MsgVote) ValidateBasic() error { // String implements the Stringer interface func (msg MsgVote) String() string { - return fmt.Sprintf(`Vote Message: - Proposal ID: %d - Option: %s -`, msg.ProposalID, msg.Option) + out, _ := yaml.Marshal(msg) + return string(out) } // GetSignBytes implements Msg @@ -176,3 +155,61 @@ 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 +} + +// 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) +} + +// nolint +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 } diff --git a/x/gov/types/params.go b/x/gov/types/params.go index d15ae88b8..511485bfa 100644 --- a/x/gov/types/params.go +++ b/x/gov/types/params.go @@ -4,6 +4,8 @@ import ( "fmt" "time" + "gopkg.in/yaml.v2" + sdk "github.com/cosmos/cosmos-sdk/types" paramtypes "github.com/cosmos/cosmos-sdk/x/params/types" ) @@ -61,9 +63,8 @@ func DefaultDepositParams() DepositParams { // String implements stringer insterface func (dp DepositParams) String() string { - return fmt.Sprintf(`Deposit Params: - Min Deposit: %s - Max Deposit Period: %s`, dp.MinDeposit, dp.MaxDepositPeriod) + out, _ := yaml.Marshal(dp) + return string(out) } // Equal checks equality of DepositParams @@ -108,13 +109,15 @@ func DefaultTallyParams() TallyParams { return NewTallyParams(DefaultQuorum, DefaultThreshold, DefaultVeto) } +// Equal checks equality of TallyParams +func (tp TallyParams) Equal(other TallyParams) bool { + return tp.Quorum.Equal(other.Quorum) && tp.Threshold.Equal(other.Threshold) && tp.Veto.Equal(other.Veto) +} + // String implements stringer insterface func (tp TallyParams) String() string { - return fmt.Sprintf(`Tally Params: - Quorum: %s - Threshold: %s - Veto: %s`, - tp.Quorum, tp.Threshold, tp.Veto) + out, _ := yaml.Marshal(tp) + return string(out) } func validateTallyParams(i interface{}) error { @@ -162,10 +165,15 @@ func DefaultVotingParams() VotingParams { return NewVotingParams(DefaultPeriod) } +// Equal checks equality of TallyParams +func (vp VotingParams) Equal(other VotingParams) bool { + return vp.VotingPeriod == other.VotingPeriod +} + // String implements stringer interface func (vp VotingParams) String() string { - return fmt.Sprintf(`Voting Params: - Voting Period: %s`, vp.VotingPeriod) + out, _ := yaml.Marshal(vp) + return string(out) } func validateVotingParams(i interface{}) error { diff --git a/x/gov/types/proposal.go b/x/gov/types/proposal.go index 945cf7866..9e65ec3c9 100644 --- a/x/gov/types/proposal.go +++ b/x/gov/types/proposal.go @@ -6,6 +6,8 @@ import ( "strings" "time" + "gopkg.in/yaml.v2" + sdk "github.com/cosmos/cosmos-sdk/types" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" ) @@ -17,53 +19,53 @@ const DefaultStartingProposalID uint64 = 1 // on network changes. type Proposal struct { Content `json:"content" yaml:"content"` // Proposal content interface - - ProposalID uint64 `json:"id" yaml:"id"` // ID of the proposal - Status ProposalStatus `json:"proposal_status" yaml:"proposal_status"` // Status of the Proposal {Pending, Active, Passed, Rejected} - FinalTallyResult TallyResult `json:"final_tally_result" yaml:"final_tally_result"` // Result of Tallys - - SubmitTime time.Time `json:"submit_time" yaml:"submit_time"` // Time of the block where TxGovSubmitProposal was included - DepositEndTime time.Time `json:"deposit_end_time" yaml:"deposit_end_time"` // Time that the Proposal would expire if deposit amount isn't met - TotalDeposit sdk.Coins `json:"total_deposit" yaml:"total_deposit"` // Current deposit on this proposal. Initial value is set at InitialDeposit - - VotingStartTime time.Time `json:"voting_start_time" yaml:"voting_start_time"` // Time of the block where MinDeposit was reached. -1 if MinDeposit is not reached - VotingEndTime time.Time `json:"voting_end_time" yaml:"voting_end_time"` // Time that the VotingPeriod for this proposal will end and votes will be tallied + ProposalBase } // NewProposal creates a new Proposal instance func NewProposal(content Content, id uint64, submitTime, depositEndTime time.Time) Proposal { return Proposal{ - Content: content, - ProposalID: id, - Status: StatusDepositPeriod, - FinalTallyResult: EmptyTallyResult(), - TotalDeposit: sdk.NewCoins(), - SubmitTime: submitTime, - DepositEndTime: depositEndTime, + Content: content, + ProposalBase: ProposalBase{ + 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() +} + // String implements stringer interface func (p Proposal) String() string { - return fmt.Sprintf(`Proposal %d: - Title: %s - Type: %s - Status: %s - Submit Time: %s - Deposit End Time: %s - Total Deposit: %s - Voting Start Time: %s - Voting End Time: %s - Description: %s`, - p.ProposalID, p.GetTitle(), p.ProposalType(), - p.Status, p.SubmitTime, p.DepositEndTime, - p.TotalDeposit, p.VotingStartTime, p.VotingEndTime, p.GetDescription(), - ) + out, _ := yaml.Marshal(p) + return string(out) } // Proposals is an array of proposal type Proposals []Proposal +// Equal returns true if two slices (order-dependant) of proposals are equal. +func (p Proposals) Equal(other Proposals) bool { + if len(p) != len(other) { + return false + } + + for i, proposal := range p { + if !proposal.Equal(other[i]) { + return false + } + } + + return true +} + // String implements stringer interface func (p Proposals) String() string { out := "ID - (Status) [Type] Title\n" @@ -78,19 +80,6 @@ func (p Proposals) String() string { type ( // ProposalQueue defines a queue for proposal ids ProposalQueue []uint64 - - // ProposalStatus is a type alias that represents a proposal status as a byte - ProposalStatus byte -) - -// Valid Proposal statuses -const ( - StatusNil ProposalStatus = 0x00 - StatusDepositPeriod ProposalStatus = 0x01 - StatusVotingPeriod ProposalStatus = 0x02 - StatusPassed ProposalStatus = 0x03 - StatusRejected ProposalStatus = 0x04 - StatusFailed ProposalStatus = 0x05 ) // ProposalStatusFromString turns a string into a ProposalStatus @@ -205,21 +194,14 @@ const ( ProposalTypeText string = "Text" ) -// TextProposal defines a standard text proposal whose changes need to be -// manually updated in case of approval -type TextProposal struct { - Title string `json:"title" yaml:"title"` - Description string `json:"description" yaml:"description"` -} +// Implements Content Interface +var _ Content = TextProposal{} // NewTextProposal creates a text proposal Content func NewTextProposal(title, description string) Content { return TextProposal{title, description} } -// Implements Content Interface -var _ Content = TextProposal{} - // GetTitle returns the proposal title func (tp TextProposal) GetTitle() string { return tp.Title } @@ -237,10 +219,8 @@ func (tp TextProposal) ValidateBasic() error { return ValidateAbstract(tp) } // String implements Stringer interface func (tp TextProposal) String() string { - return fmt.Sprintf(`Text Proposal: - Title: %s - Description: %s -`, tp.Title, tp.Description) + out, _ := yaml.Marshal(tp) + return string(out) } var validProposalTypes = map[string]struct{}{ diff --git a/x/gov/types/tally.go b/x/gov/types/tally.go index d437816e9..d8acbeacd 100644 --- a/x/gov/types/tally.go +++ b/x/gov/types/tally.go @@ -1,7 +1,7 @@ package types import ( - "fmt" + "gopkg.in/yaml.v2" sdk "github.com/cosmos/cosmos-sdk/types" ) @@ -28,14 +28,6 @@ func NewValidatorGovInfo(address sdk.ValAddress, bondedTokens sdk.Int, delegator } } -// TallyResult defines a standard tally for a proposal -type TallyResult struct { - Yes sdk.Int `json:"yes" yaml:"yes"` - Abstain sdk.Int `json:"abstain" yaml:"abstain"` - No sdk.Int `json:"no" yaml:"no"` - NoWithVeto sdk.Int `json:"no_with_veto" yaml:"no_with_veto"` -} - // NewTallyResult creates a new TallyResult instance func NewTallyResult(yes, abstain, no, noWithVeto sdk.Int) TallyResult { return TallyResult{ @@ -71,9 +63,6 @@ func (tr TallyResult) Equals(comp TallyResult) bool { // String implements stringer interface func (tr TallyResult) String() string { - return fmt.Sprintf(`Tally Result: - Yes: %s - Abstain: %s - No: %s - NoWithVeto: %s`, tr.Yes, tr.Abstain, tr.No, tr.NoWithVeto) + out, _ := yaml.Marshal(tr) + return string(out) } diff --git a/x/gov/types/types.pb.go b/x/gov/types/types.pb.go new file mode 100644 index 000000000..038f3297d --- /dev/null +++ b/x/gov/types/types.pb.go @@ -0,0 +1,2795 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: x/gov/types/types.proto + +package types + +import ( + bytes "bytes" + fmt "fmt" + github_com_cosmos_cosmos_sdk_types "github.com/cosmos/cosmos-sdk/types" + types "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" + io "io" + math "math" + math_bits "math/bits" + time "time" +) + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf +var _ = time.Kitchen + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package + +// VoteOption defines a vote option +type VoteOption int32 + +const ( + // VOTE_OPTION_UNSPECIFIED defines a no-op vote option. + OptionEmpty VoteOption = 0 + // VOTE_OPTION_YES defines a yes vote option. + OptionYes VoteOption = 1 + // VOTE_OPTION_ABSTAIN defines an abstain vote option. + OptionAbstain VoteOption = 2 + // VOTE_OPTION_NO defines a no vote option. + OptionNo VoteOption = 3 + // VOTE_OPTION_NO_WITH_VETO defines a no with veto vote option. + OptionNoWithVeto VoteOption = 4 +) + +var VoteOption_name = map[int32]string{ + 0: "VOTE_OPTION_UNSPECIFIED", + 1: "VOTE_OPTION_YES", + 2: "VOTE_OPTION_ABSTAIN", + 3: "VOTE_OPTION_NO", + 4: "VOTE_OPTION_NO_WITH_VETO", +} + +var VoteOption_value = map[string]int32{ + "VOTE_OPTION_UNSPECIFIED": 0, + "VOTE_OPTION_YES": 1, + "VOTE_OPTION_ABSTAIN": 2, + "VOTE_OPTION_NO": 3, + "VOTE_OPTION_NO_WITH_VETO": 4, +} + +func (VoteOption) EnumDescriptor() ([]byte, []int) { + return fileDescriptor_a5ae5e91b5b3fb03, []int{0} +} + +// ProposalStatus is a type alias that represents a proposal status as a byte +type ProposalStatus int32 + +const ( + // PROPOSAL_STATUS_UNSPECIFIED defines the default propopsal status. + StatusNil ProposalStatus = 0 + // PROPOSAL_STATUS_DEPOSIT_PERIOD defines a proposal status during the deposit period. + StatusDepositPeriod ProposalStatus = 1 + // PROPOSAL_STATUS_VOTING_PERIOD defines a proposal status during the voting period. + StatusVotingPeriod ProposalStatus = 2 + // PROPOSAL_STATUS_PASSED defines a proposal status of a proposal that has passed. + StatusPassed ProposalStatus = 3 + // PROPOSAL_STATUS_REJECTED defines a proposal status of a proposal that has been rejected. + StatusRejected ProposalStatus = 4 + // PROPOSAL_STATUS_FAILED defines a proposal status of a proposal that has failed. + StatusFailed ProposalStatus = 5 +) + +var ProposalStatus_name = map[int32]string{ + 0: "PROPOSAL_STATUS_UNSPECIFIED", + 1: "PROPOSAL_STATUS_DEPOSIT_PERIOD", + 2: "PROPOSAL_STATUS_VOTING_PERIOD", + 3: "PROPOSAL_STATUS_PASSED", + 4: "PROPOSAL_STATUS_REJECTED", + 5: "PROPOSAL_STATUS_FAILED", +} + +var ProposalStatus_value = map[string]int32{ + "PROPOSAL_STATUS_UNSPECIFIED": 0, + "PROPOSAL_STATUS_DEPOSIT_PERIOD": 1, + "PROPOSAL_STATUS_VOTING_PERIOD": 2, + "PROPOSAL_STATUS_PASSED": 3, + "PROPOSAL_STATUS_REJECTED": 4, + "PROPOSAL_STATUS_FAILED": 5, +} + +func (ProposalStatus) EnumDescriptor() ([]byte, []int) { + return fileDescriptor_a5ae5e91b5b3fb03, []int{1} +} + +// MsgSubmitProposalBase 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) { + return fileDescriptor_a5ae5e91b5b3fb03, []int{0} +} +func (m *MsgSubmitProposalBase) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgSubmitProposalBase) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgSubmitProposalBase.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 *MsgSubmitProposalBase) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgSubmitProposalBase.Merge(m, src) +} +func (m *MsgSubmitProposalBase) XXX_Size() int { + return m.Size() +} +func (m *MsgSubmitProposalBase) XXX_DiscardUnknown() { + xxx_messageInfo_MsgSubmitProposalBase.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgSubmitProposalBase proto.InternalMessageInfo + +// MsgVote defines a message to cast a vote +type MsgVote struct { + ProposalID uint64 `protobuf:"varint,1,opt,name=proposal_id,json=proposalId,proto3" json:"proposal_id" yaml:"proposal_id"` + Voter github_com_cosmos_cosmos_sdk_types.AccAddress `protobuf:"bytes,2,opt,name=voter,proto3,casttype=github.com/cosmos/cosmos-sdk/types.AccAddress" json:"voter,omitempty"` + Option VoteOption `protobuf:"varint,3,opt,name=option,proto3,enum=cosmos_sdk.x.gov.v1.VoteOption" json:"option,omitempty"` +} + +func (m *MsgVote) Reset() { *m = MsgVote{} } +func (*MsgVote) ProtoMessage() {} +func (*MsgVote) Descriptor() ([]byte, []int) { + return fileDescriptor_a5ae5e91b5b3fb03, []int{1} +} +func (m *MsgVote) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgVote) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgVote.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 *MsgVote) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgVote.Merge(m, src) +} +func (m *MsgVote) XXX_Size() int { + return m.Size() +} +func (m *MsgVote) XXX_DiscardUnknown() { + xxx_messageInfo_MsgVote.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgVote proto.InternalMessageInfo + +// MsgDeposit defines a message to submit a deposit to an existing proposal +type MsgDeposit struct { + ProposalID uint64 `protobuf:"varint,1,opt,name=proposal_id,json=proposalId,proto3" json:"proposal_id" yaml:"proposal_id"` + Depositor github_com_cosmos_cosmos_sdk_types.AccAddress `protobuf:"bytes,2,opt,name=depositor,proto3,casttype=github.com/cosmos/cosmos-sdk/types.AccAddress" json:"depositor,omitempty"` + Amount github_com_cosmos_cosmos_sdk_types.Coins `protobuf:"bytes,3,rep,name=amount,proto3,castrepeated=github.com/cosmos/cosmos-sdk/types.Coins" json:"amount"` +} + +func (m *MsgDeposit) Reset() { *m = MsgDeposit{} } +func (*MsgDeposit) ProtoMessage() {} +func (*MsgDeposit) Descriptor() ([]byte, []int) { + return fileDescriptor_a5ae5e91b5b3fb03, []int{2} +} +func (m *MsgDeposit) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgDeposit) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgDeposit.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 *MsgDeposit) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgDeposit.Merge(m, src) +} +func (m *MsgDeposit) XXX_Size() int { + return m.Size() +} +func (m *MsgDeposit) XXX_DiscardUnknown() { + xxx_messageInfo_MsgDeposit.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgDeposit proto.InternalMessageInfo + +// TextProposal defines a standard text proposal whose changes need to be +// manually updated in case of approval +type TextProposal struct { + Title string `protobuf:"bytes,1,opt,name=title,proto3" json:"title,omitempty"` + Description string `protobuf:"bytes,2,opt,name=description,proto3" json:"description,omitempty"` +} + +func (m *TextProposal) Reset() { *m = TextProposal{} } +func (*TextProposal) ProtoMessage() {} +func (*TextProposal) Descriptor() ([]byte, []int) { + return fileDescriptor_a5ae5e91b5b3fb03, []int{3} +} +func (m *TextProposal) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *TextProposal) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_TextProposal.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 *TextProposal) XXX_Merge(src proto.Message) { + xxx_messageInfo_TextProposal.Merge(m, src) +} +func (m *TextProposal) XXX_Size() int { + return m.Size() +} +func (m *TextProposal) XXX_DiscardUnknown() { + xxx_messageInfo_TextProposal.DiscardUnknown(m) +} + +var xxx_messageInfo_TextProposal proto.InternalMessageInfo + +// Deposit defines an amount deposited by an account address to an active proposal +type Deposit struct { + ProposalID uint64 `protobuf:"varint,1,opt,name=proposal_id,json=proposalId,proto3" json:"proposal_id,omitempty" yaml:"proposal_id"` + Depositor github_com_cosmos_cosmos_sdk_types.AccAddress `protobuf:"bytes,2,opt,name=depositor,proto3,casttype=github.com/cosmos/cosmos-sdk/types.AccAddress" json:"depositor,omitempty"` + Amount github_com_cosmos_cosmos_sdk_types.Coins `protobuf:"bytes,3,rep,name=amount,proto3,castrepeated=github.com/cosmos/cosmos-sdk/types.Coins" json:"amount"` +} + +func (m *Deposit) Reset() { *m = Deposit{} } +func (*Deposit) ProtoMessage() {} +func (*Deposit) Descriptor() ([]byte, []int) { + return fileDescriptor_a5ae5e91b5b3fb03, []int{4} +} +func (m *Deposit) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *Deposit) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_Deposit.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 *Deposit) XXX_Merge(src proto.Message) { + xxx_messageInfo_Deposit.Merge(m, src) +} +func (m *Deposit) XXX_Size() int { + return m.Size() +} +func (m *Deposit) XXX_DiscardUnknown() { + xxx_messageInfo_Deposit.DiscardUnknown(m) +} + +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 { + 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) { + return fileDescriptor_a5ae5e91b5b3fb03, []int{5} +} +func (m *ProposalBase) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *ProposalBase) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_ProposalBase.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 *ProposalBase) XXX_Merge(src proto.Message) { + xxx_messageInfo_ProposalBase.Merge(m, src) +} +func (m *ProposalBase) XXX_Size() int { + return m.Size() +} +func (m *ProposalBase) XXX_DiscardUnknown() { + xxx_messageInfo_ProposalBase.DiscardUnknown(m) +} + +var xxx_messageInfo_ProposalBase proto.InternalMessageInfo + +// TallyResult defines a standard tally for a proposal +type TallyResult struct { + Yes github_com_cosmos_cosmos_sdk_types.Int `protobuf:"bytes,1,opt,name=yes,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Int" json:"yes"` + Abstain github_com_cosmos_cosmos_sdk_types.Int `protobuf:"bytes,2,opt,name=abstain,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Int" json:"abstain"` + No github_com_cosmos_cosmos_sdk_types.Int `protobuf:"bytes,3,opt,name=no,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Int" json:"no"` + NoWithVeto github_com_cosmos_cosmos_sdk_types.Int `protobuf:"bytes,4,opt,name=no_with_veto,json=noWithVeto,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Int" json:"no_with_veto" yaml:"no_with_veto"` +} + +func (m *TallyResult) Reset() { *m = TallyResult{} } +func (*TallyResult) ProtoMessage() {} +func (*TallyResult) Descriptor() ([]byte, []int) { + return fileDescriptor_a5ae5e91b5b3fb03, []int{6} +} +func (m *TallyResult) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *TallyResult) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_TallyResult.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 *TallyResult) XXX_Merge(src proto.Message) { + xxx_messageInfo_TallyResult.Merge(m, src) +} +func (m *TallyResult) XXX_Size() int { + return m.Size() +} +func (m *TallyResult) XXX_DiscardUnknown() { + xxx_messageInfo_TallyResult.DiscardUnknown(m) +} + +var xxx_messageInfo_TallyResult proto.InternalMessageInfo + +// Vote defines a vote on a governance proposal. A vote corresponds to a proposal +// ID, the voter, and the vote option. +type Vote struct { + ProposalID uint64 `protobuf:"varint,1,opt,name=proposal_id,json=proposalId,proto3" json:"proposal_id,omitempty" yaml:"proposal_id"` + Voter github_com_cosmos_cosmos_sdk_types.AccAddress `protobuf:"bytes,2,opt,name=voter,proto3,casttype=github.com/cosmos/cosmos-sdk/types.AccAddress" json:"voter,omitempty"` + Option VoteOption `protobuf:"varint,3,opt,name=option,proto3,enum=cosmos_sdk.x.gov.v1.VoteOption" json:"option,omitempty"` +} + +func (m *Vote) Reset() { *m = Vote{} } +func (*Vote) ProtoMessage() {} +func (*Vote) Descriptor() ([]byte, []int) { + return fileDescriptor_a5ae5e91b5b3fb03, []int{7} +} +func (m *Vote) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *Vote) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_Vote.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 *Vote) XXX_Merge(src proto.Message) { + xxx_messageInfo_Vote.Merge(m, src) +} +func (m *Vote) XXX_Size() int { + return m.Size() +} +func (m *Vote) XXX_DiscardUnknown() { + xxx_messageInfo_Vote.DiscardUnknown(m) +} + +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((*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((*TallyResult)(nil), "cosmos_sdk.x.gov.v1.TallyResult") + proto.RegisterType((*Vote)(nil), "cosmos_sdk.x.gov.v1.Vote") +} + +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, 0xaa, 0x6d, 0x02, 0x42, + 0x2b, 0x04, 0x5e, 0x58, 0x0e, 0x55, 0xa9, 0x54, 0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, + 0x3c, 0xbf, 0x85, 0x70, 0x48, 0xca, 0x9c, 0x3c, 0xb6, 0x50, 0x58, 0x9a, 0x53, 0x32, 0xab, 0xec, + 0x9c, 0x53, 0x2e, 0xa2, 0x30, 0x56, 0xaf, 0x6e, 0xf5, 0xa5, 0xdc, 0x8b, 0xbe, 0x74, 0x74, 0xd3, + 0x6d, 0x46, 0x17, 0x2a, 0x23, 0xcc, 0xca, 0xb7, 0x4f, 0xa5, 0x85, 0x20, 0x24, 0xeb, 0x1b, 0xab, + 0xca, 0x1a, 0x6a, 0x2e, 0x52, 0x01, 0xf6, 0x75, 0x06, 0x7b, 0xb7, 0x59, 0x75, 0x03, 0x29, 0x6c, + 0x96, 0x18, 0xbb, 0x46, 0xc9, 0x70, 0x19, 0x1c, 0x6a, 0x25, 0x4b, 0xf3, 0xdb, 0xe5, 0xbc, 0xcc, + 0x2d, 0x14, 0xd5, 0x73, 0x7f, 0xf6, 0xa5, 0x33, 0xaf, 0xa1, 0x57, 0x5d, 0x5b, 0xab, 0x7a, 0x5e, + 0xdb, 0xc7, 0xd8, 0x7c, 0x29, 0x71, 0x61, 0xfc, 0xd7, 0x07, 0x12, 0x57, 0xf9, 0x85, 0x03, 0x53, + 0xcb, 0x38, 0x58, 0x41, 0xc4, 0x87, 0x36, 0x28, 0xb4, 0x58, 0xed, 0x4e, 0xe8, 0x95, 0x39, 0x99, + 0x5b, 0x18, 0x57, 0xcf, 0x6f, 0xf7, 0x25, 0x90, 0xb6, 0x44, 0xaf, 0xfd, 0xd6, 0x97, 0xb2, 0xa0, + 0x17, 0x7d, 0x09, 0xd2, 0x52, 0x33, 0xc1, 0x8a, 0x09, 0xd2, 0x27, 0xdd, 0x83, 0x97, 0xc1, 0x44, + 0x07, 0x91, 0x37, 0x59, 0x33, 0xe5, 0xc3, 0xf7, 0xc0, 0x24, 0x6a, 0x91, 0x10, 0xc5, 0xe5, 0x31, + 0x99, 0x5b, 0x28, 0x2d, 0x49, 0xca, 0x1e, 0x63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x19, 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 { + if that == nil { + return this == nil + } + + that1, ok := that.(*MsgSubmitProposalBase) + if !ok { + that2, ok := that.(MsgSubmitProposalBase) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + return this == nil + } else if this == nil { + return false + } + if len(this.InitialDeposit) != len(that1.InitialDeposit) { + return false + } + for i := range this.InitialDeposit { + if !this.InitialDeposit[i].Equal(&that1.InitialDeposit[i]) { + return false + } + } + if !bytes.Equal(this.Proposer, that1.Proposer) { + return false + } + return true +} +func (this *MsgVote) Equal(that interface{}) bool { + if that == nil { + return this == nil + } + + that1, ok := that.(*MsgVote) + if !ok { + that2, ok := that.(MsgVote) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + return this == nil + } else if this == nil { + return false + } + if this.ProposalID != that1.ProposalID { + return false + } + if !bytes.Equal(this.Voter, that1.Voter) { + return false + } + if this.Option != that1.Option { + return false + } + return true +} +func (this *MsgDeposit) Equal(that interface{}) bool { + if that == nil { + return this == nil + } + + that1, ok := that.(*MsgDeposit) + if !ok { + that2, ok := that.(MsgDeposit) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + return this == nil + } else if this == nil { + return false + } + if this.ProposalID != that1.ProposalID { + return false + } + if !bytes.Equal(this.Depositor, that1.Depositor) { + 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 + } + } + return true +} +func (this *TextProposal) Equal(that interface{}) bool { + if that == nil { + return this == nil + } + + that1, ok := that.(*TextProposal) + if !ok { + that2, ok := that.(TextProposal) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + return this == nil + } else if this == nil { + return false + } + if this.Title != that1.Title { + return false + } + if this.Description != that1.Description { + return false + } + return true +} +func (this *Deposit) Equal(that interface{}) bool { + if that == nil { + return this == nil + } + + that1, ok := that.(*Deposit) + if !ok { + that2, ok := that.(Deposit) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + return this == nil + } else if this == nil { + return false + } + if this.ProposalID != that1.ProposalID { + return false + } + if !bytes.Equal(this.Depositor, that1.Depositor) { + 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 + } + } + return true +} +func (this *ProposalBase) Equal(that interface{}) bool { + if that == nil { + return this == nil + } + + that1, ok := that.(*ProposalBase) + if !ok { + that2, ok := that.(ProposalBase) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + return this == nil + } else if this == nil { + return false + } + if this.ProposalID != that1.ProposalID { + return false + } + if this.Status != that1.Status { + return false + } + if !this.FinalTallyResult.Equal(&that1.FinalTallyResult) { + return false + } + if !this.SubmitTime.Equal(that1.SubmitTime) { + return false + } + if !this.DepositEndTime.Equal(that1.DepositEndTime) { + return false + } + if len(this.TotalDeposit) != len(that1.TotalDeposit) { + return false + } + for i := range this.TotalDeposit { + if !this.TotalDeposit[i].Equal(&that1.TotalDeposit[i]) { + return false + } + } + if !this.VotingStartTime.Equal(that1.VotingStartTime) { + return false + } + if !this.VotingEndTime.Equal(that1.VotingEndTime) { + return false + } + return true +} +func (this *TallyResult) Equal(that interface{}) bool { + if that == nil { + return this == nil + } + + that1, ok := that.(*TallyResult) + if !ok { + that2, ok := that.(TallyResult) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + return this == nil + } else if this == nil { + return false + } + if !this.Yes.Equal(that1.Yes) { + return false + } + if !this.Abstain.Equal(that1.Abstain) { + return false + } + if !this.No.Equal(that1.No) { + return false + } + if !this.NoWithVeto.Equal(that1.NoWithVeto) { + return false + } + return true +} +func (this *Vote) Equal(that interface{}) bool { + if that == nil { + return this == nil + } + + that1, ok := that.(*Vote) + if !ok { + that2, ok := that.(Vote) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + return this == nil + } else if this == nil { + return false + } + if this.ProposalID != that1.ProposalID { + return false + } + if !bytes.Equal(this.Voter, that1.Voter) { + return false + } + if this.Option != that1.Option { + return false + } + 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) { + 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 *MsgSubmitProposalBase) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgSubmitProposalBase) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Proposer) > 0 { + i -= len(m.Proposer) + copy(dAtA[i:], m.Proposer) + i = encodeVarintTypes(dAtA, i, uint64(len(m.Proposer))) + i-- + dAtA[i] = 0x12 + } + if len(m.InitialDeposit) > 0 { + for iNdEx := len(m.InitialDeposit) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.InitialDeposit[iNdEx].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 +} + +func (m *MsgVote) 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 *MsgVote) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgVote) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Option != 0 { + i = encodeVarintTypes(dAtA, i, uint64(m.Option)) + i-- + dAtA[i] = 0x18 + } + if len(m.Voter) > 0 { + i -= len(m.Voter) + copy(dAtA[i:], m.Voter) + i = encodeVarintTypes(dAtA, i, uint64(len(m.Voter))) + i-- + dAtA[i] = 0x12 + } + if m.ProposalID != 0 { + i = encodeVarintTypes(dAtA, i, uint64(m.ProposalID)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + +func (m *MsgDeposit) 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 *MsgDeposit) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgDeposit) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Amount) > 0 { + for iNdEx := len(m.Amount) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Amount[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTypes(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1a + } + } + if len(m.Depositor) > 0 { + i -= len(m.Depositor) + copy(dAtA[i:], m.Depositor) + i = encodeVarintTypes(dAtA, i, uint64(len(m.Depositor))) + i-- + dAtA[i] = 0x12 + } + if m.ProposalID != 0 { + i = encodeVarintTypes(dAtA, i, uint64(m.ProposalID)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + +func (m *TextProposal) 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 *TextProposal) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *TextProposal) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Description) > 0 { + i -= len(m.Description) + copy(dAtA[i:], m.Description) + i = encodeVarintTypes(dAtA, i, uint64(len(m.Description))) + i-- + dAtA[i] = 0x12 + } + if len(m.Title) > 0 { + i -= len(m.Title) + copy(dAtA[i:], m.Title) + i = encodeVarintTypes(dAtA, i, uint64(len(m.Title))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *Deposit) 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 *Deposit) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Deposit) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Amount) > 0 { + for iNdEx := len(m.Amount) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Amount[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTypes(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1a + } + } + if len(m.Depositor) > 0 { + i -= len(m.Depositor) + copy(dAtA[i:], m.Depositor) + i = encodeVarintTypes(dAtA, i, uint64(len(m.Depositor))) + i-- + dAtA[i] = 0x12 + } + if m.ProposalID != 0 { + i = encodeVarintTypes(dAtA, i, uint64(m.ProposalID)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + +func (m *ProposalBase) 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 *ProposalBase) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *ProposalBase) 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):]) + if err2 != nil { + return 0, err2 + } + i -= n2 + i = encodeVarintTypes(dAtA, i, uint64(n2)) + i-- + dAtA[i] = 0x3a + if len(m.TotalDeposit) > 0 { + for iNdEx := len(m.TotalDeposit) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.TotalDeposit[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTypes(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x32 + } + } + 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):]) + if err4 != nil { + return 0, err4 + } + i -= n4 + i = encodeVarintTypes(dAtA, i, uint64(n4)) + i-- + dAtA[i] = 0x22 + { + size, err := m.FinalTallyResult.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTypes(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1a + if m.Status != 0 { + i = encodeVarintTypes(dAtA, i, uint64(m.Status)) + i-- + dAtA[i] = 0x10 + } + if m.ProposalID != 0 { + i = encodeVarintTypes(dAtA, i, uint64(m.ProposalID)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + +func (m *TallyResult) 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 *TallyResult) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *TallyResult) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + { + size := m.NoWithVeto.Size() + i -= size + if _, err := m.NoWithVeto.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintTypes(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x22 + { + size := m.No.Size() + i -= size + if _, err := m.No.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintTypes(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1a + { + size := m.Abstain.Size() + i -= size + if _, err := m.Abstain.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintTypes(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + { + size := m.Yes.Size() + i -= size + if _, err := m.Yes.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintTypes(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil +} + +func (m *Vote) 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 *Vote) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Vote) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Option != 0 { + i = encodeVarintTypes(dAtA, i, uint64(m.Option)) + i-- + dAtA[i] = 0x18 + } + if len(m.Voter) > 0 { + i -= len(m.Voter) + copy(dAtA[i:], m.Voter) + i = encodeVarintTypes(dAtA, i, uint64(len(m.Voter))) + i-- + dAtA[i] = 0x12 + } + if m.ProposalID != 0 { + i = encodeVarintTypes(dAtA, i, uint64(m.ProposalID)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + +func encodeVarintTypes(dAtA []byte, offset int, v uint64) int { + offset -= sovTypes(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *MsgSubmitProposalBase) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.InitialDeposit) > 0 { + for _, e := range m.InitialDeposit { + l = e.Size() + n += 1 + l + sovTypes(uint64(l)) + } + } + l = len(m.Proposer) + if l > 0 { + n += 1 + l + sovTypes(uint64(l)) + } + return n +} + +func (m *MsgVote) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.ProposalID != 0 { + n += 1 + sovTypes(uint64(m.ProposalID)) + } + l = len(m.Voter) + if l > 0 { + n += 1 + l + sovTypes(uint64(l)) + } + if m.Option != 0 { + n += 1 + sovTypes(uint64(m.Option)) + } + return n +} + +func (m *MsgDeposit) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.ProposalID != 0 { + n += 1 + sovTypes(uint64(m.ProposalID)) + } + l = len(m.Depositor) + if l > 0 { + n += 1 + l + sovTypes(uint64(l)) + } + if len(m.Amount) > 0 { + for _, e := range m.Amount { + l = e.Size() + n += 1 + l + sovTypes(uint64(l)) + } + } + return n +} + +func (m *TextProposal) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Title) + if l > 0 { + n += 1 + l + sovTypes(uint64(l)) + } + l = len(m.Description) + if l > 0 { + n += 1 + l + sovTypes(uint64(l)) + } + return n +} + +func (m *Deposit) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.ProposalID != 0 { + n += 1 + sovTypes(uint64(m.ProposalID)) + } + l = len(m.Depositor) + if l > 0 { + n += 1 + l + sovTypes(uint64(l)) + } + if len(m.Amount) > 0 { + for _, e := range m.Amount { + l = e.Size() + n += 1 + l + sovTypes(uint64(l)) + } + } + return n +} + +func (m *ProposalBase) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.ProposalID != 0 { + n += 1 + sovTypes(uint64(m.ProposalID)) + } + if m.Status != 0 { + n += 1 + sovTypes(uint64(m.Status)) + } + l = m.FinalTallyResult.Size() + n += 1 + l + sovTypes(uint64(l)) + l = github_com_gogo_protobuf_types.SizeOfStdTime(m.SubmitTime) + n += 1 + l + sovTypes(uint64(l)) + l = github_com_gogo_protobuf_types.SizeOfStdTime(m.DepositEndTime) + n += 1 + l + sovTypes(uint64(l)) + if len(m.TotalDeposit) > 0 { + for _, e := range m.TotalDeposit { + l = e.Size() + n += 1 + l + sovTypes(uint64(l)) + } + } + l = github_com_gogo_protobuf_types.SizeOfStdTime(m.VotingStartTime) + n += 1 + l + sovTypes(uint64(l)) + l = github_com_gogo_protobuf_types.SizeOfStdTime(m.VotingEndTime) + n += 1 + l + sovTypes(uint64(l)) + return n +} + +func (m *TallyResult) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.Yes.Size() + n += 1 + l + sovTypes(uint64(l)) + l = m.Abstain.Size() + n += 1 + l + sovTypes(uint64(l)) + l = m.No.Size() + n += 1 + l + sovTypes(uint64(l)) + l = m.NoWithVeto.Size() + n += 1 + l + sovTypes(uint64(l)) + return n +} + +func (m *Vote) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.ProposalID != 0 { + n += 1 + sovTypes(uint64(m.ProposalID)) + } + l = len(m.Voter) + if l > 0 { + n += 1 + l + sovTypes(uint64(l)) + } + if m.Option != 0 { + n += 1 + sovTypes(uint64(m.Option)) + } + return n +} + +func sovTypes(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozTypes(x uint64) (n int) { + return sovTypes(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *MsgSubmitProposalBase) 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 ErrIntOverflowTypes + } + 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: MsgSubmitProposalBase: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgSubmitProposalBase: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field InitialDeposit", 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 + } + m.InitialDeposit = append(m.InitialDeposit, types.Coin{}) + if err := m.InitialDeposit[len(m.InitialDeposit)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Proposer", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Proposer = append(m.Proposer[:0], dAtA[iNdEx:postIndex]...) + if m.Proposer == nil { + m.Proposer = []byte{} + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipTypes(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *MsgVote) 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 ErrIntOverflowTypes + } + 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: MsgVote: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgVote: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field ProposalID", wireType) + } + m.ProposalID = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.ProposalID |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Voter", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Voter = append(m.Voter[:0], dAtA[iNdEx:postIndex]...) + if m.Voter == nil { + m.Voter = []byte{} + } + iNdEx = postIndex + case 3: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Option", wireType) + } + m.Option = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Option |= VoteOption(b&0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := skipTypes(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *MsgDeposit) 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 ErrIntOverflowTypes + } + 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: MsgDeposit: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgDeposit: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field ProposalID", wireType) + } + m.ProposalID = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.ProposalID |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Depositor", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Depositor = append(m.Depositor[:0], dAtA[iNdEx:postIndex]...) + if m.Depositor == nil { + m.Depositor = []byte{} + } + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Amount", 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 + } + m.Amount = append(m.Amount, types.Coin{}) + if err := m.Amount[len(m.Amount)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipTypes(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *TextProposal) 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 ErrIntOverflowTypes + } + 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: TextProposal: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: TextProposal: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Title", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Title = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Description", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Description = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipTypes(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *Deposit) 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 ErrIntOverflowTypes + } + 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: Deposit: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Deposit: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field ProposalID", wireType) + } + m.ProposalID = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.ProposalID |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Depositor", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Depositor = append(m.Depositor[:0], dAtA[iNdEx:postIndex]...) + if m.Depositor == nil { + m.Depositor = []byte{} + } + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Amount", 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 + } + m.Amount = append(m.Amount, types.Coin{}) + if err := m.Amount[len(m.Amount)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipTypes(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *ProposalBase) 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 ErrIntOverflowTypes + } + 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: ProposalBase: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: ProposalBase: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field ProposalID", wireType) + } + m.ProposalID = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.ProposalID |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Status", wireType) + } + m.Status = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Status |= ProposalStatus(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field FinalTallyResult", 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 err := m.FinalTallyResult.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field SubmitTime", 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 err := github_com_gogo_protobuf_types.StdTimeUnmarshal(&m.SubmitTime, dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 5: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field DepositEndTime", 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 err := github_com_gogo_protobuf_types.StdTimeUnmarshal(&m.DepositEndTime, dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 6: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field TotalDeposit", 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 + } + m.TotalDeposit = append(m.TotalDeposit, types.Coin{}) + if err := m.TotalDeposit[len(m.TotalDeposit)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 7: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field VotingStartTime", 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 err := github_com_gogo_protobuf_types.StdTimeUnmarshal(&m.VotingStartTime, dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 8: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field VotingEndTime", 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 err := github_com_gogo_protobuf_types.StdTimeUnmarshal(&m.VotingEndTime, dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipTypes(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *TallyResult) 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 ErrIntOverflowTypes + } + 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: TallyResult: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: TallyResult: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Yes", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.Yes.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Abstain", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.Abstain.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field No", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.No.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field NoWithVeto", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.NoWithVeto.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipTypes(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *Vote) 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 ErrIntOverflowTypes + } + 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: Vote: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Vote: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field ProposalID", wireType) + } + m.ProposalID = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.ProposalID |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Voter", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Voter = append(m.Voter[:0], dAtA[iNdEx:postIndex]...) + if m.Voter == nil { + m.Voter = []byte{} + } + iNdEx = postIndex + case 3: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Option", wireType) + } + m.Option = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Option |= VoteOption(b&0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := skipTypes(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipTypes(dAtA []byte) (n int, err error) { + l := len(dAtA) + iNdEx := 0 + depth := 0 + for iNdEx < l { + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowTypes + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + wireType := int(wire & 0x7) + switch wireType { + case 0: + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowTypes + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + iNdEx++ + if dAtA[iNdEx-1] < 0x80 { + break + } + } + case 1: + iNdEx += 8 + case 2: + var length int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowTypes + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + length |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if length < 0 { + return 0, ErrInvalidLengthTypes + } + iNdEx += length + case 3: + depth++ + case 4: + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupTypes + } + depth-- + case 5: + iNdEx += 4 + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + if iNdEx < 0 { + return 0, ErrInvalidLengthTypes + } + if depth == 0 { + return iNdEx, nil + } + } + return 0, io.ErrUnexpectedEOF +} + +var ( + ErrInvalidLengthTypes = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowTypes = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupTypes = fmt.Errorf("proto: unexpected end of group") +) diff --git a/x/gov/types/types.proto b/x/gov/types/types.proto new file mode 100644 index 000000000..ea6da041a --- /dev/null +++ b/x/gov/types/types.proto @@ -0,0 +1,165 @@ +syntax = "proto3"; +package cosmos_sdk.x.gov.v1; + +import "types/types.proto"; +import "third_party/proto/gogoproto/gogo.proto"; +import "google/protobuf/timestamp.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 +// 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 { + option (gogoproto.equal) = true; + + repeated cosmos_sdk.v1.Coin initial_deposit = 1 [ + (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"]; +} + +// MsgVote defines a message to cast a vote +message MsgVote { + option (gogoproto.equal) = true; + + uint64 proposal_id = 1 [ + (gogoproto.customname) = "ProposalID", + (gogoproto.moretags) = "yaml:\"proposal_id\"", + (gogoproto.jsontag) = "proposal_id" + ]; + bytes voter = 2 [(gogoproto.casttype) = "github.com/cosmos/cosmos-sdk/types.AccAddress"]; + VoteOption option = 3; +} + +// MsgDeposit defines a message to submit a deposit to an existing proposal +message MsgDeposit { + option (gogoproto.equal) = true; + + uint64 proposal_id = 1 [ + (gogoproto.customname) = "ProposalID", + (gogoproto.moretags) = "yaml:\"proposal_id\"", + (gogoproto.jsontag) = "proposal_id" + ]; + bytes depositor = 2 [(gogoproto.casttype) = "github.com/cosmos/cosmos-sdk/types.AccAddress"]; + repeated cosmos_sdk.v1.Coin amount = 3 + [(gogoproto.nullable) = false, (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins"]; +} + +// VoteOption defines a vote option +enum VoteOption { + option (gogoproto.enum_stringer) = false; + option (gogoproto.goproto_enum_stringer) = false; + option (gogoproto.goproto_enum_prefix) = false; + + // VOTE_OPTION_UNSPECIFIED defines a no-op vote option. + VOTE_OPTION_UNSPECIFIED = 0 [(gogoproto.enumvalue_customname) = "OptionEmpty"]; + // VOTE_OPTION_YES defines a yes vote option. + VOTE_OPTION_YES = 1 [(gogoproto.enumvalue_customname) = "OptionYes"]; + // VOTE_OPTION_ABSTAIN defines an abstain vote option. + VOTE_OPTION_ABSTAIN = 2 [(gogoproto.enumvalue_customname) = "OptionAbstain"]; + // VOTE_OPTION_NO defines a no vote option. + VOTE_OPTION_NO = 3 [(gogoproto.enumvalue_customname) = "OptionNo"]; + // VOTE_OPTION_NO_WITH_VETO defines a no with veto vote option. + VOTE_OPTION_NO_WITH_VETO = 4 [(gogoproto.enumvalue_customname) = "OptionNoWithVeto"]; +} + +// TextProposal defines a standard text proposal whose changes need to be +// manually updated in case of approval +message TextProposal { + option (gogoproto.equal) = true; + + string title = 1; + string description = 2; +} + +// Deposit defines an amount deposited by an account address to an active proposal +message Deposit { + option (gogoproto.equal) = true; + + uint64 proposal_id = 1 [(gogoproto.customname) = "ProposalID", (gogoproto.moretags) = "yaml:\"proposal_id\""]; + bytes depositor = 2 [(gogoproto.casttype) = "github.com/cosmos/cosmos-sdk/types.AccAddress"]; + repeated cosmos_sdk.v1.Coin amount = 3 + [(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 { + 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 + [(gogoproto.nullable) = false, (gogoproto.moretags) = "yaml:\"final_tally_result\""]; + google.protobuf.Timestamp submit_time = 4 + [(gogoproto.stdtime) = true, (gogoproto.nullable) = false, (gogoproto.moretags) = "yaml:\"submit_time\""]; + google.protobuf.Timestamp deposit_end_time = 5 + [(gogoproto.stdtime) = true, (gogoproto.nullable) = false, (gogoproto.moretags) = "yaml:\"deposit_end_time\""]; + repeated cosmos_sdk.v1.Coin total_deposit = 6 [ + (gogoproto.nullable) = false, + (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins", + (gogoproto.moretags) = "yaml:\"total_deposit\"" + ]; + google.protobuf.Timestamp voting_start_time = 7 + [(gogoproto.stdtime) = true, (gogoproto.nullable) = false, (gogoproto.moretags) = "yaml:\"voting_start_time\""]; + google.protobuf.Timestamp voting_end_time = 8 + [(gogoproto.stdtime) = true, (gogoproto.nullable) = false, (gogoproto.moretags) = "yaml:\"voting_end_time\""]; +} + +// ProposalStatus is a type alias that represents a proposal status as a byte +enum ProposalStatus { + option (gogoproto.enum_stringer) = false; + option (gogoproto.goproto_enum_stringer) = false; + option (gogoproto.goproto_enum_prefix) = false; + + // PROPOSAL_STATUS_UNSPECIFIED defines the default propopsal status. + PROPOSAL_STATUS_UNSPECIFIED = 0 [(gogoproto.enumvalue_customname) = "StatusNil"]; + // PROPOSAL_STATUS_DEPOSIT_PERIOD defines a proposal status during the deposit period. + PROPOSAL_STATUS_DEPOSIT_PERIOD = 1 [(gogoproto.enumvalue_customname) = "StatusDepositPeriod"]; + // PROPOSAL_STATUS_VOTING_PERIOD defines a proposal status during the voting period. + PROPOSAL_STATUS_VOTING_PERIOD = 2 [(gogoproto.enumvalue_customname) = "StatusVotingPeriod"]; + // PROPOSAL_STATUS_PASSED defines a proposal status of a proposal that has passed. + PROPOSAL_STATUS_PASSED = 3 [(gogoproto.enumvalue_customname) = "StatusPassed"]; + // PROPOSAL_STATUS_REJECTED defines a proposal status of a proposal that has been rejected. + PROPOSAL_STATUS_REJECTED = 4 [(gogoproto.enumvalue_customname) = "StatusRejected"]; + // PROPOSAL_STATUS_FAILED defines a proposal status of a proposal that has failed. + PROPOSAL_STATUS_FAILED = 5 [(gogoproto.enumvalue_customname) = "StatusFailed"]; +} + +// TallyResult defines a standard tally for a proposal +message TallyResult { + option (gogoproto.equal) = true; + + string yes = 1 [(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int", (gogoproto.nullable) = false]; + string abstain = 2 [(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int", (gogoproto.nullable) = false]; + string no = 3 [(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int", (gogoproto.nullable) = false]; + string no_with_veto = 4 [ + (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int", + (gogoproto.nullable) = false, + (gogoproto.moretags) = "yaml:\"no_with_veto\"" + ]; +} + +// Vote defines a vote on a governance proposal. A vote corresponds to a proposal +// ID, the voter, and the vote option. +message Vote { + option (gogoproto.equal) = true; + + uint64 proposal_id = 1 [(gogoproto.customname) = "ProposalID", (gogoproto.moretags) = "yaml:\"proposal_id\""]; + bytes voter = 2 [(gogoproto.casttype) = "github.com/cosmos/cosmos-sdk/types.AccAddress"]; + VoteOption option = 3; +} diff --git a/x/gov/types/vote.go b/x/gov/types/vote.go index ca49fdb6f..13eb41f75 100644 --- a/x/gov/types/vote.go +++ b/x/gov/types/vote.go @@ -4,28 +4,39 @@ import ( "encoding/json" "fmt" + "gopkg.in/yaml.v2" + sdk "github.com/cosmos/cosmos-sdk/types" ) -// Vote -type Vote struct { - ProposalID uint64 `json:"proposal_id" yaml:"proposal_id"` // proposalID of the proposal - Voter sdk.AccAddress `json:"voter" yaml:"voter"` // address of the voter - Option VoteOption `json:"option" yaml:"option"` // option from OptionSet chosen by the voter -} - // NewVote creates a new Vote instance func NewVote(proposalID uint64, voter sdk.AccAddress, option VoteOption) Vote { return Vote{proposalID, voter, option} } func (v Vote) String() string { - return fmt.Sprintf("voter %s voted with option %s on proposal %d", v.Voter, v.Option, v.ProposalID) + out, _ := yaml.Marshal(v) + return string(out) } // Votes is a collection of Vote objects type Votes []Vote +// Equal returns true if two slices (order-dependant) of votes are equal. +func (v Votes) Equal(other Votes) bool { + if len(v) != len(other) { + return false + } + + for i, vote := range v { + if !vote.Equal(other[i]) { + return false + } + } + + return true +} + func (v Votes) String() string { if len(v) == 0 { return "[]" @@ -37,30 +48,11 @@ func (v Votes) String() string { return out } -// Equals returns whether two votes are equal. -func (v Vote) Equals(comp Vote) bool { - return v.Voter.Equals(comp.Voter) && - v.ProposalID == comp.ProposalID && - v.Option == comp.Option -} - // Empty returns whether a vote is empty. func (v Vote) Empty() bool { - return v.Equals(Vote{}) + return v.Equal(Vote{}) } -// VoteOption defines a vote option -type VoteOption byte - -// Vote options -const ( - OptionEmpty VoteOption = 0x00 - OptionYes VoteOption = 0x01 - OptionAbstain VoteOption = 0x02 - OptionNo VoteOption = 0x03 - OptionNoWithVeto VoteOption = 0x04 -) - // VoteOptionFromString returns a VoteOption from a string. It returns an error // if the string is invalid. func VoteOptionFromString(str string) (VoteOption, error) { diff --git a/x/staking/keeper/common_test.go b/x/staking/keeper/common_test.go index 30306adc6..d71737ddc 100644 --- a/x/staking/keeper/common_test.go +++ b/x/staking/keeper/common_test.go @@ -3,14 +3,15 @@ package keeper_test import ( "testing" + abci "github.com/tendermint/tendermint/abci/types" + "github.com/cosmos/cosmos-sdk/codec" "github.com/cosmos/cosmos-sdk/simapp" - cdc "github.com/cosmos/cosmos-sdk/simapp/codec" + simappcodec "github.com/cosmos/cosmos-sdk/simapp/codec" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/x/staking" "github.com/cosmos/cosmos-sdk/x/staking/keeper" "github.com/cosmos/cosmos-sdk/x/staking/types" - abci "github.com/tendermint/tendermint/abci/types" ) var ( @@ -23,7 +24,7 @@ func createTestInput() (*codec.Codec, *simapp.SimApp, sdk.Context) { app := simapp.Setup(false) ctx := app.BaseApp.NewContext(false, abci.Header{}) - appCodec := cdc.NewAppCodec(codec.New()) + appCodec := simappcodec.NewAppCodec(codec.New()) app.StakingKeeper = keeper.NewKeeper( appCodec, diff --git a/x/upgrade/types/types.pb.go b/x/upgrade/types/types.pb.go index 8cc9e383b..f8c8f1ffd 100644 --- a/x/upgrade/types/types.pb.go +++ b/x/upgrade/types/types.pb.go @@ -164,32 +164,123 @@ func init() { func init() { proto.RegisterFile("x/upgrade/types/types.proto", fileDescriptor_2a308fd9dd71aff8) } var fileDescriptor_2a308fd9dd71aff8 = []byte{ - // 364 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x52, 0x31, 0x6f, 0xe2, 0x30, - 0x18, 0x8d, 0x8f, 0x1c, 0x3a, 0xcc, 0x66, 0x9d, 0x8e, 0x88, 0x13, 0x26, 0x62, 0xa8, 0x18, 0x5a, - 0x47, 0xa5, 0x43, 0x3b, 0xd3, 0xbd, 0x42, 0x69, 0xab, 0x4a, 0x5d, 0x90, 0x49, 0x4c, 0x62, 0x91, - 0xc4, 0x56, 0x6c, 0x5a, 0xd8, 0x3a, 0x77, 0xe2, 0x67, 0x31, 0x32, 0x32, 0xb5, 0x05, 0xfe, 0x48, - 0x95, 0x18, 0xd4, 0xaa, 0x52, 0xb7, 0x2e, 0xf6, 0xfb, 0xac, 0xf7, 0xbd, 0xf7, 0x3e, 0xdb, 0xf0, - 0xff, 0xcc, 0x9b, 0xca, 0x28, 0xa7, 0x21, 0xf3, 0xf4, 0x5c, 0x32, 0x65, 0x56, 0x22, 0x73, 0xa1, - 0x05, 0x6a, 0x04, 0x42, 0xa5, 0x42, 0x0d, 0x55, 0x38, 0x21, 0x33, 0xb2, 0xe7, 0x91, 0x87, 0xd3, - 0xe6, 0x91, 0x8e, 0x79, 0x1e, 0x0e, 0x25, 0xcd, 0xf5, 0xdc, 0x2b, 0xb9, 0x5e, 0x24, 0x22, 0xf1, - 0x81, 0x8c, 0x40, 0xb3, 0x1d, 0x09, 0x11, 0x25, 0xcc, 0x50, 0x46, 0xd3, 0xb1, 0xa7, 0x79, 0xca, - 0x94, 0xa6, 0xa9, 0x34, 0x84, 0xce, 0x13, 0x80, 0xf6, 0x20, 0xa1, 0x19, 0x42, 0xd0, 0xce, 0x68, - 0xca, 0x1c, 0xe0, 0x82, 0x6e, 0xcd, 0x2f, 0x31, 0xba, 0x80, 0x76, 0xc1, 0x77, 0x7e, 0xb9, 0xa0, - 0x5b, 0xef, 0x35, 0x89, 0x11, 0x23, 0x07, 0x31, 0x72, 0x73, 0x10, 0xeb, 0xff, 0x59, 0xbe, 0xb4, - 0xad, 0xc5, 0x6b, 0x1b, 0xf8, 0x65, 0x07, 0xfa, 0x07, 0xab, 0x31, 0xe3, 0x51, 0xac, 0x9d, 0x8a, - 0x0b, 0xba, 0x15, 0x7f, 0x5f, 0x15, 0x2e, 0x3c, 0x1b, 0x0b, 0xc7, 0x36, 0x2e, 0x05, 0xee, 0x3c, - 0x03, 0xd8, 0xb8, 0x16, 0x63, 0xfd, 0x48, 0x73, 0x76, 0x6b, 0x46, 0x1c, 0xe4, 0x42, 0x0a, 0x45, - 0x13, 0xf4, 0x17, 0xfe, 0xd6, 0x5c, 0x27, 0x87, 0x58, 0xa6, 0x40, 0x2e, 0xac, 0x87, 0x4c, 0x05, - 0x39, 0x97, 0x9a, 0x8b, 0xac, 0x8c, 0x57, 0xf3, 0x3f, 0x1f, 0xa1, 0x73, 0x68, 0xcb, 0x84, 0x66, - 0xa5, 0x7b, 0xbd, 0xd7, 0x22, 0xdf, 0xdc, 0x23, 0x29, 0x46, 0xef, 0xdb, 0x45, 0x78, 0xbf, 0x6c, - 0xe8, 0xdc, 0xc1, 0xd6, 0x25, 0xcd, 0x02, 0x96, 0xfc, 0x70, 0xa2, 0xfe, 0xd5, 0x72, 0x83, 0xad, - 0xf5, 0x06, 0x5b, 0xcb, 0x2d, 0x06, 0xab, 0x2d, 0x06, 0x6f, 0x5b, 0x0c, 0x16, 0x3b, 0x6c, 0xad, - 0x76, 0xd8, 0x5a, 0xef, 0xb0, 0x75, 0x7f, 0x1c, 0x71, 0x1d, 0x4f, 0x47, 0x24, 0x10, 0xa9, 0x67, - 0xf2, 0xee, 0xb7, 0x13, 0x15, 0x4e, 0xbc, 0x2f, 0xdf, 0x64, 0x54, 0x2d, 0x5f, 0xe1, 0xec, 0x3d, - 0x00, 0x00, 0xff, 0xff, 0x0f, 0x77, 0x53, 0x0a, 0x40, 0x02, 0x00, 0x00, + // 379 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x92, 0x41, 0x6f, 0xda, 0x30, + 0x14, 0xc7, 0xe3, 0x91, 0xa1, 0x61, 0x6e, 0xd6, 0x34, 0x22, 0x26, 0x9c, 0x88, 0xc3, 0xc4, 0x61, + 0x73, 0x34, 0x76, 0xd8, 0xb4, 0x23, 0xbb, 0x4f, 0x28, 0x5b, 0x2f, 0x95, 0x2a, 0x64, 0x12, 0x93, + 0x58, 0x24, 0xb1, 0x15, 0x9b, 0x16, 0xbe, 0x40, 0xcf, 0x7c, 0x84, 0x7e, 0x1c, 0x8e, 0x1c, 0x39, + 0xb5, 0x05, 0x2e, 0xfd, 0x18, 0x55, 0xe2, 0xa0, 0x56, 0x95, 0x7a, 0xeb, 0x25, 0x79, 0xcf, 0xfa, + 0xbf, 0xff, 0xfb, 0xbd, 0x67, 0xc3, 0xcf, 0x4b, 0x7f, 0x21, 0xe3, 0x82, 0x46, 0xcc, 0xd7, 0x2b, + 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, 0xd0, 0x4f, 0x68, 0xcb, 0x94, 0xe6, 0x15, 0x43, 0x7b, 0xd8, + 0x23, 0xaf, 0x6c, 0x93, 0x94, 0x0b, 0x18, 0xd9, 0xe5, 0x08, 0x41, 0x55, 0x50, 0x23, 0x5d, 0xc0, + 0xde, 0x1f, 0x9a, 0x87, 0x2c, 0x7d, 0x63, 0x2e, 0x63, 0x3f, 0xfa, 0xbb, 0xd9, 0x63, 0x6b, 0xb7, + 0xc7, 0xd6, 0xe6, 0x80, 0xc1, 0xf6, 0x80, 0xc1, 0xfd, 0x01, 0x83, 0xf5, 0x11, 0x5b, 0xdb, 0x23, + 0xb6, 0x76, 0x47, 0x6c, 0x9d, 0x7f, 0x8d, 0xb9, 0x4e, 0x16, 0x53, 0x12, 0x8a, 0xcc, 0x37, 0xec, + 0xf5, 0xef, 0x9b, 0x8a, 0xe6, 0xfe, 0x8b, 0x87, 0x33, 0x6d, 0x56, 0xf7, 0xf2, 0xe3, 0x31, 0x00, + 0x00, 0xff, 0xff, 0x45, 0x05, 0x01, 0x90, 0x52, 0x02, 0x00, 0x00, } +func (this *Plan) Equal(that interface{}) bool { + if that == nil { + return this == nil + } + + that1, ok := that.(*Plan) + if !ok { + that2, ok := that.(Plan) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + return this == nil + } else if this == nil { + return false + } + if this.Name != that1.Name { + return false + } + if !this.Time.Equal(that1.Time) { + return false + } + if this.Height != that1.Height { + return false + } + if this.Info != that1.Info { + return false + } + return true +} +func (this *SoftwareUpgradeProposal) Equal(that interface{}) bool { + if that == nil { + return this == nil + } + + that1, ok := that.(*SoftwareUpgradeProposal) + if !ok { + that2, ok := that.(SoftwareUpgradeProposal) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + return this == nil + } else if this == nil { + return false + } + if this.Title != that1.Title { + return false + } + if this.Description != that1.Description { + return false + } + if !this.Plan.Equal(&that1.Plan) { + return false + } + return true +} +func (this *CancelSoftwareUpgradeProposal) Equal(that interface{}) bool { + if that == nil { + return this == nil + } + + that1, ok := that.(*CancelSoftwareUpgradeProposal) + if !ok { + that2, ok := that.(CancelSoftwareUpgradeProposal) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + return this == nil + } else if this == nil { + return false + } + if this.Title != that1.Title { + return false + } + if this.Description != that1.Description { + return false + } + return true +} func (m *Plan) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) diff --git a/x/upgrade/types/types.proto b/x/upgrade/types/types.proto index 8770158c4..ba1191773 100644 --- a/x/upgrade/types/types.proto +++ b/x/upgrade/types/types.proto @@ -4,41 +4,47 @@ package cosmos_sdk.x.upgrade.v1; import "third_party/proto/gogoproto/gogo.proto"; import "google/protobuf/timestamp.proto"; -option go_package = "github.com/cosmos/cosmos-sdk/x/upgrade/types"; +option go_package = "github.com/cosmos/cosmos-sdk/x/upgrade/types"; option (gogoproto.goproto_stringer_all) = false; -option (gogoproto.goproto_getters_all) = false; +option (gogoproto.goproto_getters_all) = false; // Plan specifies information about a planned upgrade and when it should occur message Plan { - // Sets the name for the upgrade. This name will be used by the upgraded version of the software to apply any - // special "on-upgrade" commands during the first BeginBlock method after the upgrade is applied. It is also used - // to detect whether a software version can handle a given upgrade. If no upgrade handler with this name has been - // set in the software, it will be assumed that the software is out-of-date when the upgrade Time or Height - // is reached and the software will exit. - string name = 1; + option (gogoproto.equal) = true; - // The time after which the upgrade must be performed. - // Leave set to its zero value to use a pre-defined Height instead. - google.protobuf.Timestamp time = 2 [(gogoproto.stdtime) = true, (gogoproto.nullable) = false]; + // Sets the name for the upgrade. This name will be used by the upgraded version of the software to apply any + // special "on-upgrade" commands during the first BeginBlock method after the upgrade is applied. It is also used + // to detect whether a software version can handle a given upgrade. If no upgrade handler with this name has been + // set in the software, it will be assumed that the software is out-of-date when the upgrade Time or Height + // is reached and the software will exit. + string name = 1; - // The height at which the upgrade must be performed. - // Only used if Time is not set. - int64 height = 3; + // The time after which the upgrade must be performed. + // Leave set to its zero value to use a pre-defined Height instead. + google.protobuf.Timestamp time = 2 [(gogoproto.stdtime) = true, (gogoproto.nullable) = false]; - // Any application specific upgrade info to be included on-chain - // such as a git commit that validators could automatically upgrade to - string info = 4; + // The height at which the upgrade must be performed. + // Only used if Time is not set. + int64 height = 3; + + // Any application specific upgrade info to be included on-chain + // such as a git commit that validators could automatically upgrade to + string info = 4; } // SoftwareUpgradeProposal is a gov Content type for initiating a software upgrade message SoftwareUpgradeProposal { - string title = 1; - string description = 2; - Plan plan = 3 [(gogoproto.nullable) = false]; + option (gogoproto.equal) = true; + + string title = 1; + string description = 2; + Plan plan = 3 [(gogoproto.nullable) = false]; } -// SoftwareUpgradeProposal is a gov Content type for cancelling a software upgrade +// CancelSoftwareUpgradeProposal is a gov Content type for cancelling a software upgrade message CancelSoftwareUpgradeProposal { - string title = 1; - string description = 2; + option (gogoproto.equal) = true; + + string title = 1; + string description = 2; }