From ce2445602c575c0fc09cae4a0a3eb819bcd024e2 Mon Sep 17 00:00:00 2001 From: Aaron Craelius Date: Tue, 5 May 2020 15:03:42 -0400 Subject: [PATCH 01/42] Update x/gov to use Any --- go.mod | 2 +- go.sum | 5 +- std/codec.go | 29 - std/codec.pb.go | 808 +++----------------- std/codec.proto | 20 - std/msgs.go | 55 -- std/msgs_test.go | 55 -- third_party/proto/cosmos-proto/cosmos.proto | 6 + x/distribution/client/cli/tx.go | 5 +- x/distribution/client/rest/rest.go | 5 +- x/gov/abci.go | 2 +- x/gov/alias.go | 61 +- x/gov/client/cli/tx.go | 2 +- x/gov/client/rest/tx.go | 2 +- x/gov/client/utils/query.go | 2 +- x/gov/keeper/keeper.go | 5 +- x/gov/keeper/proposal.go | 13 +- x/gov/module.go | 10 +- x/gov/simulation/decoder.go | 9 +- x/gov/simulation/operations.go | 3 +- x/gov/types/codec.go | 27 +- x/gov/types/msgs.go | 115 ++- x/gov/types/msgs_test.go | 2 +- x/gov/types/proposal.go | 82 +- x/gov/types/types.pb.go | 492 ++++++------ x/gov/types/types.proto | 41 +- x/params/client/cli/tx.go | 4 +- x/params/client/rest/rest.go | 2 +- x/upgrade/client/cli/tx.go | 4 +- x/upgrade/client/rest/tx.go | 4 +- 30 files changed, 637 insertions(+), 1235 deletions(-) delete mode 100644 std/msgs.go delete mode 100644 std/msgs_test.go diff --git a/go.mod b/go.mod index 049600965ca..18bb0b068dd 100644 --- a/go.mod +++ b/go.mod @@ -18,7 +18,7 @@ require ( github.com/pelletier/go-toml v1.7.0 github.com/pkg/errors v0.9.1 github.com/rakyll/statik v0.1.7 - github.com/regen-network/cosmos-proto v0.2.2 + github.com/regen-network/cosmos-proto v0.3.0 github.com/spf13/afero v1.2.2 // indirect github.com/spf13/cobra v1.0.0 github.com/spf13/jwalterweatherman v1.1.0 // indirect diff --git a/go.sum b/go.sum index af1d79b8091..c40c3a7d330 100644 --- a/go.sum +++ b/go.sum @@ -147,6 +147,7 @@ github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5y github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= github.com/golang/protobuf v1.3.3/go.mod h1:vzj43D7+SQXF/4pzW/hwtAqwc6iTitCiVSaWz5lYuqw= github.com/golang/protobuf v1.3.4/go.mod h1:vzj43D7+SQXF/4pzW/hwtAqwc6iTitCiVSaWz5lYuqw= +github.com/golang/protobuf v1.3.5/go.mod h1:6O5/vntMXwX2lRkT1hjjk0nAC1IDOTvTlVgjlRvqsdk= github.com/golang/protobuf v1.4.0-rc.1/go.mod h1:ceaxUfeHdC40wWswd/P6IGgMaK3YpKi5j83Wpe3EHw8= github.com/golang/protobuf v1.4.0-rc.1.0.20200221234624-67d41d38c208/go.mod h1:xKAWHe0F5eneWXFV3EuXVDTCmh+JuBKY0li0aMyXATA= github.com/golang/protobuf v1.4.0-rc.2/go.mod h1:LlEzMj4AhA7rCAGe4KMBDvJI+AwstrUpVNzEA03Pprs= @@ -374,8 +375,8 @@ github.com/rcrowley/go-metrics v0.0.0-20181016184325-3113b8401b8a h1:9ZKAASQSHhD github.com/rcrowley/go-metrics v0.0.0-20181016184325-3113b8401b8a/go.mod h1:bCqnVzQkZxMG4s8nGwiZ5l3QUCyqpo9Y+/ZMZ9VjZe4= github.com/rcrowley/go-metrics v0.0.0-20200313005456-10cdbea86bc0 h1:MkV+77GLUNo5oJ0jf870itWm3D0Sjh7+Za9gazKc5LQ= github.com/rcrowley/go-metrics v0.0.0-20200313005456-10cdbea86bc0/go.mod h1:bCqnVzQkZxMG4s8nGwiZ5l3QUCyqpo9Y+/ZMZ9VjZe4= -github.com/regen-network/cosmos-proto v0.2.2 h1:qAuQxio6lmZ3ghpeSMrhqT+Xq/FkuimzWD8o0YR9Gmo= -github.com/regen-network/cosmos-proto v0.2.2/go.mod h1:4jLYG3Qk6EtkOj3/FK7ziS5+LurpGPzJ41ungpzThcw= +github.com/regen-network/cosmos-proto v0.3.0 h1:24dVpPrPi0GDoPVLesf2Ug98iK5QgVscPl0ga4Eoub0= +github.com/regen-network/cosmos-proto v0.3.0/go.mod h1:zuP2jVPHab6+IIyOx3nXHFN+euFNeS3W8XQkcdd4s7A= github.com/regen-network/protobuf v1.3.2-alpha.regen.1 h1:YdeZbBS0lG1D13COb7b57+nM/RGgIs8WF9DwitU6EBM= github.com/regen-network/protobuf v1.3.2-alpha.regen.1/go.mod h1:lye6mqhOn/GCw1zRl3uPD5VP8rC+LPMyTyPAyQV872U= github.com/rogpeppe/fastuuid v0.0.0-20150106093220-6724a57986af/go.mod h1:XWv6SoW27p1b0cqNHllgS5HIMJraePCO15w5zCzIWYg= diff --git a/std/codec.go b/std/codec.go index 5557363f515..c7e333f8a9a 100644 --- a/std/codec.go +++ b/std/codec.go @@ -10,13 +10,11 @@ import ( "github.com/cosmos/cosmos-sdk/x/auth/vesting" "github.com/cosmos/cosmos-sdk/x/bank" bankexported "github.com/cosmos/cosmos-sdk/x/bank/exported" - gov "github.com/cosmos/cosmos-sdk/x/gov/types" ) var ( _ auth.Codec = (*Codec)(nil) _ bank.Codec = (*Codec)(nil) - _ gov.Codec = (*Codec)(nil) ) // Codec defines the application-level codec. This codec contains all the @@ -113,33 +111,6 @@ func (c *Codec) UnmarshalSupplyJSON(bz []byte) (bankexported.SupplyI, error) { return supply.GetSupplyI(), nil } -// MarshalProposal marshals a Proposal. It accepts a Proposal defined by the x/gov -// module and uses the application-level Proposal type which has the concrete -// Content implementation to serialize. -func (c *Codec) MarshalProposal(p gov.Proposal) ([]byte, error) { - proposal := &Proposal{ProposalBase: p.ProposalBase} - if err := proposal.Content.SetContent(p.Content); err != nil { - return nil, err - } - - return c.Marshaler.MarshalBinaryBare(proposal) -} - -// UnmarshalProposal decodes a Proposal defined by the x/gov module and uses the -// application-level Proposal type which has the concrete Content implementation -// to deserialize. -func (c *Codec) UnmarshalProposal(bz []byte) (gov.Proposal, error) { - proposal := &Proposal{} - if err := c.Marshaler.UnmarshalBinaryBare(bz, proposal); err != nil { - return gov.Proposal{}, err - } - - return gov.Proposal{ - Content: proposal.Content.GetContent(), - ProposalBase: proposal.ProposalBase, - }, nil -} - // ---------------------------------------------------------------------------- // necessary types and interfaces registered. This codec is provided to all the // modules the application depends on. diff --git a/std/codec.pb.go b/std/codec.pb.go index 9f612475f72..057b82fd295 100644 --- a/std/codec.pb.go +++ b/std/codec.pb.go @@ -242,93 +242,6 @@ func (*Supply) XXX_OneofWrappers() []interface{} { } } -// MsgSubmitProposal defines the application-level message type for handling -// governance proposals. -type MsgSubmitProposal struct { - types3.MsgSubmitProposalBase `protobuf:"bytes,1,opt,name=base,proto3,embedded=base" json:"base"` - Content *Content `protobuf:"bytes,2,opt,name=content,proto3" json:"content,omitempty"` -} - -func (m *MsgSubmitProposal) Reset() { *m = MsgSubmitProposal{} } -func (m *MsgSubmitProposal) String() string { return proto.CompactTextString(m) } -func (*MsgSubmitProposal) ProtoMessage() {} -func (*MsgSubmitProposal) Descriptor() ([]byte, []int) { - return fileDescriptor_ff851c3a98ef46f7, []int{2} -} -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 { - types3.ProposalBase `protobuf:"bytes,1,opt,name=base,proto3,embedded=base" json:"base"` - Content Content `protobuf:"bytes,2,opt,name=content,proto3" json:"content"` -} - -func (m *Proposal) Reset() { *m = Proposal{} } -func (m *Proposal) String() string { return proto.CompactTextString(m) } -func (*Proposal) ProtoMessage() {} -func (*Proposal) Descriptor() ([]byte, []int) { - return fileDescriptor_ff851c3a98ef46f7, []int{3} -} -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 { @@ -347,7 +260,7 @@ func (m *Content) Reset() { *m = Content{} } func (m *Content) String() string { return proto.CompactTextString(m) } func (*Content) ProtoMessage() {} func (*Content) Descriptor() ([]byte, []int) { - return fileDescriptor_ff851c3a98ef46f7, []int{4} + return fileDescriptor_ff851c3a98ef46f7, []int{2} } func (m *Content) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -470,7 +383,7 @@ func (m *Transaction) Reset() { *m = Transaction{} } func (m *Transaction) String() string { return proto.CompactTextString(m) } func (*Transaction) ProtoMessage() {} func (*Transaction) Descriptor() ([]byte, []int) { - return fileDescriptor_ff851c3a98ef46f7, []int{5} + return fileDescriptor_ff851c3a98ef46f7, []int{3} } func (m *Transaction) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -512,7 +425,6 @@ type Message struct { // *Message_MsgWithdrawDelegatorReward // *Message_MsgWithdrawValidatorCommission // *Message_MsgFundCommunityPool - // *Message_MsgSubmitProposal // *Message_MsgVote // *Message_MsgDeposit // *Message_MsgUnjail @@ -528,7 +440,7 @@ func (m *Message) Reset() { *m = Message{} } func (m *Message) String() string { return proto.CompactTextString(m) } func (*Message) ProtoMessage() {} func (*Message) Descriptor() ([]byte, []int) { - return fileDescriptor_ff851c3a98ef46f7, []int{6} + return fileDescriptor_ff851c3a98ef46f7, []int{4} } func (m *Message) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -584,9 +496,6 @@ type Message_MsgWithdrawValidatorCommission struct { type Message_MsgFundCommunityPool struct { MsgFundCommunityPool *types5.MsgFundCommunityPool `protobuf:"bytes,7,opt,name=msg_fund_community_pool,json=msgFundCommunityPool,proto3,oneof" json:"msg_fund_community_pool,omitempty"` } -type Message_MsgSubmitProposal struct { - MsgSubmitProposal *MsgSubmitProposal `protobuf:"bytes,9,opt,name=msg_submit_proposal,json=msgSubmitProposal,proto3,oneof" json:"msg_submit_proposal,omitempty"` -} type Message_MsgVote struct { MsgVote *types3.MsgVote `protobuf:"bytes,10,opt,name=msg_vote,json=msgVote,proto3,oneof" json:"msg_vote,omitempty"` } @@ -619,7 +528,6 @@ func (*Message_MsgSetWithdrawAddress) isMessage_Sum() {} func (*Message_MsgWithdrawDelegatorReward) isMessage_Sum() {} func (*Message_MsgWithdrawValidatorCommission) isMessage_Sum() {} func (*Message_MsgFundCommunityPool) isMessage_Sum() {} -func (*Message_MsgSubmitProposal) isMessage_Sum() {} func (*Message_MsgVote) isMessage_Sum() {} func (*Message_MsgDeposit) isMessage_Sum() {} func (*Message_MsgUnjail) isMessage_Sum() {} @@ -685,13 +593,6 @@ func (m *Message) GetMsgFundCommunityPool() *types5.MsgFundCommunityPool { return nil } -func (m *Message) GetMsgSubmitProposal() *MsgSubmitProposal { - if x, ok := m.GetSum().(*Message_MsgSubmitProposal); ok { - return x.MsgSubmitProposal - } - return nil -} - func (m *Message) GetMsgVote() *types3.MsgVote { if x, ok := m.GetSum().(*Message_MsgVote); ok { return x.MsgVote @@ -758,7 +659,6 @@ func (*Message) XXX_OneofWrappers() []interface{} { (*Message_MsgWithdrawDelegatorReward)(nil), (*Message_MsgWithdrawValidatorCommission)(nil), (*Message_MsgFundCommunityPool)(nil), - (*Message_MsgSubmitProposal)(nil), (*Message_MsgVote)(nil), (*Message_MsgDeposit)(nil), (*Message_MsgUnjail)(nil), @@ -781,7 +681,7 @@ func (m *SignDoc) Reset() { *m = SignDoc{} } func (m *SignDoc) String() string { return proto.CompactTextString(m) } func (*SignDoc) ProtoMessage() {} func (*SignDoc) Descriptor() ([]byte, []int) { - return fileDescriptor_ff851c3a98ef46f7, []int{7} + return fileDescriptor_ff851c3a98ef46f7, []int{5} } func (m *SignDoc) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -829,7 +729,7 @@ func (m *StdFee) Reset() { *m = StdFee{} } func (m *StdFee) String() string { return proto.CompactTextString(m) } func (*StdFee) ProtoMessage() {} func (*StdFee) Descriptor() ([]byte, []int) { - return fileDescriptor_ff851c3a98ef46f7, []int{8} + return fileDescriptor_ff851c3a98ef46f7, []int{6} } func (m *StdFee) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -869,7 +769,7 @@ func (m *StdSignature) Reset() { *m = StdSignature{} } func (m *StdSignature) String() string { return proto.CompactTextString(m) } func (*StdSignature) ProtoMessage() {} func (*StdSignature) Descriptor() ([]byte, []int) { - return fileDescriptor_ff851c3a98ef46f7, []int{9} + return fileDescriptor_ff851c3a98ef46f7, []int{7} } func (m *StdSignature) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -910,7 +810,7 @@ func (m *StdTxBase) Reset() { *m = StdTxBase{} } func (m *StdTxBase) String() string { return proto.CompactTextString(m) } func (*StdTxBase) ProtoMessage() {} func (*StdTxBase) Descriptor() ([]byte, []int) { - return fileDescriptor_ff851c3a98ef46f7, []int{10} + return fileDescriptor_ff851c3a98ef46f7, []int{8} } func (m *StdTxBase) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -974,7 +874,7 @@ func (m *StdSignDocBase) Reset() { *m = StdSignDocBase{} } func (m *StdSignDocBase) String() string { return proto.CompactTextString(m) } func (*StdSignDocBase) ProtoMessage() {} func (*StdSignDocBase) Descriptor() ([]byte, []int) { - return fileDescriptor_ff851c3a98ef46f7, []int{11} + return fileDescriptor_ff851c3a98ef46f7, []int{9} } func (m *StdSignDocBase) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1041,8 +941,6 @@ func (m *StdSignDocBase) GetFee() StdFee { func init() { proto.RegisterType((*Account)(nil), "cosmos_sdk.std.v1.Account") proto.RegisterType((*Supply)(nil), "cosmos_sdk.std.v1.Supply") - proto.RegisterType((*MsgSubmitProposal)(nil), "cosmos_sdk.std.v1.MsgSubmitProposal") - proto.RegisterType((*Proposal)(nil), "cosmos_sdk.std.v1.Proposal") proto.RegisterType((*Content)(nil), "cosmos_sdk.std.v1.Content") proto.RegisterType((*Transaction)(nil), "cosmos_sdk.std.v1.Transaction") proto.RegisterType((*Message)(nil), "cosmos_sdk.std.v1.Message") @@ -1056,110 +954,104 @@ func init() { func init() { proto.RegisterFile("std/codec.proto", fileDescriptor_ff851c3a98ef46f7) } var fileDescriptor_ff851c3a98ef46f7 = []byte{ - // 1639 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x57, 0x4f, 0x6f, 0x1b, 0xb9, - 0x15, 0x97, 0x62, 0xc5, 0xb2, 0x69, 0xf9, 0x1f, 0x93, 0xd4, 0x8a, 0xeb, 0x48, 0x8e, 0x52, 0x04, - 0x69, 0x52, 0x4b, 0x71, 0x92, 0xa6, 0x8d, 0xd0, 0x7f, 0x91, 0x1d, 0x43, 0x6e, 0xeb, 0x36, 0x18, -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0f, 0x82, 0xd9, 0x46, 0xe9, 0xec, 0xb4, 0x9c, 0xdf, 0x92, 0xb2, 0xdd, 0xed, 0x0f, 0xa7, 0xe5, - 0xc5, 0xf0, 0x38, 0x22, 0xa3, 0x8a, 0x91, 0x57, 0xcb, 0x5d, 0x1b, 0xfe, 0x0c, 0x2c, 0xe8, 0x7f, - 0x52, 0xa6, 0x1b, 0xd0, 0x16, 0xf6, 0xc3, 0x64, 0x34, 0xae, 0x7e, 0x38, 0x2d, 0x5f, 0x09, 0x51, - 0x83, 0xfa, 0x8a, 0x31, 0xaf, 0x05, 0xbf, 0x52, 0x7b, 0xb8, 0x0a, 0x66, 0x38, 0xfe, 0x73, 0x80, - 0x5d, 0x2b, 0x7c, 0x9e, 0xe6, 0x8c, 0x78, 0x1f, 0xc7, 0x9f, 0xeb, 0xc7, 0x1f, 0x9d, 0xe6, 0xc5, - 0xf3, 0x9f, 0x66, 0xa3, 0xfe, 0xfa, 0xac, 0x94, 0x7d, 0x7b, 0x56, 0xca, 0x7e, 0x7e, 0x56, 0xca, - 0xfe, 0xfb, 0x5d, 0x29, 0xf3, 0xf6, 0x5d, 0x29, 0xf3, 0xe9, 0xbb, 0x52, 0xe6, 0x77, 0xeb, 0x13, - 0x4b, 0x8e, 0x0b, 0xbb, 0x35, 0xad, 0xfe, 0xe5, 0xdf, 0xff, 0x2a, 0x00, 0x00, 0xff, 0xff, 0x1a, - 0x12, 0x9f, 0x93, 0x9d, 0x11, 0x00, 0x00, + // 1541 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x57, 0xcf, 0x6f, 0x1b, 0xc5, + 0x17, 0xb7, 0x1b, 0x37, 0x6e, 0xc6, 0xce, 0xaf, 0xf9, 0xb6, 0xdf, 0xb8, 0xa1, 0xb5, 0x53, 0x17, + 0x55, 0xa5, 0x25, 0x76, 0xd3, 0x96, 0x42, 0x2d, 0x40, 0xd4, 0x49, 0x23, 0x07, 0x08, 0x54, 0x9b, + 0xb6, 0x08, 0x04, 0xac, 0xc6, 0xbb, 0x93, 0xcd, 0x10, 0xef, 0xce, 0xb2, 0x33, 0xeb, 0xd8, 0x48, + 0x9c, 0x40, 0x88, 0x72, 0xe2, 0xca, 0xad, 0x5c, 0x39, 0xf7, 0xc4, 0x5f, 0x50, 0xf5, 0xd4, 0x23, + 0x27, 0x83, 0xd2, 0x0b, 0xea, 0x09, 0xf5, 0x2f, 0x40, 0xf3, 0x63, 0xd7, 0x76, 0xbc, 0x71, 0x73, + 0xe0, 0x12, 0xed, 0xbc, 0xf7, 0x3e, 0x9f, 0xf7, 0xfc, 0x7e, 0xcc, 0x9b, 0x80, 0x59, 0xc6, 0xed, + 0xaa, 0x45, 0x6d, 0x6c, 0x55, 0xfc, 0x80, 0x72, 0x0a, 0xe7, 0x2d, 0xca, 0x5c, 0xca, 0x4c, 0x66, + 0xef, 0x56, 0x18, 0xb7, 0x2b, 0xed, 0x95, 0xc5, 0xcb, 0x7c, 0x87, 0x04, 0xb6, 0xe9, 0xa3, 0x80, + 0x77, 0xab, 0xd2, 0xaa, 0xaa, 0x8c, 0x96, 0x07, 0x0f, 0x0a, 0xbf, 0x78, 0x61, 0xd4, 0xd8, 0xa1, + 0x0e, 0xed, 0x7f, 0x69, 0xbb, 0x79, 0xde, 0xf5, 0x31, 0xab, 0xca, 0xbf, 0x5a, 0x54, 0xe8, 0x54, + 0x51, 0xc8, 0x77, 0xaa, 0xa3, 0x9a, 0x25, 0xad, 0x69, 0x63, 0xc6, 0x89, 0xe7, 0x54, 0x13, 0xb1, + 0x4d, 0xe4, 0xed, 0x26, 0x68, 0x16, 0x3b, 0x55, 0x2b, 0x20, 0x8c, 0xb0, 0x64, 0x5e, 0x9b, 0x30, + 0x1e, 0x90, 0x66, 0xc8, 0x09, 0xf5, 0x12, 0x2c, 0x16, 0x3a, 0x55, 0x87, 0xb6, 0x13, 0x14, 0x67, + 0x3a, 0x55, 0x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0x17, 0x2c, + 0x88, 0x50, 0xb6, 0x43, 0xcf, 0x36, 0x87, 0x67, 0xb6, 0x90, 0x95, 0x01, 0x5c, 0x7d, 0x69, 0x00, + 0xeb, 0xa1, 0x67, 0x0f, 0x0d, 0x6d, 0x23, 0x65, 0x88, 0x7e, 0x19, 0x91, 0xc3, 0x9b, 0xaa, 0x9f, + 0xdb, 0x94, 0xe3, 0x02, 0x48, 0xda, 0x05, 0xfa, 0x0e, 0x16, 0x8d, 0x43, 0x39, 0xd6, 0xed, 0x2c, + 0x3e, 0x61, 0x1d, 0xe4, 0x04, 0xd4, 0xc6, 0x3e, 0x65, 0x84, 0x17, 0x72, 0x12, 0x5d, 0x3a, 0x0c, + 0xbd, 0xa6, 0xcc, 0x1a, 0x29, 0x03, 0xb8, 0xf1, 0x09, 0xae, 0x01, 0x71, 0x32, 0x43, 0xef, 0x2b, + 0x44, 0x5a, 0x85, 0x7c, 0xd2, 0x7e, 0x8c, 0x5e, 0x5b, 0x9a, 0xe7, 0x9e, 0x34, 0x6d, 0xa4, 0x8c, + 0x29, 0x37, 0x3a, 0x40, 0x53, 0x0d, 0x83, 0x15, 0x60, 0xc4, 0x71, 0xbf, 0x74, 0x85, 0x69, 0xc9, + 0x77, 0xf9, 0x00, 0x9f, 0x7a, 0x9f, 0x69, 0xba, 0x55, 0x89, 0x89, 0xcb, 0xa0, 0xa7, 0xe1, 0x80, + 0x14, 0x7e, 0x0a, 0x84, 0xd4, 0xc4, 0x36, 0xe1, 0x03, 0xf4, 0x33, 0x92, 0xfe, 0xb5, 0x71, 0xf4, + 0xb7, 0x6d, 0xc2, 0x07, 0xc9, 0xe7, 0xdc, 0x03, 0x32, 0xb8, 0x01, 0xf2, 0x2a, 0x8b, 0xb2, 0x21, + 0x71, 0x61, 0x56, 0x92, 0xbe, 0x3a, 0x8e, 0x54, 0x37, 0xaf, 0x28, 0x46, 0xce, 0xed, 0x1f, 0xa3, + 0x34, 0x34, 0xb1, 0x43, 0x3c, 0x33,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x67, + 0xc5, 0xd4, 0xd3, 0x67, 0xc5, 0xd4, 0x1f, 0xcf, 0x8a, 0xa9, 0xcf, 0x96, 0xc6, 0xb6, 0x1c, 0xe3, + 0x76, 0x73, 0x52, 0xfe, 0x77, 0x79, 0xed, 0xdf, 0x00, 0x00, 0x00, 0xff, 0xff, 0x30, 0xbc, 0xa7, + 0x5f, 0x15, 0x10, 0x00, 0x00, } func (this *Supply) Equal(that interface{}) bool { @@ -1216,60 +1108,6 @@ func (this *Supply_Supply) 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 @@ -1582,9 +1420,6 @@ func (this *Message) GetMsg() github_com_cosmos_cosmos_sdk_types.Msg { if x := this.GetMsgFundCommunityPool(); x != nil { return x } - if x := this.GetMsgSubmitProposal(); x != nil { - return x - } if x := this.GetMsgVote(); x != nil { return x } @@ -1660,12 +1495,6 @@ func (this *Message) SetMsg(value github_com_cosmos_cosmos_sdk_types.Msg) error case types5.MsgFundCommunityPool: this.Sum = &Message_MsgFundCommunityPool{&vt} return nil - case *MsgSubmitProposal: - this.Sum = &Message_MsgSubmitProposal{vt} - return nil - case MsgSubmitProposal: - this.Sum = &Message_MsgSubmitProposal{&vt} - return nil case *types3.MsgVote: this.Sum = &Message_MsgVote{vt} return nil @@ -1908,94 +1737,6 @@ func (m *Supply_Supply) 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) @@ -2359,27 +2100,6 @@ func (m *Message_MsgFundCommunityPool) MarshalToSizedBuffer(dAtA []byte) (int, e } return len(dAtA) - i, nil } -func (m *Message_MsgSubmitProposal) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *Message_MsgSubmitProposal) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - if m.MsgSubmitProposal != nil { - { - size, err := m.MsgSubmitProposal.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintCodec(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x4a - } - return len(dAtA) - i, nil -} func (m *Message_MsgVote) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) @@ -2896,34 +2616,6 @@ func (m *Supply_Supply) 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 @@ -3109,18 +2801,6 @@ func (m *Message_MsgFundCommunityPool) Size() (n int) { } return n } -func (m *Message_MsgSubmitProposal) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.MsgSubmitProposal != nil { - l = m.MsgSubmitProposal.Size() - n += 1 + l + sovCodec(uint64(l)) - } - return n -} func (m *Message_MsgVote) Size() (n int) { if m == nil { return 0 @@ -3637,247 +3317,6 @@ func (m *Supply) 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 @@ -4500,41 +3939,6 @@ func (m *Message) Unmarshal(dAtA []byte) error { } m.Sum = &Message_MsgFundCommunityPool{v} iNdEx = postIndex - case 9: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field MsgSubmitProposal", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowCodec - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthCodec - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthCodec - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - v := &MsgSubmitProposal{} - if err := v.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - m.Sum = &Message_MsgSubmitProposal{v} - iNdEx = postIndex case 10: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field MsgVote", wireType) diff --git a/std/codec.proto b/std/codec.proto index 8f0bb11e7bb..15ae9ab030d 100644 --- a/std/codec.proto +++ b/std/codec.proto @@ -42,25 +42,6 @@ message Supply { } } -// 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 { @@ -101,7 +82,6 @@ message Message { cosmos_sdk.x.distribution.v1.MsgWithdrawDelegatorReward msg_withdraw_delegator_reward = 5; cosmos_sdk.x.distribution.v1.MsgWithdrawValidatorCommission msg_withdraw_validator_commission = 6; cosmos_sdk.x.distribution.v1.MsgFundCommunityPool msg_fund_community_pool = 7; - MsgSubmitProposal msg_submit_proposal = 9; cosmos_sdk.x.gov.v1.MsgVote msg_vote = 10; cosmos_sdk.x.gov.v1.MsgDeposit msg_deposit = 11; cosmos_sdk.x.slashing.v1.MsgUnjail msg_unjail = 12; diff --git a/std/msgs.go b/std/msgs.go deleted file mode 100644 index 259dad15602..00000000000 --- a/std/msgs.go +++ /dev/null @@ -1,55 +0,0 @@ -package std - -import ( - sdk "github.com/cosmos/cosmos-sdk/types" - sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" - gov "github.com/cosmos/cosmos-sdk/x/gov/types" -) - -var ( - _ gov.MsgSubmitProposalI = &MsgSubmitProposal{} -) - -// NewMsgSubmitProposal returns a new MsgSubmitProposal. -func NewMsgSubmitProposal(c gov.Content, d sdk.Coins, p sdk.AccAddress) (gov.MsgSubmitProposalI, error) { - content := &Content{} - if err := content.SetContent(c); err != nil { - return nil, err - } - - return &MsgSubmitProposal{ - Content: content, - MsgSubmitProposalBase: gov.NewMsgSubmitProposalBase(d, p), - }, nil -} - -// ValidateBasic performs basic (non-state-dependant) validation on a -// MsgSubmitProposal. -func (msg MsgSubmitProposal) ValidateBasic() error { - if err := msg.MsgSubmitProposalBase.ValidateBasic(); err != nil { - return nil - } - if msg.Content == nil { - return sdkerrors.Wrap(gov.ErrInvalidProposalContent, "missing content") - } - if !gov.IsValidProposalType(msg.Content.GetContent().ProposalType()) { - return sdkerrors.Wrap(gov.ErrInvalidProposalType, msg.Content.GetContent().ProposalType()) - } - if err := msg.Content.GetContent().ValidateBasic(); err != nil { - return err - } - - return nil -} - -// nolint -func (msg *MsgSubmitProposal) GetContent() gov.Content { return msg.Content.GetContent() } -func (msg *MsgSubmitProposal) SetContent(content gov.Content) error { - stdContent := &Content{} - err := stdContent.SetContent(content) - if err != nil { - return err - } - msg.Content = stdContent - return nil -} diff --git a/std/msgs_test.go b/std/msgs_test.go deleted file mode 100644 index a034c65a21d..00000000000 --- a/std/msgs_test.go +++ /dev/null @@ -1,55 +0,0 @@ -package std_test - -import ( - "testing" - - gov "github.com/cosmos/cosmos-sdk/x/gov/types" - - "github.com/stretchr/testify/require" - - "github.com/cosmos/cosmos-sdk/std" - sdk "github.com/cosmos/cosmos-sdk/types" -) - -type invalidProposal struct { - *gov.TextProposal -} - -func TestMsgSubmitProposal(t *testing.T) { - p := sdk.AccAddress("foo") - d := sdk.NewCoins(sdk.NewInt64Coin("stake", 1000)) - c := gov.NewTextProposal("title", "description") - - // - // test constructor - // - - msg, err := std.NewMsgSubmitProposal(c, d, p) - require.NoError(t, err) - require.Equal(t, msg.GetContent(), c) - require.Equal(t, msg.GetProposer(), p) - require.Equal(t, msg.GetInitialDeposit(), d) - require.NoError(t, msg.ValidateBasic()) - - _, err = std.NewMsgSubmitProposal(invalidProposal{}, d, p) - require.Error(t, err) - - // - // test setter methods - // - - msg = &std.MsgSubmitProposal{} - msg.SetProposer(p) - msg.SetInitialDeposit(d) - err = msg.SetContent(c) - require.NoError(t, err) - require.Equal(t, msg.GetContent(), c) - require.Equal(t, msg.GetProposer(), p) - require.Equal(t, msg.GetInitialDeposit(), d) - require.NoError(t, msg.ValidateBasic()) - - msg = &std.MsgSubmitProposal{} - err = msg.SetContent(invalidProposal{}) - require.Error(t, err) - -} diff --git a/third_party/proto/cosmos-proto/cosmos.proto b/third_party/proto/cosmos-proto/cosmos.proto index a59821d4f6b..167b170757b 100644 --- a/third_party/proto/cosmos-proto/cosmos.proto +++ b/third_party/proto/cosmos-proto/cosmos.proto @@ -7,4 +7,10 @@ option go_package = "github.com/regen-network/cosmos-proto"; extend google.protobuf.MessageOptions { string interface_type = 93001; + + string implements_interface = 93002; +} + +extend google.protobuf.FieldOptions { + string accepts_interface = 93001; } diff --git a/x/distribution/client/cli/tx.go b/x/distribution/client/cli/tx.go index e6df78fcc06..6f67ed21acd 100644 --- a/x/distribution/client/cli/tx.go +++ b/x/distribution/client/cli/tx.go @@ -481,7 +481,10 @@ Where proposal.json contains: if err != nil { return err } - msg := gov.NewMsgSubmitProposal(content, deposit, from) + msg, err := gov.NewMsgSubmitProposal(content, deposit, from) + if err != nil { + return err + } if err := msg.ValidateBasic(); err != nil { return err } diff --git a/x/distribution/client/rest/rest.go b/x/distribution/client/rest/rest.go index 2e71d77cbdc..f8d1fa91a1f 100644 --- a/x/distribution/client/rest/rest.go +++ b/x/distribution/client/rest/rest.go @@ -50,7 +50,10 @@ func postProposalHandlerFn(cliCtx context.CLIContext) http.HandlerFunc { content := types.NewCommunityPoolSpendProposal(req.Title, req.Description, req.Recipient, req.Amount) - msg := gov.NewMsgSubmitProposal(content, req.Deposit, req.Proposer) + msg, err := gov.NewMsgSubmitProposal(content, req.Deposit, req.Proposer) + if rest.CheckBadRequestError(w, err) { + return + } if rest.CheckBadRequestError(w, msg.ValidateBasic()) { return } diff --git a/x/gov/abci.go b/x/gov/abci.go index fa990acbf0e..a79f80d1ca4 100644 --- a/x/gov/abci.go +++ b/x/gov/abci.go @@ -54,7 +54,7 @@ func EndBlocker(ctx sdk.Context, keeper Keeper) { // The proposal handler may execute state mutating logic depending // on the proposal content. If the handler fails, no state mutation // is written and the error message is logged. - err := handler(cacheCtx, proposal.Content) + err := handler(cacheCtx, proposal.GetContent()) if err == nil { proposal.Status = StatusPassed tagValue = types.AttributeValueProposalPassed diff --git a/x/gov/alias.go b/x/gov/alias.go index b682fcd1698..6121c595bb4 100644 --- a/x/gov/alias.go +++ b/x/gov/alias.go @@ -83,7 +83,7 @@ var ( SplitKeyDeposit = types.SplitKeyDeposit SplitKeyVote = types.SplitKeyVote NewMsgSubmitProposal = types.NewMsgSubmitProposal - NewMsgSubmitProposalBase = types.NewMsgSubmitProposalBase + NewMsgSubmitProposalLegacy = types.NewMsgSubmitProposalLegacy NewMsgDeposit = types.NewMsgDeposit NewMsgVote = types.NewMsgVote ParamKeyTable = types.ParamKeyTable @@ -126,34 +126,33 @@ var ( ) type ( - Keeper = keeper.Keeper - Content = types.Content - Handler = types.Handler - Deposit = types.Deposit - Deposits = types.Deposits - GenesisState = types.GenesisState - MsgSubmitProposalI = types.MsgSubmitProposalI - MsgSubmitProposal = types.MsgSubmitProposal - MsgSubmitProposalBase = types.MsgSubmitProposalBase - MsgDeposit = types.MsgDeposit - MsgVote = types.MsgVote - DepositParams = types.DepositParams - TallyParams = types.TallyParams - VotingParams = types.VotingParams - Params = types.Params - Proposal = types.Proposal - Proposals = types.Proposals - ProposalQueue = types.ProposalQueue - ProposalStatus = types.ProposalStatus - TextProposal = types.TextProposal - QueryProposalParams = types.QueryProposalParams - QueryDepositParams = types.QueryDepositParams - QueryVoteParams = types.QueryVoteParams - QueryProposalsParams = types.QueryProposalsParams - ValidatorGovInfo = types.ValidatorGovInfo - TallyResult = types.TallyResult - Vote = types.Vote - Votes = types.Votes - VoteOption = types.VoteOption - Codec = types.Codec + Keeper = keeper.Keeper + Content = types.Content + Handler = types.Handler + Deposit = types.Deposit + Deposits = types.Deposits + GenesisState = types.GenesisState + MsgSubmitProposalI = types.MsgSubmitProposalI + MsgSubmitProposal = types.MsgSubmitProposal + MsgSubmitProposalLegacy = types.MsgSubmitProposalLegacy + MsgDeposit = types.MsgDeposit + MsgVote = types.MsgVote + DepositParams = types.DepositParams + TallyParams = types.TallyParams + VotingParams = types.VotingParams + Params = types.Params + Proposal = types.Proposal + Proposals = types.Proposals + ProposalQueue = types.ProposalQueue + ProposalStatus = types.ProposalStatus + TextProposal = types.TextProposal + QueryProposalParams = types.QueryProposalParams + QueryDepositParams = types.QueryDepositParams + QueryVoteParams = types.QueryVoteParams + QueryProposalsParams = types.QueryProposalsParams + ValidatorGovInfo = types.ValidatorGovInfo + TallyResult = types.TallyResult + Vote = types.Vote + Votes = types.Votes + VoteOption = types.VoteOption ) diff --git a/x/gov/client/cli/tx.go b/x/gov/client/cli/tx.go index dc8f0eac5a5..c94597d1d52 100644 --- a/x/gov/client/cli/tx.go +++ b/x/gov/client/cli/tx.go @@ -326,7 +326,7 @@ $ %s tx gov submit-proposal --title="Test Proposal" --description="My awesome pr content := types.ContentFromProposalType(proposal.Title, proposal.Description, proposal.Type) - msg := types.NewMsgSubmitProposal(content, amount, cliCtx.GetFromAddress()) + msg := types.NewMsgSubmitProposalLegacy(content, amount, cliCtx.GetFromAddress()) if err := msg.ValidateBasic(); err != nil { return err } diff --git a/x/gov/client/rest/tx.go b/x/gov/client/rest/tx.go index 22d6ff92425..9fc5f2a3fae 100644 --- a/x/gov/client/rest/tx.go +++ b/x/gov/client/rest/tx.go @@ -162,7 +162,7 @@ func postProposalHandlerFn(cliCtx context.CLIContext) http.HandlerFunc { proposalType := gcutils.NormalizeProposalType(req.ProposalType) content := types.ContentFromProposalType(req.Title, req.Description, proposalType) - msg := types.NewMsgSubmitProposal(content, req.InitialDeposit, req.Proposer) + msg := types.NewMsgSubmitProposalLegacy(content, req.InitialDeposit, req.Proposer) if rest.CheckBadRequestError(w, msg.ValidateBasic()) { return } diff --git a/x/gov/client/utils/query.go b/x/gov/client/utils/query.go index 3b092ccccf0..ee3a7c49ae7 100644 --- a/x/gov/client/utils/query.go +++ b/x/gov/client/utils/query.go @@ -219,7 +219,7 @@ func QueryProposerByTxQuery(cliCtx context.CLIContext, proposalID uint64) (Propo for _, msg := range info.Tx.GetMsgs() { // there should only be a single proposal under the given conditions if msg.Type() == types.TypeMsgSubmitProposal { - subMsg := msg.(*types.MsgSubmitProposal) + subMsg := msg.(*types.MsgSubmitProposalLegacy) return NewProposer(proposalID, subMsg.Proposer.String()), nil } } diff --git a/x/gov/keeper/keeper.go b/x/gov/keeper/keeper.go index 04795c70f67..0b4a7a07acf 100644 --- a/x/gov/keeper/keeper.go +++ b/x/gov/keeper/keeper.go @@ -2,6 +2,7 @@ package keeper import ( "fmt" + "github.com/cosmos/cosmos-sdk/codec" "time" "github.com/tendermint/tendermint/libs/log" @@ -26,7 +27,7 @@ type Keeper struct { storeKey sdk.StoreKey // The codec codec for binary encoding/decoding. - cdc types.Codec + cdc codec.Marshaler // Proposal router router types.Router @@ -40,7 +41,7 @@ type Keeper struct { // // CONTRACT: the parameter Subspace must have the param key table already initialized func NewKeeper( - cdc types.Codec, key sdk.StoreKey, paramSpace types.ParamSubspace, + cdc codec.Marshaler, key sdk.StoreKey, paramSpace types.ParamSubspace, authKeeper types.AccountKeeper, bankKeeper types.BankKeeper, sk types.StakingKeeper, rtr types.Router, ) Keeper { diff --git a/x/gov/keeper/proposal.go b/x/gov/keeper/proposal.go index 3055af87502..325b08f6cb6 100644 --- a/x/gov/keeper/proposal.go +++ b/x/gov/keeper/proposal.go @@ -32,7 +32,10 @@ func (keeper Keeper) SubmitProposal(ctx sdk.Context, content types.Content) (typ submitTime := ctx.BlockHeader().Time depositPeriod := keeper.GetDepositParams(ctx).MaxDepositPeriod - proposal := types.NewProposal(content, proposalID, submitTime, submitTime.Add(depositPeriod)) + proposal, err := types.NewProposal(content, proposalID, submitTime, submitTime.Add(depositPeriod)) + if err != nil { + return types.Proposal{}, err + } keeper.SetProposal(ctx, proposal) keeper.InsertInactiveProposalQueue(ctx, proposalID, proposal.DepositEndTime) @@ -57,7 +60,8 @@ func (keeper Keeper) GetProposal(ctx sdk.Context, proposalID uint64) (types.Prop return types.Proposal{}, false } - proposal, err := keeper.cdc.UnmarshalProposal(bz) + var proposal types.Proposal + err := keeper.cdc.UnmarshalBinaryBare(bz, &proposal) if err != nil { panic(err) } @@ -69,7 +73,7 @@ func (keeper Keeper) GetProposal(ctx sdk.Context, proposalID uint64) (types.Prop func (keeper Keeper) SetProposal(ctx sdk.Context, proposal types.Proposal) { store := ctx.KVStore(keeper.storeKey) - bz, err := keeper.cdc.MarshalProposal(proposal) + bz, err := keeper.cdc.MarshalBinaryBare(&proposal) if err != nil { panic(err) } @@ -97,7 +101,8 @@ func (keeper Keeper) IterateProposals(ctx sdk.Context, cb func(proposal types.Pr defer iterator.Close() for ; iterator.Valid(); iterator.Next() { - proposal, err := keeper.cdc.UnmarshalProposal(iterator.Value()) + var proposal types.Proposal + err := keeper.cdc.UnmarshalBinaryBare(iterator.Value(), &proposal) if err != nil { panic(err) } diff --git a/x/gov/module.go b/x/gov/module.go index 63fecf1440c..b7eb14dfa47 100644 --- a/x/gov/module.go +++ b/x/gov/module.go @@ -5,6 +5,7 @@ package gov import ( "encoding/json" "fmt" + codectypes "github.com/cosmos/cosmos-sdk/codec/types" "math/rand" "github.com/gorilla/mux" @@ -28,11 +29,12 @@ var ( _ module.AppModule = AppModule{} _ module.AppModuleBasic = AppModuleBasic{} _ module.AppModuleSimulation = AppModule{} + _ module.InterfaceModule = AppModuleBasic{} ) // AppModuleBasic defines the basic application module used by the gov module. type AppModuleBasic struct { - cdc Codec + cdc codec.Marshaler proposalHandlers []client.ProposalHandler // proposal handlers which live in governance cli and rest } @@ -95,6 +97,10 @@ func (AppModuleBasic) GetQueryCmd(cdc *codec.Codec) *cobra.Command { return cli.GetQueryCmd(StoreKey, cdc) } +func (a AppModuleBasic) RegisterInterfaceTypes(registry codectypes.InterfaceRegistry) { + types.RegisterInterfaces(registry) +} + //____________________________________________________________________________ // AppModule implements an application module for the gov module. @@ -107,7 +113,7 @@ type AppModule struct { } // NewAppModule creates a new AppModule object -func NewAppModule(cdc Codec, keeper Keeper, ak types.AccountKeeper, bk types.BankKeeper) AppModule { +func NewAppModule(cdc codec.Marshaler, keeper Keeper, ak types.AccountKeeper, bk types.BankKeeper) AppModule { return AppModule{ AppModuleBasic: AppModuleBasic{cdc: cdc}, keeper: keeper, diff --git a/x/gov/simulation/decoder.go b/x/gov/simulation/decoder.go index 1faeb9145d3..25eae16ab36 100644 --- a/x/gov/simulation/decoder.go +++ b/x/gov/simulation/decoder.go @@ -4,6 +4,7 @@ import ( "bytes" "encoding/binary" "fmt" + "github.com/cosmos/cosmos-sdk/codec" tmkv "github.com/tendermint/tendermint/libs/kv" @@ -12,15 +13,17 @@ import ( // NewDecodeStore returns a decoder function closure that unmarshals the KVPair's // Value to the corresponding gov type. -func NewDecodeStore(cdc types.Codec) func(kvA, kvB tmkv.Pair) string { +func NewDecodeStore(cdc codec.Marshaler) func(kvA, kvB tmkv.Pair) string { return func(kvA, kvB tmkv.Pair) string { switch { case bytes.Equal(kvA.Key[:1], types.ProposalsKeyPrefix): - proposalA, err := cdc.UnmarshalProposal(kvA.Value) + var proposalA types.Proposal + err := cdc.UnmarshalBinaryBare(kvA.Value, &proposalA) if err != nil { panic(err) } - proposalB, err := cdc.UnmarshalProposal(kvB.Value) + var proposalB types.Proposal + err = cdc.UnmarshalBinaryBare(kvA.Value, &proposalB) if err != nil { panic(err) } diff --git a/x/gov/simulation/operations.go b/x/gov/simulation/operations.go index 5c82f235e51..05d47bee7e8 100644 --- a/x/gov/simulation/operations.go +++ b/x/gov/simulation/operations.go @@ -9,7 +9,6 @@ import ( "github.com/cosmos/cosmos-sdk/codec" "github.com/cosmos/cosmos-sdk/simapp/helpers" simappparams "github.com/cosmos/cosmos-sdk/simapp/params" - std "github.com/cosmos/cosmos-sdk/std" sdk "github.com/cosmos/cosmos-sdk/types" simtypes "github.com/cosmos/cosmos-sdk/types/simulation" "github.com/cosmos/cosmos-sdk/x/gov/keeper" @@ -126,7 +125,7 @@ func SimulateSubmitProposal( return simtypes.NoOpMsg(types.ModuleName), nil, err } - msg, err := std.NewMsgSubmitProposal(content, deposit, simAccount.Address) + msg, err := types.NewMsgSubmitProposal(content, deposit, simAccount.Address) if err != nil { return simtypes.NoOpMsg(types.ModuleName), nil, err } diff --git a/x/gov/types/codec.go b/x/gov/types/codec.go index 7a6b4c0b97e..46b084c8013 100644 --- a/x/gov/types/codec.go +++ b/x/gov/types/codec.go @@ -3,29 +3,34 @@ package types import ( "github.com/cosmos/cosmos-sdk/codec" "github.com/cosmos/cosmos-sdk/codec/types" + sdk "github.com/cosmos/cosmos-sdk/types" ) -// Codec defines the interface required to serialize custom x/gov types. -type Codec interface { - codec.Marshaler - - MarshalProposal(Proposal) ([]byte, error) - UnmarshalProposal([]byte) (Proposal, error) -} - // RegisterCodec registers all the necessary types and interfaces for the // governance module. func RegisterCodec(cdc *codec.Codec) { cdc.RegisterInterface((*Content)(nil), nil) - cdc.RegisterConcrete(MsgSubmitProposalBase{}, "cosmos-sdk/MsgSubmitProposalBase", nil) - cdc.RegisterConcrete(&MsgSubmitProposal{}, "cosmos-sdk/MsgSubmitProposal", nil) + cdc.RegisterConcrete(&MsgSubmitProposalLegacy{}, "cosmos-sdk/MsgSubmitProposal", nil) cdc.RegisterConcrete(MsgDeposit{}, "cosmos-sdk/MsgDeposit", nil) cdc.RegisterConcrete(MsgVote{}, "cosmos-sdk/MsgVote", nil) cdc.RegisterConcrete(&TextProposal{}, "cosmos-sdk/TextProposal", nil) } +func RegisterInterfaces(registry types.InterfaceRegistry) { + registry.RegisterImplementations((*sdk.Msg)(nil), + &MsgSubmitProposal{}, + &MsgVote{}, + &MsgDeposit{}, + ) + registry.RegisterInterface( + "cosmos_sdk.gov.v1.Content", + (*Content)(nil), + &TextProposal{}, + ) +} + // RegisterProposalTypeCodec registers an external proposal content type defined -// in another module for the internal ModuleCdc. This allows the MsgSubmitProposal +// in another module for the internal ModuleCdc. This allows the MsgSubmitProposalLegacy // to be correctly Amino encoded and decoded. // // NOTE: This should only be used for applications that are still using a concrete diff --git a/x/gov/types/msgs.go b/x/gov/types/msgs.go index 29e3ab93298..fca68629b57 100644 --- a/x/gov/types/msgs.go +++ b/x/gov/types/msgs.go @@ -1,8 +1,11 @@ package types import ( + "fmt" + "github.com/gogo/protobuf/proto" "gopkg.in/yaml.v2" + types "github.com/cosmos/cosmos-sdk/codec/types" sdk "github.com/cosmos/cosmos-sdk/types" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" ) @@ -14,10 +17,12 @@ const ( TypeMsgSubmitProposal = "submit_proposal" ) -var _, _, _ sdk.Msg = MsgSubmitProposalBase{}, MsgDeposit{}, MsgVote{} +var _, _, _ sdk.Msg = MsgSubmitProposal{}, MsgDeposit{}, MsgVote{} +var _ MsgSubmitProposalI = &MsgSubmitProposal{} +var _ types.UnpackInterfacesMessage = MsgSubmitProposal{} // MsgSubmitProposalI defines the specific interface a concrete message must -// implement in order to process governance proposals. The concrete MsgSubmitProposal +// implement in order to process governance proposals. The concrete MsgSubmitProposalLegacy // must be defined at the application-level. type MsgSubmitProposalI interface { sdk.Msg @@ -32,34 +37,60 @@ type MsgSubmitProposalI interface { SetProposer(sdk.AccAddress) } -// NewMsgSubmitProposalBase creates a new MsgSubmitProposalBase. -func NewMsgSubmitProposalBase(initialDeposit sdk.Coins, proposer sdk.AccAddress) MsgSubmitProposalBase { - return MsgSubmitProposalBase{ +// NewMsgSubmitProposal creates a new MsgSubmitProposal. +func NewMsgSubmitProposal(content Content, initialDeposit sdk.Coins, proposer sdk.AccAddress) (*MsgSubmitProposal, error) { + m := &MsgSubmitProposal{ InitialDeposit: initialDeposit, Proposer: proposer, } + err := m.SetContent(content) + if err != nil { + return nil, err + } + return m, nil } -func (msg *MsgSubmitProposalBase) GetInitialDeposit() sdk.Coins { return msg.InitialDeposit } +func (msg *MsgSubmitProposal) GetInitialDeposit() sdk.Coins { return msg.InitialDeposit } -func (msg *MsgSubmitProposalBase) GetProposer() sdk.AccAddress { return msg.Proposer } +func (msg *MsgSubmitProposal) GetProposer() sdk.AccAddress { return msg.Proposer } -func (msg *MsgSubmitProposalBase) SetInitialDeposit(coins sdk.Coins) { +func (msg *MsgSubmitProposal) GetContent() Content { + content, ok := msg.Content.GetCachedValue().(Content) + if !ok { + return nil + } + return content +} + +func (msg *MsgSubmitProposal) SetInitialDeposit(coins sdk.Coins) { msg.InitialDeposit = coins } -func (msg *MsgSubmitProposalBase) SetProposer(address sdk.AccAddress) { +func (msg *MsgSubmitProposal) SetProposer(address sdk.AccAddress) { msg.Proposer = address } +func (m *MsgSubmitProposal) SetContent(content Content) error { + msg, ok := content.(proto.Message) + if !ok { + return fmt.Errorf("can't proto marshal %T", msg) + } + any, err := types.NewAnyWithValue(msg) + if err != nil { + return err + } + m.Content = any + return nil +} + // Route implements Msg -func (msg MsgSubmitProposalBase) Route() string { return RouterKey } +func (msg MsgSubmitProposal) Route() string { return RouterKey } // Type implements Msg -func (msg MsgSubmitProposalBase) Type() string { return TypeMsgSubmitProposal } +func (msg MsgSubmitProposal) Type() string { return TypeMsgSubmitProposal } // ValidateBasic implements Msg -func (msg MsgSubmitProposalBase) ValidateBasic() error { +func (msg MsgSubmitProposal) ValidateBasic() error { if msg.Proposer.Empty() { return sdkerrors.Wrap(sdkerrors.ErrInvalidAddress, msg.Proposer.String()) } @@ -70,26 +101,42 @@ func (msg MsgSubmitProposalBase) ValidateBasic() error { return sdkerrors.Wrap(sdkerrors.ErrInvalidCoins, msg.InitialDeposit.String()) } + content := msg.GetContent() + if content == nil { + return sdkerrors.Wrap(ErrInvalidProposalContent, "missing content") + } + if !IsValidProposalType(content.ProposalType()) { + return sdkerrors.Wrap(ErrInvalidProposalType, content.ProposalType()) + } + if err := content.ValidateBasic(); err != nil { + return err + } + return nil } // GetSignBytes implements Msg -func (msg MsgSubmitProposalBase) GetSignBytes() []byte { +func (msg MsgSubmitProposal) GetSignBytes() []byte { bz := ModuleCdc.MustMarshalJSON(msg) return sdk.MustSortJSON(bz) } // GetSigners implements Msg -func (msg MsgSubmitProposalBase) GetSigners() []sdk.AccAddress { +func (msg MsgSubmitProposal) GetSigners() []sdk.AccAddress { return []sdk.AccAddress{msg.Proposer} } // String implements the Stringer interface -func (msg MsgSubmitProposalBase) String() string { +func (msg MsgSubmitProposal) String() string { out, _ := yaml.Marshal(msg) return string(out) } +func (m MsgSubmitProposal) UnpackInterfaces(unpacker types.AnyUnpacker) error { + var content Content + return unpacker.UnpackAny(m.Content, &content) +} + // NewMsgDeposit creates a new MsgDeposit instance func NewMsgDeposit(depositor sdk.AccAddress, proposalID uint64, amount sdk.Coins) MsgDeposit { return MsgDeposit{proposalID, depositor, amount} @@ -179,27 +226,27 @@ func (msg MsgVote) GetSigners() []sdk.AccAddress { // TODO: Remove once client-side Protobuf migration has been completed. // --------------------------------------------------------------------------- -// MsgSubmitProposal defines a (deprecated) message to create/submit a governance +// MsgSubmitProposalLegacy defines a (deprecated) message to create/submit a governance // proposal. // // TODO: Remove once client-side Protobuf migration has been completed. -type MsgSubmitProposal struct { +type MsgSubmitProposalLegacy struct { Content Content `json:"content" yaml:"content"` InitialDeposit sdk.Coins `json:"initial_deposit" yaml:"initial_deposit"` // Initial deposit paid by sender. Must be strictly positive Proposer sdk.AccAddress `json:"proposer" yaml:"proposer"` // Address of the proposer } -var _ MsgSubmitProposalI = &MsgSubmitProposal{} +var _ MsgSubmitProposalI = &MsgSubmitProposalLegacy{} -// NewMsgSubmitProposal returns a (deprecated) MsgSubmitProposal message. +// NewMsgSubmitProposalLegacy returns a (deprecated) MsgSubmitProposalLegacy 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} +func NewMsgSubmitProposalLegacy(content Content, initialDeposit sdk.Coins, proposer sdk.AccAddress) *MsgSubmitProposalLegacy { + return &MsgSubmitProposalLegacy{content, initialDeposit, proposer} } // ValidateBasic implements Msg -func (msg MsgSubmitProposal) ValidateBasic() error { +func (msg MsgSubmitProposalLegacy) ValidateBasic() error { if msg.Content == nil { return sdkerrors.Wrap(ErrInvalidProposalContent, "missing content") } @@ -220,28 +267,30 @@ func (msg MsgSubmitProposal) ValidateBasic() error { } // GetSignBytes implements Msg -func (msg MsgSubmitProposal) GetSignBytes() []byte { +func (msg MsgSubmitProposalLegacy) 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 } - -func (msg *MsgSubmitProposal) SetContent(content Content) error { +func (msg MsgSubmitProposalLegacy) GetSigners() []sdk.AccAddress { + return []sdk.AccAddress{msg.Proposer} +} +func (msg MsgSubmitProposalLegacy) Route() string { return RouterKey } +func (msg MsgSubmitProposalLegacy) Type() string { return TypeMsgSubmitProposal } +func (msg MsgSubmitProposalLegacy) GetContent() Content { return msg.Content } +func (msg MsgSubmitProposalLegacy) GetInitialDeposit() sdk.Coins { return msg.InitialDeposit } +func (msg MsgSubmitProposalLegacy) GetProposer() sdk.AccAddress { return msg.Proposer } + +func (msg *MsgSubmitProposalLegacy) SetContent(content Content) error { msg.Content = content return nil } -func (msg *MsgSubmitProposal) SetInitialDeposit(deposit sdk.Coins) { +func (msg *MsgSubmitProposalLegacy) SetInitialDeposit(deposit sdk.Coins) { msg.InitialDeposit = deposit } -func (msg *MsgSubmitProposal) SetProposer(proposer sdk.AccAddress) { +func (msg *MsgSubmitProposalLegacy) SetProposer(proposer sdk.AccAddress) { msg.Proposer = proposer } diff --git a/x/gov/types/msgs_test.go b/x/gov/types/msgs_test.go index 54bb3fa4841..9642d9f2a83 100644 --- a/x/gov/types/msgs_test.go +++ b/x/gov/types/msgs_test.go @@ -43,7 +43,7 @@ func TestMsgSubmitProposal(t *testing.T) { } for i, tc := range tests { - msg := NewMsgSubmitProposal( + msg := NewMsgSubmitProposalLegacy( ContentFromProposalType(tc.title, tc.description, tc.proposalType), tc.initialDeposit, tc.proposerAddr, diff --git a/x/gov/types/proposal.go b/x/gov/types/proposal.go index 60f888d30e3..d5cc6333b96 100644 --- a/x/gov/types/proposal.go +++ b/x/gov/types/proposal.go @@ -3,11 +3,13 @@ package types import ( "encoding/json" "fmt" + "github.com/gogo/protobuf/proto" "strings" "time" "gopkg.in/yaml.v2" + "github.com/cosmos/cosmos-sdk/codec/types" sdk "github.com/cosmos/cosmos-sdk/types" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" ) @@ -15,31 +17,30 @@ import ( // DefaultStartingProposalID is 1 const DefaultStartingProposalID uint64 = 1 -// Proposal defines a struct used by the governance module to allow for voting -// on network changes. -type Proposal struct { - Content `json:"content" yaml:"content"` // Proposal content interface - ProposalBase -} - // NewProposal creates a new Proposal instance -func NewProposal(content Content, id uint64, submitTime, depositEndTime time.Time) Proposal { - return Proposal{ - Content: content, - ProposalBase: ProposalBase{ - ProposalID: id, - Status: StatusDepositPeriod, - FinalTallyResult: EmptyTallyResult(), - TotalDeposit: sdk.NewCoins(), - SubmitTime: submitTime, - DepositEndTime: depositEndTime, - }, +func NewProposal(content Content, id uint64, submitTime, depositEndTime time.Time) (Proposal, error) { + p := Proposal{ + ProposalID: id, + Status: StatusDepositPeriod, + FinalTallyResult: EmptyTallyResult(), + TotalDeposit: sdk.NewCoins(), + SubmitTime: submitTime, + DepositEndTime: depositEndTime, } -} -// Equal returns true if two Proposal types are equal. -func (p Proposal) Equal(other Proposal) bool { - return p.ProposalBase.Equal(other.ProposalBase) && p.Content.String() == other.Content.String() + msg, ok := content.(proto.Message) + if !ok { + return Proposal{}, fmt.Errorf("can't proto marshal %T", content) + } + + any, err := types.NewAnyWithValue(msg) + if err != nil { + return Proposal{}, err + } + + p.Content = any + + return p, nil } // String implements stringer interface @@ -48,6 +49,43 @@ func (p Proposal) String() string { return string(out) } +func (m Proposal) GetContent() Content { + content, ok := m.Content.GetCachedValue().(Content) + if !ok { + return nil + } + return content +} + +func (m Proposal) ProposalType() string { + content := m.GetContent() + if content != nil { + return "" + } + return content.ProposalType() +} + +func (m Proposal) ProposalRoute() string { + content := m.GetContent() + if content != nil { + return "" + } + return content.ProposalRoute() +} + +func (m Proposal) GetTitle() string { + content := m.GetContent() + if content != nil { + return "" + } + return content.GetTitle() +} + +func (m Proposal) UnpackInterfaces(unpacker types.AnyUnpacker) error { + var content Content + return unpacker.UnpackAny(m.Content, &content) +} + // Proposals is an array of proposal type Proposals []Proposal diff --git a/x/gov/types/types.pb.go b/x/gov/types/types.pb.go index 038f3297d78..ab6b530e78f 100644 --- a/x/gov/types/types.pb.go +++ b/x/gov/types/types.pb.go @@ -6,13 +6,14 @@ package types import ( bytes "bytes" fmt "fmt" + types1 "github.com/cosmos/cosmos-sdk/codec/types" github_com_cosmos_cosmos_sdk_types "github.com/cosmos/cosmos-sdk/types" types "github.com/cosmos/cosmos-sdk/types" _ "github.com/gogo/protobuf/gogoproto" - github_com_gogo_protobuf_proto "github.com/gogo/protobuf/proto" proto "github.com/gogo/protobuf/proto" github_com_gogo_protobuf_types "github.com/gogo/protobuf/types" _ "github.com/golang/protobuf/ptypes/timestamp" + _ "github.com/regen-network/cosmos-proto" io "io" math "math" math_bits "math/bits" @@ -107,29 +108,25 @@ func (ProposalStatus) EnumDescriptor() ([]byte, []int) { return fileDescriptor_a5ae5e91b5b3fb03, []int{1} } -// MsgSubmitProposalBase defines an sdk.Msg type that supports submitting arbitrary +// MsgSubmitProposal defines an sdk.Msg type that supports submitting arbitrary // proposal Content. -// -// Note, this message type provides the basis for which a true MsgSubmitProposal -// can be constructed. Since the Content submitted in the message can be arbitrary, -// assuming it fulfills the Content interface, it must be defined at the -// application-level and extend MsgSubmitProposalBase. -type MsgSubmitProposalBase struct { +type MsgSubmitProposal 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"` + Content *types1.Any `protobuf:"bytes,3,opt,name=content,proto3" json:"content,omitempty"` } -func (m *MsgSubmitProposalBase) Reset() { *m = MsgSubmitProposalBase{} } -func (*MsgSubmitProposalBase) ProtoMessage() {} -func (*MsgSubmitProposalBase) Descriptor() ([]byte, []int) { +func (m *MsgSubmitProposal) Reset() { *m = MsgSubmitProposal{} } +func (*MsgSubmitProposal) ProtoMessage() {} +func (*MsgSubmitProposal) Descriptor() ([]byte, []int) { return fileDescriptor_a5ae5e91b5b3fb03, []int{0} } -func (m *MsgSubmitProposalBase) XXX_Unmarshal(b []byte) error { +func (m *MsgSubmitProposal) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } -func (m *MsgSubmitProposalBase) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { +func (m *MsgSubmitProposal) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { - return xxx_messageInfo_MsgSubmitProposalBase.Marshal(b, m, deterministic) + return xxx_messageInfo_MsgSubmitProposal.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) @@ -139,17 +136,17 @@ func (m *MsgSubmitProposalBase) XXX_Marshal(b []byte, deterministic bool) ([]byt return b[:n], nil } } -func (m *MsgSubmitProposalBase) XXX_Merge(src proto.Message) { - xxx_messageInfo_MsgSubmitProposalBase.Merge(m, src) +func (m *MsgSubmitProposal) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgSubmitProposal.Merge(m, src) } -func (m *MsgSubmitProposalBase) XXX_Size() int { +func (m *MsgSubmitProposal) XXX_Size() int { return m.Size() } -func (m *MsgSubmitProposalBase) XXX_DiscardUnknown() { - xxx_messageInfo_MsgSubmitProposalBase.DiscardUnknown(m) +func (m *MsgSubmitProposal) XXX_DiscardUnknown() { + xxx_messageInfo_MsgSubmitProposal.DiscardUnknown(m) } -var xxx_messageInfo_MsgSubmitProposalBase proto.InternalMessageInfo +var xxx_messageInfo_MsgSubmitProposal proto.InternalMessageInfo // MsgVote defines a message to cast a vote type MsgVote struct { @@ -307,10 +304,8 @@ func (m *Deposit) XXX_DiscardUnknown() { var xxx_messageInfo_Deposit proto.InternalMessageInfo -// ProposalBase defines the core field members of a governance proposal. It includes -// all static fields (i.e fields excluding the dynamic Content). A full proposal -// extends the ProposalBase with Content. -type ProposalBase struct { +// Proposal defines the core field members of a governance proposal +type Proposal struct { ProposalID uint64 `protobuf:"varint,1,opt,name=proposal_id,json=proposalId,proto3" json:"id" yaml:"id"` Status ProposalStatus `protobuf:"varint,2,opt,name=status,proto3,enum=cosmos_sdk.x.gov.v1.ProposalStatus" json:"status,omitempty" yaml:"proposal_status"` FinalTallyResult TallyResult `protobuf:"bytes,3,opt,name=final_tally_result,json=finalTallyResult,proto3" json:"final_tally_result" yaml:"final_tally_result"` @@ -319,20 +314,20 @@ type ProposalBase struct { 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"` + Content *types1.Any `protobuf:"bytes,9,opt,name=content,proto3" json:"content,omitempty"` } -func (m *ProposalBase) Reset() { *m = ProposalBase{} } -func (m *ProposalBase) String() string { return proto.CompactTextString(m) } -func (*ProposalBase) ProtoMessage() {} -func (*ProposalBase) Descriptor() ([]byte, []int) { +func (m *Proposal) Reset() { *m = Proposal{} } +func (*Proposal) ProtoMessage() {} +func (*Proposal) Descriptor() ([]byte, []int) { return fileDescriptor_a5ae5e91b5b3fb03, []int{5} } -func (m *ProposalBase) XXX_Unmarshal(b []byte) error { +func (m *Proposal) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } -func (m *ProposalBase) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { +func (m *Proposal) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { - return xxx_messageInfo_ProposalBase.Marshal(b, m, deterministic) + return xxx_messageInfo_Proposal.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) @@ -342,17 +337,17 @@ func (m *ProposalBase) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) return b[:n], nil } } -func (m *ProposalBase) XXX_Merge(src proto.Message) { - xxx_messageInfo_ProposalBase.Merge(m, src) +func (m *Proposal) XXX_Merge(src proto.Message) { + xxx_messageInfo_Proposal.Merge(m, src) } -func (m *ProposalBase) XXX_Size() int { +func (m *Proposal) XXX_Size() int { return m.Size() } -func (m *ProposalBase) XXX_DiscardUnknown() { - xxx_messageInfo_ProposalBase.DiscardUnknown(m) +func (m *Proposal) XXX_DiscardUnknown() { + xxx_messageInfo_Proposal.DiscardUnknown(m) } -var xxx_messageInfo_ProposalBase proto.InternalMessageInfo +var xxx_messageInfo_Proposal proto.InternalMessageInfo // TallyResult defines a standard tally for a proposal type TallyResult struct { @@ -437,12 +432,12 @@ var xxx_messageInfo_Vote proto.InternalMessageInfo func init() { proto.RegisterEnum("cosmos_sdk.x.gov.v1.VoteOption", VoteOption_name, VoteOption_value) proto.RegisterEnum("cosmos_sdk.x.gov.v1.ProposalStatus", ProposalStatus_name, ProposalStatus_value) - proto.RegisterType((*MsgSubmitProposalBase)(nil), "cosmos_sdk.x.gov.v1.MsgSubmitProposalBase") + proto.RegisterType((*MsgSubmitProposal)(nil), "cosmos_sdk.x.gov.v1.MsgSubmitProposal") proto.RegisterType((*MsgVote)(nil), "cosmos_sdk.x.gov.v1.MsgVote") proto.RegisterType((*MsgDeposit)(nil), "cosmos_sdk.x.gov.v1.MsgDeposit") proto.RegisterType((*TextProposal)(nil), "cosmos_sdk.x.gov.v1.TextProposal") proto.RegisterType((*Deposit)(nil), "cosmos_sdk.x.gov.v1.Deposit") - proto.RegisterType((*ProposalBase)(nil), "cosmos_sdk.x.gov.v1.ProposalBase") + proto.RegisterType((*Proposal)(nil), "cosmos_sdk.x.gov.v1.Proposal") proto.RegisterType((*TallyResult)(nil), "cosmos_sdk.x.gov.v1.TallyResult") proto.RegisterType((*Vote)(nil), "cosmos_sdk.x.gov.v1.Vote") } @@ -450,94 +445,97 @@ func init() { func init() { proto.RegisterFile("x/gov/types/types.proto", fileDescriptor_a5ae5e91b5b3fb03) } var fileDescriptor_a5ae5e91b5b3fb03 = []byte{ - // 1230 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xdc, 0x57, 0xcf, 0x8f, 0xd3, 0x46, - 0x14, 0x8e, 0xb3, 0xbf, 0xd8, 0x49, 0x36, 0x6b, 0x66, 0x29, 0x9b, 0xba, 0xaa, 0x6d, 0x02, 0x42, - 0x2b, 0x04, 0x5e, 0x58, 0x0e, 0x55, 0xa9, 0x54, 0x35, 0x26, 0x06, 0x8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85, 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, 0xa2, 0x0c, 0x2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b2, 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 { + // 1273 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xdc, 0x57, 0xbf, 0x6f, 0xdb, 0x56, + 0x17, 0x15, 0xe5, 0x1f, 0xb2, 0xaf, 0x64, 0x99, 0x7e, 0x36, 0x62, 0x85, 0x1f, 0x3e, 0x92, 0x51, + 0x82, 0xc0, 0x48, 0x13, 0x3a, 0x71, 0x86, 0xa2, 0x09, 0x50, 0x54, 0xb2, 0x98, 0x44, 0x41, 0x2c, + 0x09, 0x14, 0x63, 0x23, 0x2d, 0x0a, 0x82, 0x16, 0x19, 0x99, 0x0d, 0xc5, 0xa7, 0x8a, 0xcf, 0x6a, + 0xb4, 0x05, 0x1d, 0x8a, 0x40, 0x53, 0xc6, 0x2e, 0x02, 0x0a, 0x34, 0x43, 0xd1, 0x29, 0x43, 0xff, + 0x08, 0xa3, 0x53, 0x50, 0xb4, 0x40, 0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0xc7, 0x68, 0xd9, 0xfe, 0xb6, 0x1b, 0x8e, 0x17, 0xf9, 0xc0, 0x24, + 0xfa, 0x00, 0xa8, 0x05, 0xb8, 0xfc, 0x09, 0x36, 0x3c, 0x8f, 0xd3, 0x2c, 0xfb, 0x95, 0xb2, 0x1a, + 0x1f, 0x04, 0x23, 0x24, 0xf4, 0x01, 0x24, 0xfd, 0x60, 0x64, 0x1b, 0x83, 0x59, 0x9f, 0x19, 0x0f, + 0x72, 0x09, 0xfb, 0x46, 0x99, 0x1e, 0x5e, 0x04, 0x79, 0x91, 0x65, 0x61, 0xbd, 0x12, 0x21, 0x67, + 0x1f, 0x3c, 0x95, 0x38, 0x0d, 0x68, 0x64, 0x40, 0x40, 0x0e, 0xf0, 0x6c, 0xaf, 0x0d, 0xdb, 0xb3, + 0x68, 0x86, 0x89, 0x43, 0x33, 0x9c, 0x64, 0x19, 0x16, 0x69, 0x86, 0x51, 0x05, 0x9a, 0x26, 0xcd, + 0xc2, 0xaa, 0x67, 0x05, 0xa9, 0x3e, 0xe5, 0x60, 0x86, 0x60, 0x12, 0xb9, 0x66, 0x26, 0x5f, 0xdd, + 0x51, 0xd7, 0x58, 0x86, 0x05, 0x9a, 0x61, 0x0f, 0xef, 0x68, 0x97, 0x4c, 0x2a, 0xe0, 0x86, 0xc7, + 0xcc, 0x85, 0xb9, 0x36, 0x26, 0x8e, 0x57, 0x1f, 0xec, 0x6c, 0x8b, 0x59, 0x9a, 0x38, 0xb4, 0xe0, + 0x53, 0x6c, 0x39, 0x19, 0xba, 0x9c, 0x7d, 0x12, 0xb4, 0xe2, 0x59, 0x1a, 0xaf, 0x0e, 0xc2, 0x41, + 0xc9, 0xb7, 0x81, 0x85, 0x86, 0xe6, 0x4e, 0x1d, 0x9a, 0x2b, 0xbb, 0xf7, 0x86, 0x1d, 0x11, 0xa0, + 0x99, 0x66, 0x68, 0x34, 0xb4, 0x36, 0x72, 0xd3, 0x4d, 0xff, 0xc5, 0x9b, 0x6e, 0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0x02, 0x3f, 0x2e, 0xa0, 0x6e, 0x4f, 0x4e, + 0x53, 0xbc, 0x66, 0x7f, 0x64, 0xd7, 0x88, 0x7d, 0xa0, 0xfe, 0x95, 0x5c, 0xf1, 0x86, 0x5a, 0xe0, + 0x27, 0xa2, 0xfa, 0x57, 0x4c, 0xc7, 0xb5, 0xad, 0xbd, 0xb6, 0xe6, 0x4b, 0x3b, 0xcf, 0xc4, 0xd8, + 0x93, 0x67, 0x62, 0xec, 0xde, 0xae, 0x18, 0xdb, 0xd9, 0x15, 0xb9, 0xc7, 0xbb, 0x22, 0xf7, 0xd3, + 0xae, 0xc8, 0x3d, 0x78, 0x2e, 0xc6, 0x1e, 0x3f, 0x17, 0x63, 0x4f, 0x9e, 0x8b, 0xb1, 0xf7, 0xff, + 0x7c, 0xc2, 0x47, 0x7e, 0x9c, 0x6d, 0x4e, 0x06, 0x43, 0xee, 0xe2, 0x1f, 0x01, 0x00, 0x00, 0xff, + 0xff, 0xf4, 0xce, 0xde, 0xda, 0xb2, 0x0d, 0x00, 0x00, +} + +func (this *MsgSubmitProposal) Equal(that interface{}) bool { if that == nil { return this == nil } - that1, ok := that.(*MsgSubmitProposalBase) + that1, ok := that.(*MsgSubmitProposal) if !ok { - that2, ok := that.(MsgSubmitProposalBase) + that2, ok := that.(MsgSubmitProposal) if ok { that1 = &that2 } else { @@ -560,6 +558,9 @@ func (this *MsgSubmitProposalBase) Equal(that interface{}) bool { if !bytes.Equal(this.Proposer, that1.Proposer) { return false } + if !this.Content.Equal(that1.Content) { + return false + } return true } func (this *MsgVote) Equal(that interface{}) bool { @@ -689,14 +690,14 @@ func (this *Deposit) Equal(that interface{}) bool { } return true } -func (this *ProposalBase) Equal(that interface{}) bool { +func (this *Proposal) Equal(that interface{}) bool { if that == nil { return this == nil } - that1, ok := that.(*ProposalBase) + that1, ok := that.(*Proposal) if !ok { - that2, ok := that.(ProposalBase) + that2, ok := that.(Proposal) if ok { that1 = &that2 } else { @@ -737,6 +738,9 @@ func (this *ProposalBase) Equal(that interface{}) bool { if !this.VotingEndTime.Equal(that1.VotingEndTime) { return false } + if !this.Content.Equal(that1.Content) { + return false + } return true } func (this *TallyResult) Equal(that interface{}) bool { @@ -802,73 +806,7 @@ func (this *Vote) Equal(that interface{}) bool { } return true } - -type ProposalBaseFace interface { - Proto() github_com_gogo_protobuf_proto.Message - GetProposalID() uint64 - GetStatus() ProposalStatus - GetFinalTallyResult() TallyResult - GetSubmitTime() time.Time - GetDepositEndTime() time.Time - GetTotalDeposit() github_com_cosmos_cosmos_sdk_types.Coins - GetVotingStartTime() time.Time - GetVotingEndTime() time.Time -} - -func (this *ProposalBase) Proto() github_com_gogo_protobuf_proto.Message { - return this -} - -func (this *ProposalBase) TestProto() github_com_gogo_protobuf_proto.Message { - return NewProposalBaseFromFace(this) -} - -func (this *ProposalBase) GetProposalID() uint64 { - return this.ProposalID -} - -func (this *ProposalBase) GetStatus() ProposalStatus { - return this.Status -} - -func (this *ProposalBase) GetFinalTallyResult() TallyResult { - return this.FinalTallyResult -} - -func (this *ProposalBase) GetSubmitTime() time.Time { - return this.SubmitTime -} - -func (this *ProposalBase) GetDepositEndTime() time.Time { - return this.DepositEndTime -} - -func (this *ProposalBase) GetTotalDeposit() github_com_cosmos_cosmos_sdk_types.Coins { - return this.TotalDeposit -} - -func (this *ProposalBase) GetVotingStartTime() time.Time { - return this.VotingStartTime -} - -func (this *ProposalBase) GetVotingEndTime() time.Time { - return this.VotingEndTime -} - -func NewProposalBaseFromFace(that ProposalBaseFace) *ProposalBase { - this := &ProposalBase{} - this.ProposalID = that.GetProposalID() - this.Status = that.GetStatus() - this.FinalTallyResult = that.GetFinalTallyResult() - this.SubmitTime = that.GetSubmitTime() - this.DepositEndTime = that.GetDepositEndTime() - this.TotalDeposit = that.GetTotalDeposit() - this.VotingStartTime = that.GetVotingStartTime() - this.VotingEndTime = that.GetVotingEndTime() - return this -} - -func (m *MsgSubmitProposalBase) Marshal() (dAtA []byte, err error) { +func (m *MsgSubmitProposal) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -878,16 +816,28 @@ func (m *MsgSubmitProposalBase) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *MsgSubmitProposalBase) MarshalTo(dAtA []byte) (int, error) { +func (m *MsgSubmitProposal) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *MsgSubmitProposalBase) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *MsgSubmitProposal) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int _ = l + if m.Content != nil { + { + size, err := m.Content.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTypes(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1a + } if len(m.Proposer) > 0 { i -= len(m.Proposer) copy(dAtA[i:], m.Proposer) @@ -1087,7 +1037,7 @@ func (m *Deposit) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } -func (m *ProposalBase) Marshal() (dAtA []byte, err error) { +func (m *Proposal) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -1097,30 +1047,42 @@ func (m *ProposalBase) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *ProposalBase) MarshalTo(dAtA []byte) (int, error) { +func (m *Proposal) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *ProposalBase) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *Proposal) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int _ = l - n1, err1 := github_com_gogo_protobuf_types.StdTimeMarshalTo(m.VotingEndTime, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdTime(m.VotingEndTime):]) - if err1 != nil { - return 0, err1 + if m.Content != nil { + { + size, err := m.Content.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTypes(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x4a } - i -= n1 - i = encodeVarintTypes(dAtA, i, uint64(n1)) + n3, err3 := github_com_gogo_protobuf_types.StdTimeMarshalTo(m.VotingEndTime, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdTime(m.VotingEndTime):]) + if err3 != nil { + return 0, err3 + } + i -= n3 + i = encodeVarintTypes(dAtA, i, uint64(n3)) 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 + n4, err4 := github_com_gogo_protobuf_types.StdTimeMarshalTo(m.VotingStartTime, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdTime(m.VotingStartTime):]) + if err4 != nil { + return 0, err4 } - i -= n2 - i = encodeVarintTypes(dAtA, i, uint64(n2)) + i -= n4 + i = encodeVarintTypes(dAtA, i, uint64(n4)) i-- dAtA[i] = 0x3a if len(m.TotalDeposit) > 0 { @@ -1137,20 +1099,20 @@ func (m *ProposalBase) MarshalToSizedBuffer(dAtA []byte) (int, error) { 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 + n5, err5 := github_com_gogo_protobuf_types.StdTimeMarshalTo(m.DepositEndTime, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdTime(m.DepositEndTime):]) + if err5 != nil { + return 0, err5 } - i -= n3 - i = encodeVarintTypes(dAtA, i, uint64(n3)) + i -= n5 + i = encodeVarintTypes(dAtA, i, uint64(n5)) 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 + n6, err6 := github_com_gogo_protobuf_types.StdTimeMarshalTo(m.SubmitTime, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdTime(m.SubmitTime):]) + if err6 != nil { + return 0, err6 } - i -= n4 - i = encodeVarintTypes(dAtA, i, uint64(n4)) + i -= n6 + i = encodeVarintTypes(dAtA, i, uint64(n6)) i-- dAtA[i] = 0x22 { @@ -1290,7 +1252,7 @@ func encodeVarintTypes(dAtA []byte, offset int, v uint64) int { dAtA[offset] = uint8(v) return base } -func (m *MsgSubmitProposalBase) Size() (n int) { +func (m *MsgSubmitProposal) Size() (n int) { if m == nil { return 0 } @@ -1306,6 +1268,10 @@ func (m *MsgSubmitProposalBase) Size() (n int) { if l > 0 { n += 1 + l + sovTypes(uint64(l)) } + if m.Content != nil { + l = m.Content.Size() + n += 1 + l + sovTypes(uint64(l)) + } return n } @@ -1389,7 +1355,7 @@ func (m *Deposit) Size() (n int) { return n } -func (m *ProposalBase) Size() (n int) { +func (m *Proposal) Size() (n int) { if m == nil { return 0 } @@ -1417,6 +1383,10 @@ func (m *ProposalBase) Size() (n int) { n += 1 + l + sovTypes(uint64(l)) l = github_com_gogo_protobuf_types.SizeOfStdTime(m.VotingEndTime) n += 1 + l + sovTypes(uint64(l)) + if m.Content != nil { + l = m.Content.Size() + n += 1 + l + sovTypes(uint64(l)) + } return n } @@ -1462,7 +1432,7 @@ func sovTypes(x uint64) (n int) { func sozTypes(x uint64) (n int) { return sovTypes(uint64((x << 1) ^ uint64((int64(x) >> 63)))) } -func (m *MsgSubmitProposalBase) Unmarshal(dAtA []byte) error { +func (m *MsgSubmitProposal) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -1485,10 +1455,10 @@ func (m *MsgSubmitProposalBase) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: MsgSubmitProposalBase: wiretype end group for non-group") + return fmt.Errorf("proto: MsgSubmitProposal: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: MsgSubmitProposalBase: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: MsgSubmitProposal: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: @@ -1559,6 +1529,42 @@ func (m *MsgSubmitProposalBase) Unmarshal(dAtA []byte) error { m.Proposer = []byte{} } iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Content", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Content == nil { + m.Content = &types1.Any{} + } + if err := m.Content.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipTypes(dAtA[iNdEx:]) @@ -2105,7 +2111,7 @@ func (m *Deposit) Unmarshal(dAtA []byte) error { } return nil } -func (m *ProposalBase) Unmarshal(dAtA []byte) error { +func (m *Proposal) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -2128,10 +2134,10 @@ func (m *ProposalBase) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: ProposalBase: wiretype end group for non-group") + return fmt.Errorf("proto: Proposal: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: ProposalBase: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: Proposal: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: @@ -2371,6 +2377,42 @@ func (m *ProposalBase) Unmarshal(dAtA []byte) error { return err } iNdEx = postIndex + case 9: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Content", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Content == nil { + m.Content = &types1.Any{} + } + if err := m.Content.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipTypes(dAtA[iNdEx:]) diff --git a/x/gov/types/types.proto b/x/gov/types/types.proto index ea6da041a19..307ea245724 100644 --- a/x/gov/types/types.proto +++ b/x/gov/types/types.proto @@ -3,29 +3,27 @@ package cosmos_sdk.x.gov.v1; import "types/types.proto"; import "third_party/proto/gogoproto/gogo.proto"; +import "third_party/proto/cosmos-proto/cosmos.proto"; import "google/protobuf/timestamp.proto"; +import "google/protobuf/any.proto"; option go_package = "github.com/cosmos/cosmos-sdk/x/gov/types"; option (gogoproto.goproto_stringer_all) = false; option (gogoproto.stringer_all) = false; option (gogoproto.goproto_getters_all) = false; -// MsgSubmitProposalBase defines an sdk.Msg type that supports submitting arbitrary +// MsgSubmitProposal defines an sdk.Msg type that supports submitting arbitrary // proposal Content. -// -// Note, this message type provides the basis for which a true MsgSubmitProposal -// can be constructed. Since the Content submitted in the message can be arbitrary, -// assuming it fulfills the Content interface, it must be defined at the -// application-level and extend MsgSubmitProposalBase. -message MsgSubmitProposalBase { +message MsgSubmitProposal { option (gogoproto.equal) = true; - repeated cosmos_sdk.v1.Coin initial_deposit = 1 [ + google.protobuf.Any content = 1 [(cosmos_proto.accepts_interface) = "Content"]; + repeated cosmos_sdk.v1.Coin initial_deposit = 2 [ (gogoproto.nullable) = false, (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins", (gogoproto.moretags) = "yaml:\"initial_deposit\"" ]; - bytes proposer = 2 [(gogoproto.casttype) = "github.com/cosmos/cosmos-sdk/types.AccAddress"]; + bytes proposer = 3 [(gogoproto.casttype) = "github.com/cosmos/cosmos-sdk/types.AccAddress"]; } // MsgVote defines a message to cast a vote @@ -76,6 +74,8 @@ enum VoteOption { // TextProposal defines a standard text proposal whose changes need to be // manually updated in case of approval message TextProposal { + option (cosmos_proto.implements_interface) = "Content"; + option (gogoproto.equal) = true; string title = 1; @@ -92,31 +92,28 @@ message Deposit { [(gogoproto.nullable) = false, (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins"]; } -// ProposalBase defines the core field members of a governance proposal. It includes -// all static fields (i.e fields excluding the dynamic Content). A full proposal -// extends the ProposalBase with Content. -message ProposalBase { +// Proposal defines the core field members of a governance proposal +message Proposal { option (gogoproto.equal) = true; - option (gogoproto.goproto_stringer) = true; - option (gogoproto.face) = true; uint64 proposal_id = 1 [(gogoproto.customname) = "ProposalID", (gogoproto.jsontag) = "id", (gogoproto.moretags) = "yaml:\"id\""]; - ProposalStatus status = 2 [(gogoproto.moretags) = "yaml:\"proposal_status\""]; - TallyResult final_tally_result = 3 + google.protobuf.Any content = 2 [(cosmos_proto.accepts_interface) = "Content"]; + ProposalStatus status = 3 [(gogoproto.moretags) = "yaml:\"proposal_status\""]; + TallyResult final_tally_result = 4 [(gogoproto.nullable) = false, (gogoproto.moretags) = "yaml:\"final_tally_result\""]; - google.protobuf.Timestamp submit_time = 4 + google.protobuf.Timestamp submit_time = 5 [(gogoproto.stdtime) = true, (gogoproto.nullable) = false, (gogoproto.moretags) = "yaml:\"submit_time\""]; - google.protobuf.Timestamp deposit_end_time = 5 + google.protobuf.Timestamp deposit_end_time = 6 [(gogoproto.stdtime) = true, (gogoproto.nullable) = false, (gogoproto.moretags) = "yaml:\"deposit_end_time\""]; - repeated cosmos_sdk.v1.Coin total_deposit = 6 [ + repeated cosmos_sdk.v1.Coin total_deposit = 7 [ (gogoproto.nullable) = false, (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins", (gogoproto.moretags) = "yaml:\"total_deposit\"" ]; - google.protobuf.Timestamp voting_start_time = 7 + google.protobuf.Timestamp voting_start_time = 8 [(gogoproto.stdtime) = true, (gogoproto.nullable) = false, (gogoproto.moretags) = "yaml:\"voting_start_time\""]; - google.protobuf.Timestamp voting_end_time = 8 + google.protobuf.Timestamp voting_end_time = 9 [(gogoproto.stdtime) = true, (gogoproto.nullable) = false, (gogoproto.moretags) = "yaml:\"voting_end_time\""]; } diff --git a/x/params/client/cli/tx.go b/x/params/client/cli/tx.go index 020854f2a12..3dc395bd4e6 100644 --- a/x/params/client/cli/tx.go +++ b/x/params/client/cli/tx.go @@ -80,7 +80,7 @@ Where proposal.json contains: return err } - msg := govtypes.NewMsgSubmitProposal(content, deposit, from) + msg := govtypes.NewMsgSubmitProposalLegacy(content, deposit, from) if err := msg.ValidateBasic(); err != nil { return err } @@ -160,7 +160,7 @@ Where proposal.json contains: return err } - msg := govtypes.NewMsgSubmitProposal(content, deposit, from) + msg := govtypes.NewMsgSubmitProposalLegacy(content, deposit, from) if err := msg.ValidateBasic(); err != nil { return err } diff --git a/x/params/client/rest/rest.go b/x/params/client/rest/rest.go index 59c5a4cd3df..15b9d7eb5e4 100644 --- a/x/params/client/rest/rest.go +++ b/x/params/client/rest/rest.go @@ -36,7 +36,7 @@ func postProposalHandlerFn(cliCtx context.CLIContext) http.HandlerFunc { content := proposal.NewParameterChangeProposal(req.Title, req.Description, req.Changes.ToParamChanges()) - msg := govtypes.NewMsgSubmitProposal(content, req.Deposit, req.Proposer) + msg := govtypes.NewMsgSubmitProposalLegacy(content, req.Deposit, req.Proposer) if rest.CheckBadRequestError(w, msg.ValidateBasic()) { return } diff --git a/x/upgrade/client/cli/tx.go b/x/upgrade/client/cli/tx.go index 27df5c3ec3c..65caf2ec84e 100644 --- a/x/upgrade/client/cli/tx.go +++ b/x/upgrade/client/cli/tx.go @@ -224,7 +224,7 @@ func GetCmdSubmitUpgradeProposal(cdc *codec.Codec) *cobra.Command { return err } - msg := gov.NewMsgSubmitProposal(content, deposit, from) + msg := gov.NewMsgSubmitProposalLegacy(content, deposit, from) if err := msg.ValidateBasic(); err != nil { return err } @@ -277,7 +277,7 @@ func GetCmdSubmitCancelUpgradeProposal(cdc *codec.Codec) *cobra.Command { content := types.NewCancelSoftwareUpgradeProposal(title, description) - msg := gov.NewMsgSubmitProposal(content, deposit, from) + msg := gov.NewMsgSubmitProposalLegacy(content, deposit, from) if err := msg.ValidateBasic(); err != nil { return err } diff --git a/x/upgrade/client/rest/tx.go b/x/upgrade/client/rest/tx.go index f04e4d07ab7..b0e6f1f6a72 100644 --- a/x/upgrade/client/rest/tx.go +++ b/x/upgrade/client/rest/tx.go @@ -169,7 +169,7 @@ func postPlanHandler(cliCtx context.CLIContext) http.HandlerFunc { plan := types.Plan{Name: req.UpgradeName, Time: t, Height: req.UpgradeHeight, Info: req.UpgradeInfo} content := types.NewSoftwareUpgradeProposal(req.Title, req.Description, plan) - msg := gov.NewMsgSubmitProposal(content, req.Deposit, fromAddr) + msg := gov.NewMsgSubmitProposalLegacy(content, req.Deposit, fromAddr) if rest.CheckBadRequestError(w, msg.ValidateBasic()) { return } @@ -197,7 +197,7 @@ func cancelPlanHandler(cliCtx context.CLIContext) http.HandlerFunc { } content := types.NewCancelSoftwareUpgradeProposal(req.Title, req.Description) - msg := gov.NewMsgSubmitProposal(content, req.Deposit, fromAddr) + msg := gov.NewMsgSubmitProposalLegacy(content, req.Deposit, fromAddr) if rest.CheckBadRequestError(w, msg.ValidateBasic()) { return } From df49ab469ac520b434c2505917dd64b8060ad84e Mon Sep 17 00:00:00 2001 From: Aaron Craelius Date: Tue, 5 May 2020 15:27:01 -0400 Subject: [PATCH 02/42] Fixes --- std/codec.proto | 16 ---------------- x/gov/abci_test.go | 12 +++++------- x/gov/client/rest/tx.go | 5 ++++- x/gov/client/utils/query.go | 2 +- x/gov/keeper/proposal_test.go | 4 +++- x/gov/keeper/querier_test.go | 6 ++---- x/gov/simulation/decoder_test.go | 6 ++++-- x/gov/types/msgs_test.go | 4 +++- x/gov/types/proposal.go | 9 ++++----- 9 files changed, 26 insertions(+), 38 deletions(-) diff --git a/std/codec.proto b/std/codec.proto index 15ae9ab030d..38be566947c 100644 --- a/std/codec.proto +++ b/std/codec.proto @@ -42,22 +42,6 @@ message Supply { } } -// Content defines the application-level allowed Content to be included in a -// governance proposal. -message Content { - option (gogoproto.equal) = true; - option (cosmos_proto.interface_type) = "*github.com/cosmos/cosmos-sdk/x/gov/types.Content"; - - // sum defines a set of all acceptable concrete governance proposal Content types. - oneof sum { - cosmos_sdk.x.gov.v1.TextProposal text = 1; - cosmos_sdk.x.params.v1.ParameterChangeProposal parameter_change = 2; - cosmos_sdk.x.upgrade.v1.SoftwareUpgradeProposal software_upgrade = 3; - cosmos_sdk.x.upgrade.v1.CancelSoftwareUpgradeProposal cancel_software_upgrade = 4; - cosmos_sdk.x.distribution.v1.CommunityPoolSpendProposal community_pool_spend = 5; - } -} - // Transaction defines the application-level transaction that can be signed and // processed by the state-machine. It contains a base of common fields and // repeated set of Message types. diff --git a/x/gov/abci_test.go b/x/gov/abci_test.go index 7fd04b6edbb..505b9269fca 100644 --- a/x/gov/abci_test.go +++ b/x/gov/abci_test.go @@ -4,8 +4,6 @@ import ( "testing" "time" - "github.com/cosmos/cosmos-sdk/std" - "github.com/stretchr/testify/require" abci "github.com/tendermint/tendermint/abci/types" @@ -29,7 +27,7 @@ func TestTickExpiredDepositPeriod(t *testing.T) { require.False(t, inactiveQueue.Valid()) inactiveQueue.Close() - newProposalMsg, err := std.NewMsgSubmitProposal( + newProposalMsg, err := gov.NewMsgSubmitProposal( gov.ContentFromProposalType("test", "test", gov.ProposalTypeText), sdk.Coins{sdk.NewInt64Coin(sdk.DefaultBondDenom, 5)}, addrs[0], @@ -81,7 +79,7 @@ func TestTickMultipleExpiredDepositPeriod(t *testing.T) { require.False(t, inactiveQueue.Valid()) inactiveQueue.Close() - newProposalMsg, err := std.NewMsgSubmitProposal( + newProposalMsg, err := gov.NewMsgSubmitProposal( gov.ContentFromProposalType("test", "test", gov.ProposalTypeText), sdk.Coins{sdk.NewInt64Coin(sdk.DefaultBondDenom, 5)}, addrs[0], @@ -104,7 +102,7 @@ func TestTickMultipleExpiredDepositPeriod(t *testing.T) { require.False(t, inactiveQueue.Valid()) inactiveQueue.Close() - newProposalMsg2, err := std.NewMsgSubmitProposal( + newProposalMsg2, err := gov.NewMsgSubmitProposal( gov.ContentFromProposalType("test2", "test2", gov.ProposalTypeText), sdk.Coins{sdk.NewInt64Coin(sdk.DefaultBondDenom, 5)}, addrs[0], @@ -161,7 +159,7 @@ func TestTickPassedDepositPeriod(t *testing.T) { require.False(t, activeQueue.Valid()) activeQueue.Close() - newProposalMsg, err := std.NewMsgSubmitProposal( + newProposalMsg, err := gov.NewMsgSubmitProposal( gov.ContentFromProposalType("test2", "test2", gov.ProposalTypeText), sdk.Coins{sdk.NewInt64Coin(sdk.DefaultBondDenom, 5)}, addrs[0], @@ -217,7 +215,7 @@ func TestTickPassedVotingPeriod(t *testing.T) { activeQueue.Close() proposalCoins := sdk.Coins{sdk.NewCoin(sdk.DefaultBondDenom, sdk.TokensFromConsensusPower(5))} - newProposalMsg, err := std.NewMsgSubmitProposal(TestProposal, proposalCoins, addrs[0]) + newProposalMsg, err := gov.NewMsgSubmitProposal(TestProposal, proposalCoins, addrs[0]) require.NoError(t, err) res, err := govHandler(ctx, newProposalMsg) diff --git a/x/gov/client/rest/tx.go b/x/gov/client/rest/tx.go index 9fc5f2a3fae..5fc94d1e8ed 100644 --- a/x/gov/client/rest/tx.go +++ b/x/gov/client/rest/tx.go @@ -162,7 +162,10 @@ func postProposalHandlerFn(cliCtx context.CLIContext) http.HandlerFunc { proposalType := gcutils.NormalizeProposalType(req.ProposalType) content := types.ContentFromProposalType(req.Title, req.Description, proposalType) - msg := types.NewMsgSubmitProposalLegacy(content, req.InitialDeposit, req.Proposer) + msg, err := types.NewMsgSubmitProposal(content, req.InitialDeposit, req.Proposer) + if rest.CheckBadRequestError(w, err) { + return + } if rest.CheckBadRequestError(w, msg.ValidateBasic()) { return } diff --git a/x/gov/client/utils/query.go b/x/gov/client/utils/query.go index ee3a7c49ae7..3b092ccccf0 100644 --- a/x/gov/client/utils/query.go +++ b/x/gov/client/utils/query.go @@ -219,7 +219,7 @@ func QueryProposerByTxQuery(cliCtx context.CLIContext, proposalID uint64) (Propo for _, msg := range info.Tx.GetMsgs() { // there should only be a single proposal under the given conditions if msg.Type() == types.TypeMsgSubmitProposal { - subMsg := msg.(*types.MsgSubmitProposalLegacy) + subMsg := msg.(*types.MsgSubmitProposal) return NewProposer(proposalID, subMsg.Proposer.String()), nil } } diff --git a/x/gov/keeper/proposal_test.go b/x/gov/keeper/proposal_test.go index aa176b473a8..4f29a6748d1 100644 --- a/x/gov/keeper/proposal_test.go +++ b/x/gov/keeper/proposal_test.go @@ -93,7 +93,9 @@ func TestGetProposalsFiltered(t *testing.T) { for _, s := range status { for i := 0; i < 50; i++ { - p := types.NewProposal(TestProposal, proposalID, time.Now(), time.Now()) + p, err := types.NewProposal(TestProposal, proposalID, time.Now(), time.Now()) + require.NoError(t, err) + p.Status = s if i%2 == 0 { diff --git a/x/gov/keeper/querier_test.go b/x/gov/keeper/querier_test.go index dd842af2933..f517874244b 100644 --- a/x/gov/keeper/querier_test.go +++ b/x/gov/keeper/querier_test.go @@ -297,10 +297,8 @@ func TestPaginatedVotesQuery(t *testing.T) { appCodec := app.AppCodec() proposal := types.Proposal{ - ProposalBase: types.ProposalBase{ - ProposalID: 100, - Status: types.StatusVotingPeriod, - }, + ProposalID: 100, + Status: types.StatusVotingPeriod, } app.GovKeeper.SetProposal(ctx, proposal) diff --git a/x/gov/simulation/decoder_test.go b/x/gov/simulation/decoder_test.go index 5a11ab0304c..20087f4a11e 100644 --- a/x/gov/simulation/decoder_test.go +++ b/x/gov/simulation/decoder_test.go @@ -29,13 +29,15 @@ func TestDecodeStore(t *testing.T) { endTime := time.Now().UTC() content := types.ContentFromProposalType("test", "test", types.ProposalTypeText) - proposal := types.NewProposal(content, 1, endTime, endTime.Add(24*time.Hour)) + proposal, err := types.NewProposal(content, 1, endTime, endTime.Add(24*time.Hour)) + require.NoError(t, err) + proposalIDBz := make([]byte, 8) binary.LittleEndian.PutUint64(proposalIDBz, 1) deposit := types.NewDeposit(1, delAddr1, sdk.NewCoins(sdk.NewCoin(sdk.DefaultBondDenom, sdk.OneInt()))) vote := types.NewVote(1, delAddr1, types.OptionYes) - proposalBz, err := cdc.MarshalProposal(proposal) + proposalBz, err := cdc.MarshalBinaryBare(&proposal) require.NoError(t, err) kvPairs := tmkv.Pairs{ diff --git a/x/gov/types/msgs_test.go b/x/gov/types/msgs_test.go index 9642d9f2a83..49e51b13eb8 100644 --- a/x/gov/types/msgs_test.go +++ b/x/gov/types/msgs_test.go @@ -43,12 +43,14 @@ func TestMsgSubmitProposal(t *testing.T) { } for i, tc := range tests { - msg := NewMsgSubmitProposalLegacy( + msg, err := NewMsgSubmitProposal( ContentFromProposalType(tc.title, tc.description, tc.proposalType), tc.initialDeposit, tc.proposerAddr, ) + require.NoError(t, err) + if tc.expectPass { require.NoError(t, msg.ValidateBasic(), "test: %v", i) } else { diff --git a/x/gov/types/proposal.go b/x/gov/types/proposal.go index d5cc6333b96..29586d9976e 100644 --- a/x/gov/types/proposal.go +++ b/x/gov/types/proposal.go @@ -3,11 +3,10 @@ package types import ( "encoding/json" "fmt" - "github.com/gogo/protobuf/proto" "strings" "time" - "gopkg.in/yaml.v2" + "github.com/gogo/protobuf/proto" "github.com/cosmos/cosmos-sdk/codec/types" sdk "github.com/cosmos/cosmos-sdk/types" @@ -59,7 +58,7 @@ func (m Proposal) GetContent() Content { func (m Proposal) ProposalType() string { content := m.GetContent() - if content != nil { + if content == nil { return "" } return content.ProposalType() @@ -67,7 +66,7 @@ func (m Proposal) ProposalType() string { func (m Proposal) ProposalRoute() string { content := m.GetContent() - if content != nil { + if content == nil { return "" } return content.ProposalRoute() @@ -75,7 +74,7 @@ func (m Proposal) ProposalRoute() string { func (m Proposal) GetTitle() string { content := m.GetContent() - if content != nil { + if content == nil { return "" } return content.GetTitle() From 3e5a787a665a68b7cd263a6cfb37ccaddca649e0 Mon Sep 17 00:00:00 2001 From: Aaron Craelius Date: Wed, 6 May 2020 17:11:31 -0400 Subject: [PATCH 03/42] Remove MsgSubmitProposalLegacy --- std/codec.pb.go | 2243 +++++++--------------------------- std/codec.proto | 38 - x/gov/alias.go | 58 +- x/gov/client/cli/tx.go | 5 +- x/gov/types/codec.go | 2 +- x/gov/types/msgs.go | 76 +- x/gov/types/proposal.go | 2 + x/gov/types/types.pb.go | 428 +++---- x/params/client/cli/tx.go | 10 +- x/params/client/rest/rest.go | 5 +- x/upgrade/client/cli/tx.go | 10 +- x/upgrade/client/rest/tx.go | 10 +- 12 files changed, 713 insertions(+), 2174 deletions(-) diff --git a/std/codec.pb.go b/std/codec.pb.go index f05db8eed67..5de1c46bb0e 100644 --- a/std/codec.pb.go +++ b/std/codec.pb.go @@ -6,20 +6,17 @@ package std import ( fmt "fmt" github_com_cosmos_cosmos_sdk_types "github.com/cosmos/cosmos-sdk/types" - types9 "github.com/cosmos/cosmos-sdk/types" + types8 "github.com/cosmos/cosmos-sdk/types" github_com_cosmos_cosmos_sdk_x_auth_exported "github.com/cosmos/cosmos-sdk/x/auth/exported" types "github.com/cosmos/cosmos-sdk/x/auth/types" types1 "github.com/cosmos/cosmos-sdk/x/auth/vesting/types" github_com_cosmos_cosmos_sdk_x_bank_exported "github.com/cosmos/cosmos-sdk/x/bank/exported" types2 "github.com/cosmos/cosmos-sdk/x/bank/types" - types6 "github.com/cosmos/cosmos-sdk/x/crisis/types" - types5 "github.com/cosmos/cosmos-sdk/x/distribution/types" - github_com_cosmos_cosmos_sdk_x_gov_types "github.com/cosmos/cosmos-sdk/x/gov/types" - types3 "github.com/cosmos/cosmos-sdk/x/gov/types" - proposal "github.com/cosmos/cosmos-sdk/x/params/types/proposal" - types7 "github.com/cosmos/cosmos-sdk/x/slashing/types" - types8 "github.com/cosmos/cosmos-sdk/x/staking/types" - types4 "github.com/cosmos/cosmos-sdk/x/upgrade/types" + types3 "github.com/cosmos/cosmos-sdk/x/crisis/types" + types4 "github.com/cosmos/cosmos-sdk/x/distribution/types" + types5 "github.com/cosmos/cosmos-sdk/x/gov/types" + types6 "github.com/cosmos/cosmos-sdk/x/slashing/types" + types7 "github.com/cosmos/cosmos-sdk/x/staking/types" _ "github.com/gogo/protobuf/gogoproto" proto "github.com/gogo/protobuf/proto" _ "github.com/regen-network/cosmos-proto" @@ -242,223 +239,6 @@ func (*Supply) XXX_OneofWrappers() []interface{} { } } -// MsgSubmitProposal defines the application-level message type for handling -// governance proposals. -type MsgSubmitProposal struct { - types3.MsgSubmitProposalBase `protobuf:"bytes,1,opt,name=base,proto3,embedded=base" json:"base"` - Content *Content `protobuf:"bytes,2,opt,name=content,proto3" json:"content,omitempty"` -} - -func (m *MsgSubmitProposal) Reset() { *m = MsgSubmitProposal{} } -func (m *MsgSubmitProposal) String() string { return proto.CompactTextString(m) } -func (*MsgSubmitProposal) ProtoMessage() {} -func (*MsgSubmitProposal) Descriptor() ([]byte, []int) { - return fileDescriptor_ff851c3a98ef46f7, []int{2} -} -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 { - types3.ProposalBase `protobuf:"bytes,1,opt,name=base,proto3,embedded=base" json:"base"` - Content Content `protobuf:"bytes,2,opt,name=content,proto3" json:"content"` -} - -func (m *Proposal) Reset() { *m = Proposal{} } -func (m *Proposal) String() string { return proto.CompactTextString(m) } -func (*Proposal) ProtoMessage() {} -func (*Proposal) Descriptor() ([]byte, []int) { - return fileDescriptor_ff851c3a98ef46f7, []int{3} -} -func (m *Proposal) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *Proposal) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_Proposal.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *Proposal) XXX_Merge(src proto.Message) { - xxx_messageInfo_Proposal.Merge(m, src) -} -func (m *Proposal) XXX_Size() int { - return m.Size() -} -func (m *Proposal) XXX_DiscardUnknown() { - xxx_messageInfo_Proposal.DiscardUnknown(m) -} - -var xxx_messageInfo_Proposal proto.InternalMessageInfo - -func (m *Proposal) GetContent() Content { - if m != nil { - return m.Content - } - return Content{} -} - -// Content defines the application-level allowed Content to be included in a -// governance proposal. -type Content struct { - // sum defines a set of all acceptable concrete governance proposal Content - // types. - // - // Types that are valid to be assigned to Sum: - // *Content_Text - // *Content_ParameterChange - // *Content_SoftwareUpgrade - // *Content_CancelSoftwareUpgrade - // *Content_CommunityPoolSpend - Sum isContent_Sum `protobuf_oneof:"sum"` -} - -func (m *Content) Reset() { *m = Content{} } -func (m *Content) String() string { return proto.CompactTextString(m) } -func (*Content) ProtoMessage() {} -func (*Content) Descriptor() ([]byte, []int) { - return fileDescriptor_ff851c3a98ef46f7, []int{4} -} -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 *types3.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 *types4.SoftwareUpgradeProposal `protobuf:"bytes,3,opt,name=software_upgrade,json=softwareUpgrade,proto3,oneof" json:"software_upgrade,omitempty"` -} -type Content_CancelSoftwareUpgrade struct { - CancelSoftwareUpgrade *types4.CancelSoftwareUpgradeProposal `protobuf:"bytes,4,opt,name=cancel_software_upgrade,json=cancelSoftwareUpgrade,proto3,oneof" json:"cancel_software_upgrade,omitempty"` -} -type Content_CommunityPoolSpend struct { - CommunityPoolSpend *types5.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() *types3.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() *types4.SoftwareUpgradeProposal { - if x, ok := m.GetSum().(*Content_SoftwareUpgrade); ok { - return x.SoftwareUpgrade - } - return nil -} - -func (m *Content) GetCancelSoftwareUpgrade() *types4.CancelSoftwareUpgradeProposal { - if x, ok := m.GetSum().(*Content_CancelSoftwareUpgrade); ok { - return x.CancelSoftwareUpgrade - } - return nil -} - -func (m *Content) GetCommunityPoolSpend() *types5.CommunityPoolSpendProposal { - if x, ok := m.GetSum().(*Content_CommunityPoolSpend); ok { - return x.CommunityPoolSpend - } - return nil -} - -// XXX_OneofWrappers is for the internal use of the proto package. -func (*Content) XXX_OneofWrappers() []interface{} { - return []interface{}{ - (*Content_Text)(nil), - (*Content_ParameterChange)(nil), - (*Content_SoftwareUpgrade)(nil), - (*Content_CancelSoftwareUpgrade)(nil), - (*Content_CommunityPoolSpend)(nil), - } -} - // Transaction defines the application-level transaction that can be signed and // processed by the state-machine. It contains a base of common fields and // repeated set of Message types. @@ -471,7 +251,7 @@ func (m *Transaction) Reset() { *m = Transaction{} } func (m *Transaction) String() string { return proto.CompactTextString(m) } func (*Transaction) ProtoMessage() {} func (*Transaction) Descriptor() ([]byte, []int) { - return fileDescriptor_ff851c3a98ef46f7, []int{5} + return fileDescriptor_ff851c3a98ef46f7, []int{2} } func (m *Transaction) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -513,7 +293,6 @@ type Message struct { // *Message_MsgWithdrawDelegatorReward // *Message_MsgWithdrawValidatorCommission // *Message_MsgFundCommunityPool - // *Message_MsgSubmitProposal // *Message_MsgVote // *Message_MsgDeposit // *Message_MsgUnjail @@ -529,7 +308,7 @@ func (m *Message) Reset() { *m = Message{} } func (m *Message) String() string { return proto.CompactTextString(m) } func (*Message) ProtoMessage() {} func (*Message) Descriptor() ([]byte, []int) { - return fileDescriptor_ff851c3a98ef46f7, []int{6} + return fileDescriptor_ff851c3a98ef46f7, []int{3} } func (m *Message) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -571,46 +350,43 @@ type Message_MsgMultiSend struct { MsgMultiSend *types2.MsgMultiSend `protobuf:"bytes,2,opt,name=msg_multi_send,json=msgMultiSend,proto3,oneof" json:"msg_multi_send,omitempty"` } type Message_MsgVerifyInvariant struct { - MsgVerifyInvariant *types6.MsgVerifyInvariant `protobuf:"bytes,3,opt,name=msg_verify_invariant,json=msgVerifyInvariant,proto3,oneof" json:"msg_verify_invariant,omitempty"` + MsgVerifyInvariant *types3.MsgVerifyInvariant `protobuf:"bytes,3,opt,name=msg_verify_invariant,json=msgVerifyInvariant,proto3,oneof" json:"msg_verify_invariant,omitempty"` } type Message_MsgSetWithdrawAddress struct { - MsgSetWithdrawAddress *types5.MsgSetWithdrawAddress `protobuf:"bytes,4,opt,name=msg_set_withdraw_address,json=msgSetWithdrawAddress,proto3,oneof" json:"msg_set_withdraw_address,omitempty"` + MsgSetWithdrawAddress *types4.MsgSetWithdrawAddress `protobuf:"bytes,4,opt,name=msg_set_withdraw_address,json=msgSetWithdrawAddress,proto3,oneof" json:"msg_set_withdraw_address,omitempty"` } type Message_MsgWithdrawDelegatorReward struct { - MsgWithdrawDelegatorReward *types5.MsgWithdrawDelegatorReward `protobuf:"bytes,5,opt,name=msg_withdraw_delegator_reward,json=msgWithdrawDelegatorReward,proto3,oneof" json:"msg_withdraw_delegator_reward,omitempty"` + MsgWithdrawDelegatorReward *types4.MsgWithdrawDelegatorReward `protobuf:"bytes,5,opt,name=msg_withdraw_delegator_reward,json=msgWithdrawDelegatorReward,proto3,oneof" json:"msg_withdraw_delegator_reward,omitempty"` } type Message_MsgWithdrawValidatorCommission struct { - MsgWithdrawValidatorCommission *types5.MsgWithdrawValidatorCommission `protobuf:"bytes,6,opt,name=msg_withdraw_validator_commission,json=msgWithdrawValidatorCommission,proto3,oneof" json:"msg_withdraw_validator_commission,omitempty"` + MsgWithdrawValidatorCommission *types4.MsgWithdrawValidatorCommission `protobuf:"bytes,6,opt,name=msg_withdraw_validator_commission,json=msgWithdrawValidatorCommission,proto3,oneof" json:"msg_withdraw_validator_commission,omitempty"` } type Message_MsgFundCommunityPool struct { - MsgFundCommunityPool *types5.MsgFundCommunityPool `protobuf:"bytes,7,opt,name=msg_fund_community_pool,json=msgFundCommunityPool,proto3,oneof" json:"msg_fund_community_pool,omitempty"` -} -type Message_MsgSubmitProposal struct { - MsgSubmitProposal *MsgSubmitProposal `protobuf:"bytes,9,opt,name=msg_submit_proposal,json=msgSubmitProposal,proto3,oneof" json:"msg_submit_proposal,omitempty"` + MsgFundCommunityPool *types4.MsgFundCommunityPool `protobuf:"bytes,7,opt,name=msg_fund_community_pool,json=msgFundCommunityPool,proto3,oneof" json:"msg_fund_community_pool,omitempty"` } type Message_MsgVote struct { - MsgVote *types3.MsgVote `protobuf:"bytes,10,opt,name=msg_vote,json=msgVote,proto3,oneof" json:"msg_vote,omitempty"` + MsgVote *types5.MsgVote `protobuf:"bytes,10,opt,name=msg_vote,json=msgVote,proto3,oneof" json:"msg_vote,omitempty"` } type Message_MsgDeposit struct { - MsgDeposit *types3.MsgDeposit `protobuf:"bytes,11,opt,name=msg_deposit,json=msgDeposit,proto3,oneof" json:"msg_deposit,omitempty"` + MsgDeposit *types5.MsgDeposit `protobuf:"bytes,11,opt,name=msg_deposit,json=msgDeposit,proto3,oneof" json:"msg_deposit,omitempty"` } type Message_MsgUnjail struct { - MsgUnjail *types7.MsgUnjail `protobuf:"bytes,12,opt,name=msg_unjail,json=msgUnjail,proto3,oneof" json:"msg_unjail,omitempty"` + MsgUnjail *types6.MsgUnjail `protobuf:"bytes,12,opt,name=msg_unjail,json=msgUnjail,proto3,oneof" json:"msg_unjail,omitempty"` } type Message_MsgCreateValidator struct { - MsgCreateValidator *types8.MsgCreateValidator `protobuf:"bytes,13,opt,name=msg_create_validator,json=msgCreateValidator,proto3,oneof" json:"msg_create_validator,omitempty"` + MsgCreateValidator *types7.MsgCreateValidator `protobuf:"bytes,13,opt,name=msg_create_validator,json=msgCreateValidator,proto3,oneof" json:"msg_create_validator,omitempty"` } type Message_MsgEditValidator struct { - MsgEditValidator *types8.MsgEditValidator `protobuf:"bytes,14,opt,name=msg_edit_validator,json=msgEditValidator,proto3,oneof" json:"msg_edit_validator,omitempty"` + MsgEditValidator *types7.MsgEditValidator `protobuf:"bytes,14,opt,name=msg_edit_validator,json=msgEditValidator,proto3,oneof" json:"msg_edit_validator,omitempty"` } type Message_MsgDelegate struct { - MsgDelegate *types8.MsgDelegate `protobuf:"bytes,15,opt,name=msg_delegate,json=msgDelegate,proto3,oneof" json:"msg_delegate,omitempty"` + MsgDelegate *types7.MsgDelegate `protobuf:"bytes,15,opt,name=msg_delegate,json=msgDelegate,proto3,oneof" json:"msg_delegate,omitempty"` } type Message_MsgBeginRedelegate struct { - MsgBeginRedelegate *types8.MsgBeginRedelegate `protobuf:"bytes,16,opt,name=msg_begin_redelegate,json=msgBeginRedelegate,proto3,oneof" json:"msg_begin_redelegate,omitempty"` + MsgBeginRedelegate *types7.MsgBeginRedelegate `protobuf:"bytes,16,opt,name=msg_begin_redelegate,json=msgBeginRedelegate,proto3,oneof" json:"msg_begin_redelegate,omitempty"` } type Message_MsgUndelegate struct { - MsgUndelegate *types8.MsgUndelegate `protobuf:"bytes,17,opt,name=msg_undelegate,json=msgUndelegate,proto3,oneof" json:"msg_undelegate,omitempty"` + MsgUndelegate *types7.MsgUndelegate `protobuf:"bytes,17,opt,name=msg_undelegate,json=msgUndelegate,proto3,oneof" json:"msg_undelegate,omitempty"` } func (*Message_MsgSend) isMessage_Sum() {} @@ -620,7 +396,6 @@ func (*Message_MsgSetWithdrawAddress) isMessage_Sum() {} func (*Message_MsgWithdrawDelegatorReward) isMessage_Sum() {} func (*Message_MsgWithdrawValidatorCommission) isMessage_Sum() {} func (*Message_MsgFundCommunityPool) isMessage_Sum() {} -func (*Message_MsgSubmitProposal) isMessage_Sum() {} func (*Message_MsgVote) isMessage_Sum() {} func (*Message_MsgDeposit) isMessage_Sum() {} func (*Message_MsgUnjail) isMessage_Sum() {} @@ -651,98 +426,91 @@ func (m *Message) GetMsgMultiSend() *types2.MsgMultiSend { return nil } -func (m *Message) GetMsgVerifyInvariant() *types6.MsgVerifyInvariant { +func (m *Message) GetMsgVerifyInvariant() *types3.MsgVerifyInvariant { if x, ok := m.GetSum().(*Message_MsgVerifyInvariant); ok { return x.MsgVerifyInvariant } return nil } -func (m *Message) GetMsgSetWithdrawAddress() *types5.MsgSetWithdrawAddress { +func (m *Message) GetMsgSetWithdrawAddress() *types4.MsgSetWithdrawAddress { if x, ok := m.GetSum().(*Message_MsgSetWithdrawAddress); ok { return x.MsgSetWithdrawAddress } return nil } -func (m *Message) GetMsgWithdrawDelegatorReward() *types5.MsgWithdrawDelegatorReward { +func (m *Message) GetMsgWithdrawDelegatorReward() *types4.MsgWithdrawDelegatorReward { if x, ok := m.GetSum().(*Message_MsgWithdrawDelegatorReward); ok { return x.MsgWithdrawDelegatorReward } return nil } -func (m *Message) GetMsgWithdrawValidatorCommission() *types5.MsgWithdrawValidatorCommission { +func (m *Message) GetMsgWithdrawValidatorCommission() *types4.MsgWithdrawValidatorCommission { if x, ok := m.GetSum().(*Message_MsgWithdrawValidatorCommission); ok { return x.MsgWithdrawValidatorCommission } return nil } -func (m *Message) GetMsgFundCommunityPool() *types5.MsgFundCommunityPool { +func (m *Message) GetMsgFundCommunityPool() *types4.MsgFundCommunityPool { if x, ok := m.GetSum().(*Message_MsgFundCommunityPool); ok { return x.MsgFundCommunityPool } return nil } -func (m *Message) GetMsgSubmitProposal() *MsgSubmitProposal { - if x, ok := m.GetSum().(*Message_MsgSubmitProposal); ok { - return x.MsgSubmitProposal - } - return nil -} - -func (m *Message) GetMsgVote() *types3.MsgVote { +func (m *Message) GetMsgVote() *types5.MsgVote { if x, ok := m.GetSum().(*Message_MsgVote); ok { return x.MsgVote } return nil } -func (m *Message) GetMsgDeposit() *types3.MsgDeposit { +func (m *Message) GetMsgDeposit() *types5.MsgDeposit { if x, ok := m.GetSum().(*Message_MsgDeposit); ok { return x.MsgDeposit } return nil } -func (m *Message) GetMsgUnjail() *types7.MsgUnjail { +func (m *Message) GetMsgUnjail() *types6.MsgUnjail { if x, ok := m.GetSum().(*Message_MsgUnjail); ok { return x.MsgUnjail } return nil } -func (m *Message) GetMsgCreateValidator() *types8.MsgCreateValidator { +func (m *Message) GetMsgCreateValidator() *types7.MsgCreateValidator { if x, ok := m.GetSum().(*Message_MsgCreateValidator); ok { return x.MsgCreateValidator } return nil } -func (m *Message) GetMsgEditValidator() *types8.MsgEditValidator { +func (m *Message) GetMsgEditValidator() *types7.MsgEditValidator { if x, ok := m.GetSum().(*Message_MsgEditValidator); ok { return x.MsgEditValidator } return nil } -func (m *Message) GetMsgDelegate() *types8.MsgDelegate { +func (m *Message) GetMsgDelegate() *types7.MsgDelegate { if x, ok := m.GetSum().(*Message_MsgDelegate); ok { return x.MsgDelegate } return nil } -func (m *Message) GetMsgBeginRedelegate() *types8.MsgBeginRedelegate { +func (m *Message) GetMsgBeginRedelegate() *types7.MsgBeginRedelegate { if x, ok := m.GetSum().(*Message_MsgBeginRedelegate); ok { return x.MsgBeginRedelegate } return nil } -func (m *Message) GetMsgUndelegate() *types8.MsgUndelegate { +func (m *Message) GetMsgUndelegate() *types7.MsgUndelegate { if x, ok := m.GetSum().(*Message_MsgUndelegate); ok { return x.MsgUndelegate } @@ -759,7 +527,6 @@ func (*Message) XXX_OneofWrappers() []interface{} { (*Message_MsgWithdrawDelegatorReward)(nil), (*Message_MsgWithdrawValidatorCommission)(nil), (*Message_MsgFundCommunityPool)(nil), - (*Message_MsgSubmitProposal)(nil), (*Message_MsgVote)(nil), (*Message_MsgDeposit)(nil), (*Message_MsgUnjail)(nil), @@ -782,7 +549,7 @@ func (m *SignDoc) Reset() { *m = SignDoc{} } func (m *SignDoc) String() string { return proto.CompactTextString(m) } func (*SignDoc) ProtoMessage() {} func (*SignDoc) Descriptor() ([]byte, []int) { - return fileDescriptor_ff851c3a98ef46f7, []int{7} + return fileDescriptor_ff851c3a98ef46f7, []int{4} } func (m *SignDoc) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -830,7 +597,7 @@ func (m *StdFee) Reset() { *m = StdFee{} } func (m *StdFee) String() string { return proto.CompactTextString(m) } func (*StdFee) ProtoMessage() {} func (*StdFee) Descriptor() ([]byte, []int) { - return fileDescriptor_ff851c3a98ef46f7, []int{8} + return fileDescriptor_ff851c3a98ef46f7, []int{5} } func (m *StdFee) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -870,7 +637,7 @@ func (m *StdSignature) Reset() { *m = StdSignature{} } func (m *StdSignature) String() string { return proto.CompactTextString(m) } func (*StdSignature) ProtoMessage() {} func (*StdSignature) Descriptor() ([]byte, []int) { - return fileDescriptor_ff851c3a98ef46f7, []int{9} + return fileDescriptor_ff851c3a98ef46f7, []int{6} } func (m *StdSignature) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -911,7 +678,7 @@ func (m *StdTxBase) Reset() { *m = StdTxBase{} } func (m *StdTxBase) String() string { return proto.CompactTextString(m) } func (*StdTxBase) ProtoMessage() {} func (*StdTxBase) Descriptor() ([]byte, []int) { - return fileDescriptor_ff851c3a98ef46f7, []int{10} + return fileDescriptor_ff851c3a98ef46f7, []int{7} } func (m *StdTxBase) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -975,7 +742,7 @@ func (m *StdSignDocBase) Reset() { *m = StdSignDocBase{} } func (m *StdSignDocBase) String() string { return proto.CompactTextString(m) } func (*StdSignDocBase) ProtoMessage() {} func (*StdSignDocBase) Descriptor() ([]byte, []int) { - return fileDescriptor_ff851c3a98ef46f7, []int{11} + return fileDescriptor_ff851c3a98ef46f7, []int{8} } func (m *StdSignDocBase) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1042,9 +809,6 @@ func (m *StdSignDocBase) GetFee() StdFee { func init() { proto.RegisterType((*Account)(nil), "cosmos_sdk.std.v1.Account") proto.RegisterType((*Supply)(nil), "cosmos_sdk.std.v1.Supply") - proto.RegisterType((*MsgSubmitProposal)(nil), "cosmos_sdk.std.v1.MsgSubmitProposal") - proto.RegisterType((*Proposal)(nil), "cosmos_sdk.std.v1.Proposal") - proto.RegisterType((*Content)(nil), "cosmos_sdk.std.v1.Content") proto.RegisterType((*Transaction)(nil), "cosmos_sdk.std.v1.Transaction") proto.RegisterType((*Message)(nil), "cosmos_sdk.std.v1.Message") proto.RegisterType((*SignDoc)(nil), "cosmos_sdk.std.v1.SignDoc") @@ -1057,110 +821,92 @@ func init() { func init() { proto.RegisterFile("std/codec.proto", fileDescriptor_ff851c3a98ef46f7) } var fileDescriptor_ff851c3a98ef46f7 = []byte{ - // 1639 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x57, 0x4f, 0x6f, 0x1b, 0xb9, - 0x15, 0x97, 0x62, 0xc5, 0xb2, 0x69, 0xf9, 0x1f, 0x93, 0xd4, 0x8a, 0xeb, 0x48, 0x8e, 0x52, 0x04, - 0x69, 0x52, 0x4b, 0x71, 0x92, 0xa6, 0x8d, 0xd0, 0x7f, 0x91, 0x1d, 0x43, 0x6e, 0xeb, 0x36, 0x18, - 0x27, 0x2e, 0x5a, 0xb4, 0x1d, 0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0xb4, 0x9c, 0xdf, 0x92, 0xb2, 0xdd, 0xed, 0x0f, 0xa7, 0xe5, - 0xc5, 0xf0, 0x38, 0x22, 0xa3, 0x8a, 0x91, 0x57, 0xcb, 0x5d, 0x1b, 0xfe, 0x0c, 0x2c, 0xe8, 0x7f, - 0x52, 0xa6, 0x1b, 0xd0, 0x16, 0xf6, 0xc3, 0x64, 0x34, 0xae, 0x7e, 0x38, 0x2d, 0x5f, 0x09, 0x51, - 0x83, 0xfa, 0x8a, 0x31, 0xaf, 0x05, 0xbf, 0x52, 0x7b, 0xb8, 0x0a, 0x66, 0x38, 0xfe, 0x73, 0x80, - 0x5d, 0x2b, 0x7c, 0x9e, 0xe6, 0x8c, 0x78, 0x1f, 0xc7, 0x9f, 0xeb, 0xc7, 0x1f, 0x9d, 0xe6, 0xc5, - 0xf3, 0x9f, 0x66, 0xa3, 0xfe, 0xfa, 0xac, 0x94, 0x7d, 0x7b, 0x56, 0xca, 0x7e, 0x7e, 0x56, 0xca, - 0xfe, 0xfb, 0x5d, 0x29, 0xf3, 0xf6, 0x5d, 0x29, 0xf3, 0xe9, 0xbb, 0x52, 0xe6, 0x77, 0xeb, 0x13, - 0x4b, 0x8e, 0x0b, 0xbb, 0x35, 0xad, 0xfe, 0xe5, 0xdf, 0xff, 0x2a, 0x00, 0x00, 0xff, 0xff, 0x1a, - 0x12, 0x9f, 0x93, 0x9d, 0x11, 0x00, 0x00, + // 1354 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x57, 0xcd, 0x6f, 0x1b, 0x45, + 0x14, 0x5f, 0x37, 0x6e, 0xdc, 0x8c, 0x9d, 0xb4, 0x19, 0x5a, 0xea, 0x9a, 0xd6, 0x4e, 0x0d, 0xaa, + 0x4a, 0x4b, 0x6c, 0xfa, 0x41, 0x45, 0x2d, 0x40, 0xd4, 0x49, 0x23, 0x07, 0x08, 0x54, 0x9b, 0xb6, + 0x08, 0x24, 0x58, 0xad, 0x77, 0xa6, 0xce, 0x10, 0xcf, 0xce, 0xb2, 0x33, 0xeb, 0xda, 0x48, 0x9c, + 0x40, 0x88, 0x72, 0xe2, 0xca, 0xad, 0x67, 0xce, 0x3d, 0xf1, 0x17, 0x54, 0x3d, 0xf5, 0xc8, 0xc9, + 0xa0, 0xf4, 0x82, 0x7a, 0x42, 0xfd, 0x0b, 0xd0, 0x7c, 0xec, 0xda, 0x89, 0x37, 0x6e, 0x0e, 0x5c, + 0xa2, 0x99, 0xf7, 0xde, 0xef, 0xf7, 0xde, 0xbe, 0x8f, 0x79, 0x0e, 0x38, 0xca, 0x05, 0xaa, 0x7b, + 0x0c, 0x61, 0xaf, 0x16, 0x84, 0x4c, 0x30, 0xb8, 0xe8, 0x31, 0x4e, 0x19, 0x77, 0x38, 0xda, 0xae, + 0x71, 0x81, 0x6a, 0xbd, 0x4b, 0xa5, 0x8b, 0x62, 0x8b, 0x84, 0xc8, 0x09, 0xdc, 0x50, 0x0c, 0xea, + 0xca, 0xaa, 0xae, 0x8d, 0x96, 0xc7, 0x2f, 0x1a, 0x5f, 0x3a, 0x37, 0x69, 0xdc, 0x61, 0x1d, 0x36, + 0x3a, 0x19, 0xbb, 0x45, 0x31, 0x08, 0x30, 0xaf, 0xab, 0xbf, 0x46, 0x54, 0xec, 0xd7, 0xdd, 0x48, + 0x6c, 0xd5, 0x27, 0x35, 0x4b, 0x46, 0xd3, 0xc3, 0x5c, 0x10, 0xbf, 0x53, 0x4f, 0xc5, 0xb6, 0x5d, + 0x7f, 0x3b, 0x45, 0x53, 0xea, 0xd7, 0xbd, 0x90, 0x70, 0xc2, 0xd3, 0x79, 0x11, 0xe1, 0x22, 0x24, + 0xed, 0x48, 0x10, 0xe6, 0xa7, 0x58, 0x9c, 0xec, 0xd7, 0x3b, 0xac, 0x97, 0xa2, 0x38, 0xdd, 0xaf, + 0xf3, 0xae, 0xcb, 0xb7, 0xd2, 0xc3, 0x79, 0xad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x9e, 0x3e, 0x2b, 0x5b, 0x7f, 0x3e, 0x2b, 0x5b, 0x5f, + 0x2e, 0x4d, 0x6d, 0x39, 0x2e, 0x50, 0x7b, 0x56, 0xfd, 0xe7, 0x70, 0xe5, 0xbf, 0x00, 0x00, 0x00, + 0xff, 0xff, 0xa5, 0xcf, 0x10, 0x8f, 0xaf, 0x0d, 0x00, 0x00, } func (this *Supply) Equal(that interface{}) bool { @@ -1217,14 +963,14 @@ func (this *Supply_Supply) Equal(that interface{}) bool { } return true } -func (this *MsgSubmitProposal) Equal(that interface{}) bool { +func (this *StdFee) Equal(that interface{}) bool { if that == nil { return this == nil } - that1, ok := that.(*MsgSubmitProposal) + that1, ok := that.(*StdFee) if !ok { - that2, ok := that.(MsgSubmitProposal) + that2, ok := that.(StdFee) if ok { that1 = &that2 } else { @@ -1236,334 +982,86 @@ func (this *MsgSubmitProposal) Equal(that interface{}) bool { } else if this == nil { return false } - if !this.MsgSubmitProposalBase.Equal(&that1.MsgSubmitProposalBase) { + if len(this.Amount) != len(that1.Amount) { return false } - if !this.Content.Equal(that1.Content) { + for i := range this.Amount { + if !this.Amount[i].Equal(&that1.Amount[i]) { + return false + } + } + if this.Gas != that1.Gas { return false } return true } -func (this *Proposal) Equal(that interface{}) bool { - if that == nil { - return this == nil +func (this *Account) GetAccount() github_com_cosmos_cosmos_sdk_x_auth_exported.Account { + if x := this.GetBaseAccount(); x != nil { + return x } - - that1, ok := that.(*Proposal) - if !ok { - that2, ok := that.(Proposal) - if ok { - that1 = &that2 - } else { - return false - } + if x := this.GetContinuousVestingAccount(); x != nil { + return x } - if that1 == nil { - return this == nil - } else if this == nil { - return false + if x := this.GetDelayedVestingAccount(); x != nil { + return x } - if !this.ProposalBase.Equal(&that1.ProposalBase) { - return false + if x := this.GetPeriodicVestingAccount(); x != nil { + return x } - if !this.Content.Equal(&that1.Content) { - return false + if x := this.GetModuleAccount(); x != nil { + return x } - return true + return nil } -func (this *Content) Equal(that interface{}) bool { - if that == nil { - return this == nil - } - that1, ok := that.(*Content) - if !ok { - that2, ok := that.(Content) - if ok { - that1 = &that2 - } else { - return false - } - } - if that1 == nil { - return this == nil - } else if this == nil { - return false +func (this *Account) SetAccount(value github_com_cosmos_cosmos_sdk_x_auth_exported.Account) error { + if value == nil { + this.Sum = nil + return nil } - if that1.Sum == nil { - if this.Sum != nil { - return false - } - } else if this.Sum == nil { - return false - } else if !this.Sum.Equal(that1.Sum) { - return false + switch vt := value.(type) { + case *types.BaseAccount: + this.Sum = &Account_BaseAccount{vt} + return nil + case *types1.ContinuousVestingAccount: + this.Sum = &Account_ContinuousVestingAccount{vt} + return nil + case *types1.DelayedVestingAccount: + this.Sum = &Account_DelayedVestingAccount{vt} + return nil + case *types1.PeriodicVestingAccount: + this.Sum = &Account_PeriodicVestingAccount{vt} + return nil + case *types.ModuleAccount: + this.Sum = &Account_ModuleAccount{vt} + return nil } - return true + return fmt.Errorf("can't encode value of type %T as message Account", value) } -func (this *Content_Text) Equal(that interface{}) bool { - if that == nil { - return this == nil - } - that1, ok := that.(*Content_Text) - if !ok { - that2, ok := that.(Content_Text) - if ok { - that1 = &that2 - } else { - return false - } +func (this *Supply) GetSupplyI() github_com_cosmos_cosmos_sdk_x_bank_exported.SupplyI { + if x := this.GetSupply(); x != nil { + return x } - if that1 == nil { - return this == nil - } else if this == nil { - return false + return nil +} + +func (this *Supply) SetSupplyI(value github_com_cosmos_cosmos_sdk_x_bank_exported.SupplyI) error { + if value == nil { + this.Sum = nil + return nil } - if !this.Text.Equal(that1.Text) { - return false + switch vt := value.(type) { + case *types2.Supply: + this.Sum = &Supply_Supply{vt} + return nil } - return true + return fmt.Errorf("can't encode value of type %T as message Supply", value) } -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 *StdFee) Equal(that interface{}) bool { - if that == nil { - return this == nil - } - - that1, ok := that.(*StdFee) - if !ok { - that2, ok := that.(StdFee) - if ok { - that1 = &that2 - } else { - return false - } - } - if that1 == nil { - return this == nil - } else if this == nil { - return false - } - if len(this.Amount) != len(that1.Amount) { - return false - } - for i := range this.Amount { - if !this.Amount[i].Equal(&that1.Amount[i]) { - return false - } - } - if this.Gas != that1.Gas { - return false - } - return true -} -func (this *Account) GetAccount() github_com_cosmos_cosmos_sdk_x_auth_exported.Account { - if x := this.GetBaseAccount(); x != nil { - return x - } - if x := this.GetContinuousVestingAccount(); x != nil { - return x - } - if x := this.GetDelayedVestingAccount(); x != nil { - return x - } - if x := this.GetPeriodicVestingAccount(); x != nil { - return x - } - if x := this.GetModuleAccount(); x != nil { - return x - } - return nil -} - -func (this *Account) SetAccount(value github_com_cosmos_cosmos_sdk_x_auth_exported.Account) error { - if value == nil { - this.Sum = nil - return nil - } - switch vt := value.(type) { - case *types.BaseAccount: - this.Sum = &Account_BaseAccount{vt} - return nil - case *types1.ContinuousVestingAccount: - this.Sum = &Account_ContinuousVestingAccount{vt} - return nil - case *types1.DelayedVestingAccount: - this.Sum = &Account_DelayedVestingAccount{vt} - return nil - case *types1.PeriodicVestingAccount: - this.Sum = &Account_PeriodicVestingAccount{vt} - return nil - case *types.ModuleAccount: - this.Sum = &Account_ModuleAccount{vt} - return nil - } - return fmt.Errorf("can't encode value of type %T as message Account", value) -} - -func (this *Supply) GetSupplyI() github_com_cosmos_cosmos_sdk_x_bank_exported.SupplyI { - if x := this.GetSupply(); x != nil { - return x - } - return nil -} - -func (this *Supply) SetSupplyI(value github_com_cosmos_cosmos_sdk_x_bank_exported.SupplyI) error { - if value == nil { - this.Sum = nil - return nil - } - switch vt := value.(type) { - case *types2.Supply: - this.Sum = &Supply_Supply{vt} - return nil - } - return fmt.Errorf("can't encode value of type %T as message Supply", 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 *types3.TextProposal: - this.Sum = &Content_Text{vt} - return nil - case *proposal.ParameterChangeProposal: - this.Sum = &Content_ParameterChange{vt} - return nil - case *types4.SoftwareUpgradeProposal: - this.Sum = &Content_SoftwareUpgrade{vt} - return nil - case *types4.CancelSoftwareUpgradeProposal: - this.Sum = &Content_CancelSoftwareUpgrade{vt} - return nil - case *types5.CommunityPoolSpendProposal: - this.Sum = &Content_CommunityPoolSpend{vt} - return nil - } - return fmt.Errorf("can't encode value of type %T as message Content", value) -} - -func (this *Message) GetMsg() github_com_cosmos_cosmos_sdk_types.Msg { - if x := this.GetMsgSend(); x != nil { - return x +func (this *Message) GetMsg() github_com_cosmos_cosmos_sdk_types.Msg { + if x := this.GetMsgSend(); x != nil { + return x } if x := this.GetMsgMultiSend(); x != nil { return x @@ -1583,9 +1081,6 @@ func (this *Message) GetMsg() github_com_cosmos_cosmos_sdk_types.Msg { if x := this.GetMsgFundCommunityPool(); x != nil { return x } - if x := this.GetMsgSubmitProposal(); x != nil { - return x - } if x := this.GetMsgVote(); x != nil { return x } @@ -1631,88 +1126,82 @@ func (this *Message) SetMsg(value github_com_cosmos_cosmos_sdk_types.Msg) error case types2.MsgMultiSend: this.Sum = &Message_MsgMultiSend{&vt} return nil - case *types6.MsgVerifyInvariant: + case *types3.MsgVerifyInvariant: this.Sum = &Message_MsgVerifyInvariant{vt} return nil - case types6.MsgVerifyInvariant: + case types3.MsgVerifyInvariant: this.Sum = &Message_MsgVerifyInvariant{&vt} return nil - case *types5.MsgSetWithdrawAddress: + case *types4.MsgSetWithdrawAddress: this.Sum = &Message_MsgSetWithdrawAddress{vt} return nil - case types5.MsgSetWithdrawAddress: + case types4.MsgSetWithdrawAddress: this.Sum = &Message_MsgSetWithdrawAddress{&vt} return nil - case *types5.MsgWithdrawDelegatorReward: + case *types4.MsgWithdrawDelegatorReward: this.Sum = &Message_MsgWithdrawDelegatorReward{vt} return nil - case types5.MsgWithdrawDelegatorReward: + case types4.MsgWithdrawDelegatorReward: this.Sum = &Message_MsgWithdrawDelegatorReward{&vt} return nil - case *types5.MsgWithdrawValidatorCommission: + case *types4.MsgWithdrawValidatorCommission: this.Sum = &Message_MsgWithdrawValidatorCommission{vt} return nil - case types5.MsgWithdrawValidatorCommission: + case types4.MsgWithdrawValidatorCommission: this.Sum = &Message_MsgWithdrawValidatorCommission{&vt} return nil - case *types5.MsgFundCommunityPool: + case *types4.MsgFundCommunityPool: this.Sum = &Message_MsgFundCommunityPool{vt} return nil - case types5.MsgFundCommunityPool: + case types4.MsgFundCommunityPool: this.Sum = &Message_MsgFundCommunityPool{&vt} return nil - case *MsgSubmitProposal: - this.Sum = &Message_MsgSubmitProposal{vt} - return nil - case MsgSubmitProposal: - this.Sum = &Message_MsgSubmitProposal{&vt} - return nil - case *types3.MsgVote: + case *types5.MsgVote: this.Sum = &Message_MsgVote{vt} return nil - case types3.MsgVote: + case types5.MsgVote: this.Sum = &Message_MsgVote{&vt} return nil - case *types3.MsgDeposit: + case *types5.MsgDeposit: this.Sum = &Message_MsgDeposit{vt} return nil - case types3.MsgDeposit: + case types5.MsgDeposit: this.Sum = &Message_MsgDeposit{&vt} return nil - case *types7.MsgUnjail: + case *types6.MsgUnjail: this.Sum = &Message_MsgUnjail{vt} return nil - case types7.MsgUnjail: + case types6.MsgUnjail: this.Sum = &Message_MsgUnjail{&vt} return nil - case *types8.MsgCreateValidator: + case *types7.MsgCreateValidator: this.Sum = &Message_MsgCreateValidator{vt} return nil - case types8.MsgCreateValidator: + case types7.MsgCreateValidator: this.Sum = &Message_MsgCreateValidator{&vt} return nil - case *types8.MsgEditValidator: + case *types7.MsgEditValidator: this.Sum = &Message_MsgEditValidator{vt} return nil - case types8.MsgEditValidator: + case types7.MsgEditValidator: this.Sum = &Message_MsgEditValidator{&vt} return nil - case *types8.MsgDelegate: + case *types7.MsgDelegate: this.Sum = &Message_MsgDelegate{vt} return nil - case types8.MsgDelegate: + case types7.MsgDelegate: this.Sum = &Message_MsgDelegate{&vt} return nil - case *types8.MsgBeginRedelegate: + case *types7.MsgBeginRedelegate: this.Sum = &Message_MsgBeginRedelegate{vt} return nil - case types8.MsgBeginRedelegate: + case types7.MsgBeginRedelegate: this.Sum = &Message_MsgBeginRedelegate{&vt} return nil - case *types8.MsgUndelegate: + case *types7.MsgUndelegate: this.Sum = &Message_MsgUndelegate{vt} return nil - case types8.MsgUndelegate: + case types7.MsgUndelegate: this.Sum = &Message_MsgUndelegate{&vt} return nil } @@ -1909,7 +1398,7 @@ func (m *Supply_Supply) MarshalToSizedBuffer(dAtA []byte) (int, error) { } return len(dAtA) - i, nil } -func (m *MsgSubmitProposal) Marshal() (dAtA []byte, err error) { +func (m *Transaction) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -1919,30 +1408,32 @@ func (m *MsgSubmitProposal) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *MsgSubmitProposal) MarshalTo(dAtA []byte) (int, error) { +func (m *Transaction) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *MsgSubmitProposal) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *Transaction) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int _ = l - if m.Content != nil { - { - size, err := m.Content.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err + if len(m.Msgs) > 0 { + for iNdEx := len(m.Msgs) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Msgs[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintCodec(dAtA, i, uint64(size)) } - i -= size - i = encodeVarintCodec(dAtA, i, uint64(size)) + i-- + dAtA[i] = 0x12 } - i-- - dAtA[i] = 0x12 } { - size, err := m.MsgSubmitProposalBase.MarshalToSizedBuffer(dAtA[:i]) + size, err := m.StdTxBase.MarshalToSizedBuffer(dAtA[:i]) if err != nil { return 0, err } @@ -1954,7 +1445,7 @@ func (m *MsgSubmitProposal) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } -func (m *Proposal) Marshal() (dAtA []byte, err error) { +func (m *Message) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -1964,261 +1455,34 @@ func (m *Proposal) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *Proposal) MarshalTo(dAtA []byte) (int, error) { +func (m *Message) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *Proposal) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *Message) 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 + if m.Sum != nil { + { + size := m.Sum.Size() + i -= size + if _, err := m.Sum.MarshalTo(dAtA[i:]); 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) { +func (m *Message_MsgSend) 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 (m *Transaction) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *Transaction) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *Transaction) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.Msgs) > 0 { - for iNdEx := len(m.Msgs) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.Msgs[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintCodec(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - } - } - { - size, err := m.StdTxBase.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintCodec(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - return len(dAtA) - i, nil -} - -func (m *Message) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *Message) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *Message) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.Sum != nil { - { - size := m.Sum.Size() - i -= size - if _, err := m.Sum.MarshalTo(dAtA[i:]); err != nil { - return 0, err - } - } - } - return len(dAtA) - i, nil -} - -func (m *Message_MsgSend) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *Message_MsgSend) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *Message_MsgSend) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) if m.MsgSend != nil { { @@ -2360,27 +1624,6 @@ func (m *Message_MsgFundCommunityPool) MarshalToSizedBuffer(dAtA []byte) (int, e } return len(dAtA) - i, nil } -func (m *Message_MsgSubmitProposal) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *Message_MsgSubmitProposal) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - if m.MsgSubmitProposal != nil { - { - size, err := m.MsgSubmitProposal.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintCodec(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x4a - } - return len(dAtA) - i, nil -} func (m *Message_MsgVote) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) @@ -2897,240 +2140,128 @@ func (m *Supply_Supply) Size() (n int) { } return n } -func (m *MsgSubmitProposal) Size() (n int) { +func (m *Transaction) Size() (n int) { if m == nil { return 0 } var l int _ = l - l = m.MsgSubmitProposalBase.Size() + l = m.StdTxBase.Size() n += 1 + l + sovCodec(uint64(l)) - if m.Content != nil { - l = m.Content.Size() - n += 1 + l + sovCodec(uint64(l)) + if len(m.Msgs) > 0 { + for _, e := range m.Msgs { + l = e.Size() + n += 1 + l + sovCodec(uint64(l)) + } } return n } -func (m *Proposal) Size() (n int) { +func (m *Message) 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)) + if m.Sum != nil { + n += m.Sum.Size() + } return n } -func (m *Content) Size() (n int) { +func (m *Message_MsgSend) Size() (n int) { if m == nil { return 0 } var l int _ = l - if m.Sum != nil { - n += m.Sum.Size() + if m.MsgSend != nil { + l = m.MsgSend.Size() + n += 1 + l + sovCodec(uint64(l)) } return n } - -func (m *Content_Text) Size() (n int) { +func (m *Message_MsgMultiSend) Size() (n int) { if m == nil { return 0 } var l int _ = l - if m.Text != nil { - l = m.Text.Size() + if m.MsgMultiSend != nil { + l = m.MsgMultiSend.Size() n += 1 + l + sovCodec(uint64(l)) } return n } -func (m *Content_ParameterChange) Size() (n int) { +func (m *Message_MsgVerifyInvariant) Size() (n int) { if m == nil { return 0 } var l int _ = l - if m.ParameterChange != nil { - l = m.ParameterChange.Size() + if m.MsgVerifyInvariant != nil { + l = m.MsgVerifyInvariant.Size() n += 1 + l + sovCodec(uint64(l)) } return n } -func (m *Content_SoftwareUpgrade) Size() (n int) { +func (m *Message_MsgSetWithdrawAddress) Size() (n int) { if m == nil { return 0 } var l int _ = l - if m.SoftwareUpgrade != nil { - l = m.SoftwareUpgrade.Size() + if m.MsgSetWithdrawAddress != nil { + l = m.MsgSetWithdrawAddress.Size() n += 1 + l + sovCodec(uint64(l)) } return n } -func (m *Content_CancelSoftwareUpgrade) Size() (n int) { +func (m *Message_MsgWithdrawDelegatorReward) Size() (n int) { if m == nil { return 0 } var l int _ = l - if m.CancelSoftwareUpgrade != nil { - l = m.CancelSoftwareUpgrade.Size() + if m.MsgWithdrawDelegatorReward != nil { + l = m.MsgWithdrawDelegatorReward.Size() n += 1 + l + sovCodec(uint64(l)) } return n } -func (m *Content_CommunityPoolSpend) Size() (n int) { +func (m *Message_MsgWithdrawValidatorCommission) Size() (n int) { if m == nil { return 0 } var l int _ = l - if m.CommunityPoolSpend != nil { - l = m.CommunityPoolSpend.Size() + if m.MsgWithdrawValidatorCommission != nil { + l = m.MsgWithdrawValidatorCommission.Size() n += 1 + l + sovCodec(uint64(l)) } return n } -func (m *Transaction) Size() (n int) { +func (m *Message_MsgFundCommunityPool) Size() (n int) { if m == nil { return 0 } var l int _ = l - l = m.StdTxBase.Size() - n += 1 + l + sovCodec(uint64(l)) - if len(m.Msgs) > 0 { - for _, e := range m.Msgs { - l = e.Size() - n += 1 + l + sovCodec(uint64(l)) - } + if m.MsgFundCommunityPool != nil { + l = m.MsgFundCommunityPool.Size() + n += 1 + l + sovCodec(uint64(l)) } return n } - -func (m *Message) Size() (n int) { +func (m *Message_MsgVote) Size() (n int) { if m == nil { return 0 } var l int _ = l - if m.Sum != nil { - n += m.Sum.Size() - } - return n -} - -func (m *Message_MsgSend) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.MsgSend != nil { - l = m.MsgSend.Size() - n += 1 + l + sovCodec(uint64(l)) - } - return n -} -func (m *Message_MsgMultiSend) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.MsgMultiSend != nil { - l = m.MsgMultiSend.Size() - n += 1 + l + sovCodec(uint64(l)) - } - return n -} -func (m *Message_MsgVerifyInvariant) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.MsgVerifyInvariant != nil { - l = m.MsgVerifyInvariant.Size() - n += 1 + l + sovCodec(uint64(l)) - } - return n -} -func (m *Message_MsgSetWithdrawAddress) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.MsgSetWithdrawAddress != nil { - l = m.MsgSetWithdrawAddress.Size() - n += 1 + l + sovCodec(uint64(l)) - } - return n -} -func (m *Message_MsgWithdrawDelegatorReward) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.MsgWithdrawDelegatorReward != nil { - l = m.MsgWithdrawDelegatorReward.Size() - n += 1 + l + sovCodec(uint64(l)) - } - return n -} -func (m *Message_MsgWithdrawValidatorCommission) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.MsgWithdrawValidatorCommission != nil { - l = m.MsgWithdrawValidatorCommission.Size() - n += 1 + l + sovCodec(uint64(l)) - } - return n -} -func (m *Message_MsgFundCommunityPool) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.MsgFundCommunityPool != nil { - l = m.MsgFundCommunityPool.Size() - n += 1 + l + sovCodec(uint64(l)) - } - return n -} -func (m *Message_MsgSubmitProposal) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.MsgSubmitProposal != nil { - l = m.MsgSubmitProposal.Size() - n += 1 + l + sovCodec(uint64(l)) - } - return n -} -func (m *Message_MsgVote) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.MsgVote != nil { - l = m.MsgVote.Size() - n += 1 + l + sovCodec(uint64(l)) + if m.MsgVote != nil { + l = m.MsgVote.Size() + n += 1 + l + sovCodec(uint64(l)) } return n } @@ -3247,520 +2378,82 @@ func (m *StdFee) Size() (n int) { n += 1 + l + sovCodec(uint64(l)) } } - if m.Gas != 0 { - n += 1 + sovCodec(uint64(m.Gas)) - } - return n -} - -func (m *StdSignature) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.PubKey) - if l > 0 { - n += 1 + l + sovCodec(uint64(l)) - } - l = len(m.Signature) - if l > 0 { - n += 1 + l + sovCodec(uint64(l)) - } - return n -} - -func (m *StdTxBase) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = m.Fee.Size() - n += 1 + l + sovCodec(uint64(l)) - if len(m.Signatures) > 0 { - for _, e := range m.Signatures { - l = e.Size() - n += 1 + l + sovCodec(uint64(l)) - } - } - l = len(m.Memo) - if l > 0 { - n += 1 + l + sovCodec(uint64(l)) - } - return n -} - -func (m *StdSignDocBase) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.ChainID) - if l > 0 { - n += 1 + l + sovCodec(uint64(l)) - } - if m.AccountNumber != 0 { - n += 1 + sovCodec(uint64(m.AccountNumber)) - } - if m.Sequence != 0 { - n += 1 + sovCodec(uint64(m.Sequence)) - } - l = len(m.Memo) - if l > 0 { - n += 1 + l + sovCodec(uint64(l)) - } - l = m.Fee.Size() - n += 1 + l + sovCodec(uint64(l)) - return n -} - -func sovCodec(x uint64) (n int) { - return (math_bits.Len64(x|1) + 6) / 7 -} -func sozCodec(x uint64) (n int) { - return sovCodec(uint64((x << 1) ^ uint64((int64(x) >> 63)))) -} -func (m *Account) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowCodec - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: Account: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: Account: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field BaseAccount", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowCodec - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthCodec - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthCodec - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - v := &types.BaseAccount{} - if err := v.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - m.Sum = &Account_BaseAccount{v} - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ContinuousVestingAccount", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowCodec - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthCodec - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthCodec - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - v := &types1.ContinuousVestingAccount{} - if err := v.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - m.Sum = &Account_ContinuousVestingAccount{v} - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field DelayedVestingAccount", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowCodec - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthCodec - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthCodec - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - v := &types1.DelayedVestingAccount{} - if err := v.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - m.Sum = &Account_DelayedVestingAccount{v} - iNdEx = postIndex - case 4: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field PeriodicVestingAccount", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowCodec - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthCodec - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthCodec - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - v := &types1.PeriodicVestingAccount{} - if err := v.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - m.Sum = &Account_PeriodicVestingAccount{v} - iNdEx = postIndex - case 5: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ModuleAccount", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowCodec - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthCodec - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthCodec - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - v := &types.ModuleAccount{} - if err := v.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - m.Sum = &Account_ModuleAccount{v} - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipCodec(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthCodec - } - if (iNdEx + skippy) < 0 { - return ErrInvalidLengthCodec - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *Supply) 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: Supply: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: Supply: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Supply", 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 := &types2.Supply{} - if err := v.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - m.Sum = &Supply_Supply{v} - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipCodec(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthCodec - } - if (iNdEx + skippy) < 0 { - return ErrInvalidLengthCodec - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *MsgSubmitProposal) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowCodec - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: MsgSubmitProposal: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: MsgSubmitProposal: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field MsgSubmitProposalBase", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowCodec - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthCodec - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthCodec - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.MsgSubmitProposalBase.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Content", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowCodec - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthCodec - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthCodec - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Content == nil { - m.Content = &Content{} - } - if err := m.Content.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipCodec(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthCodec - } - if (iNdEx + skippy) < 0 { - return ErrInvalidLengthCodec - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } + if m.Gas != 0 { + n += 1 + sovCodec(uint64(m.Gas)) + } + return n +} - if iNdEx > l { - return io.ErrUnexpectedEOF +func (m *StdSignature) Size() (n int) { + if m == nil { + return 0 } - return nil + var l int + _ = l + l = len(m.PubKey) + if l > 0 { + n += 1 + l + sovCodec(uint64(l)) + } + l = len(m.Signature) + if l > 0 { + n += 1 + l + sovCodec(uint64(l)) + } + return n +} + +func (m *StdTxBase) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.Fee.Size() + n += 1 + l + sovCodec(uint64(l)) + if len(m.Signatures) > 0 { + for _, e := range m.Signatures { + l = e.Size() + n += 1 + l + sovCodec(uint64(l)) + } + } + l = len(m.Memo) + if l > 0 { + n += 1 + l + sovCodec(uint64(l)) + } + return n +} + +func (m *StdSignDocBase) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.ChainID) + if l > 0 { + n += 1 + l + sovCodec(uint64(l)) + } + if m.AccountNumber != 0 { + n += 1 + sovCodec(uint64(m.AccountNumber)) + } + if m.Sequence != 0 { + n += 1 + sovCodec(uint64(m.Sequence)) + } + l = len(m.Memo) + if l > 0 { + n += 1 + l + sovCodec(uint64(l)) + } + l = m.Fee.Size() + n += 1 + l + sovCodec(uint64(l)) + return n +} + +func sovCodec(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 } -func (m *Proposal) Unmarshal(dAtA []byte) error { +func sozCodec(x uint64) (n int) { + return sovCodec(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *Account) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -3783,15 +2476,15 @@ func (m *Proposal) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: Proposal: wiretype end group for non-group") + return fmt.Errorf("proto: Account: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: Proposal: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: Account: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ProposalBase", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field BaseAccount", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -3818,13 +2511,15 @@ func (m *Proposal) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - if err := m.ProposalBase.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + v := &types.BaseAccount{} + if err := v.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } + m.Sum = &Account_BaseAccount{v} iNdEx = postIndex case 2: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Content", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field ContinuousVestingAccount", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -3851,66 +2546,15 @@ func (m *Proposal) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - if err := m.Content.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + v := &types1.ContinuousVestingAccount{} + if err := v.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } + m.Sum = &Account_ContinuousVestingAccount{v} iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipCodec(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthCodec - } - if (iNdEx + skippy) < 0 { - return ErrInvalidLengthCodec - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *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: + case 3: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Text", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field DelayedVestingAccount", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -3937,15 +2581,15 @@ func (m *Content) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - v := &types3.TextProposal{} + v := &types1.DelayedVestingAccount{} if err := v.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } - m.Sum = &Content_Text{v} + m.Sum = &Account_DelayedVestingAccount{v} iNdEx = postIndex - case 2: + case 4: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ParameterChange", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field PeriodicVestingAccount", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -3972,15 +2616,15 @@ func (m *Content) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - v := &proposal.ParameterChangeProposal{} + v := &types1.PeriodicVestingAccount{} if err := v.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } - m.Sum = &Content_ParameterChange{v} + m.Sum = &Account_PeriodicVestingAccount{v} iNdEx = postIndex - case 3: + case 5: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field SoftwareUpgrade", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field ModuleAccount", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -4007,50 +2651,68 @@ func (m *Content) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - v := &types4.SoftwareUpgradeProposal{} + v := &types.ModuleAccount{} if err := v.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } - m.Sum = &Content_SoftwareUpgrade{v} + m.Sum = &Account_ModuleAccount{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 - } + default: + iNdEx = preIndex + skippy, err := skipCodec(dAtA[iNdEx:]) + if err != nil { + return err } - if msglen < 0 { + if skippy < 0 { return ErrInvalidLengthCodec } - postIndex := iNdEx + msglen - if postIndex < 0 { + if (iNdEx + skippy) < 0 { return ErrInvalidLengthCodec } - if postIndex > l { + if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } - v := &types4.CancelSoftwareUpgradeProposal{} - if err := v.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *Supply) 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 } - m.Sum = &Content_CancelSoftwareUpgrade{v} - iNdEx = postIndex - case 5: + 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: Supply: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Supply: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field CommunityPoolSpend", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Supply", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -4077,11 +2739,11 @@ func (m *Content) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - v := &types5.CommunityPoolSpendProposal{} + v := &types2.Supply{} if err := v.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } - m.Sum = &Content_CommunityPoolSpend{v} + m.Sum = &Supply_Supply{v} iNdEx = postIndex default: iNdEx = preIndex @@ -4355,7 +3017,7 @@ func (m *Message) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - v := &types6.MsgVerifyInvariant{} + v := &types3.MsgVerifyInvariant{} if err := v.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } @@ -4390,7 +3052,7 @@ func (m *Message) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - v := &types5.MsgSetWithdrawAddress{} + v := &types4.MsgSetWithdrawAddress{} if err := v.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } @@ -4425,7 +3087,7 @@ func (m *Message) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - v := &types5.MsgWithdrawDelegatorReward{} + v := &types4.MsgWithdrawDelegatorReward{} if err := v.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } @@ -4460,7 +3122,7 @@ func (m *Message) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - v := &types5.MsgWithdrawValidatorCommission{} + v := &types4.MsgWithdrawValidatorCommission{} if err := v.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } @@ -4495,47 +3157,12 @@ func (m *Message) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - v := &types5.MsgFundCommunityPool{} + v := &types4.MsgFundCommunityPool{} if err := v.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } m.Sum = &Message_MsgFundCommunityPool{v} iNdEx = postIndex - case 9: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field MsgSubmitProposal", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowCodec - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthCodec - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthCodec - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - v := &MsgSubmitProposal{} - if err := v.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - m.Sum = &Message_MsgSubmitProposal{v} - iNdEx = postIndex case 10: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field MsgVote", wireType) @@ -4565,7 +3192,7 @@ func (m *Message) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - v := &types3.MsgVote{} + v := &types5.MsgVote{} if err := v.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } @@ -4600,7 +3227,7 @@ func (m *Message) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - v := &types3.MsgDeposit{} + v := &types5.MsgDeposit{} if err := v.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } @@ -4635,7 +3262,7 @@ func (m *Message) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - v := &types7.MsgUnjail{} + v := &types6.MsgUnjail{} if err := v.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } @@ -4670,7 +3297,7 @@ func (m *Message) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - v := &types8.MsgCreateValidator{} + v := &types7.MsgCreateValidator{} if err := v.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } @@ -4705,7 +3332,7 @@ func (m *Message) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - v := &types8.MsgEditValidator{} + v := &types7.MsgEditValidator{} if err := v.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } @@ -4740,7 +3367,7 @@ func (m *Message) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - v := &types8.MsgDelegate{} + v := &types7.MsgDelegate{} if err := v.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } @@ -4775,7 +3402,7 @@ func (m *Message) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - v := &types8.MsgBeginRedelegate{} + v := &types7.MsgBeginRedelegate{} if err := v.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } @@ -4810,7 +3437,7 @@ func (m *Message) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - v := &types8.MsgUndelegate{} + v := &types7.MsgUndelegate{} if err := v.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } @@ -5018,7 +3645,7 @@ func (m *StdFee) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.Amount = append(m.Amount, types9.Coin{}) + m.Amount = append(m.Amount, types8.Coin{}) if err := m.Amount[len(m.Amount)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } diff --git a/std/codec.proto b/std/codec.proto index 8f0bb11e7bb..a4b2b3e1452 100644 --- a/std/codec.proto +++ b/std/codec.proto @@ -12,8 +12,6 @@ import "x/distribution/types/types.proto"; import "x/gov/types/types.proto"; import "x/slashing/types/types.proto"; import "x/staking/types/types.proto"; -import "x/params/types/proposal/types.proto"; -import "x/upgrade/types/types.proto"; option go_package = "github.com/cosmos/cosmos-sdk/std"; @@ -42,41 +40,6 @@ message Supply { } } -// MsgSubmitProposal defines the application-level message type for handling -// governance proposals. -message MsgSubmitProposal { - option (gogoproto.equal) = true; - option (gogoproto.goproto_getters) = false; - - cosmos_sdk.x.gov.v1.MsgSubmitProposalBase base = 1 [(gogoproto.nullable) = false, (gogoproto.embed) = true]; - Content content = 2; -} - -// Proposal defines the application-level concrete proposal type used in governance -// proposals. -message Proposal { - option (gogoproto.equal) = true; - - cosmos_sdk.x.gov.v1.ProposalBase base = 1 [(gogoproto.embed) = true, (gogoproto.nullable) = false]; - Content content = 2 [(gogoproto.nullable) = false]; -} - -// Content defines the application-level allowed Content to be included in a -// governance proposal. -message Content { - option (gogoproto.equal) = true; - option (cosmos_proto.interface_type) = "*github.com/cosmos/cosmos-sdk/x/gov/types.Content"; - - // sum defines a set of all acceptable concrete governance proposal Content types. - oneof sum { - cosmos_sdk.x.gov.v1.TextProposal text = 1; - cosmos_sdk.x.params.v1.ParameterChangeProposal parameter_change = 2; - cosmos_sdk.x.upgrade.v1.SoftwareUpgradeProposal software_upgrade = 3; - cosmos_sdk.x.upgrade.v1.CancelSoftwareUpgradeProposal cancel_software_upgrade = 4; - cosmos_sdk.x.distribution.v1.CommunityPoolSpendProposal community_pool_spend = 5; - } -} - // Transaction defines the application-level transaction that can be signed and // processed by the state-machine. It contains a base of common fields and // repeated set of Message types. @@ -101,7 +64,6 @@ message Message { cosmos_sdk.x.distribution.v1.MsgWithdrawDelegatorReward msg_withdraw_delegator_reward = 5; cosmos_sdk.x.distribution.v1.MsgWithdrawValidatorCommission msg_withdraw_validator_commission = 6; cosmos_sdk.x.distribution.v1.MsgFundCommunityPool msg_fund_community_pool = 7; - MsgSubmitProposal msg_submit_proposal = 9; cosmos_sdk.x.gov.v1.MsgVote msg_vote = 10; cosmos_sdk.x.gov.v1.MsgDeposit msg_deposit = 11; cosmos_sdk.x.slashing.v1.MsgUnjail msg_unjail = 12; diff --git a/x/gov/alias.go b/x/gov/alias.go index 6121c595bb4..3d7aea4eb55 100644 --- a/x/gov/alias.go +++ b/x/gov/alias.go @@ -83,7 +83,6 @@ var ( SplitKeyDeposit = types.SplitKeyDeposit SplitKeyVote = types.SplitKeyVote NewMsgSubmitProposal = types.NewMsgSubmitProposal - NewMsgSubmitProposalLegacy = types.NewMsgSubmitProposalLegacy NewMsgDeposit = types.NewMsgDeposit NewMsgVote = types.NewMsgVote ParamKeyTable = types.ParamKeyTable @@ -126,33 +125,32 @@ var ( ) type ( - Keeper = keeper.Keeper - Content = types.Content - Handler = types.Handler - Deposit = types.Deposit - Deposits = types.Deposits - GenesisState = types.GenesisState - MsgSubmitProposalI = types.MsgSubmitProposalI - MsgSubmitProposal = types.MsgSubmitProposal - MsgSubmitProposalLegacy = types.MsgSubmitProposalLegacy - 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 + MsgDeposit = types.MsgDeposit + MsgVote = types.MsgVote + DepositParams = types.DepositParams + TallyParams = types.TallyParams + VotingParams = types.VotingParams + Params = types.Params + Proposal = types.Proposal + Proposals = types.Proposals + ProposalQueue = types.ProposalQueue + ProposalStatus = types.ProposalStatus + TextProposal = types.TextProposal + QueryProposalParams = types.QueryProposalParams + QueryDepositParams = types.QueryDepositParams + QueryVoteParams = types.QueryVoteParams + QueryProposalsParams = types.QueryProposalsParams + ValidatorGovInfo = types.ValidatorGovInfo + TallyResult = types.TallyResult + Vote = types.Vote + Votes = types.Votes + VoteOption = types.VoteOption ) diff --git a/x/gov/client/cli/tx.go b/x/gov/client/cli/tx.go index c94597d1d52..045d2f25e87 100644 --- a/x/gov/client/cli/tx.go +++ b/x/gov/client/cli/tx.go @@ -326,7 +326,10 @@ $ %s tx gov submit-proposal --title="Test Proposal" --description="My awesome pr content := types.ContentFromProposalType(proposal.Title, proposal.Description, proposal.Type) - msg := types.NewMsgSubmitProposalLegacy(content, amount, cliCtx.GetFromAddress()) + msg, err := types.NewMsgSubmitProposal(content, amount, cliCtx.GetFromAddress()) + if err != nil { + return err + } if err := msg.ValidateBasic(); err != nil { return err } diff --git a/x/gov/types/codec.go b/x/gov/types/codec.go index 46b084c8013..0ac77df0985 100644 --- a/x/gov/types/codec.go +++ b/x/gov/types/codec.go @@ -10,7 +10,7 @@ import ( // governance module. func RegisterCodec(cdc *codec.Codec) { cdc.RegisterInterface((*Content)(nil), nil) - cdc.RegisterConcrete(&MsgSubmitProposalLegacy{}, "cosmos-sdk/MsgSubmitProposal", 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) diff --git a/x/gov/types/msgs.go b/x/gov/types/msgs.go index fca68629b57..f2c124e5766 100644 --- a/x/gov/types/msgs.go +++ b/x/gov/types/msgs.go @@ -2,6 +2,7 @@ package types import ( "fmt" + "github.com/gogo/protobuf/proto" "gopkg.in/yaml.v2" @@ -219,78 +220,3 @@ func (msg MsgVote) GetSignBytes() []byte { func (msg MsgVote) GetSigners() []sdk.AccAddress { return []sdk.AccAddress{msg.Voter} } - -// --------------------------------------------------------------------------- -// Deprecated -// -// TODO: Remove once client-side Protobuf migration has been completed. -// --------------------------------------------------------------------------- - -// MsgSubmitProposalLegacy defines a (deprecated) message to create/submit a governance -// proposal. -// -// TODO: Remove once client-side Protobuf migration has been completed. -type MsgSubmitProposalLegacy struct { - Content Content `json:"content" yaml:"content"` - InitialDeposit sdk.Coins `json:"initial_deposit" yaml:"initial_deposit"` // Initial deposit paid by sender. Must be strictly positive - Proposer sdk.AccAddress `json:"proposer" yaml:"proposer"` // Address of the proposer -} - -var _ MsgSubmitProposalI = &MsgSubmitProposalLegacy{} - -// NewMsgSubmitProposalLegacy returns a (deprecated) MsgSubmitProposalLegacy message. -// -// TODO: Remove once client-side Protobuf migration has been completed. -func NewMsgSubmitProposalLegacy(content Content, initialDeposit sdk.Coins, proposer sdk.AccAddress) *MsgSubmitProposalLegacy { - return &MsgSubmitProposalLegacy{content, initialDeposit, proposer} -} - -// ValidateBasic implements Msg -func (msg MsgSubmitProposalLegacy) 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 MsgSubmitProposalLegacy) GetSignBytes() []byte { - bz := ModuleCdc.MustMarshalJSON(msg) - return sdk.MustSortJSON(bz) -} - -// nolint -func (msg MsgSubmitProposalLegacy) GetSigners() []sdk.AccAddress { - return []sdk.AccAddress{msg.Proposer} -} -func (msg MsgSubmitProposalLegacy) Route() string { return RouterKey } -func (msg MsgSubmitProposalLegacy) Type() string { return TypeMsgSubmitProposal } -func (msg MsgSubmitProposalLegacy) GetContent() Content { return msg.Content } -func (msg MsgSubmitProposalLegacy) GetInitialDeposit() sdk.Coins { return msg.InitialDeposit } -func (msg MsgSubmitProposalLegacy) GetProposer() sdk.AccAddress { return msg.Proposer } - -func (msg *MsgSubmitProposalLegacy) SetContent(content Content) error { - msg.Content = content - return nil -} - -func (msg *MsgSubmitProposalLegacy) SetInitialDeposit(deposit sdk.Coins) { - msg.InitialDeposit = deposit -} - -func (msg *MsgSubmitProposalLegacy) SetProposer(proposer sdk.AccAddress) { - msg.Proposer = proposer -} diff --git a/x/gov/types/proposal.go b/x/gov/types/proposal.go index 29586d9976e..438ec329d1b 100644 --- a/x/gov/types/proposal.go +++ b/x/gov/types/proposal.go @@ -6,6 +6,8 @@ import ( "strings" "time" + "gopkg.in/yaml.v2" + "github.com/gogo/protobuf/proto" "github.com/cosmos/cosmos-sdk/codec/types" diff --git a/x/gov/types/types.pb.go b/x/gov/types/types.pb.go index ab6b530e78f..590f19869dc 100644 --- a/x/gov/types/types.pb.go +++ b/x/gov/types/types.pb.go @@ -6,9 +6,9 @@ package types import ( bytes "bytes" fmt "fmt" - types1 "github.com/cosmos/cosmos-sdk/codec/types" + types "github.com/cosmos/cosmos-sdk/codec/types" github_com_cosmos_cosmos_sdk_types "github.com/cosmos/cosmos-sdk/types" - types "github.com/cosmos/cosmos-sdk/types" + types1 "github.com/cosmos/cosmos-sdk/types" _ "github.com/gogo/protobuf/gogoproto" proto "github.com/gogo/protobuf/proto" github_com_gogo_protobuf_types "github.com/gogo/protobuf/types" @@ -111,9 +111,9 @@ func (ProposalStatus) EnumDescriptor() ([]byte, []int) { // MsgSubmitProposal defines an sdk.Msg type that supports submitting arbitrary // proposal Content. type MsgSubmitProposal 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"` - Content *types1.Any `protobuf:"bytes,3,opt,name=content,proto3" json:"content,omitempty"` + Content *types.Any `protobuf:"bytes,1,opt,name=content,proto3" json:"content,omitempty"` + InitialDeposit github_com_cosmos_cosmos_sdk_types.Coins `protobuf:"bytes,2,rep,name=initial_deposit,json=initialDeposit,proto3,castrepeated=github.com/cosmos/cosmos-sdk/types.Coins" json:"initial_deposit" yaml:"initial_deposit"` + Proposer github_com_cosmos_cosmos_sdk_types.AccAddress `protobuf:"bytes,3,opt,name=proposer,proto3,casttype=github.com/cosmos/cosmos-sdk/types.AccAddress" json:"proposer,omitempty"` } func (m *MsgSubmitProposal) Reset() { *m = MsgSubmitProposal{} } @@ -307,14 +307,14 @@ var xxx_messageInfo_Deposit proto.InternalMessageInfo // Proposal defines the core field members of a governance proposal type Proposal struct { ProposalID uint64 `protobuf:"varint,1,opt,name=proposal_id,json=proposalId,proto3" json:"id" yaml:"id"` - Status ProposalStatus `protobuf:"varint,2,opt,name=status,proto3,enum=cosmos_sdk.x.gov.v1.ProposalStatus" json:"status,omitempty" yaml:"proposal_status"` - FinalTallyResult TallyResult `protobuf:"bytes,3,opt,name=final_tally_result,json=finalTallyResult,proto3" json:"final_tally_result" yaml:"final_tally_result"` - SubmitTime time.Time `protobuf:"bytes,4,opt,name=submit_time,json=submitTime,proto3,stdtime" json:"submit_time" yaml:"submit_time"` - DepositEndTime time.Time `protobuf:"bytes,5,opt,name=deposit_end_time,json=depositEndTime,proto3,stdtime" json:"deposit_end_time" yaml:"deposit_end_time"` - TotalDeposit github_com_cosmos_cosmos_sdk_types.Coins `protobuf:"bytes,6,rep,name=total_deposit,json=totalDeposit,proto3,castrepeated=github.com/cosmos/cosmos-sdk/types.Coins" json:"total_deposit" yaml:"total_deposit"` - VotingStartTime time.Time `protobuf:"bytes,7,opt,name=voting_start_time,json=votingStartTime,proto3,stdtime" json:"voting_start_time" yaml:"voting_start_time"` - VotingEndTime time.Time `protobuf:"bytes,8,opt,name=voting_end_time,json=votingEndTime,proto3,stdtime" json:"voting_end_time" yaml:"voting_end_time"` - Content *types1.Any `protobuf:"bytes,9,opt,name=content,proto3" json:"content,omitempty"` + Content *types.Any `protobuf:"bytes,2,opt,name=content,proto3" json:"content,omitempty"` + Status ProposalStatus `protobuf:"varint,3,opt,name=status,proto3,enum=cosmos_sdk.x.gov.v1.ProposalStatus" json:"status,omitempty" yaml:"proposal_status"` + FinalTallyResult TallyResult `protobuf:"bytes,4,opt,name=final_tally_result,json=finalTallyResult,proto3" json:"final_tally_result" yaml:"final_tally_result"` + SubmitTime time.Time `protobuf:"bytes,5,opt,name=submit_time,json=submitTime,proto3,stdtime" json:"submit_time" yaml:"submit_time"` + DepositEndTime time.Time `protobuf:"bytes,6,opt,name=deposit_end_time,json=depositEndTime,proto3,stdtime" json:"deposit_end_time" yaml:"deposit_end_time"` + TotalDeposit github_com_cosmos_cosmos_sdk_types.Coins `protobuf:"bytes,7,rep,name=total_deposit,json=totalDeposit,proto3,castrepeated=github.com/cosmos/cosmos-sdk/types.Coins" json:"total_deposit" yaml:"total_deposit"` + VotingStartTime time.Time `protobuf:"bytes,8,opt,name=voting_start_time,json=votingStartTime,proto3,stdtime" json:"voting_start_time" yaml:"voting_start_time"` + VotingEndTime time.Time `protobuf:"bytes,9,opt,name=voting_end_time,json=votingEndTime,proto3,stdtime" json:"voting_end_time" yaml:"voting_end_time"` } func (m *Proposal) Reset() { *m = Proposal{} } @@ -445,87 +445,87 @@ func init() { func init() { proto.RegisterFile("x/gov/types/types.proto", fileDescriptor_a5ae5e91b5b3fb03) } var fileDescriptor_a5ae5e91b5b3fb03 = []byte{ - // 1273 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xdc, 0x57, 0xbf, 0x6f, 0xdb, 0x56, - 0x17, 0x15, 0xe5, 0x1f, 0xb2, 0xaf, 0x64, 0x99, 0x7e, 0x36, 0x62, 0x85, 0x1f, 0x3e, 0x92, 0x51, - 0x82, 0xc0, 0x48, 0x13, 0x3a, 0x71, 0x86, 0xa2, 0x09, 0x50, 0x54, 0xb2, 0x98, 0x44, 0x41, 0x2c, - 0x09, 0x14, 0x63, 0x23, 0x2d, 0x0a, 0x82, 0x16, 0x19, 0x99, 0x0d, 0xc5, 0xa7, 0x8a, 0xcf, 0x6a, - 0xb4, 0x05, 0x1d, 0x8a, 0x40, 0x53, 0xc6, 0x2e, 0x02, 0x0a, 0x34, 0x43, 0xd1, 0x29, 0x43, 0xff, - 0x08, 0xa3, 0x53, 0x50, 0xb4, 0x40, 0xd0, 0x41, 0x69, 0x9c, 0xa1, 0x45, 0x87, 0x0e, 0x19, 0x3b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0xc0, 0x24, - 0xfa, 0x00, 0xa8, 0x05, 0xb8, 0xfc, 0x09, 0x36, 0x3c, 0x8f, 0xd3, 0x2c, 0xfb, 0x95, 0xb2, 0x1a, - 0x1f, 0x04, 0x23, 0x24, 0xf4, 0x01, 0x24, 0xfd, 0x60, 0x64, 0x1b, 0x83, 0x59, 0x9f, 0x19, 0x0f, - 0x72, 0x09, 0xfb, 0x46, 0x99, 0x1e, 0x5e, 0x04, 0x79, 0x91, 0x65, 0x61, 0xbd, 0x12, 0x21, 0x67, - 0x1f, 0x3c, 0x95, 0x38, 0x0d, 0x68, 0x64, 0x40, 0x40, 0x0e, 0xf0, 0x6c, 0xaf, 0x0d, 0xdb, 0xb3, - 0x68, 0x86, 0x89, 0x43, 0x33, 0x9c, 0x64, 0x19, 0x16, 0x69, 0x86, 0x51, 0x05, 0x9a, 0x26, 0xcd, - 0xc2, 0xaa, 0x67, 0x05, 0xa9, 0x3e, 0xe5, 0x60, 0x86, 0x60, 0x12, 0xb9, 0x66, 0x26, 0x5f, 0xdd, - 0x51, 0xd7, 0x58, 0x86, 0x05, 0x9a, 0x61, 0x0f, 0xef, 0x68, 0x97, 0x4c, 0x2a, 0xe0, 0x86, 0xc7, - 0xcc, 0x85, 0xb9, 0x36, 0x26, 0x8e, 0x57, 0x1f, 0xec, 0x6c, 0x8b, 0x59, 0x9a, 0x38, 0xb4, 0xe0, - 0x53, 0x6c, 0x39, 0x19, 0xba, 0x9c, 0x7d, 0x12, 0xb4, 0xe2, 0x59, 0x1a, 0xaf, 0x0e, 0xc2, 0x41, - 0xc9, 0xb7, 0x81, 0x85, 0x86, 0xe6, 0x4e, 0x1d, 0x9a, 0x2b, 0xbb, 0xf7, 0x86, 0x1d, 0x11, 0xa0, - 0x99, 0x66, 0x68, 0x34, 0xb4, 0x36, 0x72, 0xd3, 0x4d, 0xff, 0xc5, 0x9b, 0x6e, 0x27, 0x0e, 0xc9, - 0x68, 0xd7, 0xbd, 0x07, 0x63, 0x1d, 0x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 0x66, 0x7f, 0x64, 0xd7, 0x88, 0x7d, 0xa0, 0xfe, 0x95, 0x5c, 0xf1, 0x86, 0x5a, 0xe0, - 0x27, 0xa2, 0xfa, 0x57, 0x4c, 0xc7, 0xb5, 0xad, 0xbd, 0xb6, 0xe6, 0x4b, 0x3b, 0xcf, 0xc4, 0xd8, - 0x93, 0x67, 0x62, 0xec, 0xde, 0xae, 0x18, 0xdb, 0xd9, 0x15, 0xb9, 0xc7, 0xbb, 0x22, 0xf7, 0xd3, - 0xae, 0xc8, 0x3d, 0x78, 0x2e, 0xc6, 0x1e, 0x3f, 0x17, 0x63, 0x4f, 0x9e, 0x8b, 0xb1, 0xf7, 0xff, - 0x7c, 0xc2, 0x47, 0x7e, 0x9c, 0x6d, 0x4e, 0x06, 0x43, 0xee, 0xe2, 0x1f, 0x01, 0x00, 0x00, 0xff, - 0xff, 0xf4, 0xce, 0xde, 0xda, 0xb2, 0x0d, 0x00, 0x00, + // 1275 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xdc, 0x57, 0xbd, 0x6f, 0xdb, 0xd6, + 0x17, 0x15, 0xe9, 0x0f, 0xd9, 0x4f, 0xb2, 0x4d, 0x3f, 0x1b, 0xb1, 0xc2, 0x1f, 0x7e, 0x24, 0xa3, + 0x04, 0x81, 0x91, 0x26, 0x74, 0xe2, 0x0c, 0x45, 0x53, 0xa0, 0xa8, 0x64, 0x31, 0x89, 0x82, 0x58, + 0x12, 0x28, 0xc6, 0x46, 0x5a, 0x14, 0x04, 0x2d, 0xbe, 0xc8, 0x6c, 0x24, 0x3e, 0x55, 0xef, 0x59, + 0x8d, 0xb6, 0xa0, 0x43, 0x11, 0x68, 0xca, 0xd8, 0x45, 0x40, 0x81, 0x66, 0x28, 0x3a, 0x65, 0xe8, + 0x1f, 0x61, 0x74, 0x0a, 0x8a, 0x16, 0x08, 0x3a, 0x28, 0x8d, 0x33, 0xb4,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x1a, + 0x34, 0x33, 0x1e, 0x1e, 0x50, 0x3b, 0x34, 0x89, 0x15, 0x00, 0xcd, 0x10, 0x97, 0x3f, 0xc1, 0x97, + 0xe7, 0x71, 0x96, 0xe5, 0xa0, 0x52, 0xd6, 0x94, 0xc2, 0x60, 0x8c, 0x04, 0xdf, 0x07, 0x29, 0x12, + 0xee, 0x7b, 0x3b, 0x78, 0x51, 0x64, 0x26, 0xc2, 0x5c, 0xf2, 0x01, 0x33, 0xac, 0xe8, 0x2d, 0x92, + 0x57, 0x78, 0x16, 0xde, 0x68, 0x31, 0x72, 0xf6, 0xfe, 0x13, 0x55, 0x30, 0x01, 0x8b, 0x04, 0x04, + 0xe8, 0x01, 0x89, 0x37, 0x8a, 0x8d, 0x7c, 0x97, 0x65, 0x98, 0x7c, 0x65, 0x86, 0x93, 0x3c, 0xc3, + 0x12, 0xcb, 0x30, 0xaa, 0xc0, 0xd2, 0xcc, 0xf2, 0xb0, 0xe1, 0xbb, 0x61, 0xaa, 0x4f, 0x04, 0x30, + 0x43, 0x31, 0x8d, 0xbd, 0x66, 0x92, 0x2f, 0x6f, 0xc7, 0xab, 0x3c, 0xc3, 0x22, 0xcb, 0xb0, 0x8f, + 0x77, 0xb4, 0x97, 0x4c, 0x3a, 0xe4, 0x46, 0x33, 0xda, 0x00, 0xf3, 0x1d, 0x4c, 0x3d, 0xbf, 0x1e, + 0x3c, 0xd9, 0x36, 0xb7, 0x74, 0xea, 0x95, 0x05, 0x9f, 0xe2, 0xc7, 0xc9, 0xb0, 0xe3, 0x1c, 0x90, + 0x60, 0x15, 0xcf, 0xb1, 0x78, 0x35, 0x08, 0x87, 0x25, 0xdf, 0x02, 0x3c, 0x34, 0x34, 0x77, 0xfa, + 0x95, 0xb9, 0xb2, 0xfb, 0xdf, 0xb0, 0x23, 0x02, 0x2c, 0xd3, 0x0c, 0x8b, 0x72, 0x6b, 0xf9, 0x08, + 0xee, 0x8a, 0x20, 0x15, 0x6f, 0x9c, 0x77, 0x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x4f, 0x68, 0x60, 0x36, 0x8e, + 0x2d, 0x95, 0xa5, 0x31, 0x39, 0xdd, 0xeb, 0x6b, 0x53, 0x0c, 0x56, 0xc2, 0x70, 0x15, 0x64, 0xf6, + 0x23, 0xec, 0xcd, 0xa2, 0x75, 0xd5, 0xde, 0x30, 0xac, 0xb2, 0x34, 0x2e, 0x2f, 0xf6, 0xfa, 0x9a, + 0x14, 0x61, 0xa3, 0x07, 0x28, 0xa7, 0xef, 0x7d, 0xa1, 0x24, 0xbe, 0x7c, 0xa0, 0x24, 0x1e, 0x3e, + 0x50, 0x12, 0x67, 0xbe, 0x13, 0xc1, 0xec, 0xfe, 0x35, 0x0f, 0x75, 0xf0, 0xbf, 0x8a, 0x59, 0xae, + 0x94, 0xab, 0xb9, 0xeb, 0x76, 0xd5, 0xca, 0x59, 0x37, 0xaa, 0x23, 0x85, 0x87, 0x25, 0x31, 0x70, + 0xc9, 0x0b, 0xbe, 0xae, 0x95, 0x51, 0x7c, 0xc1, 0xa8, 0x94, 0xab, 0x45, 0xcb, 0xae, 0x18, 0x66, + 0xb1, 0x5c, 0x90, 0x04, 0x79, 0xa9, 0xd7, 0xd7, 0x16, 0x18, 0x85, 0x6f, 0x9a, 0x0a, 0x6a, 0x7b, + 0xd8, 0x85, 0x6f, 0x81, 0xff, 0x8f, 0x92, 0x37, 0xca, 0x56, 0xb1, 0x74, 0x25, 0xe2, 0x8a, 0xf2, + 0xb1, 0x5e, 0x5f, 0x83, 0x8c, 0xbb, 0x11, 0x4e, 0x35, 0xa7, 0x9e, 0x05, 0xc7, 0x46, 0xa9, 0x95, + 0x5c, 0xb5, 0x6a, 0x14, 0xa4, 0x31, 0x59, 0xea, 0xf5, 0xb5, 0x34, 0xe3, 0x54, 0x1c, 0x42, 0x90, + 0x0b, 0xcf, 0x83, 0xcc, 0x28, 0xda, 0x34, 0xae, 0x19, 0x6b, 0x96, 0x51, 0x90, 0xc6, 0x65, 0xd8, + 0xeb, 0x6b, 0xb3, 0x0c, 0x6f, 0xa2, 0x0f, 0x51, 0x8d, 0xa2, 0x43, 0xf5, 0x2f, 0xe7, 0x8a, 0xd7, + 0x8d, 0x82, 0x34, 0x11, 0xd7, 0xbf, 0xec, 0x78, 0x0d, 0xe4, 0xee, 0xb7, 0x35, 0x5f, 0xda, 0x7d, + 0xaa, 0x24, 0x1e, 0x3f, 0x55, 0x12, 0x77, 0xf7, 0x94, 0xc4, 0xee, 0x9e, 0x22, 0x3c, 0xda, 0x53, + 0x84, 0x1f, 0xf7, 0x14, 0xe1, 0xfe, 0x33, 0x25, 0xf1, 0xe8, 0x99, 0x92, 0x78, 0xfc, 0x4c, 0x49, + 0xbc, 0xf7, 0xc7, 0x4b, 0x3a, 0xf6, 0xe3, 0x6c, 0x6b, 0x32, 0xdc, 0x83, 0x17, 0x7f, 0x0f, 0x00, + 0x00, 0xff, 0xff, 0xd6, 0x34, 0x18, 0x2d, 0xb2, 0x0d, 0x00, 0x00, } func (this *MsgSubmitProposal) Equal(that interface{}) bool { @@ -547,6 +547,9 @@ func (this *MsgSubmitProposal) Equal(that interface{}) bool { } else if this == nil { return false } + if !this.Content.Equal(that1.Content) { + return false + } if len(this.InitialDeposit) != len(that1.InitialDeposit) { return false } @@ -558,9 +561,6 @@ func (this *MsgSubmitProposal) Equal(that interface{}) bool { if !bytes.Equal(this.Proposer, that1.Proposer) { return false } - if !this.Content.Equal(that1.Content) { - return false - } return true } func (this *MsgVote) Equal(that interface{}) bool { @@ -712,6 +712,9 @@ func (this *Proposal) Equal(that interface{}) bool { if this.ProposalID != that1.ProposalID { return false } + if !this.Content.Equal(that1.Content) { + return false + } if this.Status != that1.Status { return false } @@ -738,9 +741,6 @@ func (this *Proposal) Equal(that interface{}) bool { if !this.VotingEndTime.Equal(that1.VotingEndTime) { return false } - if !this.Content.Equal(that1.Content) { - return false - } return true } func (this *TallyResult) Equal(that interface{}) bool { @@ -826,24 +826,12 @@ func (m *MsgSubmitProposal) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = 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 = encodeVarintTypes(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x1a - } 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 + dAtA[i] = 0x1a } if len(m.InitialDeposit) > 0 { for iNdEx := len(m.InitialDeposit) - 1; iNdEx >= 0; iNdEx-- { @@ -856,9 +844,21 @@ func (m *MsgSubmitProposal) MarshalToSizedBuffer(dAtA []byte) (int, error) { i = encodeVarintTypes(dAtA, i, uint64(size)) } i-- - dAtA[i] = 0xa + dAtA[i] = 0x12 } } + if m.Content != nil { + { + size, err := m.Content.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTypes(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } return len(dAtA) - i, nil } @@ -1057,19 +1057,15 @@ func (m *Proposal) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = 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 = encodeVarintTypes(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x4a + n2, err2 := github_com_gogo_protobuf_types.StdTimeMarshalTo(m.VotingEndTime, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdTime(m.VotingEndTime):]) + if err2 != nil { + return 0, err2 } - n3, err3 := github_com_gogo_protobuf_types.StdTimeMarshalTo(m.VotingEndTime, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdTime(m.VotingEndTime):]) + i -= n2 + i = encodeVarintTypes(dAtA, i, uint64(n2)) + i-- + dAtA[i] = 0x4a + n3, err3 := github_com_gogo_protobuf_types.StdTimeMarshalTo(m.VotingStartTime, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdTime(m.VotingStartTime):]) if err3 != nil { return 0, err3 } @@ -1077,14 +1073,6 @@ func (m *Proposal) MarshalToSizedBuffer(dAtA []byte) (int, error) { i = encodeVarintTypes(dAtA, i, uint64(n3)) i-- dAtA[i] = 0x42 - n4, err4 := github_com_gogo_protobuf_types.StdTimeMarshalTo(m.VotingStartTime, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdTime(m.VotingStartTime):]) - if err4 != nil { - return 0, err4 - } - i -= n4 - i = encodeVarintTypes(dAtA, i, uint64(n4)) - i-- - dAtA[i] = 0x3a if len(m.TotalDeposit) > 0 { for iNdEx := len(m.TotalDeposit) - 1; iNdEx >= 0; iNdEx-- { { @@ -1096,10 +1084,18 @@ func (m *Proposal) MarshalToSizedBuffer(dAtA []byte) (int, error) { i = encodeVarintTypes(dAtA, i, uint64(size)) } i-- - dAtA[i] = 0x32 + dAtA[i] = 0x3a } } - n5, err5 := github_com_gogo_protobuf_types.StdTimeMarshalTo(m.DepositEndTime, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdTime(m.DepositEndTime):]) + n4, err4 := github_com_gogo_protobuf_types.StdTimeMarshalTo(m.DepositEndTime, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdTime(m.DepositEndTime):]) + if err4 != nil { + return 0, err4 + } + i -= n4 + i = encodeVarintTypes(dAtA, i, uint64(n4)) + i-- + dAtA[i] = 0x32 + n5, err5 := github_com_gogo_protobuf_types.StdTimeMarshalTo(m.SubmitTime, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdTime(m.SubmitTime):]) if err5 != nil { return 0, err5 } @@ -1107,14 +1103,6 @@ func (m *Proposal) MarshalToSizedBuffer(dAtA []byte) (int, error) { i = encodeVarintTypes(dAtA, i, uint64(n5)) i-- dAtA[i] = 0x2a - n6, err6 := github_com_gogo_protobuf_types.StdTimeMarshalTo(m.SubmitTime, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdTime(m.SubmitTime):]) - if err6 != nil { - return 0, err6 - } - i -= n6 - i = encodeVarintTypes(dAtA, i, uint64(n6)) - i-- - dAtA[i] = 0x22 { size, err := m.FinalTallyResult.MarshalToSizedBuffer(dAtA[:i]) if err != nil { @@ -1124,11 +1112,23 @@ func (m *Proposal) MarshalToSizedBuffer(dAtA []byte) (int, error) { i = encodeVarintTypes(dAtA, i, uint64(size)) } i-- - dAtA[i] = 0x1a + dAtA[i] = 0x22 if m.Status != 0 { i = encodeVarintTypes(dAtA, i, uint64(m.Status)) i-- - dAtA[i] = 0x10 + dAtA[i] = 0x18 + } + if m.Content != nil { + { + size, err := m.Content.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTypes(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 } if m.ProposalID != 0 { i = encodeVarintTypes(dAtA, i, uint64(m.ProposalID)) @@ -1258,6 +1258,10 @@ func (m *MsgSubmitProposal) Size() (n int) { } var l int _ = l + if m.Content != nil { + l = m.Content.Size() + n += 1 + l + sovTypes(uint64(l)) + } if len(m.InitialDeposit) > 0 { for _, e := range m.InitialDeposit { l = e.Size() @@ -1268,10 +1272,6 @@ func (m *MsgSubmitProposal) Size() (n int) { if l > 0 { n += 1 + l + sovTypes(uint64(l)) } - if m.Content != nil { - l = m.Content.Size() - n += 1 + l + sovTypes(uint64(l)) - } return n } @@ -1364,6 +1364,10 @@ func (m *Proposal) Size() (n int) { if m.ProposalID != 0 { n += 1 + sovTypes(uint64(m.ProposalID)) } + if m.Content != nil { + l = m.Content.Size() + n += 1 + l + sovTypes(uint64(l)) + } if m.Status != 0 { n += 1 + sovTypes(uint64(m.Status)) } @@ -1383,10 +1387,6 @@ func (m *Proposal) Size() (n int) { n += 1 + l + sovTypes(uint64(l)) l = github_com_gogo_protobuf_types.SizeOfStdTime(m.VotingEndTime) n += 1 + l + sovTypes(uint64(l)) - if m.Content != nil { - l = m.Content.Size() - n += 1 + l + sovTypes(uint64(l)) - } return n } @@ -1463,7 +1463,7 @@ func (m *MsgSubmitProposal) Unmarshal(dAtA []byte) error { switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field InitialDeposit", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Content", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -1490,16 +1490,18 @@ func (m *MsgSubmitProposal) Unmarshal(dAtA []byte) error { 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 { + if m.Content == nil { + m.Content = &types.Any{} + } + if err := m.Content.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex case 2: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Proposer", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field InitialDeposit", wireType) } - var byteLen int + var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowTypes @@ -1509,31 +1511,31 @@ func (m *MsgSubmitProposal) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - byteLen |= int(b&0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } } - if byteLen < 0 { + if msglen < 0 { return ErrInvalidLengthTypes } - postIndex := iNdEx + byteLen + postIndex := iNdEx + msglen 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{} + m.InitialDeposit = append(m.InitialDeposit, types1.Coin{}) + if err := m.InitialDeposit[len(m.InitialDeposit)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err } iNdEx = postIndex case 3: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Content", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Proposer", wireType) } - var msglen int + var byteLen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowTypes @@ -1543,26 +1545,24 @@ func (m *MsgSubmitProposal) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - msglen |= int(b&0x7F) << shift + byteLen |= int(b&0x7F) << shift if b < 0x80 { break } } - if msglen < 0 { + if byteLen < 0 { return ErrInvalidLengthTypes } - postIndex := iNdEx + msglen + postIndex := iNdEx + byteLen if postIndex < 0 { return ErrInvalidLengthTypes } if postIndex > l { return io.ErrUnexpectedEOF } - if m.Content == nil { - m.Content = &types1.Any{} - } - if err := m.Content.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err + m.Proposer = append(m.Proposer[:0], dAtA[iNdEx:postIndex]...) + if m.Proposer == nil { + m.Proposer = []byte{} } iNdEx = postIndex default: @@ -1825,7 +1825,7 @@ func (m *MsgDeposit) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.Amount = append(m.Amount, types.Coin{}) + m.Amount = append(m.Amount, types1.Coin{}) if err := m.Amount[len(m.Amount)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } @@ -2082,7 +2082,7 @@ func (m *Deposit) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.Amount = append(m.Amount, types.Coin{}) + m.Amount = append(m.Amount, types1.Coin{}) if err := m.Amount[len(m.Amount)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } @@ -2160,27 +2160,8 @@ func (m *Proposal) Unmarshal(dAtA []byte) error { } } 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) + return fmt.Errorf("proto: wrong wireType = %d for field Content", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -2207,13 +2188,35 @@ func (m *Proposal) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - if err := m.FinalTallyResult.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + if m.Content == nil { + m.Content = &types.Any{} + } + if err := m.Content.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex + case 3: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Status", wireType) + } + 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 4: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field SubmitTime", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field FinalTallyResult", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -2240,13 +2243,13 @@ func (m *Proposal) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - if err := github_com_gogo_protobuf_types.StdTimeUnmarshal(&m.SubmitTime, dAtA[iNdEx:postIndex]); err != nil { + if err := m.FinalTallyResult.Unmarshal(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) + return fmt.Errorf("proto: wrong wireType = %d for field SubmitTime", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -2273,13 +2276,13 @@ func (m *Proposal) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - if err := github_com_gogo_protobuf_types.StdTimeUnmarshal(&m.DepositEndTime, dAtA[iNdEx:postIndex]); err != nil { + if err := github_com_gogo_protobuf_types.StdTimeUnmarshal(&m.SubmitTime, 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) + return fmt.Errorf("proto: wrong wireType = %d for field DepositEndTime", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -2306,14 +2309,13 @@ func (m *Proposal) Unmarshal(dAtA []byte) error { 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 { + if err := github_com_gogo_protobuf_types.StdTimeUnmarshal(&m.DepositEndTime, 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) + return fmt.Errorf("proto: wrong wireType = %d for field TotalDeposit", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -2340,13 +2342,14 @@ func (m *Proposal) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - if err := github_com_gogo_protobuf_types.StdTimeUnmarshal(&m.VotingStartTime, dAtA[iNdEx:postIndex]); err != nil { + m.TotalDeposit = append(m.TotalDeposit, types1.Coin{}) + if err := m.TotalDeposit[len(m.TotalDeposit)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex case 8: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field VotingEndTime", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field VotingStartTime", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -2373,13 +2376,13 @@ func (m *Proposal) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - if err := github_com_gogo_protobuf_types.StdTimeUnmarshal(&m.VotingEndTime, dAtA[iNdEx:postIndex]); err != nil { + if err := github_com_gogo_protobuf_types.StdTimeUnmarshal(&m.VotingStartTime, dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex case 9: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Content", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field VotingEndTime", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -2406,10 +2409,7 @@ func (m *Proposal) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - if m.Content == nil { - m.Content = &types1.Any{} - } - if err := m.Content.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + if err := github_com_gogo_protobuf_types.StdTimeUnmarshal(&m.VotingEndTime, dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex diff --git a/x/params/client/cli/tx.go b/x/params/client/cli/tx.go index 3dc395bd4e6..839875f09b2 100644 --- a/x/params/client/cli/tx.go +++ b/x/params/client/cli/tx.go @@ -80,7 +80,10 @@ Where proposal.json contains: return err } - msg := govtypes.NewMsgSubmitProposalLegacy(content, deposit, from) + msg, err := govtypes.NewMsgSubmitProposal(content, deposit, from) + if err != nil { + return err + } if err := msg.ValidateBasic(); err != nil { return err } @@ -160,7 +163,10 @@ Where proposal.json contains: return err } - msg := govtypes.NewMsgSubmitProposalLegacy(content, deposit, from) + msg, err := govtypes.NewMsgSubmitProposal(content, deposit, from) + if err != nil { + return err + } if err := msg.ValidateBasic(); err != nil { return err } diff --git a/x/params/client/rest/rest.go b/x/params/client/rest/rest.go index 15b9d7eb5e4..0893a0bbd5e 100644 --- a/x/params/client/rest/rest.go +++ b/x/params/client/rest/rest.go @@ -36,7 +36,10 @@ func postProposalHandlerFn(cliCtx context.CLIContext) http.HandlerFunc { content := proposal.NewParameterChangeProposal(req.Title, req.Description, req.Changes.ToParamChanges()) - msg := govtypes.NewMsgSubmitProposalLegacy(content, req.Deposit, req.Proposer) + msg, err := govtypes.NewMsgSubmitProposal(content, req.Deposit, req.Proposer) + if rest.CheckBadRequestError(w, err) { + return + } if rest.CheckBadRequestError(w, msg.ValidateBasic()) { return } diff --git a/x/upgrade/client/cli/tx.go b/x/upgrade/client/cli/tx.go index 65caf2ec84e..cf302463eac 100644 --- a/x/upgrade/client/cli/tx.go +++ b/x/upgrade/client/cli/tx.go @@ -224,7 +224,10 @@ func GetCmdSubmitUpgradeProposal(cdc *codec.Codec) *cobra.Command { return err } - msg := gov.NewMsgSubmitProposalLegacy(content, deposit, from) + msg, err := gov.NewMsgSubmitProposal(content, deposit, from) + if err != nil { + return err + } if err := msg.ValidateBasic(); err != nil { return err } @@ -277,7 +280,10 @@ func GetCmdSubmitCancelUpgradeProposal(cdc *codec.Codec) *cobra.Command { content := types.NewCancelSoftwareUpgradeProposal(title, description) - msg := gov.NewMsgSubmitProposalLegacy(content, deposit, from) + msg, err := gov.NewMsgSubmitProposal(content, deposit, from) + if err != nil { + return err + } if err := msg.ValidateBasic(); err != nil { return err } diff --git a/x/upgrade/client/rest/tx.go b/x/upgrade/client/rest/tx.go index b0e6f1f6a72..3e0ab0119a0 100644 --- a/x/upgrade/client/rest/tx.go +++ b/x/upgrade/client/rest/tx.go @@ -169,7 +169,10 @@ func postPlanHandler(cliCtx context.CLIContext) http.HandlerFunc { plan := types.Plan{Name: req.UpgradeName, Time: t, Height: req.UpgradeHeight, Info: req.UpgradeInfo} content := types.NewSoftwareUpgradeProposal(req.Title, req.Description, plan) - msg := gov.NewMsgSubmitProposalLegacy(content, req.Deposit, fromAddr) + msg, err := gov.NewMsgSubmitProposal(content, req.Deposit, fromAddr) + if rest.CheckBadRequestError(w, err) { + return + } if rest.CheckBadRequestError(w, msg.ValidateBasic()) { return } @@ -197,7 +200,10 @@ func cancelPlanHandler(cliCtx context.CLIContext) http.HandlerFunc { } content := types.NewCancelSoftwareUpgradeProposal(req.Title, req.Description) - msg := gov.NewMsgSubmitProposalLegacy(content, req.Deposit, fromAddr) + msg, err := gov.NewMsgSubmitProposal(content, req.Deposit, fromAddr) + if rest.CheckBadRequestError(w, err) { + return + } if rest.CheckBadRequestError(w, msg.ValidateBasic()) { return } From 526418225a85b64d9c27034d9ff06fe24adf4609 Mon Sep 17 00:00:00 2001 From: Aaron Craelius Date: Wed, 6 May 2020 17:18:10 -0400 Subject: [PATCH 04/42] Update CHANGELOG.md --- CHANGELOG.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 147d721becb..3e009542620 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -96,6 +96,9 @@ information on how to implement the new `Keyring` interface. * [\#5858](https://github.com/cosmos/cosmos-sdk/pull/5858) Make Keyring store keys by name and address's hexbytes representation. * (x/evidence) [\#5952](https://github.com/cosmos/cosmos-sdk/pull/5952) Remove APIs for getting and setting `x/evidence` parameters. `BaseApp` now uses a `ParamStore` to manage Tendermint consensus parameters which is managed via the `x/params` `Substore` type. * (export) [\#5952](https://github.com/cosmos/cosmos-sdk/pull/5952) `AppExporter` now returns ABCI consensus parameters to be included in marshaled exported state. These parameters must be returned from the application via the `BaseApp`. +* (x/gov) [\#6147](https://github.com/cosmos/cosmos-sdk/pull/6147) The `Content` field on `Proposal` and `MsgSubmitProposal` +is now `Any` in concordance with [ADR 019](docs/architecture/adr-019-protobuf-state-encoding.md) and `GetContent` should now +be used to retrieve the actual proposal `Content`. Also the `NewMsgSubmitProposal` constructor now may return an `error` ### Features From b2ca3a4d7eb2ceca28eff212da6030b301dea766 Mon Sep 17 00:00:00 2001 From: Aaron Craelius Date: Wed, 6 May 2020 17:25:18 -0400 Subject: [PATCH 05/42] Add RegisterInterfaces for x/distribution, x/params, & x/upgrade --- x/distribution/module.go | 7 +++++++ x/distribution/types/codec.go | 15 +++++++++++++++ x/params/module.go | 7 +++++++ x/params/types/proposal/codec.go | 8 ++++++++ x/upgrade/module.go | 12 ++++++++++-- x/upgrade/types/codec.go | 10 ++++++++++ 6 files changed, 57 insertions(+), 2 deletions(-) diff --git a/x/distribution/module.go b/x/distribution/module.go index ee32db9231a..95bbe87e705 100644 --- a/x/distribution/module.go +++ b/x/distribution/module.go @@ -5,6 +5,8 @@ import ( "fmt" "math/rand" + cdctypes "github.com/cosmos/cosmos-sdk/codec/types" + "github.com/gorilla/mux" "github.com/spf13/cobra" abci "github.com/tendermint/tendermint/abci/types" @@ -25,6 +27,7 @@ var ( _ module.AppModule = AppModule{} _ module.AppModuleBasic = AppModuleBasic{} _ module.AppModuleSimulation = AppModule{} + _ module.InterfaceModule = AppModuleBasic{} ) // AppModuleBasic defines the basic application module used by the distribution module. @@ -73,6 +76,10 @@ func (AppModuleBasic) GetQueryCmd(cdc *codec.Codec) *cobra.Command { return cli.GetQueryCmd(StoreKey, cdc) } +func (b AppModuleBasic) RegisterInterfaceTypes(registry cdctypes.InterfaceRegistry) { + types.RegisterInterfaces(registry) +} + //____________________________________________________________________________ // AppModule implements an application module for the distribution module. diff --git a/x/distribution/types/codec.go b/x/distribution/types/codec.go index bd4242a00d0..fa6a3042bba 100644 --- a/x/distribution/types/codec.go +++ b/x/distribution/types/codec.go @@ -3,6 +3,8 @@ package types import ( "github.com/cosmos/cosmos-sdk/codec" "github.com/cosmos/cosmos-sdk/codec/types" + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/cosmos/cosmos-sdk/x/gov" ) // RegisterCodec registers the necessary x/distribution interfaces and concrete types @@ -14,6 +16,19 @@ func RegisterCodec(cdc *codec.Codec) { cdc.RegisterConcrete(&CommunityPoolSpendProposal{}, "cosmos-sdk/CommunityPoolSpendProposal", nil) } +func RegisterInterfaces(registry types.InterfaceRegistry) { + registry.RegisterImplementations( + (*sdk.Msg)(nil), + &MsgWithdrawDelegatorReward{}, + &MsgWithdrawValidatorCommission{}, + &MsgSetWithdrawAddress{}, + ) + registry.RegisterImplementations( + (*gov.Content)(nil), + &CommunityPoolSpendProposal{}, + ) +} + var ( amino = codec.New() diff --git a/x/params/module.go b/x/params/module.go index c2a6f5860e5..628b1c8365d 100644 --- a/x/params/module.go +++ b/x/params/module.go @@ -4,6 +4,8 @@ import ( "encoding/json" "math/rand" + "github.com/cosmos/cosmos-sdk/codec/types" + "github.com/gorilla/mux" "github.com/spf13/cobra" abci "github.com/tendermint/tendermint/abci/types" @@ -21,6 +23,7 @@ var ( _ module.AppModule = AppModule{} _ module.AppModuleBasic = AppModuleBasic{} _ module.AppModuleSimulation = AppModule{} + _ module.InterfaceModule = AppModuleBasic{} ) // AppModuleBasic defines the basic application module used by the params module. @@ -52,6 +55,10 @@ func (AppModuleBasic) GetTxCmd(_ *codec.Codec) *cobra.Command { return nil } // GetQueryCmd returns no root query command for the params module. func (AppModuleBasic) GetQueryCmd(_ *codec.Codec) *cobra.Command { return nil } +func (am AppModuleBasic) RegisterInterfaceTypes(registry types.InterfaceRegistry) { + proposal.RegisterInterfaces(registry) +} + //____________________________________________________________________________ // AppModule implements an application module for the distribution module. diff --git a/x/params/types/proposal/codec.go b/x/params/types/proposal/codec.go index 959ec4a369e..225b0c946dc 100644 --- a/x/params/types/proposal/codec.go +++ b/x/params/types/proposal/codec.go @@ -3,6 +3,7 @@ package proposal import ( "github.com/cosmos/cosmos-sdk/codec" "github.com/cosmos/cosmos-sdk/codec/types" + "github.com/cosmos/cosmos-sdk/x/gov" ) type Codec struct { @@ -31,3 +32,10 @@ func init() { func RegisterCodec(cdc *codec.Codec) { cdc.RegisterConcrete(&ParameterChangeProposal{}, "cosmos-sdk/ParameterChangeProposal", nil) } + +func RegisterInterfaces(registry types.InterfaceRegistry) { + registry.RegisterImplementations( + (*gov.Content)(nil), + &ParameterChangeProposal{}, + ) +} diff --git a/x/upgrade/module.go b/x/upgrade/module.go index f5a9b461ef8..46b0ad3febc 100644 --- a/x/upgrade/module.go +++ b/x/upgrade/module.go @@ -6,6 +6,9 @@ import ( "github.com/gorilla/mux" "github.com/spf13/cobra" + codectypes "github.com/cosmos/cosmos-sdk/codec/types" + types "github.com/cosmos/cosmos-sdk/x/upgrade/types" + abci "github.com/tendermint/tendermint/abci/types" "github.com/cosmos/cosmos-sdk/client/context" @@ -25,8 +28,9 @@ func init() { } var ( - _ module.AppModule = AppModule{} - _ module.AppModuleBasic = AppModuleBasic{} + _ module.AppModule = AppModule{} + _ module.AppModuleBasic = AppModuleBasic{} + _ module.InterfaceModule = AppModuleBasic{} ) // AppModuleBasic implements the sdk.AppModuleBasic interface @@ -71,6 +75,10 @@ func (AppModuleBasic) GetTxCmd(cdc *codec.Codec) *cobra.Command { return txCmd } +func (b AppModuleBasic) RegisterInterfaceTypes(registry codectypes.InterfaceRegistry) { + types.RegisterInterfaces(registry) +} + // AppModule implements the sdk.AppModule interface type AppModule struct { AppModuleBasic diff --git a/x/upgrade/types/codec.go b/x/upgrade/types/codec.go index 78ad0af0137..c363d050f36 100644 --- a/x/upgrade/types/codec.go +++ b/x/upgrade/types/codec.go @@ -2,6 +2,8 @@ package types import ( "github.com/cosmos/cosmos-sdk/codec" + "github.com/cosmos/cosmos-sdk/codec/types" + "github.com/cosmos/cosmos-sdk/x/gov" ) // RegisterCodec registers concrete types on the Amino codec @@ -10,3 +12,11 @@ func RegisterCodec(cdc *codec.Codec) { cdc.RegisterConcrete(&SoftwareUpgradeProposal{}, "cosmos-sdk/SoftwareUpgradeProposal", nil) cdc.RegisterConcrete(&CancelSoftwareUpgradeProposal{}, "cosmos-sdk/CancelSoftwareUpgradeProposal", nil) } + +func RegisterInterfaces(registry types.InterfaceRegistry) { + registry.RegisterImplementations( + (*gov.Content)(nil), + &SoftwareUpgradeProposal{}, + &CancelSoftwareUpgradeProposal{}, + ) +} From 8dcfffbb08819d39c87cc5d8c335a4b590be3408 Mon Sep 17 00:00:00 2001 From: Aaron Craelius Date: Thu, 7 May 2020 15:53:15 -0400 Subject: [PATCH 06/42] Fix query JSON issue --- codec/types/amino_compat.go | 4 +- codec/types/any.go | 33 +++++++++++++ codec/types/any.pb.go | 52 +++++---------------- third_party/proto/google/protobuf/any.proto | 1 + x/gov/keeper/proposal.go | 2 +- x/gov/types/proposal.go | 14 +++++- 6 files changed, 60 insertions(+), 46 deletions(-) diff --git a/codec/types/amino_compat.go b/codec/types/amino_compat.go index 5bb7be3f9a5..590328120f4 100644 --- a/codec/types/amino_compat.go +++ b/codec/types/amino_compat.go @@ -16,7 +16,7 @@ type aminoCompat struct { func (any Any) MarshalAmino() ([]byte, error) { ac := any.aminoCompat if ac == nil { - return nil, fmt.Errorf("can't amino unmarshal") + return nil, fmt.Errorf("can't amino unmarshal %+v", any) } return ac.bz, ac.err } @@ -32,7 +32,7 @@ func (any *Any) UnmarshalAmino(bz []byte) error { func (any Any) MarshalJSON() ([]byte, error) { ac := any.aminoCompat if ac == nil { - return nil, fmt.Errorf("can't JSON marshal") + return nil, fmt.Errorf("can't JSON marshal %+v", any) } return ac.jsonBz, ac.err } diff --git a/codec/types/any.go b/codec/types/any.go index 714c0f78f21..e2151707c3c 100644 --- a/codec/types/any.go +++ b/codec/types/any.go @@ -1,6 +1,8 @@ package types import ( + "bytes" + "github.com/gogo/protobuf/proto" ) @@ -92,3 +94,34 @@ func (any *Any) GetCachedValue() interface{} { func (any *Any) ClearCachedValue() { any.cachedValue = nil } + +func (this *Any) Equal(that interface{}) bool { + if that == nil { + return this == nil + } + + that1, ok := that.(*Any) + if !ok { + that2, ok := that.(Any) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + return this == nil + } else if this == nil { + return false + } + if this.TypeUrl != that1.TypeUrl { + return false + } + if !bytes.Equal(this.Value, that1.Value) { + return false + } + if !bytes.Equal(this.XXX_unrecognized, that1.XXX_unrecognized) { + return false + } + return true +} diff --git a/codec/types/any.pb.go b/codec/types/any.pb.go index d084381696f..d591a076736 100644 --- a/codec/types/any.pb.go +++ b/codec/types/any.pb.go @@ -84,23 +84,23 @@ func init() { } var fileDescriptor_cb68f365a8e2bcdc = []byte{ - // 246 bytes of a gzipped FileDescriptorProto + // 251 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0xd2, 0x2e, 0xc9, 0xc8, 0x2c, 0x4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0xec, 0xc4, 0xe1, 0x98, 0x57, 0x19, 0x00, 0xe2, - 0x04, 0x30, 0x46, 0xb1, 0x82, 0x2c, 0x2f, 0x5e, 0xc4, 0xc4, 0xec, 0x1e, 0xe0, 0xb4, 0x8a, 0x49, - 0xce, 0x1d, 0xa2, 0x34, 0x00, 0xaa, 0x54, 0x2f, 0x3c, 0x35, 0x27, 0xc7, 0x3b, 0x2f, 0xbf, 0x3c, - 0x2f, 0x04, 0xa4, 0x2c, 0x89, 0x0d, 0x6c, 0x86, 0x31, 0x20, 0x00, 0x00, 0xff, 0xff, 0x16, 0xc3, - 0x46, 0x5f, 0x32, 0x01, 0x00, 0x00, + 0x82, 0x70, 0xac, 0x38, 0x5e, 0x2c, 0x90, 0x67, 0xf8, 0xb0, 0x50, 0x9e, 0xc1, 0xa9, 0x99, 0xf1, + 0xc6, 0x43, 0x39, 0x86, 0x0f, 0x0f, 0xe5, 0x18, 0x7f, 0x3c, 0x94, 0x63, 0x6c, 0x78, 0x24, 0xc7, + 0xb8, 0xe2, 0x91, 0x1c, 0xe3, 0x89, 0x47, 0x72, 0x8c, 0x17, 0x1e, 0xc9, 0x31, 0x3e, 0x78, 0x24, + 0xc7, 0xf8, 0xe2, 0x91, 0x1c, 0xc3, 0x07, 0x90, 0xf8, 0x63, 0x39, 0xc6, 0x03, 0x8f, 0xe5, 0x18, + 0x4e, 0x3c, 0x96, 0x63, 0xe4, 0x12, 0x4e, 0xce, 0xcf, 0xd5, 0x43, 0x73, 0xb5, 0x13, 0x87, 0x63, + 0x5e, 0x65, 0x00, 0x88, 0x13, 0xc0, 0x18, 0xc5, 0x0a, 0x72, 0x40, 0xf1, 0x22, 0x26, 0x66, 0xf7, + 0x00, 0xa7, 0x55, 0x4c, 0x72, 0xee, 0x10, 0xa5, 0x01, 0x50, 0xa5, 0x7a, 0xe1, 0xa9, 0x39, 0x39, + 0xde, 0x79, 0xf9, 0xe5, 0x79, 0x21, 0x20, 0x65, 0x49, 0x6c, 0x60, 0x33, 0x8c, 0x01, 0x01, 0x00, + 0x00, 0xff, 0xff, 0x45, 0x88, 0x2c, 0x39, 0x36, 0x01, 0x00, 0x00, } func (this *Any) Compare(that interface{}) int { @@ -142,36 +142,6 @@ func (this *Any) Compare(that interface{}) int { } return 0 } -func (this *Any) Equal(that interface{}) bool { - if that == nil { - return this == nil - } - - that1, ok := that.(*Any) - if !ok { - that2, ok := that.(Any) - if ok { - that1 = &that2 - } else { - return false - } - } - if that1 == nil { - return this == nil - } else if this == nil { - return false - } - if this.TypeUrl != that1.TypeUrl { - return false - } - if !bytes.Equal(this.Value, that1.Value) { - return false - } - if !bytes.Equal(this.XXX_unrecognized, that1.XXX_unrecognized) { - return false - } - return true -} func (this *Any) GoString() string { if this == nil { return "nil" diff --git a/third_party/proto/google/protobuf/any.proto b/third_party/proto/google/protobuf/any.proto index a769fa3b222..26aa74f50b3 100644 --- a/third_party/proto/google/protobuf/any.proto +++ b/third_party/proto/google/protobuf/any.proto @@ -156,6 +156,7 @@ message Any { bytes value = 2; option (gogoproto.typedecl) = false; + option (gogoproto.equal) = false; } option (gogoproto.goproto_registration) = false; diff --git a/x/gov/keeper/proposal.go b/x/gov/keeper/proposal.go index 325b08f6cb6..47a4bdbfc10 100644 --- a/x/gov/keeper/proposal.go +++ b/x/gov/keeper/proposal.go @@ -131,7 +131,7 @@ func (keeper Keeper) GetProposals(ctx sdk.Context) (proposals types.Proposals) { // // NOTE: If no filters are provided, all proposals will be returned in paginated // form. -func (keeper Keeper) GetProposalsFiltered(ctx sdk.Context, params types.QueryProposalsParams) []types.Proposal { +func (keeper Keeper) GetProposalsFiltered(ctx sdk.Context, params types.QueryProposalsParams) types.Proposals { proposals := keeper.GetProposals(ctx) filteredProposals := make([]types.Proposal, 0, len(proposals)) diff --git a/x/gov/types/proposal.go b/x/gov/types/proposal.go index 438ec329d1b..b70aefe6b6f 100644 --- a/x/gov/types/proposal.go +++ b/x/gov/types/proposal.go @@ -6,8 +6,6 @@ import ( "strings" "time" - "gopkg.in/yaml.v2" - "github.com/gogo/protobuf/proto" "github.com/cosmos/cosmos-sdk/codec/types" @@ -90,6 +88,8 @@ func (m Proposal) UnpackInterfaces(unpacker types.AnyUnpacker) error { // Proposals is an array of proposal type Proposals []Proposal +var _ types.UnpackInterfacesMessage = Proposals{} + // Equal returns true if two slices (order-dependant) of proposals are equal. func (p Proposals) Equal(other Proposals) bool { if len(p) != len(other) { @@ -116,6 +116,16 @@ func (p Proposals) String() string { return strings.TrimSpace(out) } +func (p Proposals) UnpackInterfaces(unpacker types.AnyUnpacker) error { + for _, x := range p { + err := x.UnpackInterfaces(unpacker) + if err != nil { + return err + } + } + return nil +} + type ( // ProposalQueue defines a queue for proposal ids ProposalQueue []uint64 From 42092cf72608f68f798c09d900ff6497acaeb704 Mon Sep 17 00:00:00 2001 From: Aaron Craelius Date: Fri, 8 May 2020 14:54:40 -0400 Subject: [PATCH 07/42] Fix gov tests --- codec/types/amino_compat.go | 30 ++++++++++++++++++++++++++++-- codec/types/interface_registry.go | 4 ++++ x/gov/genesis_test.go | 6 +++--- x/gov/types/genesis.go | 14 ++++++++++++++ x/gov/types/proposal.go | 2 ++ 5 files changed, 51 insertions(+), 5 deletions(-) diff --git a/codec/types/amino_compat.go b/codec/types/amino_compat.go index 590328120f4..fc2e2689f44 100644 --- a/codec/types/amino_compat.go +++ b/codec/types/amino_compat.go @@ -4,6 +4,8 @@ import ( "fmt" "reflect" + "github.com/gogo/protobuf/proto" + amino "github.com/tendermint/go-amino" ) @@ -67,7 +69,19 @@ func (a AminoUnpacker) UnpackAny(any *Any, iface interface{}) error { if err != nil { return err } - any.cachedValue = val + if m, ok := val.(proto.Message); ok { + err := any.Pack(m) + if err != nil { + return err + } + } else { + any.cachedValue = val + } + + // this is necessary for tests that use reflect.DeepEqual and compare + // proto vs amino marshaled values + any.aminoCompat = nil + return nil } @@ -114,7 +128,19 @@ func (a AminoJSONUnpacker) UnpackAny(any *Any, iface interface{}) error { if err != nil { return err } - any.cachedValue = val + if m, ok := val.(proto.Message); ok { + err := any.Pack(m) + if err != nil { + return err + } + } else { + any.cachedValue = val + } + + // this is necessary for tests that use reflect.DeepEqual and compare + // proto vs amino marshaled values + any.aminoCompat = nil + return nil } diff --git a/codec/types/interface_registry.go b/codec/types/interface_registry.go index d83800d4453..6cfa38af08f 100644 --- a/codec/types/interface_registry.go +++ b/codec/types/interface_registry.go @@ -112,6 +112,10 @@ func (registry *interfaceRegistry) RegisterImplementations(iface interface{}, im } func (registry *interfaceRegistry) UnpackAny(any *Any, iface interface{}) error { + if len(any.Value) == 0 || any.TypeUrl == "" { + return nil + } + rv := reflect.ValueOf(iface) if rv.Kind() != reflect.Ptr { return fmt.Errorf("UnpackAny expects a pointer") diff --git a/x/gov/genesis_test.go b/x/gov/genesis_test.go index 5f838c1f53f..7dacb7a47b8 100644 --- a/x/gov/genesis_test.go +++ b/x/gov/genesis_test.go @@ -55,9 +55,9 @@ func TestImportExportQueues(t *testing.T) { govGenState := gov.ExportGenesis(ctx, app.GovKeeper) genesisState := simapp.NewDefaultGenesisState() - genesisState[auth.ModuleName] = app.Codec().MustMarshalJSON(authGenState) - genesisState[bank.ModuleName] = app.Codec().MustMarshalJSON(bankGenState) - genesisState[gov.ModuleName] = app.Codec().MustMarshalJSON(govGenState) + genesisState[auth.ModuleName] = app.AppCodec().MustMarshalJSON(authGenState) + genesisState[bank.ModuleName] = app.AppCodec().MustMarshalJSON(bankGenState) + genesisState[gov.ModuleName] = app.AppCodec().MustMarshalJSON(govGenState) stateBytes, err := codec.MarshalJSONIndent(app.Codec(), genesisState) if err != nil { diff --git a/x/gov/types/genesis.go b/x/gov/types/genesis.go index 7099cb9590b..ec816ec9fde 100644 --- a/x/gov/types/genesis.go +++ b/x/gov/types/genesis.go @@ -3,6 +3,8 @@ package types import ( "fmt" + "github.com/cosmos/cosmos-sdk/codec/types" + sdk "github.com/cosmos/cosmos-sdk/types" ) @@ -73,3 +75,15 @@ func ValidateGenesis(data GenesisState) error { return nil } + +var _ types.UnpackInterfacesMessage = GenesisState{} + +func (data GenesisState) UnpackInterfaces(unpacker types.AnyUnpacker) error { + for _, p := range data.Proposals { + err := p.UnpackInterfaces(unpacker) + if err != nil { + return err + } + } + return nil +} diff --git a/x/gov/types/proposal.go b/x/gov/types/proposal.go index b70aefe6b6f..46179d2f33f 100644 --- a/x/gov/types/proposal.go +++ b/x/gov/types/proposal.go @@ -6,6 +6,8 @@ import ( "strings" "time" + "gopkg.in/yaml.v2" + "github.com/gogo/protobuf/proto" "github.com/cosmos/cosmos-sdk/codec/types" From 8ea6a44bfb0b6fd5732bc6d5ef4c29d087e391ca Mon Sep 17 00:00:00 2001 From: Aaron Craelius Date: Fri, 8 May 2020 14:55:18 -0400 Subject: [PATCH 08/42] Revert custom Any Equals --- codec/types/any.go | 33 ------------- codec/types/any.pb.go | 52 ++++++++++++++++----- third_party/proto/google/protobuf/any.proto | 1 - 3 files changed, 41 insertions(+), 45 deletions(-) diff --git a/codec/types/any.go b/codec/types/any.go index e2151707c3c..714c0f78f21 100644 --- a/codec/types/any.go +++ b/codec/types/any.go @@ -1,8 +1,6 @@ package types import ( - "bytes" - "github.com/gogo/protobuf/proto" ) @@ -94,34 +92,3 @@ func (any *Any) GetCachedValue() interface{} { func (any *Any) ClearCachedValue() { any.cachedValue = nil } - -func (this *Any) Equal(that interface{}) bool { - if that == nil { - return this == nil - } - - that1, ok := that.(*Any) - if !ok { - that2, ok := that.(Any) - if ok { - that1 = &that2 - } else { - return false - } - } - if that1 == nil { - return this == nil - } else if this == nil { - return false - } - if this.TypeUrl != that1.TypeUrl { - return false - } - if !bytes.Equal(this.Value, that1.Value) { - return false - } - if !bytes.Equal(this.XXX_unrecognized, that1.XXX_unrecognized) { - return false - } - return true -} diff --git a/codec/types/any.pb.go b/codec/types/any.pb.go index d591a076736..d084381696f 100644 --- a/codec/types/any.pb.go +++ b/codec/types/any.pb.go @@ -84,23 +84,23 @@ func init() { } var fileDescriptor_cb68f365a8e2bcdc = []byte{ - // 251 bytes of a gzipped FileDescriptorProto + // 246 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0xd2, 0x2e, 0xc9, 0xc8, 0x2c, 0x4a, 0x89, 0x2f, 0x48, 0x2c, 0x2a, 0xa9, 0xd4, 0x2f, 0x28, 0xca, 0x2f, 0xc9, 0xd7, 0x4f, 0xcf, 0xcf, 0x4f, 0xcf, 0x49, 0x85, 0x70, 0x92, 0x4a, 0xd3, 0xf4, 0x13, 0xf3, 0x2a, 0xf5, 0xc0, 0x1c, 0x21, 0x7e, 0x88, 0x94, 0x1e, 0x4c, 0x4a, 0x4a, 0x0d, 0x9b, 0xee, 0xf4, 0x7c, 0x04, 0x0b, 0xa2, - 0x54, 0xc9, 0x81, 0x8b, 0xd9, 0x31, 0xaf, 0x52, 0x48, 0x92, 0x8b, 0xa3, 0xa4, 0xb2, 0x20, 0x35, + 0x54, 0xc9, 0x86, 0x8b, 0xd9, 0x31, 0xaf, 0x52, 0x48, 0x92, 0x8b, 0xa3, 0xa4, 0xb2, 0x20, 0x35, 0xbe, 0xb4, 0x28, 0x47, 0x82, 0x51, 0x81, 0x51, 0x83, 0x33, 0x88, 0x1d, 0xc4, 0x0f, 0x2d, 0xca, 0x11, 0x12, 0xe1, 0x62, 0x2d, 0x4b, 0xcc, 0x29, 0x4d, 0x95, 0x60, 0x52, 0x60, 0xd4, 0xe0, 0x09, - 0x82, 0x70, 0xac, 0x38, 0x5e, 0x2c, 0x90, 0x67, 0xf8, 0xb0, 0x50, 0x9e, 0xc1, 0xa9, 0x99, 0xf1, - 0xc6, 0x43, 0x39, 0x86, 0x0f, 0x0f, 0xe5, 0x18, 0x7f, 0x3c, 0x94, 0x63, 0x6c, 0x78, 0x24, 0xc7, - 0xb8, 0xe2, 0x91, 0x1c, 0xe3, 0x89, 0x47, 0x72, 0x8c, 0x17, 0x1e, 0xc9, 0x31, 0x3e, 0x78, 0x24, - 0xc7, 0xf8, 0xe2, 0x91, 0x1c, 0xc3, 0x07, 0x90, 0xf8, 0x63, 0x39, 0xc6, 0x03, 0x8f, 0xe5, 0x18, - 0x4e, 0x3c, 0x96, 0x63, 0xe4, 0x12, 0x4e, 0xce, 0xcf, 0xd5, 0x43, 0x73, 0xb5, 0x13, 0x87, 0x63, - 0x5e, 0x65, 0x00, 0x88, 0x13, 0xc0, 0x18, 0xc5, 0x0a, 0x72, 0x40, 0xf1, 0x22, 0x26, 0x66, 0xf7, - 0x00, 0xa7, 0x55, 0x4c, 0x72, 0xee, 0x10, 0xa5, 0x01, 0x50, 0xa5, 0x7a, 0xe1, 0xa9, 0x39, 0x39, - 0xde, 0x79, 0xf9, 0xe5, 0x79, 0x21, 0x20, 0x65, 0x49, 0x6c, 0x60, 0x33, 0x8c, 0x01, 0x01, 0x00, - 0x00, 0xff, 0xff, 0x45, 0x88, 0x2c, 0x39, 0x36, 0x01, 0x00, 0x00, + 0x82, 0x70, 0xac, 0x58, 0x3e, 0x2c, 0x94, 0x67, 0x70, 0x6a, 0x66, 0xbc, 0xf1, 0x50, 0x8e, 0xe1, + 0xc3, 0x43, 0x39, 0xc6, 0x1f, 0x0f, 0xe5, 0x18, 0x1b, 0x1e, 0xc9, 0x31, 0xae, 0x78, 0x24, 0xc7, + 0x78, 0xe2, 0x91, 0x1c, 0xe3, 0x85, 0x47, 0x72, 0x8c, 0x0f, 0x1e, 0xc9, 0x31, 0xbe, 0x78, 0x24, + 0xc7, 0xf0, 0x01, 0x24, 0xfe, 0x58, 0x8e, 0xf1, 0xc0, 0x63, 0x39, 0x86, 0x13, 0x8f, 0xe5, 0x18, + 0xb9, 0x84, 0x93, 0xf3, 0x73, 0xf5, 0xd0, 0x5c, 0xec, 0xc4, 0xe1, 0x98, 0x57, 0x19, 0x00, 0xe2, + 0x04, 0x30, 0x46, 0xb1, 0x82, 0x2c, 0x2f, 0x5e, 0xc4, 0xc4, 0xec, 0x1e, 0xe0, 0xb4, 0x8a, 0x49, + 0xce, 0x1d, 0xa2, 0x34, 0x00, 0xaa, 0x54, 0x2f, 0x3c, 0x35, 0x27, 0xc7, 0x3b, 0x2f, 0xbf, 0x3c, + 0x2f, 0x04, 0xa4, 0x2c, 0x89, 0x0d, 0x6c, 0x86, 0x31, 0x20, 0x00, 0x00, 0xff, 0xff, 0x16, 0xc3, + 0x46, 0x5f, 0x32, 0x01, 0x00, 0x00, } func (this *Any) Compare(that interface{}) int { @@ -142,6 +142,36 @@ func (this *Any) Compare(that interface{}) int { } return 0 } +func (this *Any) Equal(that interface{}) bool { + if that == nil { + return this == nil + } + + that1, ok := that.(*Any) + if !ok { + that2, ok := that.(Any) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + return this == nil + } else if this == nil { + return false + } + if this.TypeUrl != that1.TypeUrl { + return false + } + if !bytes.Equal(this.Value, that1.Value) { + return false + } + if !bytes.Equal(this.XXX_unrecognized, that1.XXX_unrecognized) { + return false + } + return true +} func (this *Any) GoString() string { if this == nil { return "nil" diff --git a/third_party/proto/google/protobuf/any.proto b/third_party/proto/google/protobuf/any.proto index 26aa74f50b3..a769fa3b222 100644 --- a/third_party/proto/google/protobuf/any.proto +++ b/third_party/proto/google/protobuf/any.proto @@ -156,7 +156,6 @@ message Any { bytes value = 2; option (gogoproto.typedecl) = false; - option (gogoproto.equal) = false; } option (gogoproto.goproto_registration) = false; From 7531d14b8a4682b2e104101cb1f29d7894f7cc17 Mon Sep 17 00:00:00 2001 From: Aaron Craelius Date: Fri, 8 May 2020 16:41:39 -0400 Subject: [PATCH 09/42] Re-remove types --- std/msgs.go | 55 ---------------------------------- x/gov/types/msgs.go | 73 --------------------------------------------- 2 files changed, 128 deletions(-) delete mode 100644 std/msgs.go diff --git a/std/msgs.go b/std/msgs.go deleted file mode 100644 index 259dad15602..00000000000 --- a/std/msgs.go +++ /dev/null @@ -1,55 +0,0 @@ -package std - -import ( - sdk "github.com/cosmos/cosmos-sdk/types" - sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" - gov "github.com/cosmos/cosmos-sdk/x/gov/types" -) - -var ( - _ gov.MsgSubmitProposalI = &MsgSubmitProposal{} -) - -// NewMsgSubmitProposal returns a new MsgSubmitProposal. -func NewMsgSubmitProposal(c gov.Content, d sdk.Coins, p sdk.AccAddress) (gov.MsgSubmitProposalI, error) { - content := &Content{} - if err := content.SetContent(c); err != nil { - return nil, err - } - - return &MsgSubmitProposal{ - Content: content, - MsgSubmitProposalBase: gov.NewMsgSubmitProposalBase(d, p), - }, nil -} - -// ValidateBasic performs basic (non-state-dependant) validation on a -// MsgSubmitProposal. -func (msg MsgSubmitProposal) ValidateBasic() error { - if err := msg.MsgSubmitProposalBase.ValidateBasic(); err != nil { - return nil - } - if msg.Content == nil { - return sdkerrors.Wrap(gov.ErrInvalidProposalContent, "missing content") - } - if !gov.IsValidProposalType(msg.Content.GetContent().ProposalType()) { - return sdkerrors.Wrap(gov.ErrInvalidProposalType, msg.Content.GetContent().ProposalType()) - } - if err := msg.Content.GetContent().ValidateBasic(); err != nil { - return err - } - - return nil -} - -// nolint -func (msg *MsgSubmitProposal) GetContent() gov.Content { return msg.Content.GetContent() } -func (msg *MsgSubmitProposal) SetContent(content gov.Content) error { - stdContent := &Content{} - err := stdContent.SetContent(content) - if err != nil { - return err - } - msg.Content = stdContent - return nil -} diff --git a/x/gov/types/msgs.go b/x/gov/types/msgs.go index 5c157a2a688..f2c124e5766 100644 --- a/x/gov/types/msgs.go +++ b/x/gov/types/msgs.go @@ -220,76 +220,3 @@ func (msg MsgVote) GetSignBytes() []byte { func (msg MsgVote) GetSigners() []sdk.AccAddress { return []sdk.AccAddress{msg.Voter} } - -// --------------------------------------------------------------------------- -// Deprecated -// -// TODO: Remove once client-side Protobuf migration has been completed. -// --------------------------------------------------------------------------- - -// MsgSubmitProposal defines a (deprecated) message to create/submit a governance -// proposal. -// -// TODO: Remove once client-side Protobuf migration has been completed. -type MsgSubmitProposal struct { - Content Content `json:"content" yaml:"content"` - InitialDeposit sdk.Coins `json:"initial_deposit" yaml:"initial_deposit"` // Initial deposit paid by sender. Must be strictly positive - Proposer sdk.AccAddress `json:"proposer" yaml:"proposer"` // Address of the proposer -} - -var _ MsgSubmitProposalI = &MsgSubmitProposal{} - -// NewMsgSubmitProposal returns a (deprecated) MsgSubmitProposal message. -// -// TODO: Remove once client-side Protobuf migration has been completed. -func NewMsgSubmitProposal(content Content, initialDeposit sdk.Coins, proposer sdk.AccAddress) *MsgSubmitProposal { - return &MsgSubmitProposal{content, initialDeposit, proposer} -} - -// ValidateBasic implements Msg -func (msg MsgSubmitProposal) ValidateBasic() error { - if msg.Content == nil { - return sdkerrors.Wrap(ErrInvalidProposalContent, "missing content") - } - if msg.Proposer.Empty() { - return sdkerrors.Wrap(sdkerrors.ErrInvalidAddress, msg.Proposer.String()) - } - if !msg.InitialDeposit.IsValid() { - return sdkerrors.Wrap(sdkerrors.ErrInvalidCoins, msg.InitialDeposit.String()) - } - if msg.InitialDeposit.IsAnyNegative() { - return sdkerrors.Wrap(sdkerrors.ErrInvalidCoins, msg.InitialDeposit.String()) - } - if !IsValidProposalType(msg.Content.ProposalType()) { - return sdkerrors.Wrap(ErrInvalidProposalType, msg.Content.ProposalType()) - } - - return msg.Content.ValidateBasic() -} - -// GetSignBytes implements Msg -func (msg MsgSubmitProposal) GetSignBytes() []byte { - bz := ModuleCdc.MustMarshalJSON(msg) - return sdk.MustSortJSON(bz) -} - -// 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 } - -func (msg *MsgSubmitProposal) SetContent(content Content) error { - msg.Content = content - return nil -} - -func (msg *MsgSubmitProposal) SetInitialDeposit(deposit sdk.Coins) { - msg.InitialDeposit = deposit -} - -func (msg *MsgSubmitProposal) SetProposer(proposer sdk.AccAddress) { - msg.Proposer = proposer -} From ba6b151b339c575104bcf3a7b019326ce3984a05 Mon Sep 17 00:00:00 2001 From: Aaron Craelius Date: Fri, 8 May 2020 17:15:58 -0400 Subject: [PATCH 10/42] Rename receivers --- x/gov/types/msgs.go | 49 ++++++++++++++++++++--------------------- x/gov/types/proposal.go | 22 +++++++++--------- 2 files changed, 34 insertions(+), 37 deletions(-) diff --git a/x/gov/types/msgs.go b/x/gov/types/msgs.go index f2c124e5766..3ef1bec4129 100644 --- a/x/gov/types/msgs.go +++ b/x/gov/types/msgs.go @@ -4,7 +4,6 @@ import ( "fmt" "github.com/gogo/protobuf/proto" - "gopkg.in/yaml.v2" types "github.com/cosmos/cosmos-sdk/codec/types" sdk "github.com/cosmos/cosmos-sdk/types" @@ -51,24 +50,24 @@ func NewMsgSubmitProposal(content Content, initialDeposit sdk.Coins, proposer sd return m, nil } -func (msg *MsgSubmitProposal) GetInitialDeposit() sdk.Coins { return msg.InitialDeposit } +func (m *MsgSubmitProposal) GetInitialDeposit() sdk.Coins { return m.InitialDeposit } -func (msg *MsgSubmitProposal) GetProposer() sdk.AccAddress { return msg.Proposer } +func (m *MsgSubmitProposal) GetProposer() sdk.AccAddress { return m.Proposer } -func (msg *MsgSubmitProposal) GetContent() Content { - content, ok := msg.Content.GetCachedValue().(Content) +func (m *MsgSubmitProposal) GetContent() Content { + content, ok := m.Content.GetCachedValue().(Content) if !ok { return nil } return content } -func (msg *MsgSubmitProposal) SetInitialDeposit(coins sdk.Coins) { - msg.InitialDeposit = coins +func (m *MsgSubmitProposal) SetInitialDeposit(coins sdk.Coins) { + m.InitialDeposit = coins } -func (msg *MsgSubmitProposal) SetProposer(address sdk.AccAddress) { - msg.Proposer = address +func (m *MsgSubmitProposal) SetProposer(address sdk.AccAddress) { + m.Proposer = address } func (m *MsgSubmitProposal) SetContent(content Content) error { @@ -85,24 +84,24 @@ func (m *MsgSubmitProposal) SetContent(content Content) error { } // Route implements Msg -func (msg MsgSubmitProposal) Route() string { return RouterKey } +func (m MsgSubmitProposal) Route() string { return RouterKey } // Type implements Msg -func (msg MsgSubmitProposal) Type() string { return TypeMsgSubmitProposal } +func (m MsgSubmitProposal) Type() string { return TypeMsgSubmitProposal } // ValidateBasic implements Msg -func (msg MsgSubmitProposal) ValidateBasic() error { - if msg.Proposer.Empty() { - return sdkerrors.Wrap(sdkerrors.ErrInvalidAddress, msg.Proposer.String()) +func (m MsgSubmitProposal) ValidateBasic() error { + if m.Proposer.Empty() { + return sdkerrors.Wrap(sdkerrors.ErrInvalidAddress, m.Proposer.String()) } - if !msg.InitialDeposit.IsValid() { - return sdkerrors.Wrap(sdkerrors.ErrInvalidCoins, msg.InitialDeposit.String()) + if !m.InitialDeposit.IsValid() { + return sdkerrors.Wrap(sdkerrors.ErrInvalidCoins, m.InitialDeposit.String()) } - if msg.InitialDeposit.IsAnyNegative() { - return sdkerrors.Wrap(sdkerrors.ErrInvalidCoins, msg.InitialDeposit.String()) + if m.InitialDeposit.IsAnyNegative() { + return sdkerrors.Wrap(sdkerrors.ErrInvalidCoins, m.InitialDeposit.String()) } - content := msg.GetContent() + content := m.GetContent() if content == nil { return sdkerrors.Wrap(ErrInvalidProposalContent, "missing content") } @@ -117,19 +116,19 @@ func (msg MsgSubmitProposal) ValidateBasic() error { } // GetSignBytes implements Msg -func (msg MsgSubmitProposal) GetSignBytes() []byte { - bz := ModuleCdc.MustMarshalJSON(msg) +func (m MsgSubmitProposal) GetSignBytes() []byte { + bz := ModuleCdc.MustMarshalJSON(m) return sdk.MustSortJSON(bz) } // GetSigners implements Msg -func (msg MsgSubmitProposal) GetSigners() []sdk.AccAddress { - return []sdk.AccAddress{msg.Proposer} +func (m MsgSubmitProposal) GetSigners() []sdk.AccAddress { + return []sdk.AccAddress{m.Proposer} } // String implements the Stringer interface -func (msg MsgSubmitProposal) String() string { - out, _ := yaml.Marshal(msg) +func (m MsgSubmitProposal) String() string { + out, _ := yaml.Marshal(m) return string(out) } diff --git a/x/gov/types/proposal.go b/x/gov/types/proposal.go index 46179d2f33f..d7310d216cc 100644 --- a/x/gov/types/proposal.go +++ b/x/gov/types/proposal.go @@ -6,8 +6,6 @@ import ( "strings" "time" - "gopkg.in/yaml.v2" - "github.com/gogo/protobuf/proto" "github.com/cosmos/cosmos-sdk/codec/types" @@ -50,41 +48,41 @@ func (p Proposal) String() string { return string(out) } -func (m Proposal) GetContent() Content { - content, ok := m.Content.GetCachedValue().(Content) +func (p Proposal) GetContent() Content { + content, ok := p.Content.GetCachedValue().(Content) if !ok { return nil } return content } -func (m Proposal) ProposalType() string { - content := m.GetContent() +func (p Proposal) ProposalType() string { + content := p.GetContent() if content == nil { return "" } return content.ProposalType() } -func (m Proposal) ProposalRoute() string { - content := m.GetContent() +func (p Proposal) ProposalRoute() string { + content := p.GetContent() if content == nil { return "" } return content.ProposalRoute() } -func (m Proposal) GetTitle() string { - content := m.GetContent() +func (p Proposal) GetTitle() string { + content := p.GetContent() if content == nil { return "" } return content.GetTitle() } -func (m Proposal) UnpackInterfaces(unpacker types.AnyUnpacker) error { +func (p Proposal) UnpackInterfaces(unpacker types.AnyUnpacker) error { var content Content - return unpacker.UnpackAny(m.Content, &content) + return unpacker.UnpackAny(p.Content, &content) } // Proposals is an array of proposal From eab723ebdb8ecd0a4525e16f0c5b8ef29b0bfe6a Mon Sep 17 00:00:00 2001 From: sahith-narahari Date: Tue, 12 May 2020 04:44:02 +0530 Subject: [PATCH 11/42] Fix imports in gov --- x/gov/types/msgs.go | 1 + x/gov/types/proposal.go | 1 + 2 files changed, 2 insertions(+) diff --git a/x/gov/types/msgs.go b/x/gov/types/msgs.go index 3ef1bec4129..1550023e4c7 100644 --- a/x/gov/types/msgs.go +++ b/x/gov/types/msgs.go @@ -2,6 +2,7 @@ package types import ( "fmt" + "gopkg.in/yaml.v2" "github.com/gogo/protobuf/proto" diff --git a/x/gov/types/proposal.go b/x/gov/types/proposal.go index d7310d216cc..32cd22f7e4e 100644 --- a/x/gov/types/proposal.go +++ b/x/gov/types/proposal.go @@ -3,6 +3,7 @@ package types import ( "encoding/json" "fmt" + "gopkg.in/yaml.v2" "strings" "time" From 3777926b19fcce63bb31eb64dc2d1a1606f9133d Mon Sep 17 00:00:00 2001 From: sahith-narahari Date: Tue, 12 May 2020 04:51:20 +0530 Subject: [PATCH 12/42] Sort imports --- x/gov/keeper/keeper.go | 2 +- x/gov/module.go | 2 +- x/gov/simulation/decoder.go | 2 +- x/gov/types/msgs.go | 3 ++- x/gov/types/proposal.go | 3 ++- 5 files changed, 7 insertions(+), 5 deletions(-) diff --git a/x/gov/keeper/keeper.go b/x/gov/keeper/keeper.go index 0b4a7a07acf..b892febfff9 100644 --- a/x/gov/keeper/keeper.go +++ b/x/gov/keeper/keeper.go @@ -2,11 +2,11 @@ package keeper import ( "fmt" - "github.com/cosmos/cosmos-sdk/codec" "time" "github.com/tendermint/tendermint/libs/log" + "github.com/cosmos/cosmos-sdk/codec" sdk "github.com/cosmos/cosmos-sdk/types" authexported "github.com/cosmos/cosmos-sdk/x/auth/exported" "github.com/cosmos/cosmos-sdk/x/gov/types" diff --git a/x/gov/module.go b/x/gov/module.go index b7eb14dfa47..6aaf6e77a51 100644 --- a/x/gov/module.go +++ b/x/gov/module.go @@ -5,7 +5,6 @@ package gov import ( "encoding/json" "fmt" - codectypes "github.com/cosmos/cosmos-sdk/codec/types" "math/rand" "github.com/gorilla/mux" @@ -15,6 +14,7 @@ import ( "github.com/cosmos/cosmos-sdk/client/context" "github.com/cosmos/cosmos-sdk/codec" + codectypes "github.com/cosmos/cosmos-sdk/codec/types" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/types/module" simtypes "github.com/cosmos/cosmos-sdk/types/simulation" diff --git a/x/gov/simulation/decoder.go b/x/gov/simulation/decoder.go index 25eae16ab36..1433761a111 100644 --- a/x/gov/simulation/decoder.go +++ b/x/gov/simulation/decoder.go @@ -4,10 +4,10 @@ import ( "bytes" "encoding/binary" "fmt" - "github.com/cosmos/cosmos-sdk/codec" tmkv "github.com/tendermint/tendermint/libs/kv" + "github.com/cosmos/cosmos-sdk/codec" "github.com/cosmos/cosmos-sdk/x/gov/types" ) diff --git a/x/gov/types/msgs.go b/x/gov/types/msgs.go index 1550023e4c7..859e29342d0 100644 --- a/x/gov/types/msgs.go +++ b/x/gov/types/msgs.go @@ -2,11 +2,12 @@ package types import ( "fmt" + "gopkg.in/yaml.v2" "github.com/gogo/protobuf/proto" - types "github.com/cosmos/cosmos-sdk/codec/types" + "github.com/cosmos/cosmos-sdk/codec/types" sdk "github.com/cosmos/cosmos-sdk/types" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" ) diff --git a/x/gov/types/proposal.go b/x/gov/types/proposal.go index 32cd22f7e4e..a098a87a0d9 100644 --- a/x/gov/types/proposal.go +++ b/x/gov/types/proposal.go @@ -3,10 +3,11 @@ package types import ( "encoding/json" "fmt" - "gopkg.in/yaml.v2" "strings" "time" + "gopkg.in/yaml.v2" + "github.com/gogo/protobuf/proto" "github.com/cosmos/cosmos-sdk/codec/types" From bf056760d4ab4571f4ee19dbcd91d6a5687659a5 Mon Sep 17 00:00:00 2001 From: Aaron Craelius Date: Thu, 14 May 2020 12:59:21 -0400 Subject: [PATCH 13/42] Make amino JSON signing work with Any --- Makefile | 2 +- client/context/context.go | 3 +++ codec/amino_codec.go | 24 +++++++++++++++++++----- codec/types/amino_compat.go | 12 ++++++++---- x/auth/client/cli/broadcast.go | 2 +- x/auth/client/cli/encode.go | 2 +- x/auth/client/cli/tx_multisign.go | 20 ++++++++++++-------- x/auth/client/cli/tx_sign.go | 13 +++++++------ x/auth/client/cli/validate_sigs.go | 10 +++++----- x/auth/client/tx.go | 10 +++++----- x/auth/types/stdsignmsg.go | 13 +++++++++++++ x/auth/types/stdtx.go | 24 ++++++++++++++++++++---- x/gov/types/msgs_test.go | 13 +++++++++++++ 13 files changed, 108 insertions(+), 40 deletions(-) diff --git a/Makefile b/Makefile index e32facd4e14..e060ea27c6b 100644 --- a/Makefile +++ b/Makefile @@ -124,7 +124,7 @@ test-race: @VERSION=$(VERSION) go test -mod=readonly -race $(PACKAGES_NOSIMULATION) test-integration: build-sim - BUILDDIR=$(BUILDDIR) go test -mod=readonly -p 4 -tags=-tags='ledger test_ledger_mock cli_test' -run ^TestCLI `go list ./.../cli/...` + BUILDDIR=$(BUILDDIR) go test -mod=readonly -p 4 -tags='ledger test_ledger_mock cli_test' -run ^TestCLI `go list ./.../cli/...` .PHONY: test test-all test-ledger-mock test-ledger test-unit test-race diff --git a/client/context/context.go b/client/context/context.go index 1e8b91deff9..5daf5d2884d 100644 --- a/client/context/context.go +++ b/client/context/context.go @@ -169,6 +169,9 @@ func (ctx CLIContext) WithMarshaler(m codec.Marshaler) CLIContext { // TODO: Deprecated (remove). func (ctx CLIContext) WithCodec(cdc *codec.Codec) CLIContext { ctx.Codec = cdc + if ctx.Marshaler == nil { + ctx.Marshaler = codec.NewAminoCodec(cdc) + } return ctx } diff --git a/codec/amino_codec.go b/codec/amino_codec.go index 57dfdf4691e..bae5994b811 100644 --- a/codec/amino_codec.go +++ b/codec/amino_codec.go @@ -12,15 +12,17 @@ type AminoCodec struct { amino *Codec } -func NewAminoCodec(amino *Codec) Marshaler { +var _ Marshaler = &AminoCodec{} + +func NewAminoCodec(amino *Codec) *AminoCodec { return &AminoCodec{amino} } -func (ac *AminoCodec) marshalAnys(o ProtoMarshaler) error { +func (ac *AminoCodec) marshalAnys(o interface{}) error { return types.UnpackInterfaces(o, types.AminoPacker{Cdc: ac.amino}) } -func (ac *AminoCodec) unmarshalAnys(o ProtoMarshaler) error { +func (ac *AminoCodec) unmarshalAnys(o interface{}) error { return types.UnpackInterfaces(o, types.AminoUnpacker{Cdc: ac.amino}) } @@ -32,7 +34,7 @@ func (ac *AminoCodec) jsonUnmarshalAnys(o interface{}) error { return types.UnpackInterfaces(o, types.AminoJSONUnpacker{Cdc: ac.amino}) } -func (ac *AminoCodec) MarshalBinaryBare(o ProtoMarshaler) ([]byte, error) { +func (ac *AminoCodec) AminoMarshalBinaryBare(o interface{}) ([]byte, error) { err := ac.marshalAnys(o) if err != nil { return nil, err @@ -40,6 +42,10 @@ func (ac *AminoCodec) MarshalBinaryBare(o ProtoMarshaler) ([]byte, error) { return ac.amino.MarshalBinaryBare(o) } +func (ac *AminoCodec) MarshalBinaryBare(o ProtoMarshaler) ([]byte, error) { + return ac.AminoMarshalBinaryBare(o) +} + func (ac *AminoCodec) MustMarshalBinaryBare(o ProtoMarshaler) []byte { err := ac.marshalAnys(o) if err != nil { @@ -64,7 +70,7 @@ func (ac *AminoCodec) MustMarshalBinaryLengthPrefixed(o ProtoMarshaler) []byte { return ac.amino.MustMarshalBinaryLengthPrefixed(o) } -func (ac *AminoCodec) UnmarshalBinaryBare(bz []byte, ptr ProtoMarshaler) error { +func (ac *AminoCodec) AminoUnmarshalBinaryBare(bz []byte, ptr interface{}) error { err := ac.amino.UnmarshalBinaryBare(bz, ptr) if err != nil { return err @@ -72,6 +78,10 @@ func (ac *AminoCodec) UnmarshalBinaryBare(bz []byte, ptr ProtoMarshaler) error { return ac.unmarshalAnys(ptr) } +func (ac *AminoCodec) UnmarshalBinaryBare(bz []byte, ptr ProtoMarshaler) error { + return ac.AminoUnmarshalBinaryBare(bz, ptr) +} + func (ac *AminoCodec) MustUnmarshalBinaryBare(bz []byte, ptr ProtoMarshaler) { ac.amino.MustUnmarshalBinaryBare(bz, ptr) err := ac.unmarshalAnys(ptr) @@ -131,3 +141,7 @@ func (ac *AminoCodec) MustUnmarshalJSON(bz []byte, ptr interface{}) { func (*AminoCodec) UnpackAny(*types.Any, interface{}) error { return fmt.Errorf("AminoCodec can't handle unpack protobuf Any's") } + +func (ac *AminoCodec) Amino() *Codec { + return ac.amino +} diff --git a/codec/types/amino_compat.go b/codec/types/amino_compat.go index fc2e2689f44..9bb920dbcfc 100644 --- a/codec/types/amino_compat.go +++ b/codec/types/amino_compat.go @@ -4,6 +4,8 @@ import ( "fmt" "reflect" + "github.com/pkg/errors" + "github.com/gogo/protobuf/proto" amino "github.com/tendermint/go-amino" @@ -15,10 +17,12 @@ type aminoCompat struct { err error } +const errorExplaination = ", this is likely because UnpackInterfacesMessage is not defined for some type which contains a protobuf Any either directly or via one of its members" + func (any Any) MarshalAmino() ([]byte, error) { ac := any.aminoCompat if ac == nil { - return nil, fmt.Errorf("can't amino unmarshal %+v", any) + return nil, errors.WithStack(fmt.Errorf("can't amino unmarshal %+v"+errorExplaination, any)) } return ac.bz, ac.err } @@ -34,7 +38,7 @@ func (any *Any) UnmarshalAmino(bz []byte) error { func (any Any) MarshalJSON() ([]byte, error) { ac := any.aminoCompat if ac == nil { - return nil, fmt.Errorf("can't JSON marshal %+v", any) + return nil, errors.WithStack(fmt.Errorf("can't JSON marshal %+v"+errorExplaination, any)) } return ac.jsonBz, ac.err } @@ -58,7 +62,7 @@ var _ AnyUnpacker = AminoUnpacker{} func (a AminoUnpacker) UnpackAny(any *Any, iface interface{}) error { ac := any.aminoCompat if ac == nil { - return fmt.Errorf("can't amino unmarshal %T", iface) + return errors.WithStack(fmt.Errorf("can't amino unmarshal %T"+errorExplaination, iface)) } err := a.Cdc.UnmarshalBinaryBare(ac.bz, iface) if err != nil { @@ -117,7 +121,7 @@ var _ AnyUnpacker = AminoJSONUnpacker{} func (a AminoJSONUnpacker) UnpackAny(any *Any, iface interface{}) error { ac := any.aminoCompat if ac == nil { - return fmt.Errorf("can't amino unmarshal %T", iface) + return errors.WithStack(fmt.Errorf("can't amino unmarshal %T"+errorExplaination, iface)) } err := a.Cdc.UnmarshalJSON(ac.jsonBz, iface) if err != nil { diff --git a/x/auth/client/cli/broadcast.go b/x/auth/client/cli/broadcast.go index f948dbdd9b8..a182375cd12 100644 --- a/x/auth/client/cli/broadcast.go +++ b/x/auth/client/cli/broadcast.go @@ -32,7 +32,7 @@ $ tx broadcast ./mytxn.json return errors.New("cannot broadcast tx during offline mode") } - stdTx, err := client.ReadStdTxFromFile(cliCtx.Codec, args[0]) + stdTx, err := client.ReadStdTxFromFile(cliCtx.Marshaler, args[0]) if err != nil { return err } diff --git a/x/auth/client/cli/encode.go b/x/auth/client/cli/encode.go index 245bb0e0f67..97601060418 100644 --- a/x/auth/client/cli/encode.go +++ b/x/auth/client/cli/encode.go @@ -31,7 +31,7 @@ If you supply a dash (-) argument in place of an input filename, the command rea RunE: func(cmd *cobra.Command, args []string) (err error) { cliCtx := context.NewCLIContext().WithCodec(cdc) - stdTx, err := client.ReadStdTxFromFile(cliCtx.Codec, args[0]) + stdTx, err := client.ReadStdTxFromFile(cliCtx.Marshaler, args[0]) if err != nil { return } diff --git a/x/auth/client/cli/tx_multisign.go b/x/auth/client/cli/tx_multisign.go index 71375da72e0..765c0987d0e 100644 --- a/x/auth/client/cli/tx_multisign.go +++ b/x/auth/client/cli/tx_multisign.go @@ -46,7 +46,7 @@ recommended to set such parameters manually. version.ClientName, ), ), - RunE: makeMultiSignCmd(cdc), + RunE: makeMultiSignCmd(codec.NewAminoCodec(cdc)), Args: cobra.MinimumNArgs(3), } @@ -57,7 +57,7 @@ recommended to set such parameters manually. return flags.PostCommands(cmd)[0] } -func makeMultiSignCmd(cdc *codec.Codec) func(cmd *cobra.Command, args []string) error { +func makeMultiSignCmd(cdc *codec.AminoCodec) func(cmd *cobra.Command, args []string) error { return func(cmd *cobra.Command, args []string) (err error) { stdTx, err := client.ReadStdTxFromFile(cdc, args[0]) if err != nil { @@ -81,7 +81,7 @@ func makeMultiSignCmd(cdc *codec.Codec) func(cmd *cobra.Command, args []string) multisigPub := multisigInfo.GetPubKey().(multisig.PubKeyMultisigThreshold) multisigSig := multisig.NewMultisig(len(multisigPub.PubKeys)) - cliCtx := context.NewCLIContextWithInput(inBuf).WithCodec(cdc) + cliCtx := context.NewCLIContextWithInput(inBuf).WithMarshaler(cdc) txBldr := types.NewTxBuilderFromCLI(inBuf) if !cliCtx.Offline { @@ -113,18 +113,22 @@ func makeMultiSignCmd(cdc *codec.Codec) func(cmd *cobra.Command, args []string) } } - newStdSig := types.StdSignature{Signature: cdc.MustMarshalBinaryBare(multisigSig), PubKey: multisigPub.Bytes()} //nolint:staticcheck - newTx := types.NewStdTx(stdTx.GetMsgs(), stdTx.Fee, []types.StdSignature{newStdSig}, stdTx.GetMemo()) //nolint:staticcheck + bz, err := cdc.AminoMarshalBinaryBare(multisigSig) + if err != nil { + panic(err) + } + newStdSig := types.StdSignature{Signature: bz, PubKey: multisigPub.Bytes()} //nolint:staticcheck + newTx := types.NewStdTx(stdTx.GetMsgs(), stdTx.Fee, []types.StdSignature{newStdSig}, stdTx.GetMemo()) //nolint:staticcheck sigOnly := viper.GetBool(flagSigOnly) var json []byte switch { case sigOnly && cliCtx.Indent: - json, err = cdc.MarshalJSONIndent(newTx.Signatures[0], "", " ") + json, err = codec.MarshalJSONIndent(cdc, newTx.Signatures[0]) case sigOnly && !cliCtx.Indent: json, err = cdc.MarshalJSON(newTx.Signatures[0]) case !sigOnly && cliCtx.Indent: - json, err = cdc.MarshalJSONIndent(newTx, "", " ") + json, err = codec.MarshalJSONIndent(cdc, newTx) default: json, err = cdc.MarshalJSON(newTx) } @@ -151,7 +155,7 @@ func makeMultiSignCmd(cdc *codec.Codec) func(cmd *cobra.Command, args []string) } } -func readAndUnmarshalStdSignature(cdc *codec.Codec, filename string) (stdSig types.StdSignature, err error) { //nolint:staticcheck +func readAndUnmarshalStdSignature(cdc codec.JSONMarshaler, filename string) (stdSig types.StdSignature, err error) { //nolint:staticcheck var bytes []byte if bytes, err = ioutil.ReadFile(filename); err != nil { return diff --git a/x/auth/client/cli/tx_sign.go b/x/auth/client/cli/tx_sign.go index dc118974a61..e35d6f66011 100644 --- a/x/auth/client/cli/tx_sign.go +++ b/x/auth/client/cli/tx_sign.go @@ -22,7 +22,8 @@ const ( ) // GetSignCommand returns the transaction sign command. -func GetSignCommand(codec *codec.Codec) *cobra.Command { +func GetSignCommand(amino *codec.Codec) *cobra.Command { + cdc := codec.NewAminoCodec(amino) cmd := &cobra.Command{ Use: "sign [file]", Short: "Sign transactions generated offline", @@ -42,7 +43,7 @@ key. It implies --signature-only. Full multisig signed transactions may eventual be generated via the 'multisign' command. `, PreRun: preSignCmd, - RunE: makeSignCmd(codec), + RunE: makeSignCmd(cdc), Args: cobra.ExactArgs(1), } @@ -71,7 +72,7 @@ func preSignCmd(cmd *cobra.Command, _ []string) { } } -func makeSignCmd(cdc *codec.Codec) func(cmd *cobra.Command, args []string) error { +func makeSignCmd(cdc *codec.AminoCodec) func(cmd *cobra.Command, args []string) error { return func(cmd *cobra.Command, args []string) error { cliCtx, txBldr, stdTx, err := readStdTxAndInitContexts(cdc, cmd, args[0]) if err != nil { @@ -127,12 +128,12 @@ func makeSignCmd(cdc *codec.Codec) func(cmd *cobra.Command, args []string) error } } -func getSignatureJSON(cdc *codec.Codec, newTx types.StdTx, indent, generateSignatureOnly bool) ([]byte, error) { +func getSignatureJSON(cdc codec.JSONMarshaler, newTx types.StdTx, indent, generateSignatureOnly bool) ([]byte, error) { switch generateSignatureOnly { case true: switch indent { case true: - return cdc.MarshalJSONIndent(newTx.Signatures[0], "", " ") + return codec.MarshalJSONIndent(cdc, newTx.Signatures[0]) default: return cdc.MarshalJSON(newTx.Signatures[0]) @@ -140,7 +141,7 @@ func getSignatureJSON(cdc *codec.Codec, newTx types.StdTx, indent, generateSigna default: switch indent { case true: - return cdc.MarshalJSONIndent(newTx, "", " ") + return codec.MarshalJSONIndent(cdc, newTx) default: return cdc.MarshalJSON(newTx) diff --git a/x/auth/client/cli/validate_sigs.go b/x/auth/client/cli/validate_sigs.go index a7b87d38781..228893d0e4d 100644 --- a/x/auth/client/cli/validate_sigs.go +++ b/x/auth/client/cli/validate_sigs.go @@ -16,7 +16,7 @@ import ( "github.com/cosmos/cosmos-sdk/x/auth/types" ) -func GetValidateSignaturesCommand(codec *codec.Codec) *cobra.Command { +func GetValidateSignaturesCommand(amino *codec.Codec) *cobra.Command { cmd := &cobra.Command{ Use: "validate-signatures [file]", Short: "Validate transactions signatures", @@ -29,14 +29,14 @@ given transaction. If the --offline flag is also set, signature validation over transaction will be not be performed as that will require RPC communication with a full node. `, PreRun: preSignCmd, - RunE: makeValidateSignaturesCmd(codec), + RunE: makeValidateSignaturesCmd(codec.NewAminoCodec(amino)), Args: cobra.ExactArgs(1), } return flags.PostCommands(cmd)[0] } -func makeValidateSignaturesCmd(cdc *codec.Codec) func(cmd *cobra.Command, args []string) error { +func makeValidateSignaturesCmd(cdc *codec.AminoCodec) func(cmd *cobra.Command, args []string) error { return func(cmd *cobra.Command, args []string) error { cliCtx, txBldr, stdTx, err := readStdTxAndInitContexts(cdc, cmd, args[0]) if err != nil { @@ -133,7 +133,7 @@ func printAndValidateSigs( return success } -func readStdTxAndInitContexts(cdc *codec.Codec, cmd *cobra.Command, filename string) ( +func readStdTxAndInitContexts(cdc *codec.AminoCodec, cmd *cobra.Command, filename string) ( context.CLIContext, types.TxBuilder, types.StdTx, error, ) { stdTx, err := client.ReadStdTxFromFile(cdc, filename) @@ -142,7 +142,7 @@ func readStdTxAndInitContexts(cdc *codec.Codec, cmd *cobra.Command, filename str } inBuf := bufio.NewReader(cmd.InOrStdin()) - cliCtx := context.NewCLIContextWithInput(inBuf).WithCodec(cdc) + cliCtx := context.NewCLIContextWithInput(inBuf).WithCodec(cdc.Amino()).WithMarshaler(cdc) txBldr := types.NewTxBuilderFromCLI(inBuf) return cliCtx, txBldr, stdTx, nil diff --git a/x/auth/client/tx.go b/x/auth/client/tx.go index c06acf7367a..efc37d1c264 100644 --- a/x/auth/client/tx.go +++ b/x/auth/client/tx.go @@ -87,12 +87,12 @@ func CompleteAndBroadcastTxCLI(txBldr authtypes.TxBuilder, cliCtx context.CLICon var json []byte if viper.GetBool(flags.FlagIndentResponse) { - json, err = cliCtx.Codec.MarshalJSONIndent(stdSignMsg, "", " ") + json, err = codec.MarshalJSONIndent(cliCtx.Marshaler, stdSignMsg) if err != nil { panic(err) } } else { - json = cliCtx.Codec.MustMarshalJSON(stdSignMsg) + json = cliCtx.Marshaler.MustMarshalJSON(stdSignMsg) } _, _ = fmt.Fprintf(os.Stderr, "%s\n\n", json) @@ -163,9 +163,9 @@ func PrintUnsignedStdTx(txBldr authtypes.TxBuilder, cliCtx context.CLIContext, m var json []byte if viper.GetBool(flags.FlagIndentResponse) { - json, err = cliCtx.Codec.MarshalJSONIndent(stdTx, "", " ") + json, err = codec.MarshalJSONIndent(cliCtx.Marshaler, stdTx) } else { - json, err = cliCtx.Codec.MarshalJSON(stdTx) + json, err = cliCtx.Marshaler.MarshalJSON(stdTx) } if err != nil { return err @@ -231,7 +231,7 @@ func SignStdTxWithSignerAddress( } // Read and decode a StdTx from the given filename. Can pass "-" to read from stdin. -func ReadStdTxFromFile(cdc *codec.Codec, filename string) (stdTx authtypes.StdTx, err error) { +func ReadStdTxFromFile(cdc codec.Marshaler, filename string) (stdTx authtypes.StdTx, err error) { var bytes []byte if filename == "-" { diff --git a/x/auth/types/stdsignmsg.go b/x/auth/types/stdsignmsg.go index e018dac4004..8576b0de705 100644 --- a/x/auth/types/stdsignmsg.go +++ b/x/auth/types/stdsignmsg.go @@ -1,6 +1,7 @@ package types import ( + "github.com/cosmos/cosmos-sdk/codec/types" sdk "github.com/cosmos/cosmos-sdk/types" ) @@ -20,3 +21,15 @@ type StdSignMsg struct { func (msg StdSignMsg) Bytes() []byte { return StdSignBytes(msg.ChainID, msg.AccountNumber, msg.Sequence, msg.Fee, msg.Msgs, msg.Memo) } + +var _ types.UnpackInterfacesMessage = StdSignMsg{} + +func (msg StdSignMsg) UnpackInterfaces(unpacker types.AnyUnpacker) error { + for _, m := range msg.Msgs { + err := types.UnpackInterfaces(m, unpacker) + if err != nil { + return err + } + } + return nil +} diff --git a/x/auth/types/stdtx.go b/x/auth/types/stdtx.go index 16d7f319408..82893d8a55e 100644 --- a/x/auth/types/stdtx.go +++ b/x/auth/types/stdtx.go @@ -4,6 +4,8 @@ import ( "encoding/json" "fmt" + "github.com/cosmos/cosmos-sdk/codec/types" + "github.com/tendermint/tendermint/crypto" "github.com/tendermint/tendermint/crypto/multisig" yaml "gopkg.in/yaml.v2" @@ -318,7 +320,8 @@ type StdSignature struct { } // DefaultTxDecoder logic for standard transaction decoding -func DefaultTxDecoder(cdc *codec.Codec) sdk.TxDecoder { +func DefaultTxDecoder(amino *codec.Codec) sdk.TxDecoder { + cdc := codec.NewAminoCodec(amino) return func(txBytes []byte) (sdk.Tx, error) { var tx = StdTx{} @@ -328,7 +331,7 @@ func DefaultTxDecoder(cdc *codec.Codec) sdk.TxDecoder { // StdTx.Msg is an interface. The concrete types // are registered by MakeTxCodec - err := cdc.UnmarshalBinaryBare(txBytes, &tx) + err := cdc.AminoUnmarshalBinaryBare(txBytes, &tx) if err != nil { return nil, sdkerrors.Wrap(sdkerrors.ErrTxDecode, err.Error()) } @@ -338,8 +341,21 @@ func DefaultTxDecoder(cdc *codec.Codec) sdk.TxDecoder { } // DefaultTxEncoder logic for standard transaction encoding -func DefaultTxEncoder(cdc *codec.Codec) sdk.TxEncoder { +func DefaultTxEncoder(amino *codec.Codec) sdk.TxEncoder { + cdc := codec.NewAminoCodec(amino) return func(tx sdk.Tx) ([]byte, error) { - return cdc.MarshalBinaryBare(tx) + return cdc.AminoMarshalBinaryBare(tx) + } +} + +var _ types.UnpackInterfacesMessage = StdTx{} + +func (tx StdTx) UnpackInterfaces(unpacker types.AnyUnpacker) error { + for _, m := range tx.Msgs { + err := types.UnpackInterfaces(m, unpacker) + if err != nil { + return err + } } + return nil } diff --git a/x/gov/types/msgs_test.go b/x/gov/types/msgs_test.go index 49e51b13eb8..9d7d6a36828 100644 --- a/x/gov/types/msgs_test.go +++ b/x/gov/types/msgs_test.go @@ -117,3 +117,16 @@ func TestMsgVote(t *testing.T) { } } } + +// this tests that Amino JSON MsgSubmitProposal.GetSignBytes() still works with Content as Any using the ModuleCdc +func TestMsgSubmitProposal_GetSignBytes(t *testing.T) { + msg, err := NewMsgSubmitProposal(NewTextProposal("test", "abcd"), sdk.NewCoins(), sdk.AccAddress{}) + require.NoError(t, err) + var bz []byte + require.NotPanics(t, func() { + bz = msg.GetSignBytes() + }) + require.Equal(t, + `{"type":"cosmos-sdk/MsgSubmitProposal","value":{"content":{"type":"cosmos-sdk/TextProposal","value":{"description":"abcd","title":"test"}},"initial_deposit":[]}}`, + string(bz)) +} From 519e1b9920cc7cf0dfd4e67b1551b69cf85600d9 Mon Sep 17 00:00:00 2001 From: Aaron Craelius Date: Thu, 14 May 2020 13:46:25 -0400 Subject: [PATCH 14/42] Run proto-gen --- std/codec.pb.go | 2154 +++++++++-------------------------------------- 1 file changed, 391 insertions(+), 1763 deletions(-) diff --git a/std/codec.pb.go b/std/codec.pb.go index ba55855d94d..4b5f1c09329 100644 --- a/std/codec.pb.go +++ b/std/codec.pb.go @@ -6,19 +6,16 @@ package std import ( fmt "fmt" github_com_cosmos_cosmos_sdk_types "github.com/cosmos/cosmos-sdk/types" - types9 "github.com/cosmos/cosmos-sdk/types" + types8 "github.com/cosmos/cosmos-sdk/types" github_com_cosmos_cosmos_sdk_x_auth_exported "github.com/cosmos/cosmos-sdk/x/auth/exported" types "github.com/cosmos/cosmos-sdk/x/auth/types" types1 "github.com/cosmos/cosmos-sdk/x/auth/vesting/types" - types5 "github.com/cosmos/cosmos-sdk/x/bank/types" - types6 "github.com/cosmos/cosmos-sdk/x/crisis/types" + types2 "github.com/cosmos/cosmos-sdk/x/bank/types" + types3 "github.com/cosmos/cosmos-sdk/x/crisis/types" types4 "github.com/cosmos/cosmos-sdk/x/distribution/types" - github_com_cosmos_cosmos_sdk_x_gov_types "github.com/cosmos/cosmos-sdk/x/gov/types" - types2 "github.com/cosmos/cosmos-sdk/x/gov/types" - proposal "github.com/cosmos/cosmos-sdk/x/params/types/proposal" - types7 "github.com/cosmos/cosmos-sdk/x/slashing/types" - types8 "github.com/cosmos/cosmos-sdk/x/staking/types" - types3 "github.com/cosmos/cosmos-sdk/x/upgrade/types" + types5 "github.com/cosmos/cosmos-sdk/x/gov/types" + types6 "github.com/cosmos/cosmos-sdk/x/slashing/types" + types7 "github.com/cosmos/cosmos-sdk/x/staking/types" _ "github.com/gogo/protobuf/gogoproto" proto "github.com/gogo/protobuf/proto" _ "github.com/regen-network/cosmos-proto" @@ -165,223 +162,6 @@ func (*Account) XXX_OneofWrappers() []interface{} { } } -// MsgSubmitProposal defines the application-level message type for handling -// governance proposals. -type MsgSubmitProposal struct { - types2.MsgSubmitProposalBase `protobuf:"bytes,1,opt,name=base,proto3,embedded=base" json:"base"` - Content *Content `protobuf:"bytes,2,opt,name=content,proto3" json:"content,omitempty"` -} - -func (m *MsgSubmitProposal) Reset() { *m = MsgSubmitProposal{} } -func (m *MsgSubmitProposal) String() string { return proto.CompactTextString(m) } -func (*MsgSubmitProposal) ProtoMessage() {} -func (*MsgSubmitProposal) Descriptor() ([]byte, []int) { - return fileDescriptor_ff851c3a98ef46f7, []int{1} -} -func (m *MsgSubmitProposal) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *MsgSubmitProposal) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_MsgSubmitProposal.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *MsgSubmitProposal) XXX_Merge(src proto.Message) { - xxx_messageInfo_MsgSubmitProposal.Merge(m, src) -} -func (m *MsgSubmitProposal) XXX_Size() int { - return m.Size() -} -func (m *MsgSubmitProposal) XXX_DiscardUnknown() { - xxx_messageInfo_MsgSubmitProposal.DiscardUnknown(m) -} - -var xxx_messageInfo_MsgSubmitProposal proto.InternalMessageInfo - -// Proposal defines the application-level concrete proposal type used in -// governance proposals. -type Proposal struct { - types2.ProposalBase `protobuf:"bytes,1,opt,name=base,proto3,embedded=base" json:"base"` - Content Content `protobuf:"bytes,2,opt,name=content,proto3" json:"content"` -} - -func (m *Proposal) Reset() { *m = Proposal{} } -func (m *Proposal) String() string { return proto.CompactTextString(m) } -func (*Proposal) ProtoMessage() {} -func (*Proposal) Descriptor() ([]byte, []int) { - return fileDescriptor_ff851c3a98ef46f7, []int{2} -} -func (m *Proposal) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *Proposal) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_Proposal.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *Proposal) XXX_Merge(src proto.Message) { - xxx_messageInfo_Proposal.Merge(m, src) -} -func (m *Proposal) XXX_Size() int { - return m.Size() -} -func (m *Proposal) XXX_DiscardUnknown() { - xxx_messageInfo_Proposal.DiscardUnknown(m) -} - -var xxx_messageInfo_Proposal proto.InternalMessageInfo - -func (m *Proposal) GetContent() Content { - if m != nil { - return m.Content - } - return Content{} -} - -// Content defines the application-level allowed Content to be included in a -// governance proposal. -type Content struct { - // sum defines a set of all acceptable concrete governance proposal Content - // types. - // - // Types that are valid to be assigned to Sum: - // *Content_Text - // *Content_ParameterChange - // *Content_SoftwareUpgrade - // *Content_CancelSoftwareUpgrade - // *Content_CommunityPoolSpend - Sum isContent_Sum `protobuf_oneof:"sum"` -} - -func (m *Content) Reset() { *m = Content{} } -func (m *Content) String() string { return proto.CompactTextString(m) } -func (*Content) ProtoMessage() {} -func (*Content) Descriptor() ([]byte, []int) { - return fileDescriptor_ff851c3a98ef46f7, []int{3} -} -func (m *Content) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *Content) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_Content.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *Content) XXX_Merge(src proto.Message) { - xxx_messageInfo_Content.Merge(m, src) -} -func (m *Content) XXX_Size() int { - return m.Size() -} -func (m *Content) XXX_DiscardUnknown() { - xxx_messageInfo_Content.DiscardUnknown(m) -} - -var xxx_messageInfo_Content proto.InternalMessageInfo - -type isContent_Sum interface { - isContent_Sum() - Equal(interface{}) bool - MarshalTo([]byte) (int, error) - Size() int -} - -type Content_Text struct { - Text *types2.TextProposal `protobuf:"bytes,1,opt,name=text,proto3,oneof" json:"text,omitempty"` -} -type Content_ParameterChange struct { - ParameterChange *proposal.ParameterChangeProposal `protobuf:"bytes,2,opt,name=parameter_change,json=parameterChange,proto3,oneof" json:"parameter_change,omitempty"` -} -type Content_SoftwareUpgrade struct { - SoftwareUpgrade *types3.SoftwareUpgradeProposal `protobuf:"bytes,3,opt,name=software_upgrade,json=softwareUpgrade,proto3,oneof" json:"software_upgrade,omitempty"` -} -type Content_CancelSoftwareUpgrade struct { - CancelSoftwareUpgrade *types3.CancelSoftwareUpgradeProposal `protobuf:"bytes,4,opt,name=cancel_software_upgrade,json=cancelSoftwareUpgrade,proto3,oneof" json:"cancel_software_upgrade,omitempty"` -} -type Content_CommunityPoolSpend struct { - CommunityPoolSpend *types4.CommunityPoolSpendProposal `protobuf:"bytes,5,opt,name=community_pool_spend,json=communityPoolSpend,proto3,oneof" json:"community_pool_spend,omitempty"` -} - -func (*Content_Text) isContent_Sum() {} -func (*Content_ParameterChange) isContent_Sum() {} -func (*Content_SoftwareUpgrade) isContent_Sum() {} -func (*Content_CancelSoftwareUpgrade) isContent_Sum() {} -func (*Content_CommunityPoolSpend) isContent_Sum() {} - -func (m *Content) GetSum() isContent_Sum { - if m != nil { - return m.Sum - } - return nil -} - -func (m *Content) GetText() *types2.TextProposal { - if x, ok := m.GetSum().(*Content_Text); ok { - return x.Text - } - return nil -} - -func (m *Content) GetParameterChange() *proposal.ParameterChangeProposal { - if x, ok := m.GetSum().(*Content_ParameterChange); ok { - return x.ParameterChange - } - return nil -} - -func (m *Content) GetSoftwareUpgrade() *types3.SoftwareUpgradeProposal { - if x, ok := m.GetSum().(*Content_SoftwareUpgrade); ok { - return x.SoftwareUpgrade - } - return nil -} - -func (m *Content) GetCancelSoftwareUpgrade() *types3.CancelSoftwareUpgradeProposal { - if x, ok := m.GetSum().(*Content_CancelSoftwareUpgrade); ok { - return x.CancelSoftwareUpgrade - } - return nil -} - -func (m *Content) GetCommunityPoolSpend() *types4.CommunityPoolSpendProposal { - if x, ok := m.GetSum().(*Content_CommunityPoolSpend); ok { - return x.CommunityPoolSpend - } - return nil -} - -// XXX_OneofWrappers is for the internal use of the proto package. -func (*Content) XXX_OneofWrappers() []interface{} { - return []interface{}{ - (*Content_Text)(nil), - (*Content_ParameterChange)(nil), - (*Content_SoftwareUpgrade)(nil), - (*Content_CancelSoftwareUpgrade)(nil), - (*Content_CommunityPoolSpend)(nil), - } -} - // Transaction defines the application-level transaction that can be signed and // processed by the state-machine. It contains a base of common fields and // repeated set of Message types. @@ -394,7 +174,7 @@ func (m *Transaction) Reset() { *m = Transaction{} } func (m *Transaction) String() string { return proto.CompactTextString(m) } func (*Transaction) ProtoMessage() {} func (*Transaction) Descriptor() ([]byte, []int) { - return fileDescriptor_ff851c3a98ef46f7, []int{4} + return fileDescriptor_ff851c3a98ef46f7, []int{1} } func (m *Transaction) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -436,7 +216,6 @@ type Message struct { // *Message_MsgWithdrawDelegatorReward // *Message_MsgWithdrawValidatorCommission // *Message_MsgFundCommunityPool - // *Message_MsgSubmitProposal // *Message_MsgVote // *Message_MsgDeposit // *Message_MsgUnjail @@ -452,7 +231,7 @@ func (m *Message) Reset() { *m = Message{} } func (m *Message) String() string { return proto.CompactTextString(m) } func (*Message) ProtoMessage() {} func (*Message) Descriptor() ([]byte, []int) { - return fileDescriptor_ff851c3a98ef46f7, []int{5} + return fileDescriptor_ff851c3a98ef46f7, []int{2} } func (m *Message) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -488,13 +267,13 @@ type isMessage_Sum interface { } type Message_MsgSend struct { - MsgSend *types5.MsgSend `protobuf:"bytes,1,opt,name=msg_send,json=msgSend,proto3,oneof" json:"msg_send,omitempty"` + MsgSend *types2.MsgSend `protobuf:"bytes,1,opt,name=msg_send,json=msgSend,proto3,oneof" json:"msg_send,omitempty"` } type Message_MsgMultiSend struct { - MsgMultiSend *types5.MsgMultiSend `protobuf:"bytes,2,opt,name=msg_multi_send,json=msgMultiSend,proto3,oneof" json:"msg_multi_send,omitempty"` + MsgMultiSend *types2.MsgMultiSend `protobuf:"bytes,2,opt,name=msg_multi_send,json=msgMultiSend,proto3,oneof" json:"msg_multi_send,omitempty"` } type Message_MsgVerifyInvariant struct { - MsgVerifyInvariant *types6.MsgVerifyInvariant `protobuf:"bytes,3,opt,name=msg_verify_invariant,json=msgVerifyInvariant,proto3,oneof" json:"msg_verify_invariant,omitempty"` + MsgVerifyInvariant *types3.MsgVerifyInvariant `protobuf:"bytes,3,opt,name=msg_verify_invariant,json=msgVerifyInvariant,proto3,oneof" json:"msg_verify_invariant,omitempty"` } type Message_MsgSetWithdrawAddress struct { MsgSetWithdrawAddress *types4.MsgSetWithdrawAddress `protobuf:"bytes,4,opt,name=msg_set_withdraw_address,json=msgSetWithdrawAddress,proto3,oneof" json:"msg_set_withdraw_address,omitempty"` @@ -508,32 +287,29 @@ type Message_MsgWithdrawValidatorCommission struct { type Message_MsgFundCommunityPool struct { MsgFundCommunityPool *types4.MsgFundCommunityPool `protobuf:"bytes,7,opt,name=msg_fund_community_pool,json=msgFundCommunityPool,proto3,oneof" json:"msg_fund_community_pool,omitempty"` } -type Message_MsgSubmitProposal struct { - MsgSubmitProposal *MsgSubmitProposal `protobuf:"bytes,9,opt,name=msg_submit_proposal,json=msgSubmitProposal,proto3,oneof" json:"msg_submit_proposal,omitempty"` -} type Message_MsgVote struct { - MsgVote *types2.MsgVote `protobuf:"bytes,10,opt,name=msg_vote,json=msgVote,proto3,oneof" json:"msg_vote,omitempty"` + MsgVote *types5.MsgVote `protobuf:"bytes,10,opt,name=msg_vote,json=msgVote,proto3,oneof" json:"msg_vote,omitempty"` } type Message_MsgDeposit struct { - MsgDeposit *types2.MsgDeposit `protobuf:"bytes,11,opt,name=msg_deposit,json=msgDeposit,proto3,oneof" json:"msg_deposit,omitempty"` + MsgDeposit *types5.MsgDeposit `protobuf:"bytes,11,opt,name=msg_deposit,json=msgDeposit,proto3,oneof" json:"msg_deposit,omitempty"` } type Message_MsgUnjail struct { - MsgUnjail *types7.MsgUnjail `protobuf:"bytes,12,opt,name=msg_unjail,json=msgUnjail,proto3,oneof" json:"msg_unjail,omitempty"` + MsgUnjail *types6.MsgUnjail `protobuf:"bytes,12,opt,name=msg_unjail,json=msgUnjail,proto3,oneof" json:"msg_unjail,omitempty"` } type Message_MsgCreateValidator struct { - MsgCreateValidator *types8.MsgCreateValidator `protobuf:"bytes,13,opt,name=msg_create_validator,json=msgCreateValidator,proto3,oneof" json:"msg_create_validator,omitempty"` + MsgCreateValidator *types7.MsgCreateValidator `protobuf:"bytes,13,opt,name=msg_create_validator,json=msgCreateValidator,proto3,oneof" json:"msg_create_validator,omitempty"` } type Message_MsgEditValidator struct { - MsgEditValidator *types8.MsgEditValidator `protobuf:"bytes,14,opt,name=msg_edit_validator,json=msgEditValidator,proto3,oneof" json:"msg_edit_validator,omitempty"` + MsgEditValidator *types7.MsgEditValidator `protobuf:"bytes,14,opt,name=msg_edit_validator,json=msgEditValidator,proto3,oneof" json:"msg_edit_validator,omitempty"` } type Message_MsgDelegate struct { - MsgDelegate *types8.MsgDelegate `protobuf:"bytes,15,opt,name=msg_delegate,json=msgDelegate,proto3,oneof" json:"msg_delegate,omitempty"` + MsgDelegate *types7.MsgDelegate `protobuf:"bytes,15,opt,name=msg_delegate,json=msgDelegate,proto3,oneof" json:"msg_delegate,omitempty"` } type Message_MsgBeginRedelegate struct { - MsgBeginRedelegate *types8.MsgBeginRedelegate `protobuf:"bytes,16,opt,name=msg_begin_redelegate,json=msgBeginRedelegate,proto3,oneof" json:"msg_begin_redelegate,omitempty"` + MsgBeginRedelegate *types7.MsgBeginRedelegate `protobuf:"bytes,16,opt,name=msg_begin_redelegate,json=msgBeginRedelegate,proto3,oneof" json:"msg_begin_redelegate,omitempty"` } type Message_MsgUndelegate struct { - MsgUndelegate *types8.MsgUndelegate `protobuf:"bytes,17,opt,name=msg_undelegate,json=msgUndelegate,proto3,oneof" json:"msg_undelegate,omitempty"` + MsgUndelegate *types7.MsgUndelegate `protobuf:"bytes,17,opt,name=msg_undelegate,json=msgUndelegate,proto3,oneof" json:"msg_undelegate,omitempty"` } func (*Message_MsgSend) isMessage_Sum() {} @@ -543,7 +319,6 @@ func (*Message_MsgSetWithdrawAddress) isMessage_Sum() {} func (*Message_MsgWithdrawDelegatorReward) isMessage_Sum() {} func (*Message_MsgWithdrawValidatorCommission) isMessage_Sum() {} func (*Message_MsgFundCommunityPool) isMessage_Sum() {} -func (*Message_MsgSubmitProposal) isMessage_Sum() {} func (*Message_MsgVote) isMessage_Sum() {} func (*Message_MsgDeposit) isMessage_Sum() {} func (*Message_MsgUnjail) isMessage_Sum() {} @@ -560,21 +335,21 @@ func (m *Message) GetSum() isMessage_Sum { return nil } -func (m *Message) GetMsgSend() *types5.MsgSend { +func (m *Message) GetMsgSend() *types2.MsgSend { if x, ok := m.GetSum().(*Message_MsgSend); ok { return x.MsgSend } return nil } -func (m *Message) GetMsgMultiSend() *types5.MsgMultiSend { +func (m *Message) GetMsgMultiSend() *types2.MsgMultiSend { if x, ok := m.GetSum().(*Message_MsgMultiSend); ok { return x.MsgMultiSend } return nil } -func (m *Message) GetMsgVerifyInvariant() *types6.MsgVerifyInvariant { +func (m *Message) GetMsgVerifyInvariant() *types3.MsgVerifyInvariant { if x, ok := m.GetSum().(*Message_MsgVerifyInvariant); ok { return x.MsgVerifyInvariant } @@ -609,63 +384,56 @@ func (m *Message) GetMsgFundCommunityPool() *types4.MsgFundCommunityPool { return nil } -func (m *Message) GetMsgSubmitProposal() *MsgSubmitProposal { - if x, ok := m.GetSum().(*Message_MsgSubmitProposal); ok { - return x.MsgSubmitProposal - } - return nil -} - -func (m *Message) GetMsgVote() *types2.MsgVote { +func (m *Message) GetMsgVote() *types5.MsgVote { if x, ok := m.GetSum().(*Message_MsgVote); ok { return x.MsgVote } return nil } -func (m *Message) GetMsgDeposit() *types2.MsgDeposit { +func (m *Message) GetMsgDeposit() *types5.MsgDeposit { if x, ok := m.GetSum().(*Message_MsgDeposit); ok { return x.MsgDeposit } return nil } -func (m *Message) GetMsgUnjail() *types7.MsgUnjail { +func (m *Message) GetMsgUnjail() *types6.MsgUnjail { if x, ok := m.GetSum().(*Message_MsgUnjail); ok { return x.MsgUnjail } return nil } -func (m *Message) GetMsgCreateValidator() *types8.MsgCreateValidator { +func (m *Message) GetMsgCreateValidator() *types7.MsgCreateValidator { if x, ok := m.GetSum().(*Message_MsgCreateValidator); ok { return x.MsgCreateValidator } return nil } -func (m *Message) GetMsgEditValidator() *types8.MsgEditValidator { +func (m *Message) GetMsgEditValidator() *types7.MsgEditValidator { if x, ok := m.GetSum().(*Message_MsgEditValidator); ok { return x.MsgEditValidator } return nil } -func (m *Message) GetMsgDelegate() *types8.MsgDelegate { +func (m *Message) GetMsgDelegate() *types7.MsgDelegate { if x, ok := m.GetSum().(*Message_MsgDelegate); ok { return x.MsgDelegate } return nil } -func (m *Message) GetMsgBeginRedelegate() *types8.MsgBeginRedelegate { +func (m *Message) GetMsgBeginRedelegate() *types7.MsgBeginRedelegate { if x, ok := m.GetSum().(*Message_MsgBeginRedelegate); ok { return x.MsgBeginRedelegate } return nil } -func (m *Message) GetMsgUndelegate() *types8.MsgUndelegate { +func (m *Message) GetMsgUndelegate() *types7.MsgUndelegate { if x, ok := m.GetSum().(*Message_MsgUndelegate); ok { return x.MsgUndelegate } @@ -682,7 +450,6 @@ func (*Message) XXX_OneofWrappers() []interface{} { (*Message_MsgWithdrawDelegatorReward)(nil), (*Message_MsgWithdrawValidatorCommission)(nil), (*Message_MsgFundCommunityPool)(nil), - (*Message_MsgSubmitProposal)(nil), (*Message_MsgVote)(nil), (*Message_MsgDeposit)(nil), (*Message_MsgUnjail)(nil), @@ -705,7 +472,7 @@ func (m *SignDoc) Reset() { *m = SignDoc{} } func (m *SignDoc) String() string { return proto.CompactTextString(m) } func (*SignDoc) ProtoMessage() {} func (*SignDoc) Descriptor() ([]byte, []int) { - return fileDescriptor_ff851c3a98ef46f7, []int{6} + return fileDescriptor_ff851c3a98ef46f7, []int{3} } func (m *SignDoc) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -753,7 +520,7 @@ func (m *StdFee) Reset() { *m = StdFee{} } func (m *StdFee) String() string { return proto.CompactTextString(m) } func (*StdFee) ProtoMessage() {} func (*StdFee) Descriptor() ([]byte, []int) { - return fileDescriptor_ff851c3a98ef46f7, []int{7} + return fileDescriptor_ff851c3a98ef46f7, []int{4} } func (m *StdFee) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -793,7 +560,7 @@ func (m *StdSignature) Reset() { *m = StdSignature{} } func (m *StdSignature) String() string { return proto.CompactTextString(m) } func (*StdSignature) ProtoMessage() {} func (*StdSignature) Descriptor() ([]byte, []int) { - return fileDescriptor_ff851c3a98ef46f7, []int{8} + return fileDescriptor_ff851c3a98ef46f7, []int{5} } func (m *StdSignature) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -834,7 +601,7 @@ func (m *StdTxBase) Reset() { *m = StdTxBase{} } func (m *StdTxBase) String() string { return proto.CompactTextString(m) } func (*StdTxBase) ProtoMessage() {} func (*StdTxBase) Descriptor() ([]byte, []int) { - return fileDescriptor_ff851c3a98ef46f7, []int{9} + return fileDescriptor_ff851c3a98ef46f7, []int{6} } func (m *StdTxBase) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -898,7 +665,7 @@ func (m *StdSignDocBase) Reset() { *m = StdSignDocBase{} } func (m *StdSignDocBase) String() string { return proto.CompactTextString(m) } func (*StdSignDocBase) ProtoMessage() {} func (*StdSignDocBase) Descriptor() ([]byte, []int) { - return fileDescriptor_ff851c3a98ef46f7, []int{10} + return fileDescriptor_ff851c3a98ef46f7, []int{7} } func (m *StdSignDocBase) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -964,9 +731,6 @@ func (m *StdSignDocBase) GetFee() StdFee { func init() { proto.RegisterType((*Account)(nil), "cosmos_sdk.std.v1.Account") - proto.RegisterType((*MsgSubmitProposal)(nil), "cosmos_sdk.std.v1.MsgSubmitProposal") - proto.RegisterType((*Proposal)(nil), "cosmos_sdk.std.v1.Proposal") - proto.RegisterType((*Content)(nil), "cosmos_sdk.std.v1.Content") proto.RegisterType((*Transaction)(nil), "cosmos_sdk.std.v1.Transaction") proto.RegisterType((*Message)(nil), "cosmos_sdk.std.v1.Message") proto.RegisterType((*SignDoc)(nil), "cosmos_sdk.std.v1.SignDoc") @@ -979,117 +743,100 @@ func init() { func init() { proto.RegisterFile("std/codec.proto", fileDescriptor_ff851c3a98ef46f7) } var fileDescriptor_ff851c3a98ef46f7 = []byte{ - // 1600 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x57, 0xcd, 0x6f, 0x1b, 0xc7, - 0x15, 0x27, 0x2d, 0x5a, 0x94, 0x46, 0xd4, 0xd7, 0xd8, 0xae, 0x68, 0xd5, 0x26, 0x65, 0xba, 0x30, - 0x5c, 0xbb, 0x22, 0x2d, 0xdb, 0xfd, 0x30, 0x51, 0xb4, 0x35, 0x25, 0x0b, 0x54, 0x5b, 0xb5, 0xc6, - 0xca, 0x56, 0xd1, 0xa2, 0xed, 0x62, 0xb8, 0x3b, 0x5a, 0x4d, 0xc5, 0xd9, 0xd9, 0xee, 0xcc, 0x52, - 0x64, 0x81, 0x9e, 0x92, 0x43, 0x7c, 0x08, 0x90, 0x6b, 0x0e, 0x01, 0x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34, 0x33, 0x46, 0x89, 0x4e, - 0xb4, 0x80, 0x47, 0x60, 0x45, 0x86, 0x72, 0x10, 0xb8, 0xb6, 0x39, 0x38, 0xb3, 0xc5, 0xbc, 0x0a, - 0xe0, 0xee, 0x7b, 0x03, 0xd8, 0x0e, 0x5c, 0x7b, 0x60, 0x68, 0x9b, 0x19, 0x43, 0xf6, 0xcb, 0x88, - 0x1c, 0xee, 0x83, 0x0b, 0xaa, 0xce, 0x6a, 0x0b, 0x99, 0xd1, 0xc3, 0xa9, 0x38, 0xab, 0x1c, 0xfd, - 0x2c, 0x6d, 0x4c, 0x86, 0x57, 0x56, 0x33, 0x63, 0x2c, 0xd3, 0x91, 0xed, 0xf7, 0x20, 0x9c, 0x93, - 0x0e, 0x13, 0xb8, 0x08, 0x46, 0x67, 0x36, 0xb9, 0x01, 0xf7, 0x99, 0xc0, 0x7a, 0x4c, 0xe4, 0x27, - 0x6c, 0x80, 0x39, 0x09, 0xb5, 0xb1, 0xc7, 0x38, 0x11, 0xc5, 0x39, 0x85, 0x2e, 0x8f, 0x43, 0x6f, - 0x85, 0x66, 0xcd, 0x8c, 0x01, 0x68, 0x7c, 0x82, 0x5b, 0x40, 0x9e, 0xcc, 0xc0, 0xfd, 0x0f, 0x22, - 0xed, 0x62, 0x21, 0xed, 0x79, 0x10, 0x3d, 0x36, 0x35, 0xcf, 0x53, 0x65, 0xda, 0xcc, 0x18, 0xb3, - 0x34, 0x3a, 0x40, 0x33, 0x1c, 0x32, 0xcb, 0xc7, 0x48, 0xe0, 0x7e, 0x4b, 0x14, 0xe7, 0x15, 0xdf, - 0xed, 0x21, 0xbe, 0xf0, 0x79, 0xaa, 0xe9, 0x36, 0x15, 0x26, 0x2e, 0xaf, 0x9e, 0xb2, 0x21, 0x29, - 0xfc, 0x3b, 0x90, 0x52, 0x13, 0xdb, 0x44, 0x24, 0xe8, 0x17, 0x14, 0xfd, 0xcf, 0x27, 0xd1, 0x3f, - 0xb2, 0x89, 0x48, 0x92, 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- 0x39, 0x8e, 0x3f, 0xd7, 0x8f, 0x3f, 0xca, 0xe6, 0xf9, 0xb3, 0x67, 0xb3, 0x51, 0x7f, 0x79, 0x5a, - 0xca, 0xbe, 0x3e, 0x2d, 0x65, 0xbf, 0x39, 0x2d, 0x65, 0x3f, 0x79, 0x53, 0xca, 0xbc, 0x7e, 0x53, - 0xca, 0x7c, 0xf5, 0xa6, 0x94, 0xf9, 0xc7, 0xda, 0xc4, 0x96, 0xe3, 0xc2, 0x6e, 0x4d, 0xab, 0x7f, - 0xae, 0xef, 0x7d, 0x1f, 0x00, 0x00, 0xff, 0xff, 0x62, 0xc1, 0x70, 0xf7, 0x14, 0x11, 0x00, 0x00, -} - -func (this *MsgSubmitProposal) Equal(that interface{}) bool { + // 1317 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x56, 0xcf, 0x6f, 0x1b, 0xc5, + 0x17, 0x5f, 0x37, 0x6e, 0xdc, 0x8c, 0x9d, 0xb4, 0x99, 0x6f, 0xfb, 0xad, 0x6b, 0x5a, 0x3b, 0x35, + 0xa8, 0x2a, 0x2d, 0xb1, 0xe9, 0x0f, 0x10, 0xb5, 0x10, 0xa2, 0x4e, 0x1a, 0x39, 0x40, 0xa1, 0xda, + 0xb4, 0x45, 0x20, 0xc1, 0x6a, 0xbc, 0x33, 0xdd, 0x0c, 0xf1, 0xec, 0x2c, 0x3b, 0xb3, 0xae, 0x8d, + 0xc4, 0x09, 0x0e, 0x94, 0x13, 0x57, 0x6e, 0x3d, 0x73, 0xee, 0x89, 0xbf, 0xa0, 0xea, 0xa9, 0x47, + 0x4e, 0x06, 0xa5, 0x17, 0xd4, 0x13, 0xea, 0x5f, 0x80, 0x66, 0x76, 0x76, 0xed, 0xc4, 0x1b, 0xb7, + 0x07, 0x2e, 0xab, 0x79, 0x3f, 0x3e, 0x9f, 0xf7, 0xf6, 0xbd, 0x37, 0xfb, 0x16, 0x1c, 0x15, 0x12, + 0x37, 0x5d, 0x8e, 0x89, 0xdb, 0x08, 0x42, 0x2e, 0x39, 0x5c, 0x76, 0xb9, 0x60, 0x5c, 0x38, 0x02, + 0xef, 0x34, 0x84, 0xc4, 0x8d, 0xfe, 0xa5, 0xca, 0x45, 0xb9, 0x4d, 0x43, 0xec, 0x04, 0x28, 0x94, + 0xc3, 0xa6, 0xf6, 0x6a, 0xc6, 0x4e, 0xab, 0x93, 0x42, 0x8c, 0xaf, 0x9c, 0x9b, 0x76, 0xf6, 0xb8, + 0xc7, 0xc7, 0x27, 0xe3, 0xb7, 0x2c, 0x87, 0x01, 0x11, 0x4d, 0xfd, 0x34, 0xaa, 0xf2, 0xa0, 0x89, + 0x22, 0xb9, 0xdd, 0x9c, 0xb6, 0xac, 0x18, 0x4b, 0x9f, 0x08, 0x49, 0x7d, 0xaf, 0x99, 0x89, 0xed, + 0x22, 0x7f, 0x27, 0xc3, 0x52, 0x19, 0x34, 0xdd, 0x90, 0x0a, 0x2a, 0xb2, 0x79, 0x31, 0x15, 0x32, + 0xa4, 0xdd, 0x48, 0x52, 0xee, 0x67, 0x78, 0x9c, 0x1c, 0x34, 0x3d, 0xde, 0xcf, 0x30, 0x9c, 0x1e, + 0x34, 0x45, 0x0f, 0x89, 0xed, 0xec, 0x74, 0x5e, 0x1b, 0x34, 0x85, 0x44, 0x3b, 0x99, 0xc6, 0xfa, + 0xef, 0x79, 0x50, 0xb8, 0xee, 0xba, 0x3c, 0xf2, 0x25, 0xdc, 0x00, 0xa5, 0x2e, 0x12, 0xc4, 0x41, + 0xb1, 0x5c, 0xce, 0xad, 0xe4, 0xce, 0x17, 0x2f, 0x9f, 0x6d, 0x4c, 0x74, 0x61, 0xd0, 0x50, 0xef, + 0xde, 0xe8, 0x5f, 0x6a, 0xb4, 0x91, 0x20, 0x06, 0xd8, 0xb1, 0xec, 0x62, 0x77, 0x2c, 0xc2, 0x3e, + 0xa8, 0xb8, 0xdc, 0x97, 0x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b7, 0x0b, 0xfa, 0xb8, 0x89, 0xe1, 0x87, 0x60, 0xc9, 0xfc, 0x14, + 0x39, 0x7e, 0xc4, 0xba, 0x24, 0x8c, 0x9b, 0xd1, 0x3e, 0xf5, 0x62, 0x54, 0x3b, 0x11, 0xa3, 0xf6, + 0xda, 0xeb, 0xf6, 0xa2, 0x51, 0x7c, 0xaa, 0x65, 0x58, 0x01, 0x47, 0x04, 0xf9, 0x36, 0x22, 0xbe, + 0x4b, 0x74, 0x9e, 0x79, 0x3b, 0x95, 0xd3, 0xfc, 0xf3, 0xe3, 0xfc, 0x93, 0x6a, 0x1e, 0x7e, 0xf5, + 0x6a, 0xb6, 0x5b, 0x8f, 0x77, 0xab, 0xb9, 0xa7, 0xbb, 0xd5, 0xdc, 0x5f, 0xbb, 0xd5, 0xdc, 0x2f, + 0xcf, 0xaa, 0xd6, 0xd3, 0x67, 0x55, 0xeb, 0x8f, 0x67, 0x55, 0xeb, 0xcb, 0x95, 0x99, 0x23, 0x27, + 0x24, 0xee, 0xce, 0xeb, 0x1f, 0xf6, 0x2b, 0xff, 0x06, 0x00, 0x00, 0xff, 0xff, 0x5e, 0x75, 0x49, + 0x67, 0x26, 0x0d, 0x00, 0x00, +} + +func (this *StdFee) Equal(that interface{}) bool { if that == nil { return this == nil } - that1, ok := that.(*MsgSubmitProposal) + that1, ok := that.(*StdFee) if !ok { - that2, ok := that.(MsgSubmitProposal) + that2, ok := that.(StdFee) if ok { that1 = &that2 } else { @@ -1101,335 +848,84 @@ func (this *MsgSubmitProposal) Equal(that interface{}) bool { } else if this == nil { return false } - if !this.MsgSubmitProposalBase.Equal(&that1.MsgSubmitProposalBase) { + if len(this.Amount) != len(that1.Amount) { return false } - if !this.Content.Equal(that1.Content) { + for i := range this.Amount { + if !this.Amount[i].Equal(&that1.Amount[i]) { + return false + } + } + if this.Gas != that1.Gas { return false } return true } -func (this *Proposal) Equal(that interface{}) bool { - if that == nil { - return this == nil +func (this *Account) GetAccount() github_com_cosmos_cosmos_sdk_x_auth_exported.Account { + if x := this.GetBaseAccount(); x != nil { + return x } - - that1, ok := that.(*Proposal) - if !ok { - that2, ok := that.(Proposal) - if ok { - that1 = &that2 - } else { - return false - } + if x := this.GetContinuousVestingAccount(); x != nil { + return x } - if that1 == nil { - return this == nil - } else if this == nil { - return false + if x := this.GetDelayedVestingAccount(); x != nil { + return x } - if !this.ProposalBase.Equal(&that1.ProposalBase) { - return false + if x := this.GetPeriodicVestingAccount(); x != nil { + return x } - if !this.Content.Equal(&that1.Content) { - return false + if x := this.GetModuleAccount(); x != nil { + return x } - return true + return nil } -func (this *Content) Equal(that interface{}) bool { - if that == nil { - return this == nil - } - that1, ok := that.(*Content) - if !ok { - that2, ok := that.(Content) - if ok { - that1 = &that2 - } else { - return false - } - } - if that1 == nil { - return this == nil - } else if this == nil { - return false +func (this *Account) SetAccount(value github_com_cosmos_cosmos_sdk_x_auth_exported.Account) error { + if value == nil { + this.Sum = nil + return nil } - if that1.Sum == nil { - if this.Sum != nil { - return false - } - } else if this.Sum == nil { - return false - } else if !this.Sum.Equal(that1.Sum) { - return false + switch vt := value.(type) { + case *types.BaseAccount: + this.Sum = &Account_BaseAccount{vt} + return nil + case *types1.ContinuousVestingAccount: + this.Sum = &Account_ContinuousVestingAccount{vt} + return nil + case *types1.DelayedVestingAccount: + this.Sum = &Account_DelayedVestingAccount{vt} + return nil + case *types1.PeriodicVestingAccount: + this.Sum = &Account_PeriodicVestingAccount{vt} + return nil + case *types.ModuleAccount: + this.Sum = &Account_ModuleAccount{vt} + return nil } - return true + return fmt.Errorf("can't encode value of type %T as message Account", value) } -func (this *Content_Text) Equal(that interface{}) bool { - if that == nil { - return this == nil - } - that1, ok := that.(*Content_Text) - if !ok { - that2, ok := that.(Content_Text) - if ok { - that1 = &that2 - } else { - return false - } +func (this *Message) GetMsg() github_com_cosmos_cosmos_sdk_types.Msg { + if x := this.GetMsgSend(); x != nil { + return x } - if that1 == nil { - return this == nil - } else if this == nil { - return false + if x := this.GetMsgMultiSend(); x != nil { + return x } - if !this.Text.Equal(that1.Text) { - return false + if x := this.GetMsgVerifyInvariant(); x != nil { + return x } - return true -} -func (this *Content_ParameterChange) Equal(that interface{}) bool { - if that == nil { - return this == nil + if x := this.GetMsgSetWithdrawAddress(); x != nil { + return x } - - that1, ok := that.(*Content_ParameterChange) - if !ok { - that2, ok := that.(Content_ParameterChange) - if ok { - that1 = &that2 - } else { - return false - } + if x := this.GetMsgWithdrawDelegatorReward(); x != nil { + return x } - if that1 == nil { - return this == nil - } else if this == nil { - return false + if x := this.GetMsgWithdrawValidatorCommission(); x != nil { + return x } - if !this.ParameterChange.Equal(that1.ParameterChange) { - return false - } - return true -} -func (this *Content_SoftwareUpgrade) Equal(that interface{}) bool { - if that == nil { - return this == nil - } - - that1, ok := that.(*Content_SoftwareUpgrade) - if !ok { - that2, ok := that.(Content_SoftwareUpgrade) - if ok { - that1 = &that2 - } else { - return false - } - } - if that1 == nil { - return this == nil - } else if this == nil { - return false - } - if !this.SoftwareUpgrade.Equal(that1.SoftwareUpgrade) { - return false - } - return true -} -func (this *Content_CancelSoftwareUpgrade) Equal(that interface{}) bool { - if that == nil { - return this == nil - } - - that1, ok := that.(*Content_CancelSoftwareUpgrade) - if !ok { - that2, ok := that.(Content_CancelSoftwareUpgrade) - if ok { - that1 = &that2 - } else { - return false - } - } - if that1 == nil { - return this == nil - } else if this == nil { - return false - } - if !this.CancelSoftwareUpgrade.Equal(that1.CancelSoftwareUpgrade) { - return false - } - return true -} -func (this *Content_CommunityPoolSpend) Equal(that interface{}) bool { - if that == nil { - return this == nil - } - - that1, ok := that.(*Content_CommunityPoolSpend) - if !ok { - that2, ok := that.(Content_CommunityPoolSpend) - if ok { - that1 = &that2 - } else { - return false - } - } - if that1 == nil { - return this == nil - } else if this == nil { - return false - } - if !this.CommunityPoolSpend.Equal(that1.CommunityPoolSpend) { - return false - } - return true -} -func (this *StdFee) Equal(that interface{}) bool { - if that == nil { - return this == nil - } - - that1, ok := that.(*StdFee) - if !ok { - that2, ok := that.(StdFee) - if ok { - that1 = &that2 - } else { - return false - } - } - if that1 == nil { - return this == nil - } else if this == nil { - return false - } - if len(this.Amount) != len(that1.Amount) { - return false - } - for i := range this.Amount { - if !this.Amount[i].Equal(&that1.Amount[i]) { - return false - } - } - if this.Gas != that1.Gas { - return false - } - return true -} -func (this *Account) GetAccount() github_com_cosmos_cosmos_sdk_x_auth_exported.Account { - if x := this.GetBaseAccount(); x != nil { - return x - } - if x := this.GetContinuousVestingAccount(); x != nil { - return x - } - if x := this.GetDelayedVestingAccount(); x != nil { - return x - } - if x := this.GetPeriodicVestingAccount(); x != nil { - return x - } - if x := this.GetModuleAccount(); x != nil { - return x - } - return nil -} - -func (this *Account) SetAccount(value github_com_cosmos_cosmos_sdk_x_auth_exported.Account) error { - if value == nil { - this.Sum = nil - return nil - } - switch vt := value.(type) { - case *types.BaseAccount: - this.Sum = &Account_BaseAccount{vt} - return nil - case *types1.ContinuousVestingAccount: - this.Sum = &Account_ContinuousVestingAccount{vt} - return nil - case *types1.DelayedVestingAccount: - this.Sum = &Account_DelayedVestingAccount{vt} - return nil - case *types1.PeriodicVestingAccount: - this.Sum = &Account_PeriodicVestingAccount{vt} - return nil - case *types.ModuleAccount: - this.Sum = &Account_ModuleAccount{vt} - return nil - } - return fmt.Errorf("can't encode value of type %T as message Account", value) -} - -func (this *Content) GetContent() github_com_cosmos_cosmos_sdk_x_gov_types.Content { - if x := this.GetText(); x != nil { - return x - } - if x := this.GetParameterChange(); x != nil { - return x - } - if x := this.GetSoftwareUpgrade(); x != nil { - return x - } - if x := this.GetCancelSoftwareUpgrade(); x != nil { - return x - } - if x := this.GetCommunityPoolSpend(); x != nil { - return x - } - return nil -} - -func (this *Content) SetContent(value github_com_cosmos_cosmos_sdk_x_gov_types.Content) error { - if value == nil { - this.Sum = nil - return nil - } - switch vt := value.(type) { - case *types2.TextProposal: - this.Sum = &Content_Text{vt} - return nil - case *proposal.ParameterChangeProposal: - this.Sum = &Content_ParameterChange{vt} - return nil - case *types3.SoftwareUpgradeProposal: - this.Sum = &Content_SoftwareUpgrade{vt} - return nil - case *types3.CancelSoftwareUpgradeProposal: - this.Sum = &Content_CancelSoftwareUpgrade{vt} - return nil - case *types4.CommunityPoolSpendProposal: - this.Sum = &Content_CommunityPoolSpend{vt} - return nil - } - return fmt.Errorf("can't encode value of type %T as message Content", value) -} - -func (this *Message) GetMsg() github_com_cosmos_cosmos_sdk_types.Msg { - if x := this.GetMsgSend(); x != nil { - return x - } - if x := this.GetMsgMultiSend(); x != nil { - return x - } - if x := this.GetMsgVerifyInvariant(); x != nil { - return x - } - if x := this.GetMsgSetWithdrawAddress(); x != nil { - return x - } - if x := this.GetMsgWithdrawDelegatorReward(); x != nil { - return x - } - if x := this.GetMsgWithdrawValidatorCommission(); x != nil { - return x - } - if x := this.GetMsgFundCommunityPool(); x != nil { - return x - } - if x := this.GetMsgSubmitProposal(); x != nil { - return x + if x := this.GetMsgFundCommunityPool(); x != nil { + return x } if x := this.GetMsgVote(); x != nil { return x @@ -1464,22 +960,22 @@ func (this *Message) SetMsg(value github_com_cosmos_cosmos_sdk_types.Msg) error return nil } switch vt := value.(type) { - case *types5.MsgSend: + case *types2.MsgSend: this.Sum = &Message_MsgSend{vt} return nil - case types5.MsgSend: + case types2.MsgSend: this.Sum = &Message_MsgSend{&vt} return nil - case *types5.MsgMultiSend: + case *types2.MsgMultiSend: this.Sum = &Message_MsgMultiSend{vt} return nil - case types5.MsgMultiSend: + case types2.MsgMultiSend: this.Sum = &Message_MsgMultiSend{&vt} return nil - case *types6.MsgVerifyInvariant: + case *types3.MsgVerifyInvariant: this.Sum = &Message_MsgVerifyInvariant{vt} return nil - case types6.MsgVerifyInvariant: + case types3.MsgVerifyInvariant: this.Sum = &Message_MsgVerifyInvariant{&vt} return nil case *types4.MsgSetWithdrawAddress: @@ -1506,58 +1002,52 @@ func (this *Message) SetMsg(value github_com_cosmos_cosmos_sdk_types.Msg) error case types4.MsgFundCommunityPool: this.Sum = &Message_MsgFundCommunityPool{&vt} return nil - case *MsgSubmitProposal: - this.Sum = &Message_MsgSubmitProposal{vt} - return nil - case MsgSubmitProposal: - this.Sum = &Message_MsgSubmitProposal{&vt} - return nil - case *types2.MsgVote: + case *types5.MsgVote: this.Sum = &Message_MsgVote{vt} return nil - case types2.MsgVote: + case types5.MsgVote: this.Sum = &Message_MsgVote{&vt} return nil - case *types2.MsgDeposit: + case *types5.MsgDeposit: this.Sum = &Message_MsgDeposit{vt} return nil - case types2.MsgDeposit: + case types5.MsgDeposit: this.Sum = &Message_MsgDeposit{&vt} return nil - case *types7.MsgUnjail: + case *types6.MsgUnjail: this.Sum = &Message_MsgUnjail{vt} return nil - case types7.MsgUnjail: + case types6.MsgUnjail: this.Sum = &Message_MsgUnjail{&vt} return nil - case *types8.MsgCreateValidator: + case *types7.MsgCreateValidator: this.Sum = &Message_MsgCreateValidator{vt} return nil - case types8.MsgCreateValidator: + case types7.MsgCreateValidator: this.Sum = &Message_MsgCreateValidator{&vt} return nil - case *types8.MsgEditValidator: + case *types7.MsgEditValidator: this.Sum = &Message_MsgEditValidator{vt} return nil - case types8.MsgEditValidator: + case types7.MsgEditValidator: this.Sum = &Message_MsgEditValidator{&vt} return nil - case *types8.MsgDelegate: + case *types7.MsgDelegate: this.Sum = &Message_MsgDelegate{vt} return nil - case types8.MsgDelegate: + case types7.MsgDelegate: this.Sum = &Message_MsgDelegate{&vt} return nil - case *types8.MsgBeginRedelegate: + case *types7.MsgBeginRedelegate: this.Sum = &Message_MsgBeginRedelegate{vt} return nil - case types8.MsgBeginRedelegate: + case types7.MsgBeginRedelegate: this.Sum = &Message_MsgBeginRedelegate{&vt} return nil - case *types8.MsgUndelegate: + case *types7.MsgUndelegate: this.Sum = &Message_MsgUndelegate{vt} return nil - case types8.MsgUndelegate: + case types7.MsgUndelegate: this.Sum = &Message_MsgUndelegate{&vt} return nil } @@ -1701,7 +1191,7 @@ func (m *Account_ModuleAccount) MarshalToSizedBuffer(dAtA []byte) (int, error) { } return len(dAtA) - i, nil } -func (m *MsgSubmitProposal) Marshal() (dAtA []byte, err error) { +func (m *Transaction) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -1711,73 +1201,32 @@ func (m *MsgSubmitProposal) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *MsgSubmitProposal) MarshalTo(dAtA []byte) (int, error) { +func (m *Transaction) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *MsgSubmitProposal) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *Transaction) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int _ = l - if m.Content != nil { - { - size, err := m.Content.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err + if len(m.Msgs) > 0 { + for iNdEx := len(m.Msgs) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Msgs[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintCodec(dAtA, i, uint64(size)) } - i -= size - i = encodeVarintCodec(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - } - { - size, err := m.MsgSubmitProposalBase.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintCodec(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - return len(dAtA) - i, nil -} - -func (m *Proposal) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *Proposal) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *Proposal) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - { - size, err := m.Content.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err + i-- + dAtA[i] = 0x12 } - i -= size - i = encodeVarintCodec(dAtA, i, uint64(size)) } - i-- - dAtA[i] = 0x12 { - size, err := m.ProposalBase.MarshalToSizedBuffer(dAtA[:i]) + size, err := m.StdTxBase.MarshalToSizedBuffer(dAtA[:i]) if err != nil { return 0, err } @@ -1789,7 +1238,7 @@ func (m *Proposal) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } -func (m *Content) Marshal() (dAtA []byte, err error) { +func (m *Message) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -1799,12 +1248,12 @@ func (m *Content) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *Content) MarshalTo(dAtA []byte) (int, error) { +func (m *Message) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *Content) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *Message) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int @@ -1821,16 +1270,16 @@ func (m *Content) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } -func (m *Content_Text) MarshalTo(dAtA []byte) (int, error) { +func (m *Message_MsgSend) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *Content_Text) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *Message_MsgSend) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) - if m.Text != nil { + if m.MsgSend != nil { { - size, err := m.Text.MarshalToSizedBuffer(dAtA[:i]) + size, err := m.MsgSend.MarshalToSizedBuffer(dAtA[:i]) if err != nil { return 0, err } @@ -1842,198 +1291,14 @@ func (m *Content_Text) MarshalToSizedBuffer(dAtA []byte) (int, error) { } return len(dAtA) - i, nil } -func (m *Content_ParameterChange) MarshalTo(dAtA []byte) (int, error) { +func (m *Message_MsgMultiSend) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *Content_ParameterChange) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *Message_MsgMultiSend) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) - if m.ParameterChange != nil { - { - size, err := m.ParameterChange.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintCodec(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - } - return len(dAtA) - i, nil -} -func (m *Content_SoftwareUpgrade) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *Content_SoftwareUpgrade) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - if m.SoftwareUpgrade != nil { - { - size, err := m.SoftwareUpgrade.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintCodec(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x1a - } - return len(dAtA) - i, nil -} -func (m *Content_CancelSoftwareUpgrade) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *Content_CancelSoftwareUpgrade) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - if m.CancelSoftwareUpgrade != nil { - { - size, err := m.CancelSoftwareUpgrade.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintCodec(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x22 - } - return len(dAtA) - i, nil -} -func (m *Content_CommunityPoolSpend) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *Content_CommunityPoolSpend) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - if m.CommunityPoolSpend != nil { - { - size, err := m.CommunityPoolSpend.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintCodec(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x2a - } - return len(dAtA) - i, nil -} -func (m *Transaction) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *Transaction) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *Transaction) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.Msgs) > 0 { - for iNdEx := len(m.Msgs) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.Msgs[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintCodec(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - } - } - { - size, err := m.StdTxBase.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintCodec(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - return len(dAtA) - i, nil -} - -func (m *Message) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *Message) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *Message) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.Sum != nil { - { - size := m.Sum.Size() - i -= size - if _, err := m.Sum.MarshalTo(dAtA[i:]); err != nil { - return 0, err - } - } - } - return len(dAtA) - i, nil -} - -func (m *Message_MsgSend) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *Message_MsgSend) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - if m.MsgSend != nil { - { - size, err := m.MsgSend.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintCodec(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} -func (m *Message_MsgMultiSend) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *Message_MsgMultiSend) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - if m.MsgMultiSend != nil { + if m.MsgMultiSend != nil { { size, err := m.MsgMultiSend.MarshalToSizedBuffer(dAtA[:i]) if err != nil { @@ -2152,27 +1417,6 @@ func (m *Message_MsgFundCommunityPool) MarshalToSizedBuffer(dAtA []byte) (int, e } return len(dAtA) - i, nil } -func (m *Message_MsgSubmitProposal) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *Message_MsgSubmitProposal) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - if m.MsgSubmitProposal != nil { - { - size, err := m.MsgSubmitProposal.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintCodec(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x4a - } - return len(dAtA) - i, nil -} func (m *Message_MsgVote) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) @@ -2665,35 +1909,24 @@ func (m *Account_ModuleAccount) Size() (n int) { } return n } -func (m *MsgSubmitProposal) Size() (n int) { +func (m *Transaction) Size() (n int) { if m == nil { return 0 } var l int _ = l - l = m.MsgSubmitProposalBase.Size() + l = m.StdTxBase.Size() n += 1 + l + sovCodec(uint64(l)) - if m.Content != nil { - l = m.Content.Size() - n += 1 + l + sovCodec(uint64(l)) - } - return n -} - -func (m *Proposal) Size() (n int) { - if m == nil { - return 0 + if len(m.Msgs) > 0 { + for _, e := range m.Msgs { + l = e.Size() + n += 1 + l + sovCodec(uint64(l)) + } } - var l int - _ = l - l = m.ProposalBase.Size() - n += 1 + l + sovCodec(uint64(l)) - l = m.Content.Size() - n += 1 + l + sovCodec(uint64(l)) return n } -func (m *Content) Size() (n int) { +func (m *Message) Size() (n int) { if m == nil { return 0 } @@ -2705,216 +1938,115 @@ func (m *Content) Size() (n int) { return n } -func (m *Content_Text) Size() (n int) { +func (m *Message_MsgSend) Size() (n int) { if m == nil { return 0 } var l int _ = l - if m.Text != nil { - l = m.Text.Size() + if m.MsgSend != nil { + l = m.MsgSend.Size() n += 1 + l + sovCodec(uint64(l)) } return n } -func (m *Content_ParameterChange) Size() (n int) { +func (m *Message_MsgMultiSend) Size() (n int) { if m == nil { return 0 } var l int _ = l - if m.ParameterChange != nil { - l = m.ParameterChange.Size() + if m.MsgMultiSend != nil { + l = m.MsgMultiSend.Size() n += 1 + l + sovCodec(uint64(l)) } return n } -func (m *Content_SoftwareUpgrade) Size() (n int) { +func (m *Message_MsgVerifyInvariant) Size() (n int) { if m == nil { return 0 } var l int _ = l - if m.SoftwareUpgrade != nil { - l = m.SoftwareUpgrade.Size() + if m.MsgVerifyInvariant != nil { + l = m.MsgVerifyInvariant.Size() n += 1 + l + sovCodec(uint64(l)) } return n } -func (m *Content_CancelSoftwareUpgrade) Size() (n int) { +func (m *Message_MsgSetWithdrawAddress) Size() (n int) { if m == nil { return 0 } var l int _ = l - if m.CancelSoftwareUpgrade != nil { - l = m.CancelSoftwareUpgrade.Size() + if m.MsgSetWithdrawAddress != nil { + l = m.MsgSetWithdrawAddress.Size() n += 1 + l + sovCodec(uint64(l)) } return n } -func (m *Content_CommunityPoolSpend) Size() (n int) { +func (m *Message_MsgWithdrawDelegatorReward) Size() (n int) { if m == nil { return 0 } var l int _ = l - if m.CommunityPoolSpend != nil { - l = m.CommunityPoolSpend.Size() + if m.MsgWithdrawDelegatorReward != nil { + l = m.MsgWithdrawDelegatorReward.Size() n += 1 + l + sovCodec(uint64(l)) } return n } -func (m *Transaction) Size() (n int) { +func (m *Message_MsgWithdrawValidatorCommission) Size() (n int) { if m == nil { return 0 } var l int _ = l - l = m.StdTxBase.Size() - n += 1 + l + sovCodec(uint64(l)) - if len(m.Msgs) > 0 { - for _, e := range m.Msgs { - l = e.Size() - n += 1 + l + sovCodec(uint64(l)) - } + if m.MsgWithdrawValidatorCommission != nil { + l = m.MsgWithdrawValidatorCommission.Size() + n += 1 + l + sovCodec(uint64(l)) } return n } - -func (m *Message) Size() (n int) { +func (m *Message_MsgFundCommunityPool) Size() (n int) { if m == nil { return 0 } var l int _ = l - if m.Sum != nil { - n += m.Sum.Size() + if m.MsgFundCommunityPool != nil { + l = m.MsgFundCommunityPool.Size() + n += 1 + l + sovCodec(uint64(l)) } return n } - -func (m *Message_MsgSend) Size() (n int) { +func (m *Message_MsgVote) Size() (n int) { if m == nil { return 0 } var l int _ = l - if m.MsgSend != nil { - l = m.MsgSend.Size() + if m.MsgVote != nil { + l = m.MsgVote.Size() n += 1 + l + sovCodec(uint64(l)) } return n } -func (m *Message_MsgMultiSend) Size() (n int) { +func (m *Message_MsgDeposit) Size() (n int) { if m == nil { return 0 } var l int _ = l - if m.MsgMultiSend != nil { - l = m.MsgMultiSend.Size() + if m.MsgDeposit != nil { + l = m.MsgDeposit.Size() n += 1 + l + sovCodec(uint64(l)) } return n } -func (m *Message_MsgVerifyInvariant) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.MsgVerifyInvariant != nil { - l = m.MsgVerifyInvariant.Size() - n += 1 + l + sovCodec(uint64(l)) - } - return n -} -func (m *Message_MsgSetWithdrawAddress) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.MsgSetWithdrawAddress != nil { - l = m.MsgSetWithdrawAddress.Size() - n += 1 + l + sovCodec(uint64(l)) - } - return n -} -func (m *Message_MsgWithdrawDelegatorReward) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.MsgWithdrawDelegatorReward != nil { - l = m.MsgWithdrawDelegatorReward.Size() - n += 1 + l + sovCodec(uint64(l)) - } - return n -} -func (m *Message_MsgWithdrawValidatorCommission) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.MsgWithdrawValidatorCommission != nil { - l = m.MsgWithdrawValidatorCommission.Size() - n += 1 + l + sovCodec(uint64(l)) - } - return n -} -func (m *Message_MsgFundCommunityPool) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.MsgFundCommunityPool != nil { - l = m.MsgFundCommunityPool.Size() - n += 1 + l + sovCodec(uint64(l)) - } - return n -} -func (m *Message_MsgSubmitProposal) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.MsgSubmitProposal != nil { - l = m.MsgSubmitProposal.Size() - n += 1 + l + sovCodec(uint64(l)) - } - return n -} -func (m *Message_MsgVote) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.MsgVote != nil { - l = m.MsgVote.Size() - n += 1 + l + sovCodec(uint64(l)) - } - return n -} -func (m *Message_MsgDeposit) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.MsgDeposit != nil { - l = m.MsgDeposit.Size() - n += 1 + l + sovCodec(uint64(l)) - } - return n -} -func (m *Message_MsgUnjail) Size() (n int) { +func (m *Message_MsgUnjail) Size() (n int) { if m == nil { return 0 } @@ -2983,583 +2115,114 @@ func (m *Message_MsgUndelegate) Size() (n int) { if m.MsgUndelegate != nil { l = m.MsgUndelegate.Size() n += 2 + l + sovCodec(uint64(l)) - } - return n -} -func (m *SignDoc) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = m.StdSignDocBase.Size() - n += 1 + l + sovCodec(uint64(l)) - if len(m.Msgs) > 0 { - for _, e := range m.Msgs { - l = e.Size() - n += 1 + l + sovCodec(uint64(l)) - } - } - return n -} - -func (m *StdFee) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if len(m.Amount) > 0 { - for _, e := range m.Amount { - l = e.Size() - n += 1 + l + sovCodec(uint64(l)) - } - } - if m.Gas != 0 { - n += 1 + sovCodec(uint64(m.Gas)) - } - return n -} - -func (m *StdSignature) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.PubKey) - if l > 0 { - n += 1 + l + sovCodec(uint64(l)) - } - l = len(m.Signature) - if l > 0 { - n += 1 + l + sovCodec(uint64(l)) - } - return n -} - -func (m *StdTxBase) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = m.Fee.Size() - n += 1 + l + sovCodec(uint64(l)) - if len(m.Signatures) > 0 { - for _, e := range m.Signatures { - l = e.Size() - n += 1 + l + sovCodec(uint64(l)) - } - } - l = len(m.Memo) - if l > 0 { - n += 1 + l + sovCodec(uint64(l)) - } - return n -} - -func (m *StdSignDocBase) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.ChainID) - if l > 0 { - n += 1 + l + sovCodec(uint64(l)) - } - if m.AccountNumber != 0 { - n += 1 + sovCodec(uint64(m.AccountNumber)) - } - if m.Sequence != 0 { - n += 1 + sovCodec(uint64(m.Sequence)) - } - l = len(m.Memo) - if l > 0 { - n += 1 + l + sovCodec(uint64(l)) - } - l = m.Fee.Size() - n += 1 + l + sovCodec(uint64(l)) - return n -} - -func sovCodec(x uint64) (n int) { - return (math_bits.Len64(x|1) + 6) / 7 -} -func sozCodec(x uint64) (n int) { - return sovCodec(uint64((x << 1) ^ uint64((int64(x) >> 63)))) -} -func (m *Account) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowCodec - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: Account: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: Account: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field BaseAccount", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowCodec - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthCodec - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthCodec - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - v := &types.BaseAccount{} - if err := v.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - m.Sum = &Account_BaseAccount{v} - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ContinuousVestingAccount", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowCodec - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthCodec - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthCodec - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - v := &types1.ContinuousVestingAccount{} - if err := v.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - m.Sum = &Account_ContinuousVestingAccount{v} - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field DelayedVestingAccount", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowCodec - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthCodec - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthCodec - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - v := &types1.DelayedVestingAccount{} - if err := v.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - m.Sum = &Account_DelayedVestingAccount{v} - iNdEx = postIndex - case 4: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field PeriodicVestingAccount", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowCodec - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthCodec - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthCodec - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - v := &types1.PeriodicVestingAccount{} - if err := v.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - m.Sum = &Account_PeriodicVestingAccount{v} - iNdEx = postIndex - case 5: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ModuleAccount", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowCodec - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthCodec - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthCodec - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - v := &types.ModuleAccount{} - if err := v.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - m.Sum = &Account_ModuleAccount{v} - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipCodec(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthCodec - } - if (iNdEx + skippy) < 0 { - return ErrInvalidLengthCodec - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *MsgSubmitProposal) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowCodec - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: MsgSubmitProposal: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: MsgSubmitProposal: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field MsgSubmitProposalBase", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowCodec - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthCodec - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthCodec - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.MsgSubmitProposalBase.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Content", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowCodec - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthCodec - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthCodec - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Content == nil { - m.Content = &Content{} - } - if err := m.Content.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipCodec(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthCodec - } - if (iNdEx + skippy) < 0 { - return ErrInvalidLengthCodec - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy + } + return n +} +func (m *SignDoc) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.StdSignDocBase.Size() + n += 1 + l + sovCodec(uint64(l)) + if len(m.Msgs) > 0 { + for _, e := range m.Msgs { + l = e.Size() + n += 1 + l + sovCodec(uint64(l)) } } + return n +} - if iNdEx > l { - return io.ErrUnexpectedEOF +func (m *StdFee) Size() (n int) { + if m == nil { + return 0 } - return nil -} -func (m *Proposal) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowCodec - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: Proposal: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: Proposal: illegal tag %d (wire type %d)", fieldNum, wire) + var l int + _ = l + if len(m.Amount) > 0 { + for _, e := range m.Amount { + l = e.Size() + n += 1 + l + sovCodec(uint64(l)) } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ProposalBase", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowCodec - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthCodec - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthCodec - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.ProposalBase.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Content", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowCodec - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthCodec - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthCodec - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.Content.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipCodec(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthCodec - } - if (iNdEx + skippy) < 0 { - return ErrInvalidLengthCodec - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy + } + if m.Gas != 0 { + n += 1 + sovCodec(uint64(m.Gas)) + } + return n +} + +func (m *StdSignature) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.PubKey) + if l > 0 { + n += 1 + l + sovCodec(uint64(l)) + } + l = len(m.Signature) + if l > 0 { + n += 1 + l + sovCodec(uint64(l)) + } + return n +} + +func (m *StdTxBase) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.Fee.Size() + n += 1 + l + sovCodec(uint64(l)) + if len(m.Signatures) > 0 { + for _, e := range m.Signatures { + l = e.Size() + n += 1 + l + sovCodec(uint64(l)) } } + l = len(m.Memo) + if l > 0 { + n += 1 + l + sovCodec(uint64(l)) + } + return n +} - if iNdEx > l { - return io.ErrUnexpectedEOF +func (m *StdSignDocBase) Size() (n int) { + if m == nil { + return 0 } - return nil + var l int + _ = l + l = len(m.ChainID) + if l > 0 { + n += 1 + l + sovCodec(uint64(l)) + } + if m.AccountNumber != 0 { + n += 1 + sovCodec(uint64(m.AccountNumber)) + } + if m.Sequence != 0 { + n += 1 + sovCodec(uint64(m.Sequence)) + } + l = len(m.Memo) + if l > 0 { + n += 1 + l + sovCodec(uint64(l)) + } + l = m.Fee.Size() + n += 1 + l + sovCodec(uint64(l)) + return n } -func (m *Content) Unmarshal(dAtA []byte) error { + +func sovCodec(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozCodec(x uint64) (n int) { + return sovCodec(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *Account) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -3582,15 +2245,15 @@ func (m *Content) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: Content: wiretype end group for non-group") + return fmt.Errorf("proto: Account: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: Content: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: Account: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Text", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field BaseAccount", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -3617,15 +2280,15 @@ func (m *Content) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - v := &types2.TextProposal{} + v := &types.BaseAccount{} if err := v.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } - m.Sum = &Content_Text{v} + m.Sum = &Account_BaseAccount{v} iNdEx = postIndex case 2: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ParameterChange", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field ContinuousVestingAccount", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -3652,15 +2315,15 @@ func (m *Content) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - v := &proposal.ParameterChangeProposal{} + v := &types1.ContinuousVestingAccount{} if err := v.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } - m.Sum = &Content_ParameterChange{v} + m.Sum = &Account_ContinuousVestingAccount{v} iNdEx = postIndex case 3: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field SoftwareUpgrade", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field DelayedVestingAccount", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -3687,15 +2350,15 @@ func (m *Content) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - v := &types3.SoftwareUpgradeProposal{} + v := &types1.DelayedVestingAccount{} if err := v.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } - m.Sum = &Content_SoftwareUpgrade{v} + m.Sum = &Account_DelayedVestingAccount{v} iNdEx = postIndex case 4: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field CancelSoftwareUpgrade", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field PeriodicVestingAccount", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -3722,15 +2385,15 @@ func (m *Content) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - v := &types3.CancelSoftwareUpgradeProposal{} + v := &types1.PeriodicVestingAccount{} if err := v.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } - m.Sum = &Content_CancelSoftwareUpgrade{v} + m.Sum = &Account_PeriodicVestingAccount{v} iNdEx = postIndex case 5: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field CommunityPoolSpend", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field ModuleAccount", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -3757,11 +2420,11 @@ func (m *Content) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - v := &types4.CommunityPoolSpendProposal{} + v := &types.ModuleAccount{} if err := v.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } - m.Sum = &Content_CommunityPoolSpend{v} + m.Sum = &Account_ModuleAccount{v} iNdEx = postIndex default: iNdEx = preIndex @@ -3965,7 +2628,7 @@ func (m *Message) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - v := &types5.MsgSend{} + v := &types2.MsgSend{} if err := v.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } @@ -4000,7 +2663,7 @@ func (m *Message) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - v := &types5.MsgMultiSend{} + v := &types2.MsgMultiSend{} if err := v.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } @@ -4035,7 +2698,7 @@ func (m *Message) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - v := &types6.MsgVerifyInvariant{} + v := &types3.MsgVerifyInvariant{} if err := v.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } @@ -4181,41 +2844,6 @@ func (m *Message) Unmarshal(dAtA []byte) error { } m.Sum = &Message_MsgFundCommunityPool{v} iNdEx = postIndex - case 9: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field MsgSubmitProposal", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowCodec - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthCodec - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthCodec - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - v := &MsgSubmitProposal{} - if err := v.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - m.Sum = &Message_MsgSubmitProposal{v} - iNdEx = postIndex case 10: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field MsgVote", wireType) @@ -4245,7 +2873,7 @@ func (m *Message) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - v := &types2.MsgVote{} + v := &types5.MsgVote{} if err := v.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } @@ -4280,7 +2908,7 @@ func (m *Message) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - v := &types2.MsgDeposit{} + v := &types5.MsgDeposit{} if err := v.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } @@ -4315,7 +2943,7 @@ func (m *Message) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - v := &types7.MsgUnjail{} + v := &types6.MsgUnjail{} if err := v.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } @@ -4350,7 +2978,7 @@ func (m *Message) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - v := &types8.MsgCreateValidator{} + v := &types7.MsgCreateValidator{} if err := v.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } @@ -4385,7 +3013,7 @@ func (m *Message) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - v := &types8.MsgEditValidator{} + v := &types7.MsgEditValidator{} if err := v.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } @@ -4420,7 +3048,7 @@ func (m *Message) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - v := &types8.MsgDelegate{} + v := &types7.MsgDelegate{} if err := v.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } @@ -4455,7 +3083,7 @@ func (m *Message) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - v := &types8.MsgBeginRedelegate{} + v := &types7.MsgBeginRedelegate{} if err := v.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } @@ -4490,7 +3118,7 @@ func (m *Message) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - v := &types8.MsgUndelegate{} + v := &types7.MsgUndelegate{} if err := v.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } @@ -4698,7 +3326,7 @@ func (m *StdFee) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.Amount = append(m.Amount, types9.Coin{}) + m.Amount = append(m.Amount, types8.Coin{}) if err := m.Amount[len(m.Amount)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } From 84b4f63edb737444909f2288ab90f6b16decf2eb Mon Sep 17 00:00:00 2001 From: Aaron Craelius Date: Thu, 14 May 2020 14:27:53 -0400 Subject: [PATCH 15/42] Create full amino wrapper --- client/context/context.go | 1 + codec/amino.go | 142 ++++++++++++++++++++++++++++- codec/amino_codec.go | 126 +++---------------------- crypto/keyring/codec.go | 2 +- tests/util.go | 2 +- x/auth/client/cli/broadcast.go | 2 +- x/auth/client/cli/encode.go | 2 +- x/auth/client/cli/tx_multisign.go | 4 +- x/auth/client/cli/tx_sign.go | 13 ++- x/auth/client/cli/validate_sigs.go | 10 +- x/auth/client/tx.go | 10 +- x/simulation/params.go | 3 +- 12 files changed, 174 insertions(+), 143 deletions(-) diff --git a/client/context/context.go b/client/context/context.go index 5daf5d2884d..43c8ab30d66 100644 --- a/client/context/context.go +++ b/client/context/context.go @@ -169,6 +169,7 @@ func (ctx CLIContext) WithMarshaler(m codec.Marshaler) CLIContext { // TODO: Deprecated (remove). func (ctx CLIContext) WithCodec(cdc *codec.Codec) CLIContext { ctx.Codec = cdc + // Marshaler is set here for backwards compatibility with amino-only code if ctx.Marshaler == nil { ctx.Marshaler = codec.NewAminoCodec(cdc) } diff --git a/codec/amino.go b/codec/amino.go index c0936e70460..f14f5645df6 100644 --- a/codec/amino.go +++ b/codec/amino.go @@ -8,6 +8,8 @@ import ( amino "github.com/tendermint/go-amino" cryptoamino "github.com/tendermint/tendermint/crypto/encoding/amino" tmtypes "github.com/tendermint/tendermint/types" + + "github.com/cosmos/cosmos-sdk/codec/types" ) // Cdc defines a global generic sealed Amino codec to be used throughout sdk. It @@ -24,22 +26,30 @@ func init() { } // Codec defines a type alias for an Amino codec. -type Codec = amino.Codec +type Codec struct { + Amino *amino.Codec +} + +var _ JSONMarshaler = &Codec{} + +func (cdc *Codec) Seal() *Codec { + return &Codec{cdc.Amino.Seal()} +} func New() *Codec { - return amino.NewCodec() + return &Codec{amino.NewCodec()} } // RegisterCrypto registers all crypto dependency types with the provided Amino // codec. func RegisterCrypto(cdc *Codec) { - cryptoamino.RegisterAmino(cdc) + cryptoamino.RegisterAmino(cdc.Amino) } // RegisterEvidences registers Tendermint evidence types with the provided Amino // codec. func RegisterEvidences(cdc *Codec) { - tmtypes.RegisterEvidences(cdc) + tmtypes.RegisterEvidences(cdc.Amino) } // MarshalJSONIndent provides a utility for indented JSON encoding of an object @@ -68,3 +78,127 @@ func MustMarshalJSONIndent(m JSONMarshaler, obj interface{}) []byte { return bz } + +func (ac *Codec) marshalAnys(o interface{}) error { + return types.UnpackInterfaces(o, types.AminoPacker{Cdc: ac.Amino}) +} + +func (ac *Codec) unmarshalAnys(o interface{}) error { + return types.UnpackInterfaces(o, types.AminoUnpacker{Cdc: ac.Amino}) +} + +func (ac *Codec) jsonMarshalAnys(o interface{}) error { + return types.UnpackInterfaces(o, types.AminoJSONPacker{Cdc: ac.Amino}) +} + +func (ac *Codec) jsonUnmarshalAnys(o interface{}) error { + return types.UnpackInterfaces(o, types.AminoJSONUnpacker{Cdc: ac.Amino}) +} + +func (ac *Codec) MarshalBinaryBare(o interface{}) ([]byte, error) { + err := ac.marshalAnys(o) + if err != nil { + return nil, err + } + return ac.Amino.MarshalBinaryBare(o) +} + +func (ac *Codec) MustMarshalBinaryBare(o interface{}) []byte { + err := ac.marshalAnys(o) + if err != nil { + panic(err) + } + return ac.Amino.MustMarshalBinaryBare(o) +} + +func (ac *Codec) MarshalBinaryLengthPrefixed(o interface{}) ([]byte, error) { + err := ac.marshalAnys(o) + if err != nil { + return nil, err + } + return ac.Amino.MarshalBinaryLengthPrefixed(o) +} + +func (ac *Codec) MustMarshalBinaryLengthPrefixed(o interface{}) []byte { + err := ac.marshalAnys(o) + if err != nil { + panic(err) + } + return ac.Amino.MustMarshalBinaryLengthPrefixed(o) +} + +func (ac *Codec) UnmarshalBinaryBare(bz []byte, ptr interface{}) error { + err := ac.Amino.UnmarshalBinaryBare(bz, ptr) + if err != nil { + return err + } + return ac.unmarshalAnys(ptr) +} + +func (ac *Codec) MustUnmarshalBinaryBare(bz []byte, ptr interface{}) { + ac.Amino.MustUnmarshalBinaryBare(bz, ptr) + err := ac.unmarshalAnys(ptr) + if err != nil { + panic(err) + } +} + +func (ac *Codec) UnmarshalBinaryLengthPrefixed(bz []byte, ptr interface{}) error { + err := ac.Amino.UnmarshalBinaryLengthPrefixed(bz, ptr) + if err != nil { + return err + } + return ac.unmarshalAnys(ptr) +} + +func (ac *Codec) MustUnmarshalBinaryLengthPrefixed(bz []byte, ptr interface{}) { + ac.Amino.MustUnmarshalBinaryLengthPrefixed(bz, ptr) + err := ac.unmarshalAnys(ptr) + if err != nil { + panic(err) + } +} + +func (ac *Codec) MarshalJSON(o interface{}) ([]byte, error) { + err := ac.jsonMarshalAnys(o) + if err != nil { + return nil, err + } + return ac.Amino.MarshalJSON(o) +} + +func (ac *Codec) MustMarshalJSON(o interface{}) []byte { + err := ac.jsonMarshalAnys(o) + if err != nil { + panic(err) + } + return ac.Amino.MustMarshalJSON(o) +} + +func (ac *Codec) UnmarshalJSON(bz []byte, ptr interface{}) error { + err := ac.Amino.UnmarshalJSON(bz, ptr) + if err != nil { + return err + } + return ac.jsonUnmarshalAnys(ptr) +} + +func (ac *Codec) MustUnmarshalJSON(bz []byte, ptr interface{}) { + ac.Amino.MustUnmarshalJSON(bz, ptr) + err := ac.jsonUnmarshalAnys(ptr) + if err != nil { + panic(err) + } +} + +func (*Codec) UnpackAny(*types.Any, interface{}) error { + return fmt.Errorf("AminoCodec can't handle unpack protobuf Any's") +} + +func (cdc *Codec) RegisterInterface(ptr interface{}, iopts *amino.InterfaceOptions) { + cdc.Amino.RegisterInterface(ptr, iopts) +} + +func (cdc *Codec) RegisterConcrete(o interface{}, name string, copts *amino.ConcreteOptions) { + cdc.Amino.RegisterConcrete(o, name, copts) +} diff --git a/codec/amino_codec.go b/codec/amino_codec.go index bae5994b811..36b634a3cb6 100644 --- a/codec/amino_codec.go +++ b/codec/amino_codec.go @@ -1,147 +1,45 @@ package codec -import ( - "fmt" - - "github.com/cosmos/cosmos-sdk/codec/types" -) - -// AminoCodec defines a codec that utilizes Amino for both binary and JSON +// AminoCodec defines a codec that utilizes Codec for both binary and JSON // encoding. type AminoCodec struct { - amino *Codec + *Codec } var _ Marshaler = &AminoCodec{} -func NewAminoCodec(amino *Codec) *AminoCodec { - return &AminoCodec{amino} -} - -func (ac *AminoCodec) marshalAnys(o interface{}) error { - return types.UnpackInterfaces(o, types.AminoPacker{Cdc: ac.amino}) -} - -func (ac *AminoCodec) unmarshalAnys(o interface{}) error { - return types.UnpackInterfaces(o, types.AminoUnpacker{Cdc: ac.amino}) -} - -func (ac *AminoCodec) jsonMarshalAnys(o interface{}) error { - return types.UnpackInterfaces(o, types.AminoJSONPacker{Cdc: ac.amino}) -} - -func (ac *AminoCodec) jsonUnmarshalAnys(o interface{}) error { - return types.UnpackInterfaces(o, types.AminoJSONUnpacker{Cdc: ac.amino}) -} - -func (ac *AminoCodec) AminoMarshalBinaryBare(o interface{}) ([]byte, error) { - err := ac.marshalAnys(o) - if err != nil { - return nil, err - } - return ac.amino.MarshalBinaryBare(o) +func NewAminoCodec(Codec *Codec) *AminoCodec { + return &AminoCodec{Codec} } func (ac *AminoCodec) MarshalBinaryBare(o ProtoMarshaler) ([]byte, error) { - return ac.AminoMarshalBinaryBare(o) + return ac.Codec.MarshalBinaryBare(o) } func (ac *AminoCodec) MustMarshalBinaryBare(o ProtoMarshaler) []byte { - err := ac.marshalAnys(o) - if err != nil { - panic(err) - } - return ac.amino.MustMarshalBinaryBare(o) + return ac.Codec.MustMarshalBinaryBare(o) } func (ac *AminoCodec) MarshalBinaryLengthPrefixed(o ProtoMarshaler) ([]byte, error) { - err := ac.marshalAnys(o) - if err != nil { - return nil, err - } - return ac.amino.MarshalBinaryLengthPrefixed(o) + return ac.Codec.MarshalBinaryLengthPrefixed(o) } func (ac *AminoCodec) MustMarshalBinaryLengthPrefixed(o ProtoMarshaler) []byte { - err := ac.marshalAnys(o) - if err != nil { - panic(err) - } - return ac.amino.MustMarshalBinaryLengthPrefixed(o) -} - -func (ac *AminoCodec) AminoUnmarshalBinaryBare(bz []byte, ptr interface{}) error { - err := ac.amino.UnmarshalBinaryBare(bz, ptr) - if err != nil { - return err - } - return ac.unmarshalAnys(ptr) + return ac.Codec.MustMarshalBinaryLengthPrefixed(o) } func (ac *AminoCodec) UnmarshalBinaryBare(bz []byte, ptr ProtoMarshaler) error { - return ac.AminoUnmarshalBinaryBare(bz, ptr) + return ac.Codec.UnmarshalBinaryBare(bz, ptr) } func (ac *AminoCodec) MustUnmarshalBinaryBare(bz []byte, ptr ProtoMarshaler) { - ac.amino.MustUnmarshalBinaryBare(bz, ptr) - err := ac.unmarshalAnys(ptr) - if err != nil { - panic(err) - } + ac.Codec.MustUnmarshalBinaryBare(bz, ptr) } func (ac *AminoCodec) UnmarshalBinaryLengthPrefixed(bz []byte, ptr ProtoMarshaler) error { - err := ac.amino.UnmarshalBinaryLengthPrefixed(bz, ptr) - if err != nil { - return err - } - return ac.unmarshalAnys(ptr) + return ac.Codec.UnmarshalBinaryLengthPrefixed(bz, ptr) } func (ac *AminoCodec) MustUnmarshalBinaryLengthPrefixed(bz []byte, ptr ProtoMarshaler) { - ac.amino.MustUnmarshalBinaryLengthPrefixed(bz, ptr) - err := ac.unmarshalAnys(ptr) - if err != nil { - panic(err) - } -} - -func (ac *AminoCodec) MarshalJSON(o interface{}) ([]byte, error) { - err := ac.jsonMarshalAnys(o) - if err != nil { - return nil, err - } - return ac.amino.MarshalJSON(o) -} - -func (ac *AminoCodec) MustMarshalJSON(o interface{}) []byte { - err := ac.jsonMarshalAnys(o) - if err != nil { - panic(err) - } - return ac.amino.MustMarshalJSON(o) -} - -func (ac *AminoCodec) UnmarshalJSON(bz []byte, ptr interface{}) error { - err := ac.amino.UnmarshalJSON(bz, ptr) - if err != nil { - return err - } - return ac.jsonUnmarshalAnys(ptr) -} - -func (ac *AminoCodec) MustUnmarshalJSON(bz []byte, ptr interface{}) { - ac.amino.MustUnmarshalJSON(bz, ptr) - err := ac.jsonUnmarshalAnys(ptr) - if err != nil { - panic(err) - } -} - -func (*AminoCodec) UnpackAny(*types.Any, interface{}) error { - return fmt.Errorf("AminoCodec can't handle unpack protobuf Any's") -} - -func (ac *AminoCodec) Amino() *Codec { - return ac.amino + ac.Codec.MustUnmarshalBinaryLengthPrefixed(bz, ptr) } diff --git a/crypto/keyring/codec.go b/crypto/keyring/codec.go index 35860e71ce4..4dd78c6e843 100644 --- a/crypto/keyring/codec.go +++ b/crypto/keyring/codec.go @@ -12,7 +12,7 @@ var CryptoCdc *codec.Codec func init() { CryptoCdc = codec.New() - cryptoAmino.RegisterAmino(CryptoCdc) + cryptoAmino.RegisterAmino(CryptoCdc.Amino) RegisterCodec(CryptoCdc) CryptoCdc.Seal() } diff --git a/tests/util.go b/tests/util.go index 4435d77d417..8fa138aef8d 100644 --- a/tests/util.go +++ b/tests/util.go @@ -229,7 +229,7 @@ func NewTestCaseDir(t NamedTestingT) (string, func()) { var cdc = codec.New() func init() { - ctypes.RegisterAmino(cdc) + ctypes.RegisterAmino(cdc.Amino) } //DONTCOVER diff --git a/x/auth/client/cli/broadcast.go b/x/auth/client/cli/broadcast.go index a182375cd12..f948dbdd9b8 100644 --- a/x/auth/client/cli/broadcast.go +++ b/x/auth/client/cli/broadcast.go @@ -32,7 +32,7 @@ $ tx broadcast ./mytxn.json return errors.New("cannot broadcast tx during offline mode") } - stdTx, err := client.ReadStdTxFromFile(cliCtx.Marshaler, args[0]) + stdTx, err := client.ReadStdTxFromFile(cliCtx.Codec, args[0]) if err != nil { return err } diff --git a/x/auth/client/cli/encode.go b/x/auth/client/cli/encode.go index 97601060418..245bb0e0f67 100644 --- a/x/auth/client/cli/encode.go +++ b/x/auth/client/cli/encode.go @@ -31,7 +31,7 @@ If you supply a dash (-) argument in place of an input filename, the command rea RunE: func(cmd *cobra.Command, args []string) (err error) { cliCtx := context.NewCLIContext().WithCodec(cdc) - stdTx, err := client.ReadStdTxFromFile(cliCtx.Marshaler, args[0]) + stdTx, err := client.ReadStdTxFromFile(cliCtx.Codec, args[0]) if err != nil { return } diff --git a/x/auth/client/cli/tx_multisign.go b/x/auth/client/cli/tx_multisign.go index 765c0987d0e..0123f3cdb97 100644 --- a/x/auth/client/cli/tx_multisign.go +++ b/x/auth/client/cli/tx_multisign.go @@ -46,7 +46,7 @@ recommended to set such parameters manually. version.ClientName, ), ), - RunE: makeMultiSignCmd(codec.NewAminoCodec(cdc)), + RunE: makeMultiSignCmd(cdc), Args: cobra.MinimumNArgs(3), } @@ -57,7 +57,7 @@ recommended to set such parameters manually. return flags.PostCommands(cmd)[0] } -func makeMultiSignCmd(cdc *codec.AminoCodec) func(cmd *cobra.Command, args []string) error { +func makeMultiSignCmd(cdc *codec.Codec) func(cmd *cobra.Command, args []string) error { return func(cmd *cobra.Command, args []string) (err error) { stdTx, err := client.ReadStdTxFromFile(cdc, args[0]) if err != nil { diff --git a/x/auth/client/cli/tx_sign.go b/x/auth/client/cli/tx_sign.go index e35d6f66011..dc118974a61 100644 --- a/x/auth/client/cli/tx_sign.go +++ b/x/auth/client/cli/tx_sign.go @@ -22,8 +22,7 @@ const ( ) // GetSignCommand returns the transaction sign command. -func GetSignCommand(amino *codec.Codec) *cobra.Command { - cdc := codec.NewAminoCodec(amino) +func GetSignCommand(codec *codec.Codec) *cobra.Command { cmd := &cobra.Command{ Use: "sign [file]", Short: "Sign transactions generated offline", @@ -43,7 +42,7 @@ key. It implies --signature-only. Full multisig signed transactions may eventual be generated via the 'multisign' command. `, PreRun: preSignCmd, - RunE: makeSignCmd(cdc), + RunE: makeSignCmd(codec), Args: cobra.ExactArgs(1), } @@ -72,7 +71,7 @@ func preSignCmd(cmd *cobra.Command, _ []string) { } } -func makeSignCmd(cdc *codec.AminoCodec) func(cmd *cobra.Command, args []string) error { +func makeSignCmd(cdc *codec.Codec) func(cmd *cobra.Command, args []string) error { return func(cmd *cobra.Command, args []string) error { cliCtx, txBldr, stdTx, err := readStdTxAndInitContexts(cdc, cmd, args[0]) if err != nil { @@ -128,12 +127,12 @@ func makeSignCmd(cdc *codec.AminoCodec) func(cmd *cobra.Command, args []string) } } -func getSignatureJSON(cdc codec.JSONMarshaler, newTx types.StdTx, indent, generateSignatureOnly bool) ([]byte, error) { +func getSignatureJSON(cdc *codec.Codec, newTx types.StdTx, indent, generateSignatureOnly bool) ([]byte, error) { switch generateSignatureOnly { case true: switch indent { case true: - return codec.MarshalJSONIndent(cdc, newTx.Signatures[0]) + return cdc.MarshalJSONIndent(newTx.Signatures[0], "", " ") default: return cdc.MarshalJSON(newTx.Signatures[0]) @@ -141,7 +140,7 @@ func getSignatureJSON(cdc codec.JSONMarshaler, newTx types.StdTx, indent, genera default: switch indent { case true: - return codec.MarshalJSONIndent(cdc, newTx) + return cdc.MarshalJSONIndent(newTx, "", " ") default: return cdc.MarshalJSON(newTx) diff --git a/x/auth/client/cli/validate_sigs.go b/x/auth/client/cli/validate_sigs.go index 228893d0e4d..a7b87d38781 100644 --- a/x/auth/client/cli/validate_sigs.go +++ b/x/auth/client/cli/validate_sigs.go @@ -16,7 +16,7 @@ import ( "github.com/cosmos/cosmos-sdk/x/auth/types" ) -func GetValidateSignaturesCommand(amino *codec.Codec) *cobra.Command { +func GetValidateSignaturesCommand(codec *codec.Codec) *cobra.Command { cmd := &cobra.Command{ Use: "validate-signatures [file]", Short: "Validate transactions signatures", @@ -29,14 +29,14 @@ given transaction. If the --offline flag is also set, signature validation over transaction will be not be performed as that will require RPC communication with a full node. `, PreRun: preSignCmd, - RunE: makeValidateSignaturesCmd(codec.NewAminoCodec(amino)), + RunE: makeValidateSignaturesCmd(codec), Args: cobra.ExactArgs(1), } return flags.PostCommands(cmd)[0] } -func makeValidateSignaturesCmd(cdc *codec.AminoCodec) func(cmd *cobra.Command, args []string) error { +func makeValidateSignaturesCmd(cdc *codec.Codec) func(cmd *cobra.Command, args []string) error { return func(cmd *cobra.Command, args []string) error { cliCtx, txBldr, stdTx, err := readStdTxAndInitContexts(cdc, cmd, args[0]) if err != nil { @@ -133,7 +133,7 @@ func printAndValidateSigs( return success } -func readStdTxAndInitContexts(cdc *codec.AminoCodec, cmd *cobra.Command, filename string) ( +func readStdTxAndInitContexts(cdc *codec.Codec, cmd *cobra.Command, filename string) ( context.CLIContext, types.TxBuilder, types.StdTx, error, ) { stdTx, err := client.ReadStdTxFromFile(cdc, filename) @@ -142,7 +142,7 @@ func readStdTxAndInitContexts(cdc *codec.AminoCodec, cmd *cobra.Command, filenam } inBuf := bufio.NewReader(cmd.InOrStdin()) - cliCtx := context.NewCLIContextWithInput(inBuf).WithCodec(cdc.Amino()).WithMarshaler(cdc) + cliCtx := context.NewCLIContextWithInput(inBuf).WithCodec(cdc) txBldr := types.NewTxBuilderFromCLI(inBuf) return cliCtx, txBldr, stdTx, nil diff --git a/x/auth/client/tx.go b/x/auth/client/tx.go index efc37d1c264..c06acf7367a 100644 --- a/x/auth/client/tx.go +++ b/x/auth/client/tx.go @@ -87,12 +87,12 @@ func CompleteAndBroadcastTxCLI(txBldr authtypes.TxBuilder, cliCtx context.CLICon var json []byte if viper.GetBool(flags.FlagIndentResponse) { - json, err = codec.MarshalJSONIndent(cliCtx.Marshaler, stdSignMsg) + json, err = cliCtx.Codec.MarshalJSONIndent(stdSignMsg, "", " ") if err != nil { panic(err) } } else { - json = cliCtx.Marshaler.MustMarshalJSON(stdSignMsg) + json = cliCtx.Codec.MustMarshalJSON(stdSignMsg) } _, _ = fmt.Fprintf(os.Stderr, "%s\n\n", json) @@ -163,9 +163,9 @@ func PrintUnsignedStdTx(txBldr authtypes.TxBuilder, cliCtx context.CLIContext, m var json []byte if viper.GetBool(flags.FlagIndentResponse) { - json, err = codec.MarshalJSONIndent(cliCtx.Marshaler, stdTx) + json, err = cliCtx.Codec.MarshalJSONIndent(stdTx, "", " ") } else { - json, err = cliCtx.Marshaler.MarshalJSON(stdTx) + json, err = cliCtx.Codec.MarshalJSON(stdTx) } if err != nil { return err @@ -231,7 +231,7 @@ func SignStdTxWithSignerAddress( } // Read and decode a StdTx from the given filename. Can pass "-" to read from stdin. -func ReadStdTxFromFile(cdc codec.Marshaler, filename string) (stdTx authtypes.StdTx, err error) { +func ReadStdTxFromFile(cdc *codec.Codec, filename string) (stdTx authtypes.StdTx, err error) { var bytes []byte if filename == "-" { diff --git a/x/simulation/params.go b/x/simulation/params.go index 8a0a80352f0..6363846a09c 100644 --- a/x/simulation/params.go +++ b/x/simulation/params.go @@ -7,7 +7,6 @@ import ( "github.com/tendermint/tendermint/types" - "github.com/tendermint/go-amino" abci "github.com/tendermint/tendermint/abci/types" "github.com/cosmos/cosmos-sdk/codec" @@ -156,7 +155,7 @@ func (w WeightedProposalContent) ContentSimulatorFn() simulation.ContentSimulato // RandomParams returns random simulation consensus parameters, it extracts the Evidence from the Staking genesis state. func RandomConsensusParams(r *rand.Rand, appState json.RawMessage) *abci.ConsensusParams { - cdc := amino.NewCodec() + cdc := codec.New() var genesisState map[string]json.RawMessage From 5b2700c984f4c7c57b0cdace1ecf118819dbf711 Mon Sep 17 00:00:00 2001 From: Aaron Craelius Date: Thu, 14 May 2020 14:33:29 -0400 Subject: [PATCH 16/42] Fix errors --- codec/amino.go | 4 ++++ simapp/cmd/simcli/main.go | 7 ++++--- simapp/cmd/simd/genaccounts.go | 5 +++-- x/auth/client/cli/decode.go | 6 +++--- x/auth/client/cli/tx_multisign.go | 16 ++++++---------- x/auth/types/stdtx.go | 24 ++++-------------------- 6 files changed, 24 insertions(+), 38 deletions(-) diff --git a/codec/amino.go b/codec/amino.go index f14f5645df6..6a8d7ba0236 100644 --- a/codec/amino.go +++ b/codec/amino.go @@ -202,3 +202,7 @@ func (cdc *Codec) RegisterInterface(ptr interface{}, iopts *amino.InterfaceOptio func (cdc *Codec) RegisterConcrete(o interface{}, name string, copts *amino.ConcreteOptions) { cdc.Amino.RegisterConcrete(o, name, copts) } + +func (cdc *Codec) MarshalJSONIndent(o interface{}, prefix, indent string) ([]byte, error) { + return cdc.Amino.MarshalJSONIndent(o, prefix, indent) +} diff --git a/simapp/cmd/simcli/main.go b/simapp/cmd/simcli/main.go index 337fa166e3f..d2207f31dd7 100644 --- a/simapp/cmd/simcli/main.go +++ b/simapp/cmd/simcli/main.go @@ -5,9 +5,10 @@ import ( "os" "path" + "github.com/cosmos/cosmos-sdk/codec" + "github.com/spf13/cobra" "github.com/spf13/viper" - "github.com/tendermint/go-amino" "github.com/tendermint/tendermint/libs/cli" "github.com/cosmos/cosmos-sdk/client" @@ -81,7 +82,7 @@ func main() { } } -func queryCmd(cdc *amino.Codec) *cobra.Command { +func queryCmd(cdc *codec.Codec) *cobra.Command { queryCmd := &cobra.Command{ Use: "query", Aliases: []string{"q"}, @@ -107,7 +108,7 @@ func queryCmd(cdc *amino.Codec) *cobra.Command { return queryCmd } -func txCmd(cdc *amino.Codec) *cobra.Command { +func txCmd(cdc *codec.Codec) *cobra.Command { txCmd := &cobra.Command{ Use: "tx", Short: "Transactions subcommands", diff --git a/simapp/cmd/simd/genaccounts.go b/simapp/cmd/simd/genaccounts.go index 98efeedc7e7..0a6015104d1 100644 --- a/simapp/cmd/simd/genaccounts.go +++ b/simapp/cmd/simd/genaccounts.go @@ -5,12 +5,13 @@ import ( "errors" "fmt" + "github.com/cosmos/cosmos-sdk/codec" + "github.com/cosmos/cosmos-sdk/std" "github.com/spf13/cobra" "github.com/spf13/viper" - "github.com/tendermint/go-amino" "github.com/tendermint/tendermint/libs/cli" "github.com/cosmos/cosmos-sdk/client/flags" @@ -33,7 +34,7 @@ const ( // AddGenesisAccountCmd returns add-genesis-account cobra Command. func AddGenesisAccountCmd( - ctx *server.Context, depCdc *amino.Codec, cdc *std.Codec, defaultNodeHome, defaultClientHome string, + ctx *server.Context, depCdc *codec.Codec, cdc *std.Codec, defaultNodeHome, defaultClientHome string, ) *cobra.Command { cmd := &cobra.Command{ diff --git a/x/auth/client/cli/decode.go b/x/auth/client/cli/decode.go index f4eb7e954fb..9e12507e4bc 100644 --- a/x/auth/client/cli/decode.go +++ b/x/auth/client/cli/decode.go @@ -6,10 +6,10 @@ import ( "github.com/spf13/cobra" "github.com/spf13/viper" - "github.com/tendermint/go-amino" "github.com/cosmos/cosmos-sdk/client/context" "github.com/cosmos/cosmos-sdk/client/flags" + "github.com/cosmos/cosmos-sdk/codec" authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" ) @@ -17,7 +17,7 @@ const flagHex = "hex" // GetDecodeCommand returns the decode command to take Amino-serialized bytes // and turn it into a JSONified transaction. -func GetDecodeCommand(codec *amino.Codec) *cobra.Command { +func GetDecodeCommand(codec *codec.Codec) *cobra.Command { cmd := &cobra.Command{ Use: "decode [amino-byte-string]", Short: "Decode an amino-encoded transaction string.", @@ -29,7 +29,7 @@ func GetDecodeCommand(codec *amino.Codec) *cobra.Command { return flags.PostCommands(cmd)[0] } -func runDecodeTxString(codec *amino.Codec) func(cmd *cobra.Command, args []string) (err error) { +func runDecodeTxString(codec *codec.Codec) func(cmd *cobra.Command, args []string) (err error) { return func(cmd *cobra.Command, args []string) (err error) { cliCtx := context.NewCLIContext().WithCodec(codec).WithOutput(cmd.OutOrStdout()) var txBytes []byte diff --git a/x/auth/client/cli/tx_multisign.go b/x/auth/client/cli/tx_multisign.go index 0123f3cdb97..71375da72e0 100644 --- a/x/auth/client/cli/tx_multisign.go +++ b/x/auth/client/cli/tx_multisign.go @@ -81,7 +81,7 @@ func makeMultiSignCmd(cdc *codec.Codec) func(cmd *cobra.Command, args []string) multisigPub := multisigInfo.GetPubKey().(multisig.PubKeyMultisigThreshold) multisigSig := multisig.NewMultisig(len(multisigPub.PubKeys)) - cliCtx := context.NewCLIContextWithInput(inBuf).WithMarshaler(cdc) + cliCtx := context.NewCLIContextWithInput(inBuf).WithCodec(cdc) txBldr := types.NewTxBuilderFromCLI(inBuf) if !cliCtx.Offline { @@ -113,22 +113,18 @@ func makeMultiSignCmd(cdc *codec.Codec) func(cmd *cobra.Command, args []string) } } - bz, err := cdc.AminoMarshalBinaryBare(multisigSig) - if err != nil { - panic(err) - } - newStdSig := types.StdSignature{Signature: bz, PubKey: multisigPub.Bytes()} //nolint:staticcheck - newTx := types.NewStdTx(stdTx.GetMsgs(), stdTx.Fee, []types.StdSignature{newStdSig}, stdTx.GetMemo()) //nolint:staticcheck + newStdSig := types.StdSignature{Signature: cdc.MustMarshalBinaryBare(multisigSig), PubKey: multisigPub.Bytes()} //nolint:staticcheck + newTx := types.NewStdTx(stdTx.GetMsgs(), stdTx.Fee, []types.StdSignature{newStdSig}, stdTx.GetMemo()) //nolint:staticcheck sigOnly := viper.GetBool(flagSigOnly) var json []byte switch { case sigOnly && cliCtx.Indent: - json, err = codec.MarshalJSONIndent(cdc, newTx.Signatures[0]) + json, err = cdc.MarshalJSONIndent(newTx.Signatures[0], "", " ") case sigOnly && !cliCtx.Indent: json, err = cdc.MarshalJSON(newTx.Signatures[0]) case !sigOnly && cliCtx.Indent: - json, err = codec.MarshalJSONIndent(cdc, newTx) + json, err = cdc.MarshalJSONIndent(newTx, "", " ") default: json, err = cdc.MarshalJSON(newTx) } @@ -155,7 +151,7 @@ func makeMultiSignCmd(cdc *codec.Codec) func(cmd *cobra.Command, args []string) } } -func readAndUnmarshalStdSignature(cdc codec.JSONMarshaler, filename string) (stdSig types.StdSignature, err error) { //nolint:staticcheck +func readAndUnmarshalStdSignature(cdc *codec.Codec, filename string) (stdSig types.StdSignature, err error) { //nolint:staticcheck var bytes []byte if bytes, err = ioutil.ReadFile(filename); err != nil { return diff --git a/x/auth/types/stdtx.go b/x/auth/types/stdtx.go index 82893d8a55e..16d7f319408 100644 --- a/x/auth/types/stdtx.go +++ b/x/auth/types/stdtx.go @@ -4,8 +4,6 @@ import ( "encoding/json" "fmt" - "github.com/cosmos/cosmos-sdk/codec/types" - "github.com/tendermint/tendermint/crypto" "github.com/tendermint/tendermint/crypto/multisig" yaml "gopkg.in/yaml.v2" @@ -320,8 +318,7 @@ type StdSignature struct { } // DefaultTxDecoder logic for standard transaction decoding -func DefaultTxDecoder(amino *codec.Codec) sdk.TxDecoder { - cdc := codec.NewAminoCodec(amino) +func DefaultTxDecoder(cdc *codec.Codec) sdk.TxDecoder { return func(txBytes []byte) (sdk.Tx, error) { var tx = StdTx{} @@ -331,7 +328,7 @@ func DefaultTxDecoder(amino *codec.Codec) sdk.TxDecoder { // StdTx.Msg is an interface. The concrete types // are registered by MakeTxCodec - err := cdc.AminoUnmarshalBinaryBare(txBytes, &tx) + err := cdc.UnmarshalBinaryBare(txBytes, &tx) if err != nil { return nil, sdkerrors.Wrap(sdkerrors.ErrTxDecode, err.Error()) } @@ -341,21 +338,8 @@ func DefaultTxDecoder(amino *codec.Codec) sdk.TxDecoder { } // DefaultTxEncoder logic for standard transaction encoding -func DefaultTxEncoder(amino *codec.Codec) sdk.TxEncoder { - cdc := codec.NewAminoCodec(amino) +func DefaultTxEncoder(cdc *codec.Codec) sdk.TxEncoder { return func(tx sdk.Tx) ([]byte, error) { - return cdc.AminoMarshalBinaryBare(tx) - } -} - -var _ types.UnpackInterfacesMessage = StdTx{} - -func (tx StdTx) UnpackInterfaces(unpacker types.AnyUnpacker) error { - for _, m := range tx.Msgs { - err := types.UnpackInterfaces(m, unpacker) - if err != nil { - return err - } + return cdc.MarshalBinaryBare(tx) } - return nil } From 06c2d034afcce84da299d75a75bed971ed832fa4 Mon Sep 17 00:00:00 2001 From: Aaron Craelius Date: Thu, 14 May 2020 14:39:58 -0400 Subject: [PATCH 17/42] Fixes --- codec/amino.go | 92 ++++++++++++++++++++++++++------------------------ 1 file changed, 48 insertions(+), 44 deletions(-) diff --git a/codec/amino.go b/codec/amino.go index 6a8d7ba0236..46d5cda9f10 100644 --- a/codec/amino.go +++ b/codec/amino.go @@ -79,113 +79,113 @@ func MustMarshalJSONIndent(m JSONMarshaler, obj interface{}) []byte { return bz } -func (ac *Codec) marshalAnys(o interface{}) error { - return types.UnpackInterfaces(o, types.AminoPacker{Cdc: ac.Amino}) +func (cdc *Codec) marshalAnys(o interface{}) error { + return types.UnpackInterfaces(o, types.AminoPacker{Cdc: cdc.Amino}) } -func (ac *Codec) unmarshalAnys(o interface{}) error { - return types.UnpackInterfaces(o, types.AminoUnpacker{Cdc: ac.Amino}) +func (cdc *Codec) unmarshalAnys(o interface{}) error { + return types.UnpackInterfaces(o, types.AminoUnpacker{Cdc: cdc.Amino}) } -func (ac *Codec) jsonMarshalAnys(o interface{}) error { - return types.UnpackInterfaces(o, types.AminoJSONPacker{Cdc: ac.Amino}) +func (cdc *Codec) jsonMarshalAnys(o interface{}) error { + return types.UnpackInterfaces(o, types.AminoJSONPacker{Cdc: cdc.Amino}) } -func (ac *Codec) jsonUnmarshalAnys(o interface{}) error { - return types.UnpackInterfaces(o, types.AminoJSONUnpacker{Cdc: ac.Amino}) +func (cdc *Codec) jsonUnmarshalAnys(o interface{}) error { + return types.UnpackInterfaces(o, types.AminoJSONUnpacker{Cdc: cdc.Amino}) } -func (ac *Codec) MarshalBinaryBare(o interface{}) ([]byte, error) { - err := ac.marshalAnys(o) +func (cdc *Codec) MarshalBinaryBare(o interface{}) ([]byte, error) { + err := cdc.marshalAnys(o) if err != nil { return nil, err } - return ac.Amino.MarshalBinaryBare(o) + return cdc.Amino.MarshalBinaryBare(o) } -func (ac *Codec) MustMarshalBinaryBare(o interface{}) []byte { - err := ac.marshalAnys(o) +func (cdc *Codec) MustMarshalBinaryBare(o interface{}) []byte { + err := cdc.marshalAnys(o) if err != nil { panic(err) } - return ac.Amino.MustMarshalBinaryBare(o) + return cdc.Amino.MustMarshalBinaryBare(o) } -func (ac *Codec) MarshalBinaryLengthPrefixed(o interface{}) ([]byte, error) { - err := ac.marshalAnys(o) +func (cdc *Codec) MarshalBinaryLengthPrefixed(o interface{}) ([]byte, error) { + err := cdc.marshalAnys(o) if err != nil { return nil, err } - return ac.Amino.MarshalBinaryLengthPrefixed(o) + return cdc.Amino.MarshalBinaryLengthPrefixed(o) } -func (ac *Codec) MustMarshalBinaryLengthPrefixed(o interface{}) []byte { - err := ac.marshalAnys(o) +func (cdc *Codec) MustMarshalBinaryLengthPrefixed(o interface{}) []byte { + err := cdc.marshalAnys(o) if err != nil { panic(err) } - return ac.Amino.MustMarshalBinaryLengthPrefixed(o) + return cdc.Amino.MustMarshalBinaryLengthPrefixed(o) } -func (ac *Codec) UnmarshalBinaryBare(bz []byte, ptr interface{}) error { - err := ac.Amino.UnmarshalBinaryBare(bz, ptr) +func (cdc *Codec) UnmarshalBinaryBare(bz []byte, ptr interface{}) error { + err := cdc.Amino.UnmarshalBinaryBare(bz, ptr) if err != nil { return err } - return ac.unmarshalAnys(ptr) + return cdc.unmarshalAnys(ptr) } -func (ac *Codec) MustUnmarshalBinaryBare(bz []byte, ptr interface{}) { - ac.Amino.MustUnmarshalBinaryBare(bz, ptr) - err := ac.unmarshalAnys(ptr) +func (cdc *Codec) MustUnmarshalBinaryBare(bz []byte, ptr interface{}) { + cdc.Amino.MustUnmarshalBinaryBare(bz, ptr) + err := cdc.unmarshalAnys(ptr) if err != nil { panic(err) } } -func (ac *Codec) UnmarshalBinaryLengthPrefixed(bz []byte, ptr interface{}) error { - err := ac.Amino.UnmarshalBinaryLengthPrefixed(bz, ptr) +func (cdc *Codec) UnmarshalBinaryLengthPrefixed(bz []byte, ptr interface{}) error { + err := cdc.Amino.UnmarshalBinaryLengthPrefixed(bz, ptr) if err != nil { return err } - return ac.unmarshalAnys(ptr) + return cdc.unmarshalAnys(ptr) } -func (ac *Codec) MustUnmarshalBinaryLengthPrefixed(bz []byte, ptr interface{}) { - ac.Amino.MustUnmarshalBinaryLengthPrefixed(bz, ptr) - err := ac.unmarshalAnys(ptr) +func (cdc *Codec) MustUnmarshalBinaryLengthPrefixed(bz []byte, ptr interface{}) { + cdc.Amino.MustUnmarshalBinaryLengthPrefixed(bz, ptr) + err := cdc.unmarshalAnys(ptr) if err != nil { panic(err) } } -func (ac *Codec) MarshalJSON(o interface{}) ([]byte, error) { - err := ac.jsonMarshalAnys(o) +func (cdc *Codec) MarshalJSON(o interface{}) ([]byte, error) { + err := cdc.jsonMarshalAnys(o) if err != nil { return nil, err } - return ac.Amino.MarshalJSON(o) + return cdc.Amino.MarshalJSON(o) } -func (ac *Codec) MustMarshalJSON(o interface{}) []byte { - err := ac.jsonMarshalAnys(o) +func (cdc *Codec) MustMarshalJSON(o interface{}) []byte { + err := cdc.jsonMarshalAnys(o) if err != nil { panic(err) } - return ac.Amino.MustMarshalJSON(o) + return cdc.Amino.MustMarshalJSON(o) } -func (ac *Codec) UnmarshalJSON(bz []byte, ptr interface{}) error { - err := ac.Amino.UnmarshalJSON(bz, ptr) +func (cdc *Codec) UnmarshalJSON(bz []byte, ptr interface{}) error { + err := cdc.Amino.UnmarshalJSON(bz, ptr) if err != nil { return err } - return ac.jsonUnmarshalAnys(ptr) + return cdc.jsonUnmarshalAnys(ptr) } -func (ac *Codec) MustUnmarshalJSON(bz []byte, ptr interface{}) { - ac.Amino.MustUnmarshalJSON(bz, ptr) - err := ac.jsonUnmarshalAnys(ptr) +func (cdc *Codec) MustUnmarshalJSON(bz []byte, ptr interface{}) { + cdc.Amino.MustUnmarshalJSON(bz, ptr) + err := cdc.jsonUnmarshalAnys(ptr) if err != nil { panic(err) } @@ -204,5 +204,9 @@ func (cdc *Codec) RegisterConcrete(o interface{}, name string, copts *amino.Conc } func (cdc *Codec) MarshalJSONIndent(o interface{}, prefix, indent string) ([]byte, error) { + err := cdc.jsonMarshalAnys(o) + if err != nil { + panic(err) + } return cdc.Amino.MarshalJSONIndent(o, prefix, indent) } From ad482e44fee5d79c670a411f3aa8a72fe0d416d5 Mon Sep 17 00:00:00 2001 From: Aaron Craelius Date: Thu, 14 May 2020 15:25:26 -0400 Subject: [PATCH 18/42] Fix tests --- codec/types/amino_compat.go | 16 ++++++++++------ types/result.go | 19 +++++++++++++++++++ x/auth/types/stdtx.go | 13 +++++++++++++ 3 files changed, 42 insertions(+), 6 deletions(-) diff --git a/codec/types/amino_compat.go b/codec/types/amino_compat.go index 9bb920dbcfc..705594f83a9 100644 --- a/codec/types/amino_compat.go +++ b/codec/types/amino_compat.go @@ -3,8 +3,7 @@ package types import ( "fmt" "reflect" - - "github.com/pkg/errors" + "runtime/debug" "github.com/gogo/protobuf/proto" @@ -19,10 +18,15 @@ type aminoCompat struct { const errorExplaination = ", this is likely because UnpackInterfacesMessage is not defined for some type which contains a protobuf Any either directly or via one of its members" +func aminoCompatError(errType string, x interface{}) error { + debug.PrintStack() + return fmt.Errorf("amino marshaling error: %s %+v"+errorExplaination, errType, x) +} + func (any Any) MarshalAmino() ([]byte, error) { ac := any.aminoCompat if ac == nil { - return nil, errors.WithStack(fmt.Errorf("can't amino unmarshal %+v"+errorExplaination, any)) + return nil, aminoCompatError("binary unmarshal", any) } return ac.bz, ac.err } @@ -38,7 +42,7 @@ func (any *Any) UnmarshalAmino(bz []byte) error { func (any Any) MarshalJSON() ([]byte, error) { ac := any.aminoCompat if ac == nil { - return nil, errors.WithStack(fmt.Errorf("can't JSON marshal %+v"+errorExplaination, any)) + return nil, aminoCompatError("JSON marshal", any) } return ac.jsonBz, ac.err } @@ -62,7 +66,7 @@ var _ AnyUnpacker = AminoUnpacker{} func (a AminoUnpacker) UnpackAny(any *Any, iface interface{}) error { ac := any.aminoCompat if ac == nil { - return errors.WithStack(fmt.Errorf("can't amino unmarshal %T"+errorExplaination, iface)) + return aminoCompatError("binary unmarshal", reflect.TypeOf(iface)) } err := a.Cdc.UnmarshalBinaryBare(ac.bz, iface) if err != nil { @@ -121,7 +125,7 @@ var _ AnyUnpacker = AminoJSONUnpacker{} func (a AminoJSONUnpacker) UnpackAny(any *Any, iface interface{}) error { ac := any.aminoCompat if ac == nil { - return errors.WithStack(fmt.Errorf("can't amino unmarshal %T"+errorExplaination, iface)) + return aminoCompatError("JSON unmarshal", reflect.TypeOf(iface)) } err := a.Cdc.UnmarshalJSON(ac.jsonBz, iface) if err != nil { diff --git a/types/result.go b/types/result.go index 41fad03b0cf..d15dd8f2237 100644 --- a/types/result.go +++ b/types/result.go @@ -7,6 +7,8 @@ import ( "math" "strings" + "github.com/cosmos/cosmos-sdk/codec/types" + yaml "gopkg.in/yaml.v2" "github.com/cosmos/cosmos-sdk/codec" @@ -264,3 +266,20 @@ func ParseABCILogs(logs string) (res ABCIMessageLogs, err error) { err = json.Unmarshal([]byte(logs), &res) return res, err } + +var _ types.UnpackInterfacesMessage = SearchTxsResult{} +var _ types.UnpackInterfacesMessage = TxResponse{} + +func (s SearchTxsResult) UnpackInterfaces(unpacker types.AnyUnpacker) error { + for _, tx := range s.Txs { + err := types.UnpackInterfaces(tx, unpacker) + if err != nil { + return err + } + } + return nil +} + +func (r TxResponse) UnpackInterfaces(unpacker types.AnyUnpacker) error { + return types.UnpackInterfaces(r.Tx, unpacker) +} diff --git a/x/auth/types/stdtx.go b/x/auth/types/stdtx.go index 16d7f319408..3f5eb1e4107 100644 --- a/x/auth/types/stdtx.go +++ b/x/auth/types/stdtx.go @@ -9,6 +9,7 @@ import ( yaml "gopkg.in/yaml.v2" "github.com/cosmos/cosmos-sdk/codec" + codectypes "github.com/cosmos/cosmos-sdk/codec/types" sdk "github.com/cosmos/cosmos-sdk/types" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" "github.com/cosmos/cosmos-sdk/x/auth/exported" @@ -343,3 +344,15 @@ func DefaultTxEncoder(cdc *codec.Codec) sdk.TxEncoder { return cdc.MarshalBinaryBare(tx) } } + +var _ codectypes.UnpackInterfacesMessage = StdTx{} + +func (tx StdTx) UnpackInterfaces(unpacker codectypes.AnyUnpacker) error { + for _, m := range tx.Msgs { + err := codectypes.UnpackInterfaces(m, unpacker) + if err != nil { + return err + } + } + return nil +} From 0ff09a43babebfb5aba37b4a79f88dbc4fd31312 Mon Sep 17 00:00:00 2001 From: Aaron Craelius Date: Thu, 14 May 2020 15:44:36 -0400 Subject: [PATCH 19/42] Test fixes --- codec/amino_codec_test.go | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/codec/amino_codec_test.go b/codec/amino_codec_test.go index ff0a85efa55..48f5830adbd 100644 --- a/codec/amino_codec_test.go +++ b/codec/amino_codec_test.go @@ -6,14 +6,13 @@ import ( "github.com/cosmos/cosmos-sdk/codec/types" "github.com/stretchr/testify/require" - amino "github.com/tendermint/go-amino" "github.com/cosmos/cosmos-sdk/codec" "github.com/cosmos/cosmos-sdk/codec/testdata" ) -func createTestCodec() *amino.Codec { - cdc := amino.NewCodec() +func createTestCodec() *codec.Codec { + cdc := codec.New() cdc.RegisterInterface((*testdata.Animal)(nil), nil) cdc.RegisterConcrete(testdata.Dog{}, "testdata/Dog", nil) From 33b04ff4df457cf4d88092159feb2e020f7385a7 Mon Sep 17 00:00:00 2001 From: Aaron Craelius Date: Thu, 14 May 2020 16:44:18 -0400 Subject: [PATCH 20/42] Fix tests --- codec/types/interface_registry.go | 2 +- x/auth/client/cli/broadcast_test.go | 11 ++++++----- x/bank/keeper/invariants.go | 2 +- 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/codec/types/interface_registry.go b/codec/types/interface_registry.go index 6cfa38af08f..015b7228a6d 100644 --- a/codec/types/interface_registry.go +++ b/codec/types/interface_registry.go @@ -112,7 +112,7 @@ func (registry *interfaceRegistry) RegisterImplementations(iface interface{}, im } func (registry *interfaceRegistry) UnpackAny(any *Any, iface interface{}) error { - if len(any.Value) == 0 || any.TypeUrl == "" { + if any.TypeUrl == "" { return nil } diff --git a/x/auth/client/cli/broadcast_test.go b/x/auth/client/cli/broadcast_test.go index d75a0b0c890..be7368dad24 100644 --- a/x/auth/client/cli/broadcast_test.go +++ b/x/auth/client/cli/broadcast_test.go @@ -5,17 +5,18 @@ import ( "path/filepath" "testing" + "github.com/cosmos/cosmos-sdk/codec" + "github.com/spf13/viper" "github.com/stretchr/testify/require" - "github.com/tendermint/go-amino" "github.com/cosmos/cosmos-sdk/client/flags" "github.com/cosmos/cosmos-sdk/tests" ) func TestGetBroadcastCommand_OfflineFlag(t *testing.T) { - codec := amino.NewCodec() - cmd := GetBroadcastCommand(codec) + cdc := codec.New() + cmd := GetBroadcastCommand(cdc) viper.Set(flags.FlagOffline, true) @@ -24,8 +25,8 @@ func TestGetBroadcastCommand_OfflineFlag(t *testing.T) { } func TestGetBroadcastCommand_WithoutOfflineFlag(t *testing.T) { - codec := amino.NewCodec() - cmd := GetBroadcastCommand(codec) + cdc := codec.New() + cmd := GetBroadcastCommand(cdc) viper.Set(flags.FlagOffline, false) diff --git a/x/bank/keeper/invariants.go b/x/bank/keeper/invariants.go index 4f573c582b1..136242f4a5e 100644 --- a/x/bank/keeper/invariants.go +++ b/x/bank/keeper/invariants.go @@ -49,7 +49,7 @@ func NonnegativeBalanceInvariant(k ViewKeeper) sdk.Invariant { // TotalSupply checks that the total supply reflects all the coins held in accounts func TotalSupply(k Keeper) sdk.Invariant { return func(ctx sdk.Context) (string, bool) { - var expectedTotal sdk.Coins + var expectedTotal sdk.Coins = []sdk.Coin{} supply := k.GetSupply(ctx) k.IterateAllBalances(ctx, func(_ sdk.AccAddress, balance sdk.Coin) bool { From 72a89a1f3bc977b9b96e7686d783286c46dbe965 Mon Sep 17 00:00:00 2001 From: Aaron Craelius Date: Thu, 14 May 2020 17:02:55 -0400 Subject: [PATCH 21/42] Linting --- client/context/context.go | 4 ---- codec/amino.go | 3 ++- codec/amino_codec.go | 2 +- types/result.go | 3 +-- x/auth/client/cli/broadcast_test.go | 3 +-- x/bank/keeper/invariants.go | 2 +- x/gov/types/codec.go | 2 +- x/gov/types/genesis.go | 1 - x/gov/types/msgs.go | 2 +- 9 files changed, 8 insertions(+), 14 deletions(-) diff --git a/client/context/context.go b/client/context/context.go index 43c8ab30d66..1e8b91deff9 100644 --- a/client/context/context.go +++ b/client/context/context.go @@ -169,10 +169,6 @@ func (ctx CLIContext) WithMarshaler(m codec.Marshaler) CLIContext { // TODO: Deprecated (remove). func (ctx CLIContext) WithCodec(cdc *codec.Codec) CLIContext { ctx.Codec = cdc - // Marshaler is set here for backwards compatibility with amino-only code - if ctx.Marshaler == nil { - ctx.Marshaler = codec.NewAminoCodec(cdc) - } return ctx } diff --git a/codec/amino.go b/codec/amino.go index 46d5cda9f10..e58b2f1e6b5 100644 --- a/codec/amino.go +++ b/codec/amino.go @@ -25,7 +25,8 @@ func init() { Cdc = cdc.Seal() } -// Codec defines a type alias for an Amino codec. +// Codec defines a wrapper for an Amino codec that properly handles protobuf +// types with Any's type Codec struct { Amino *amino.Codec } diff --git a/codec/amino_codec.go b/codec/amino_codec.go index 36b634a3cb6..e239dc93287 100644 --- a/codec/amino_codec.go +++ b/codec/amino_codec.go @@ -9,7 +9,7 @@ type AminoCodec struct { var _ Marshaler = &AminoCodec{} func NewAminoCodec(Codec *Codec) *AminoCodec { - return &AminoCodec{Codec} + return &AminoCodec{Codec: Codec} } func (ac *AminoCodec) MarshalBinaryBare(o ProtoMarshaler) ([]byte, error) { diff --git a/types/result.go b/types/result.go index d15dd8f2237..006e71f9a46 100644 --- a/types/result.go +++ b/types/result.go @@ -7,11 +7,10 @@ import ( "math" "strings" - "github.com/cosmos/cosmos-sdk/codec/types" - yaml "gopkg.in/yaml.v2" "github.com/cosmos/cosmos-sdk/codec" + "github.com/cosmos/cosmos-sdk/codec/types" ctypes "github.com/tendermint/tendermint/rpc/core/types" ) diff --git a/x/auth/client/cli/broadcast_test.go b/x/auth/client/cli/broadcast_test.go index be7368dad24..11d41df89e5 100644 --- a/x/auth/client/cli/broadcast_test.go +++ b/x/auth/client/cli/broadcast_test.go @@ -5,12 +5,11 @@ import ( "path/filepath" "testing" - "github.com/cosmos/cosmos-sdk/codec" - "github.com/spf13/viper" "github.com/stretchr/testify/require" "github.com/cosmos/cosmos-sdk/client/flags" + "github.com/cosmos/cosmos-sdk/codec" "github.com/cosmos/cosmos-sdk/tests" ) diff --git a/x/bank/keeper/invariants.go b/x/bank/keeper/invariants.go index 136242f4a5e..8df31fccc1b 100644 --- a/x/bank/keeper/invariants.go +++ b/x/bank/keeper/invariants.go @@ -49,7 +49,7 @@ func NonnegativeBalanceInvariant(k ViewKeeper) sdk.Invariant { // TotalSupply checks that the total supply reflects all the coins held in accounts func TotalSupply(k Keeper) sdk.Invariant { return func(ctx sdk.Context) (string, bool) { - var expectedTotal sdk.Coins = []sdk.Coin{} + expectedTotal := []sdk.Coin{} supply := k.GetSupply(ctx) k.IterateAllBalances(ctx, func(_ sdk.AccAddress, balance sdk.Coin) bool { diff --git a/x/gov/types/codec.go b/x/gov/types/codec.go index 0ac77df0985..2397c1f87d9 100644 --- a/x/gov/types/codec.go +++ b/x/gov/types/codec.go @@ -30,7 +30,7 @@ func RegisterInterfaces(registry types.InterfaceRegistry) { } // RegisterProposalTypeCodec registers an external proposal content type defined -// in another module for the internal ModuleCdc. This allows the MsgSubmitProposalLegacy +// 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 diff --git a/x/gov/types/genesis.go b/x/gov/types/genesis.go index ec816ec9fde..6d43942049c 100644 --- a/x/gov/types/genesis.go +++ b/x/gov/types/genesis.go @@ -4,7 +4,6 @@ import ( "fmt" "github.com/cosmos/cosmos-sdk/codec/types" - sdk "github.com/cosmos/cosmos-sdk/types" ) diff --git a/x/gov/types/msgs.go b/x/gov/types/msgs.go index 859e29342d0..7b26d7ac350 100644 --- a/x/gov/types/msgs.go +++ b/x/gov/types/msgs.go @@ -24,7 +24,7 @@ var _ MsgSubmitProposalI = &MsgSubmitProposal{} var _ types.UnpackInterfacesMessage = MsgSubmitProposal{} // MsgSubmitProposalI defines the specific interface a concrete message must -// implement in order to process governance proposals. The concrete MsgSubmitProposalLegacy +// implement in order to process governance proposals. The concrete MsgSubmitProposal // must be defined at the application-level. type MsgSubmitProposalI interface { sdk.Msg From f6fa2ba30d58cfcfe8b7147f6483a0e22697eedd Mon Sep 17 00:00:00 2001 From: Aaron Craelius Date: Fri, 15 May 2020 10:19:52 -0400 Subject: [PATCH 22/42] Update ADR 019 and CHANGELOG --- CHANGELOG.md | 2 ++ .../adr-019-protobuf-state-encoding.md | 18 ++++++++++++++++++ 2 files changed, 20 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index d2f48915550..f6767e32c10 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -97,6 +97,8 @@ information on how to implement the new `Keyring` interface. * [\#5858](https://github.com/cosmos/cosmos-sdk/pull/5858) Make Keyring store keys by name and address's hexbytes representation. * (x/evidence) [\#5952](https://github.com/cosmos/cosmos-sdk/pull/5952) Remove APIs for getting and setting `x/evidence` parameters. `BaseApp` now uses a `ParamStore` to manage Tendermint consensus parameters which is managed via the `x/params` `Substore` type. * (export) [\#5952](https://github.com/cosmos/cosmos-sdk/pull/5952) `AppExporter` now returns ABCI consensus parameters to be included in marshaled exported state. These parameters must be returned from the application via the `BaseApp`. +* (codec) `*codec.Codec` is now a wrapper around Amino which provides proper backwards compatibility with protobuf `Any`. ALL legacy code +should use `*codec.Codec` instead of `*amino.Codec` directly * (x/gov) [\#6147](https://github.com/cosmos/cosmos-sdk/pull/6147) The `Content` field on `Proposal` and `MsgSubmitProposal` is now `Any` in concordance with [ADR 019](docs/architecture/adr-019-protobuf-state-encoding.md) and `GetContent` should now be used to retrieve the actual proposal `Content`. Also the `NewMsgSubmitProposal` constructor now may return an `error` diff --git a/docs/architecture/adr-019-protobuf-state-encoding.md b/docs/architecture/adr-019-protobuf-state-encoding.md index 079c07ac3b8..da51a12bee1 100644 --- a/docs/architecture/adr-019-protobuf-state-encoding.md +++ b/docs/architecture/adr-019-protobuf-state-encoding.md @@ -5,6 +5,8 @@ - 2020 Feb 15: Initial Draft - 2020 Feb 24: Updates to handle messages with interface fields - 2020 Apr 27: Convert usages of `oneof` for interfaces to `Any` +- 2020 Apr 27: Convert usages of `oneof` for interfaces to `Any` +- 2020 May 15: Describe amino compatibility ## Status @@ -299,6 +301,22 @@ func (msg MsgSubmitEvidence) GetEvidence() eviexported.Evidence { } ``` +### Amino Compatibility + +Our custom implementation of `Any` can be used transparently with Amino if used +with the proper codec instance. What this means is that interfaces packed within +`Any`s will be amino marshaled like regular Amino interfaces (assuming they +have been registered properly with Amino). + +In order for this functionality to work: +* **all legacy code must use `*codec.Codec` instead of `*amino.Codec` which is +now a wrapper which properly handles `Any`** +* **all new code should use `Marshaler` which is compatible with both amino and +protobuf + +Also, before v0.39, `codec.Codec` will be renamed to `codec.LegacyAmino`. + + ### Why Wasn't X Chosen Instead For a more complete comparison to alternative protocols, see [here](https://codeburst.io/json-vs-protocol-buffers-vs-flatbuffers-a4247f8bda6f). From f3dbd902eea07ed3db3f4856b0d7c14b80798b94 Mon Sep 17 00:00:00 2001 From: Aaron Craelius Date: Fri, 15 May 2020 10:23:53 -0400 Subject: [PATCH 23/42] Updated ADR 019 --- docs/architecture/adr-019-protobuf-state-encoding.md | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/docs/architecture/adr-019-protobuf-state-encoding.md b/docs/architecture/adr-019-protobuf-state-encoding.md index da51a12bee1..33b87253e36 100644 --- a/docs/architecture/adr-019-protobuf-state-encoding.md +++ b/docs/architecture/adr-019-protobuf-state-encoding.md @@ -178,6 +178,14 @@ type InterfaceRegistry interface { In addition to serving as a whitelist, `InterfaceRegistry` can also serve to communicate the list of concrete types that satisfy an interface to clients. +In .proto files: +* fields which accept interfaces should be annotated with `cosmos_proto.accepts_interface` +using the same full-qualified name passed as `protoName` to `InterfaceRegistry.RegisterInterface` +* interface implementations should be annotated with `cosmos_proto.implements_interface` +using the same full-qualified name passed as `protoName` to `InterfaceRegistry.RegisterInterface` + +In the future, `protoName`, `cosmos_proto.accepts_interface`, `cosmos_proto.implements_interface` +may be used via code generation, reflection &/or static linting. The same struct that implements `InterfaceRegistry` will also implement an interface `InterfaceUnpacker` to be used for unpacking `Any`s: From 8a5353609929780c5e48bbbff4d445cafe5a71a4 Mon Sep 17 00:00:00 2001 From: Aaron Craelius Date: Fri, 15 May 2020 12:10:44 -0400 Subject: [PATCH 24/42] Extract Marshal/UnmarshalProposal --- x/gov/keeper/proposal.go | 25 +++++++++++++++++++------ 1 file changed, 19 insertions(+), 6 deletions(-) diff --git a/x/gov/keeper/proposal.go b/x/gov/keeper/proposal.go index 47a4bdbfc10..6b6b8d16bc1 100644 --- a/x/gov/keeper/proposal.go +++ b/x/gov/keeper/proposal.go @@ -61,7 +61,7 @@ func (keeper Keeper) GetProposal(ctx sdk.Context, proposalID uint64) (types.Prop } var proposal types.Proposal - err := keeper.cdc.UnmarshalBinaryBare(bz, &proposal) + err := keeper.UnmarshalProposal(bz, &proposal) if err != nil { panic(err) } @@ -73,10 +73,7 @@ func (keeper Keeper) GetProposal(ctx sdk.Context, proposalID uint64) (types.Prop func (keeper Keeper) SetProposal(ctx sdk.Context, proposal types.Proposal) { store := ctx.KVStore(keeper.storeKey) - bz, err := keeper.cdc.MarshalBinaryBare(&proposal) - if err != nil { - panic(err) - } + bz := keeper.MarshalProposal(proposal) store.Set(types.ProposalKey(proposal.ProposalID), bz) } @@ -102,7 +99,7 @@ func (keeper Keeper) IterateProposals(ctx sdk.Context, cb func(proposal types.Pr for ; iterator.Valid(); iterator.Next() { var proposal types.Proposal - err := keeper.cdc.UnmarshalBinaryBare(iterator.Value(), &proposal) + err := keeper.UnmarshalProposal(iterator.Value(), &proposal) if err != nil { panic(err) } @@ -196,3 +193,19 @@ func (keeper Keeper) ActivateVotingPeriod(ctx sdk.Context, proposal types.Propos keeper.RemoveFromInactiveProposalQueue(ctx, proposal.ProposalID, proposal.DepositEndTime) keeper.InsertActiveProposalQueue(ctx, proposal.ProposalID, proposal.VotingEndTime) } + +func (keeper Keeper) MarshalProposal(proposal types.Proposal) []byte { + bz, err := keeper.cdc.MarshalBinaryBare(&proposal) + if err != nil { + panic(err) + } + return bz +} + +func (keeper Keeper) UnmarshalProposal(bz []byte, proposal *types.Proposal) error { + err := keeper.cdc.UnmarshalBinaryBare(bz, proposal) + if err != nil { + return err + } + return nil +} From e5c90d2dbeb6294ecc92b30b2bb85850c71eb7cb Mon Sep 17 00:00:00 2001 From: Aaron Craelius Date: Fri, 15 May 2020 12:20:12 -0400 Subject: [PATCH 25/42] fix error --- x/bank/keeper/invariants.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/x/bank/keeper/invariants.go b/x/bank/keeper/invariants.go index 8df31fccc1b..f06cde01119 100644 --- a/x/bank/keeper/invariants.go +++ b/x/bank/keeper/invariants.go @@ -49,7 +49,7 @@ func NonnegativeBalanceInvariant(k ViewKeeper) sdk.Invariant { // TotalSupply checks that the total supply reflects all the coins held in accounts func TotalSupply(k Keeper) sdk.Invariant { return func(ctx sdk.Context) (string, bool) { - expectedTotal := []sdk.Coin{} + expectedTotal := sdk.Coins{} supply := k.GetSupply(ctx) k.IterateAllBalances(ctx, func(_ sdk.AccAddress, balance sdk.Coin) bool { From ccf589a241f8011ef64523b2a4caf0b4960cdffa Mon Sep 17 00:00:00 2001 From: Aaron Craelius Date: Fri, 15 May 2020 12:22:37 -0400 Subject: [PATCH 26/42] lint --- codec/amino_codec.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/codec/amino_codec.go b/codec/amino_codec.go index e239dc93287..a7cf476bae8 100644 --- a/codec/amino_codec.go +++ b/codec/amino_codec.go @@ -8,8 +8,8 @@ type AminoCodec struct { var _ Marshaler = &AminoCodec{} -func NewAminoCodec(Codec *Codec) *AminoCodec { - return &AminoCodec{Codec: Codec} +func NewAminoCodec(codec *Codec) *AminoCodec { + return &AminoCodec{Codec: codec} } func (ac *AminoCodec) MarshalBinaryBare(o ProtoMarshaler) ([]byte, error) { From ba93a7e917e716705b7391a2d8da9fb9b15ec998 Mon Sep 17 00:00:00 2001 From: Aaron Craelius Date: Fri, 15 May 2020 13:06:45 -0400 Subject: [PATCH 27/42] linting --- CHANGELOG.md | 4 ++-- docs/architecture/adr-019-protobuf-state-encoding.md | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index f6767e32c10..6384005aca8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -97,8 +97,8 @@ information on how to implement the new `Keyring` interface. * [\#5858](https://github.com/cosmos/cosmos-sdk/pull/5858) Make Keyring store keys by name and address's hexbytes representation. * (x/evidence) [\#5952](https://github.com/cosmos/cosmos-sdk/pull/5952) Remove APIs for getting and setting `x/evidence` parameters. `BaseApp` now uses a `ParamStore` to manage Tendermint consensus parameters which is managed via the `x/params` `Substore` type. * (export) [\#5952](https://github.com/cosmos/cosmos-sdk/pull/5952) `AppExporter` now returns ABCI consensus parameters to be included in marshaled exported state. These parameters must be returned from the application via the `BaseApp`. -* (codec) `*codec.Codec` is now a wrapper around Amino which provides proper backwards compatibility with protobuf `Any`. ALL legacy code -should use `*codec.Codec` instead of `*amino.Codec` directly +* (codec) `*codec.Codec` is now a wrapper around Amino which provides backwards compatibility with protobuf `Any`. +ALL legacy code should use `*codec.Codec` instead of `*amino.Codec` directly * (x/gov) [\#6147](https://github.com/cosmos/cosmos-sdk/pull/6147) The `Content` field on `Proposal` and `MsgSubmitProposal` is now `Any` in concordance with [ADR 019](docs/architecture/adr-019-protobuf-state-encoding.md) and `GetContent` should now be used to retrieve the actual proposal `Content`. Also the `NewMsgSubmitProposal` constructor now may return an `error` diff --git a/docs/architecture/adr-019-protobuf-state-encoding.md b/docs/architecture/adr-019-protobuf-state-encoding.md index 33b87253e36..5b1aa0c12db 100644 --- a/docs/architecture/adr-019-protobuf-state-encoding.md +++ b/docs/architecture/adr-019-protobuf-state-encoding.md @@ -6,7 +6,7 @@ - 2020 Feb 24: Updates to handle messages with interface fields - 2020 Apr 27: Convert usages of `oneof` for interfaces to `Any` - 2020 Apr 27: Convert usages of `oneof` for interfaces to `Any` -- 2020 May 15: Describe amino compatibility +- 2020 May 15: Describe `cosmos_proto` extensions and amino compatibility ## Status From 065f051a3dfc0086aade1d3bc7c05d96ebe386d7 Mon Sep 17 00:00:00 2001 From: Aaron Craelius Date: Fri, 15 May 2020 13:07:44 -0400 Subject: [PATCH 28/42] linting From 3915704acadaf4169219d7c22b61fcad777ab999 Mon Sep 17 00:00:00 2001 From: Aaron Craelius Date: Fri, 15 May 2020 13:08:30 -0400 Subject: [PATCH 29/42] Update client/keys/parse.go Co-authored-by: Marko --- client/keys/parse.go | 1 - 1 file changed, 1 deletion(-) diff --git a/client/keys/parse.go b/client/keys/parse.go index 22051791370..f3b4ce3fcbc 100644 --- a/client/keys/parse.go +++ b/client/keys/parse.go @@ -15,7 +15,6 @@ import ( "github.com/tendermint/tendermint/libs/cli" "github.com/cosmos/cosmos-sdk/types/bech32" - "github.com/cosmos/cosmos-sdk/client/flags" sdk "github.com/cosmos/cosmos-sdk/types" ) From 83bfba740845d75ce9e5b0e7563791de3c80e1c0 Mon Sep 17 00:00:00 2001 From: Aaron Craelius Date: Fri, 15 May 2020 13:09:03 -0400 Subject: [PATCH 30/42] linting --- docs/architecture/adr-019-protobuf-state-encoding.md | 1 - 1 file changed, 1 deletion(-) diff --git a/docs/architecture/adr-019-protobuf-state-encoding.md b/docs/architecture/adr-019-protobuf-state-encoding.md index 5b1aa0c12db..51e375e69a6 100644 --- a/docs/architecture/adr-019-protobuf-state-encoding.md +++ b/docs/architecture/adr-019-protobuf-state-encoding.md @@ -5,7 +5,6 @@ - 2020 Feb 15: Initial Draft - 2020 Feb 24: Updates to handle messages with interface fields - 2020 Apr 27: Convert usages of `oneof` for interfaces to `Any` -- 2020 Apr 27: Convert usages of `oneof` for interfaces to `Any` - 2020 May 15: Describe `cosmos_proto` extensions and amino compatibility ## Status From fa169dca224f9e02ca8b8e868975a16e6f4f2ce8 Mon Sep 17 00:00:00 2001 From: Aaron Craelius Date: Mon, 18 May 2020 13:55:24 -0400 Subject: [PATCH 31/42] Update docs/architecture/adr-019-protobuf-state-encoding.md Co-authored-by: Alexander Bezobchuk --- docs/architecture/adr-019-protobuf-state-encoding.md | 1 - 1 file changed, 1 deletion(-) diff --git a/docs/architecture/adr-019-protobuf-state-encoding.md b/docs/architecture/adr-019-protobuf-state-encoding.md index 51e375e69a6..c4afa72e37d 100644 --- a/docs/architecture/adr-019-protobuf-state-encoding.md +++ b/docs/architecture/adr-019-protobuf-state-encoding.md @@ -323,7 +323,6 @@ protobuf Also, before v0.39, `codec.Codec` will be renamed to `codec.LegacyAmino`. - ### Why Wasn't X Chosen Instead For a more complete comparison to alternative protocols, see [here](https://codeburst.io/json-vs-protocol-buffers-vs-flatbuffers-a4247f8bda6f). From 50d4b36aac0e6f2da7407e06fd734adfb13c20d3 Mon Sep 17 00:00:00 2001 From: Aaron Craelius Date: Mon, 18 May 2020 13:56:31 -0400 Subject: [PATCH 32/42] Update docs/architecture/adr-019-protobuf-state-encoding.md Co-authored-by: Alexander Bezobchuk --- docs/architecture/adr-019-protobuf-state-encoding.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/architecture/adr-019-protobuf-state-encoding.md b/docs/architecture/adr-019-protobuf-state-encoding.md index c4afa72e37d..3abddd7921a 100644 --- a/docs/architecture/adr-019-protobuf-state-encoding.md +++ b/docs/architecture/adr-019-protobuf-state-encoding.md @@ -319,7 +319,7 @@ In order for this functionality to work: * **all legacy code must use `*codec.Codec` instead of `*amino.Codec` which is now a wrapper which properly handles `Any`** * **all new code should use `Marshaler` which is compatible with both amino and -protobuf +protobuf** Also, before v0.39, `codec.Codec` will be renamed to `codec.LegacyAmino`. From 34141d871adb2410c6a8baf829ebaddaa685e1b1 Mon Sep 17 00:00:00 2001 From: Aaron Craelius Date: Mon, 18 May 2020 15:31:18 -0400 Subject: [PATCH 33/42] Address review feedback --- codec/amino.go | 3 ++- codec/types/amino_compat.go | 7 ++++--- types/result.go | 3 +-- x/gov/keeper/proposal.go | 14 ++++++++++++++ x/gov/types/genesis.go | 1 + x/gov/types/msgs.go | 3 +-- x/gov/types/proposal.go | 6 +++--- x/upgrade/module.go | 5 ++--- 8 files changed, 28 insertions(+), 14 deletions(-) diff --git a/codec/amino.go b/codec/amino.go index e58b2f1e6b5..8a17d4c1e77 100644 --- a/codec/amino.go +++ b/codec/amino.go @@ -34,7 +34,8 @@ type Codec struct { var _ JSONMarshaler = &Codec{} func (cdc *Codec) Seal() *Codec { - return &Codec{cdc.Amino.Seal()} + cdc.Amino.Seal() + return cdc } func New() *Codec { diff --git a/codec/types/amino_compat.go b/codec/types/amino_compat.go index 705594f83a9..c67147a4167 100644 --- a/codec/types/amino_compat.go +++ b/codec/types/amino_compat.go @@ -16,11 +16,12 @@ type aminoCompat struct { err error } -const errorExplaination = ", this is likely because UnpackInterfacesMessage is not defined for some type which contains a protobuf Any either directly or via one of its members" - func aminoCompatError(errType string, x interface{}) error { debug.PrintStack() - return fmt.Errorf("amino marshaling error: %s %+v"+errorExplaination, errType, x) + return fmt.Errorf( + "amino %s Any marshaling error for %+v, this is likely because amino is being used directly (instead of codec.Codec which is preferred) or UnpackInterfacesMessage is not defined for some type which contains a protobuf Any either directly or via one of its members", + errType, x, + ) } func (any Any) MarshalAmino() ([]byte, error) { diff --git a/types/result.go b/types/result.go index 006e71f9a46..7b28ae52a57 100644 --- a/types/result.go +++ b/types/result.go @@ -266,8 +266,7 @@ func ParseABCILogs(logs string) (res ABCIMessageLogs, err error) { return res, err } -var _ types.UnpackInterfacesMessage = SearchTxsResult{} -var _ types.UnpackInterfacesMessage = TxResponse{} +var _, _ types.UnpackInterfacesMessage = SearchTxsResult{}, TxResponse{} func (s SearchTxsResult) UnpackInterfaces(unpacker types.AnyUnpacker) error { for _, tx := range s.Txs { diff --git a/x/gov/keeper/proposal.go b/x/gov/keeper/proposal.go index 6b6b8d16bc1..0d2e65fc939 100644 --- a/x/gov/keeper/proposal.go +++ b/x/gov/keeper/proposal.go @@ -209,3 +209,17 @@ func (keeper Keeper) UnmarshalProposal(bz []byte, proposal *types.Proposal) erro } return nil } + +func (keeper Keeper) MustMarshalProposal(proposal types.Proposal) { + err := keeper.MarshalProposal(proposal) + if err != nil { + panic(err) + } +} + +func (keeper Keeper) MustUnmarshalProposal(bz []byte, proposal *types.Proposal) { + err := keeper.UnmarshalProposal(bz, proposal) + if err != nil { + panic(err) + } +} diff --git a/x/gov/types/genesis.go b/x/gov/types/genesis.go index 6d43942049c..45c8e21ad70 100644 --- a/x/gov/types/genesis.go +++ b/x/gov/types/genesis.go @@ -77,6 +77,7 @@ func ValidateGenesis(data GenesisState) error { var _ types.UnpackInterfacesMessage = GenesisState{} +// UnpackInterfaces implements UnpackInterfacesMessage.UnpackInterfaces func (data GenesisState) UnpackInterfaces(unpacker types.AnyUnpacker) error { for _, p := range data.Proposals { err := p.UnpackInterfaces(unpacker) diff --git a/x/gov/types/msgs.go b/x/gov/types/msgs.go index 7b26d7ac350..675998c070a 100644 --- a/x/gov/types/msgs.go +++ b/x/gov/types/msgs.go @@ -3,8 +3,6 @@ package types import ( "fmt" - "gopkg.in/yaml.v2" - "github.com/gogo/protobuf/proto" "github.com/cosmos/cosmos-sdk/codec/types" @@ -134,6 +132,7 @@ func (m MsgSubmitProposal) String() string { return string(out) } +// UnpackInterfaces implements UnpackInterfacesMessage.UnpackInterfaces func (m MsgSubmitProposal) UnpackInterfaces(unpacker types.AnyUnpacker) error { var content Content return unpacker.UnpackAny(m.Content, &content) diff --git a/x/gov/types/proposal.go b/x/gov/types/proposal.go index a098a87a0d9..5f14257145f 100644 --- a/x/gov/types/proposal.go +++ b/x/gov/types/proposal.go @@ -6,8 +6,6 @@ import ( "strings" "time" - "gopkg.in/yaml.v2" - "github.com/gogo/protobuf/proto" "github.com/cosmos/cosmos-sdk/codec/types" @@ -31,7 +29,7 @@ func NewProposal(content Content, id uint64, submitTime, depositEndTime time.Tim msg, ok := content.(proto.Message) if !ok { - return Proposal{}, fmt.Errorf("can't proto marshal %T", content) + return Proposal{}, fmt.Errorf("%T does not implement proto.Message", content) } any, err := types.NewAnyWithValue(msg) @@ -82,6 +80,7 @@ func (p Proposal) GetTitle() string { return content.GetTitle() } +// UnpackInterfaces implements UnpackInterfacesMessage.UnpackInterfaces func (p Proposal) UnpackInterfaces(unpacker types.AnyUnpacker) error { var content Content return unpacker.UnpackAny(p.Content, &content) @@ -118,6 +117,7 @@ func (p Proposals) String() string { return strings.TrimSpace(out) } +// UnpackInterfaces implements UnpackInterfacesMessage.UnpackInterfaces func (p Proposals) UnpackInterfaces(unpacker types.AnyUnpacker) error { for _, x := range p { err := x.UnpackInterfaces(unpacker) diff --git a/x/upgrade/module.go b/x/upgrade/module.go index 46b0ad3febc..f2c94d76278 100644 --- a/x/upgrade/module.go +++ b/x/upgrade/module.go @@ -6,18 +6,17 @@ import ( "github.com/gorilla/mux" "github.com/spf13/cobra" - codectypes "github.com/cosmos/cosmos-sdk/codec/types" - types "github.com/cosmos/cosmos-sdk/x/upgrade/types" - abci "github.com/tendermint/tendermint/abci/types" "github.com/cosmos/cosmos-sdk/client/context" "github.com/cosmos/cosmos-sdk/client/flags" "github.com/cosmos/cosmos-sdk/codec" + codectypes "github.com/cosmos/cosmos-sdk/codec/types" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/types/module" "github.com/cosmos/cosmos-sdk/x/upgrade/client/cli" "github.com/cosmos/cosmos-sdk/x/upgrade/client/rest" + types "github.com/cosmos/cosmos-sdk/x/upgrade/types" ) // module codec From 63561a841ceab0d2d29ad7ea0b88787342cac70e Mon Sep 17 00:00:00 2001 From: Aaron Craelius Date: Mon, 18 May 2020 15:37:57 -0400 Subject: [PATCH 34/42] Add godocs --- types/result.go | 2 ++ x/gov/module.go | 1 + 2 files changed, 3 insertions(+) diff --git a/types/result.go b/types/result.go index 7b28ae52a57..f080605f15e 100644 --- a/types/result.go +++ b/types/result.go @@ -268,6 +268,7 @@ func ParseABCILogs(logs string) (res ABCIMessageLogs, err error) { var _, _ types.UnpackInterfacesMessage = SearchTxsResult{}, TxResponse{} +// UnpackInterfaces implements UnpackInterfacesMessage.UnpackInterfaces func (s SearchTxsResult) UnpackInterfaces(unpacker types.AnyUnpacker) error { for _, tx := range s.Txs { err := types.UnpackInterfaces(tx, unpacker) @@ -278,6 +279,7 @@ func (s SearchTxsResult) UnpackInterfaces(unpacker types.AnyUnpacker) error { return nil } +// UnpackInterfaces implements UnpackInterfacesMessage.UnpackInterfaces func (r TxResponse) UnpackInterfaces(unpacker types.AnyUnpacker) error { return types.UnpackInterfaces(r.Tx, unpacker) } diff --git a/x/gov/module.go b/x/gov/module.go index 6aaf6e77a51..54d7e3817c6 100644 --- a/x/gov/module.go +++ b/x/gov/module.go @@ -97,6 +97,7 @@ func (AppModuleBasic) GetQueryCmd(cdc *codec.Codec) *cobra.Command { return cli.GetQueryCmd(StoreKey, cdc) } +// RegisterInterfaceTypes implements InterfaceModule.RegisterInterfaceTypes func (a AppModuleBasic) RegisterInterfaceTypes(registry codectypes.InterfaceRegistry) { types.RegisterInterfaces(registry) } From 22d8af782b529440b09d639685ef5fecf26dea60 Mon Sep 17 00:00:00 2001 From: Aaron Craelius Date: Mon, 18 May 2020 15:41:05 -0400 Subject: [PATCH 35/42] Fix errors From a005332e836286b307038637472118c26f8eb05f Mon Sep 17 00:00:00 2001 From: Aaron Craelius Date: Mon, 18 May 2020 15:48:50 -0400 Subject: [PATCH 36/42] fix errors --- x/gov/types/msgs.go | 2 ++ x/gov/types/proposal.go | 2 ++ 2 files changed, 4 insertions(+) diff --git a/x/gov/types/msgs.go b/x/gov/types/msgs.go index 675998c070a..d3a15a4575b 100644 --- a/x/gov/types/msgs.go +++ b/x/gov/types/msgs.go @@ -3,6 +3,8 @@ package types import ( "fmt" + "gopkg.in/yaml.v2" + "github.com/gogo/protobuf/proto" "github.com/cosmos/cosmos-sdk/codec/types" diff --git a/x/gov/types/proposal.go b/x/gov/types/proposal.go index 5f14257145f..eb41825612d 100644 --- a/x/gov/types/proposal.go +++ b/x/gov/types/proposal.go @@ -6,6 +6,8 @@ import ( "strings" "time" + "gopkg.in/yaml.v2" + "github.com/gogo/protobuf/proto" "github.com/cosmos/cosmos-sdk/codec/types" From c1bad36c4977feaf54570075c8902a54a9ac45a5 Mon Sep 17 00:00:00 2001 From: Aaron Craelius Date: Mon, 18 May 2020 15:56:21 -0400 Subject: [PATCH 37/42] revert file --- client/keys/parse.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/client/keys/parse.go b/client/keys/parse.go index f3b4ce3fcbc..26b109e6714 100644 --- a/client/keys/parse.go +++ b/client/keys/parse.go @@ -12,9 +12,9 @@ import ( "github.com/spf13/viper" yaml "gopkg.in/yaml.v2" + "github.com/cosmos/cosmos-sdk/types/bech32" "github.com/tendermint/tendermint/libs/cli" - "github.com/cosmos/cosmos-sdk/types/bech32" "github.com/cosmos/cosmos-sdk/client/flags" sdk "github.com/cosmos/cosmos-sdk/types" ) From c09e2987c0a4346c544b79d2b56d347037adc4b0 Mon Sep 17 00:00:00 2001 From: Aaron Craelius Date: Tue, 19 May 2020 14:12:49 -0400 Subject: [PATCH 38/42] Address review feedback --- codec/amino.go | 11 +++++------ types/result.go | 2 ++ x/gov/keeper/proposal.go | 18 ++++++++---------- x/gov/types/msgs.go | 10 +++++----- 4 files changed, 20 insertions(+), 21 deletions(-) diff --git a/codec/amino.go b/codec/amino.go index 8a17d4c1e77..a03df5da366 100644 --- a/codec/amino.go +++ b/codec/amino.go @@ -19,10 +19,10 @@ import ( var Cdc *Codec func init() { - cdc := New() - RegisterCrypto(cdc) - RegisterEvidences(cdc) - Cdc = cdc.Seal() + Cdc := New() + RegisterCrypto(Cdc) + RegisterEvidences(Cdc) + Cdc.Seal() } // Codec defines a wrapper for an Amino codec that properly handles protobuf @@ -33,9 +33,8 @@ type Codec struct { var _ JSONMarshaler = &Codec{} -func (cdc *Codec) Seal() *Codec { +func (cdc *Codec) Seal() { cdc.Amino.Seal() - return cdc } func New() *Codec { diff --git a/types/result.go b/types/result.go index f080605f15e..a8e8016cbe5 100644 --- a/types/result.go +++ b/types/result.go @@ -271,6 +271,8 @@ var _, _ types.UnpackInterfacesMessage = SearchTxsResult{}, TxResponse{} // UnpackInterfaces implements UnpackInterfacesMessage.UnpackInterfaces func (s SearchTxsResult) UnpackInterfaces(unpacker types.AnyUnpacker) error { for _, tx := range s.Txs { + // types.UnpackInterfaces needs to be called for each nested tx to unpack + // interfaces in each Tx err := types.UnpackInterfaces(tx, unpacker) if err != nil { return err diff --git a/x/gov/keeper/proposal.go b/x/gov/keeper/proposal.go index 0d2e65fc939..51a17dc37ec 100644 --- a/x/gov/keeper/proposal.go +++ b/x/gov/keeper/proposal.go @@ -61,10 +61,7 @@ func (keeper Keeper) GetProposal(ctx sdk.Context, proposalID uint64) (types.Prop } var proposal types.Proposal - err := keeper.UnmarshalProposal(bz, &proposal) - if err != nil { - panic(err) - } + keeper.MustUnmarshalProposal(bz, &proposal) return proposal, true } @@ -73,7 +70,7 @@ func (keeper Keeper) GetProposal(ctx sdk.Context, proposalID uint64) (types.Prop func (keeper Keeper) SetProposal(ctx sdk.Context, proposal types.Proposal) { store := ctx.KVStore(keeper.storeKey) - bz := keeper.MarshalProposal(proposal) + bz := keeper.MustMarshalProposal(proposal) store.Set(types.ProposalKey(proposal.ProposalID), bz) } @@ -194,12 +191,12 @@ func (keeper Keeper) ActivateVotingPeriod(ctx sdk.Context, proposal types.Propos keeper.InsertActiveProposalQueue(ctx, proposal.ProposalID, proposal.VotingEndTime) } -func (keeper Keeper) MarshalProposal(proposal types.Proposal) []byte { +func (keeper Keeper) MarshalProposal(proposal types.Proposal) ([]byte, error) { bz, err := keeper.cdc.MarshalBinaryBare(&proposal) if err != nil { - panic(err) + return nil, err } - return bz + return bz, nil } func (keeper Keeper) UnmarshalProposal(bz []byte, proposal *types.Proposal) error { @@ -210,11 +207,12 @@ func (keeper Keeper) UnmarshalProposal(bz []byte, proposal *types.Proposal) erro return nil } -func (keeper Keeper) MustMarshalProposal(proposal types.Proposal) { - err := keeper.MarshalProposal(proposal) +func (keeper Keeper) MustMarshalProposal(proposal types.Proposal) []byte { + bz, err := keeper.MarshalProposal(proposal) if err != nil { panic(err) } + return bz } func (keeper Keeper) MustUnmarshalProposal(bz []byte, proposal *types.Proposal) { diff --git a/x/gov/types/msgs.go b/x/gov/types/msgs.go index d3a15a4575b..fca38785f59 100644 --- a/x/gov/types/msgs.go +++ b/x/gov/types/msgs.go @@ -3,8 +3,6 @@ package types import ( "fmt" - "gopkg.in/yaml.v2" - "github.com/gogo/protobuf/proto" "github.com/cosmos/cosmos-sdk/codec/types" @@ -19,9 +17,11 @@ const ( TypeMsgSubmitProposal = "submit_proposal" ) -var _, _, _ sdk.Msg = MsgSubmitProposal{}, MsgDeposit{}, MsgVote{} -var _ MsgSubmitProposalI = &MsgSubmitProposal{} -var _ types.UnpackInterfacesMessage = MsgSubmitProposal{} +var ( + _, _, _ sdk.Msg = MsgSubmitProposal{}, MsgDeposit{}, MsgVote{} + _ MsgSubmitProposalI = &MsgSubmitProposal{} + _ types.UnpackInterfacesMessage = MsgSubmitProposal{} +) // MsgSubmitProposalI defines the specific interface a concrete message must // implement in order to process governance proposals. The concrete MsgSubmitProposal From 0e159e70f22c31b81fbb8a4c826c93a121a7668e Mon Sep 17 00:00:00 2001 From: Aaron Craelius Date: Tue, 19 May 2020 14:31:55 -0400 Subject: [PATCH 39/42] Address review feedback --- codec/amino.go | 21 +++++++++------------ x/gov/client/cli/tx.go | 4 +++- x/gov/types/msgs.go | 2 ++ 3 files changed, 14 insertions(+), 13 deletions(-) diff --git a/codec/amino.go b/codec/amino.go index a03df5da366..b8000a49170 100644 --- a/codec/amino.go +++ b/codec/amino.go @@ -105,11 +105,11 @@ func (cdc *Codec) MarshalBinaryBare(o interface{}) ([]byte, error) { } func (cdc *Codec) MustMarshalBinaryBare(o interface{}) []byte { - err := cdc.marshalAnys(o) + bz, err := cdc.MarshalBinaryBare(o) if err != nil { panic(err) } - return cdc.Amino.MustMarshalBinaryBare(o) + return bz } func (cdc *Codec) MarshalBinaryLengthPrefixed(o interface{}) ([]byte, error) { @@ -121,11 +121,11 @@ func (cdc *Codec) MarshalBinaryLengthPrefixed(o interface{}) ([]byte, error) { } func (cdc *Codec) MustMarshalBinaryLengthPrefixed(o interface{}) []byte { - err := cdc.marshalAnys(o) + bz, err := cdc.MarshalBinaryLengthPrefixed(o) if err != nil { panic(err) } - return cdc.Amino.MustMarshalBinaryLengthPrefixed(o) + return bz } func (cdc *Codec) UnmarshalBinaryBare(bz []byte, ptr interface{}) error { @@ -137,8 +137,7 @@ func (cdc *Codec) UnmarshalBinaryBare(bz []byte, ptr interface{}) error { } func (cdc *Codec) MustUnmarshalBinaryBare(bz []byte, ptr interface{}) { - cdc.Amino.MustUnmarshalBinaryBare(bz, ptr) - err := cdc.unmarshalAnys(ptr) + err := cdc.UnmarshalBinaryBare(bz, ptr) if err != nil { panic(err) } @@ -153,8 +152,7 @@ func (cdc *Codec) UnmarshalBinaryLengthPrefixed(bz []byte, ptr interface{}) erro } func (cdc *Codec) MustUnmarshalBinaryLengthPrefixed(bz []byte, ptr interface{}) { - cdc.Amino.MustUnmarshalBinaryLengthPrefixed(bz, ptr) - err := cdc.unmarshalAnys(ptr) + err := cdc.UnmarshalBinaryLengthPrefixed(bz, ptr) if err != nil { panic(err) } @@ -169,11 +167,11 @@ func (cdc *Codec) MarshalJSON(o interface{}) ([]byte, error) { } func (cdc *Codec) MustMarshalJSON(o interface{}) []byte { - err := cdc.jsonMarshalAnys(o) + bz, err := cdc.MarshalJSON(o) if err != nil { panic(err) } - return cdc.Amino.MustMarshalJSON(o) + return bz } func (cdc *Codec) UnmarshalJSON(bz []byte, ptr interface{}) error { @@ -185,8 +183,7 @@ func (cdc *Codec) UnmarshalJSON(bz []byte, ptr interface{}) error { } func (cdc *Codec) MustUnmarshalJSON(bz []byte, ptr interface{}) { - cdc.Amino.MustUnmarshalJSON(bz, ptr) - err := cdc.jsonUnmarshalAnys(ptr) + err := cdc.UnmarshalJSON(bz, ptr) if err != nil { panic(err) } diff --git a/x/gov/client/cli/tx.go b/x/gov/client/cli/tx.go index 045d2f25e87..e35ccd4ae6b 100644 --- a/x/gov/client/cli/tx.go +++ b/x/gov/client/cli/tx.go @@ -6,6 +6,8 @@ import ( "strconv" "strings" + "github.com/cosmos/cosmos-sdk/types/errors" + "github.com/spf13/cobra" "github.com/cosmos/cosmos-sdk/client" @@ -328,7 +330,7 @@ $ %s tx gov submit-proposal --title="Test Proposal" --description="My awesome pr msg, err := types.NewMsgSubmitProposal(content, amount, cliCtx.GetFromAddress()) if err != nil { - return err + return errors.Wrap(err, "can't create new MsgSubmitProposal") } if err := msg.ValidateBasic(); err != nil { return err diff --git a/x/gov/types/msgs.go b/x/gov/types/msgs.go index fca38785f59..a818ee2a3c4 100644 --- a/x/gov/types/msgs.go +++ b/x/gov/types/msgs.go @@ -3,6 +3,8 @@ package types import ( "fmt" + yaml "gopkg.in/yaml.v2" + "github.com/gogo/protobuf/proto" "github.com/cosmos/cosmos-sdk/codec/types" From 5ed861d7fa7057a1b8544c760b0c0fd8fc020f36 Mon Sep 17 00:00:00 2001 From: Aaron Craelius Date: Tue, 19 May 2020 15:02:31 -0400 Subject: [PATCH 40/42] Stacktrace debug flag --- codec/types/amino_compat.go | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/codec/types/amino_compat.go b/codec/types/amino_compat.go index c67147a4167..6cb1223510c 100644 --- a/codec/types/amino_compat.go +++ b/codec/types/amino_compat.go @@ -16,10 +16,19 @@ type aminoCompat struct { err error } +var Debug = false + func aminoCompatError(errType string, x interface{}) error { - debug.PrintStack() + if Debug { + debug.PrintStack() + } return fmt.Errorf( - "amino %s Any marshaling error for %+v, this is likely because amino is being used directly (instead of codec.Codec which is preferred) or UnpackInterfacesMessage is not defined for some type which contains a protobuf Any either directly or via one of its members", + "amino %s Any marshaling error for %+v, this is likely because "+ + "amino is being used directly (instead of codec.Codec which is preferred) "+ + "or UnpackInterfacesMessage is not defined for some type which contains "+ + "a protobuf Any either directly or via one of its members. To see a "+ + "stacktrace of where the error is coming from, set the var Debug = true "+ + "in codec/types/amino_compat.go", errType, x, ) } From 2e14d48bb6338bb215748dace38493411f3187f5 Mon Sep 17 00:00:00 2001 From: Aaron Craelius Date: Tue, 19 May 2020 15:22:38 -0400 Subject: [PATCH 41/42] Fix tests --- codec/amino.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/codec/amino.go b/codec/amino.go index b8000a49170..c1a32a50fb3 100644 --- a/codec/amino.go +++ b/codec/amino.go @@ -19,7 +19,7 @@ import ( var Cdc *Codec func init() { - Cdc := New() + Cdc = New() RegisterCrypto(Cdc) RegisterEvidences(Cdc) Cdc.Seal() From 72ead83d40ac6b8e592000d774f7a463f6071cae Mon Sep 17 00:00:00 2001 From: Aaron Craelius Date: Tue, 19 May 2020 16:00:16 -0400 Subject: [PATCH 42/42] Address review feedback --- codec/amino.go | 2 +- codec/types/interface_registry.go | 1 + types/result.go | 5 +++-- x/distribution/module.go | 1 + x/gov/types/proposal.go | 4 ++-- 5 files changed, 8 insertions(+), 5 deletions(-) diff --git a/codec/amino.go b/codec/amino.go index c1a32a50fb3..53587808e65 100644 --- a/codec/amino.go +++ b/codec/amino.go @@ -25,7 +25,7 @@ func init() { Cdc.Seal() } -// Codec defines a wrapper for an Amino codec that properly handles protobuf +// deprecated: Codec defines a wrapper for an Amino codec that properly handles protobuf // types with Any's type Codec struct { Amino *amino.Codec diff --git a/codec/types/interface_registry.go b/codec/types/interface_registry.go index 015b7228a6d..01df46834c5 100644 --- a/codec/types/interface_registry.go +++ b/codec/types/interface_registry.go @@ -113,6 +113,7 @@ func (registry *interfaceRegistry) RegisterImplementations(iface interface{}, im func (registry *interfaceRegistry) UnpackAny(any *Any, iface interface{}) error { if any.TypeUrl == "" { + // if TypeUrl is empty return nil because without it we can't actually unpack anything return nil } diff --git a/types/result.go b/types/result.go index a8e8016cbe5..1c534081977 100644 --- a/types/result.go +++ b/types/result.go @@ -269,10 +269,11 @@ func ParseABCILogs(logs string) (res ABCIMessageLogs, err error) { var _, _ types.UnpackInterfacesMessage = SearchTxsResult{}, TxResponse{} // UnpackInterfaces implements UnpackInterfacesMessage.UnpackInterfaces +// +// types.UnpackInterfaces needs to be called for each nested Tx because +// there are generally interfaces to unpack in Tx's func (s SearchTxsResult) UnpackInterfaces(unpacker types.AnyUnpacker) error { for _, tx := range s.Txs { - // types.UnpackInterfaces needs to be called for each nested tx to unpack - // interfaces in each Tx err := types.UnpackInterfaces(tx, unpacker) if err != nil { return err diff --git a/x/distribution/module.go b/x/distribution/module.go index 95bbe87e705..b350294214f 100644 --- a/x/distribution/module.go +++ b/x/distribution/module.go @@ -76,6 +76,7 @@ func (AppModuleBasic) GetQueryCmd(cdc *codec.Codec) *cobra.Command { return cli.GetQueryCmd(StoreKey, cdc) } +// RegisterInterfaceTypes implements InterfaceModule func (b AppModuleBasic) RegisterInterfaceTypes(registry cdctypes.InterfaceRegistry) { types.RegisterInterfaces(registry) } diff --git a/x/gov/types/proposal.go b/x/gov/types/proposal.go index eb41825612d..f550e881a55 100644 --- a/x/gov/types/proposal.go +++ b/x/gov/types/proposal.go @@ -6,9 +6,8 @@ import ( "strings" "time" - "gopkg.in/yaml.v2" - "github.com/gogo/protobuf/proto" + yaml "gopkg.in/yaml.v2" "github.com/cosmos/cosmos-sdk/codec/types" sdk "github.com/cosmos/cosmos-sdk/types" @@ -50,6 +49,7 @@ func (p Proposal) String() string { return string(out) } +// GetContent returns the proposal Content func (p Proposal) GetContent() Content { content, ok := p.Content.GetCachedValue().(Content) if !ok {