diff --git a/client/context/context.go b/client/context/context.go index 28bfe8e83..ae0576122 100644 --- a/client/context/context.go +++ b/client/context/context.go @@ -14,6 +14,7 @@ import ( rpcclient "github.com/tendermint/tendermint/rpc/client" "github.com/cosmos/cosmos-sdk/client/flags" + clientx "github.com/cosmos/cosmos-sdk/client/tx" "github.com/cosmos/cosmos-sdk/codec" "github.com/cosmos/cosmos-sdk/crypto/keys" sdk "github.com/cosmos/cosmos-sdk/types" @@ -25,6 +26,8 @@ type CLIContext struct { FromAddress sdk.AccAddress Client rpcclient.Client ChainID string + TxGenerator clientx.Generator + Marshaler codec.Marshaler Keybase keys.Keybase Input io.Reader Output io.Writer @@ -36,13 +39,15 @@ type CLIContext struct { BroadcastMode string Verifier tmlite.Verifier FromName string - Codec *codec.Codec TrustNode bool UseLedger bool Simulate bool GenerateOnly bool Indent bool SkipConfirm bool + + // TODO: Deprecated (remove). + Codec *codec.Codec } // NewCLIContextWithInputAndFrom returns a new initialized CLIContext with parameters from the @@ -130,7 +135,20 @@ func (ctx CLIContext) WithInput(r io.Reader) CLIContext { return ctx } +// WithTxGenerator returns a copy of the CLIContext with an updated TxGenerator. +func (ctx CLIContext) WithTxGenerator(txg clientx.Generator) CLIContext { + ctx.TxGenerator = txg + return ctx +} + +// WithMarshaler returns a copy of the CLIContext with an updated Marshaler. +func (ctx CLIContext) WithMarshaler(m codec.Marshaler) CLIContext { + ctx.Marshaler = m + return ctx +} + // WithCodec returns a copy of the context with an updated codec. +// TODO: Deprecated (remove). func (ctx CLIContext) WithCodec(cdc *codec.Codec) CLIContext { ctx.Codec = cdc return ctx diff --git a/client/tx/tx.go b/client/tx/tx.go new file mode 100644 index 000000000..be25ec754 --- /dev/null +++ b/client/tx/tx.go @@ -0,0 +1,38 @@ +package tx + +import ( + "github.com/cosmos/cosmos-sdk/codec" + sdk "github.com/cosmos/cosmos-sdk/types" +) + +type ( + // Generator defines an interface a client can utilize to generate an + // application-defined concrete transaction type. The type returned must + // implement ClientTx. + Generator interface { + NewTx() ClientTx + } + + // ClientTx defines an interface which an application-defined concrete transaction + // type must implement. Namely, it must be able to set messages, generate + // signatures, and provide canonical bytes to sign over. The transaction must + // also know how to encode itself. + ClientTx interface { + sdk.Tx + codec.ProtoMarshaler + + SetMsgs(...sdk.Msg) error + GetSignatures() []sdk.Signature + SetSignatures(...sdk.Signature) + GetFee() sdk.Fee + SetFee(sdk.Fee) + GetMemo() string + SetMemo(string) + + // CanonicalSignBytes returns the canonical JSON bytes to sign over, given a + // chain ID, along with an account and sequence number. The JSON encoding + // ensures all field names adhere to their proto definition, default values + // are omitted, and follows the JSON Canonical Form. + CanonicalSignBytes(cid string, num, seq uint64) ([]byte, error) + } +) diff --git a/codec/std/codec.pb.go b/codec/std/codec.pb.go index ef4c65543..2d1c5b232 100644 --- a/codec/std/codec.pb.go +++ b/codec/std/codec.pb.go @@ -5,15 +5,20 @@ package std import ( fmt "fmt" + github_com_cosmos_cosmos_sdk_types "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" + types7 "github.com/cosmos/cosmos-sdk/x/bank/types" + types8 "github.com/cosmos/cosmos-sdk/x/crisis/types" types6 "github.com/cosmos/cosmos-sdk/x/distribution/types" github_com_cosmos_cosmos_sdk_x_evidence_exported "github.com/cosmos/cosmos-sdk/x/evidence/exported" types3 "github.com/cosmos/cosmos-sdk/x/evidence/types" github_com_cosmos_cosmos_sdk_x_gov_types "github.com/cosmos/cosmos-sdk/x/gov/types" types4 "github.com/cosmos/cosmos-sdk/x/gov/types" proposal "github.com/cosmos/cosmos-sdk/x/params/types/proposal" + types9 "github.com/cosmos/cosmos-sdk/x/slashing/types" + types10 "github.com/cosmos/cosmos-sdk/x/staking/types" github_com_cosmos_cosmos_sdk_x_supply_exported "github.com/cosmos/cosmos-sdk/x/supply/exported" types2 "github.com/cosmos/cosmos-sdk/x/supply/types" types5 "github.com/cosmos/cosmos-sdk/x/upgrade/types" @@ -319,8 +324,8 @@ func (*Evidence) XXX_OneofWrappers() []interface{} { // MsgSubmitEvidence defines the application-level message type for handling // evidence submission. type MsgSubmitEvidence struct { - Evidence *Evidence `protobuf:"bytes,1,opt,name=evidence,proto3" json:"evidence,omitempty"` - types3.MsgSubmitEvidenceBase `protobuf:"bytes,2,opt,name=base,proto3,embedded=base" json:"base"` + types3.MsgSubmitEvidenceBase `protobuf:"bytes,1,opt,name=base,proto3,embedded=base" json:"base"` + Evidence *Evidence `protobuf:"bytes,2,opt,name=evidence,proto3" json:"evidence,omitempty"` } func (m *MsgSubmitEvidence) Reset() { *m = MsgSubmitEvidence{} } @@ -572,6 +577,378 @@ func (*Content) XXX_OneofWrappers() []interface{} { } } +// 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. +type Transaction struct { + types.StdTxBase `protobuf:"bytes,1,opt,name=base,proto3,embedded=base" json:""` + Msgs []Message `protobuf:"bytes,2,rep,name=msgs,proto3" json:"msgs"` +} + +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_daf09dc2dfa19bb4, []int{7} +} +func (m *Transaction) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *Transaction) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_Transaction.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 *Transaction) XXX_Merge(src proto.Message) { + xxx_messageInfo_Transaction.Merge(m, src) +} +func (m *Transaction) XXX_Size() int { + return m.Size() +} +func (m *Transaction) XXX_DiscardUnknown() { + xxx_messageInfo_Transaction.DiscardUnknown(m) +} + +var xxx_messageInfo_Transaction proto.InternalMessageInfo + +// Message defines the set of valid concrete message types that can be used to +// construct a transaction. +type Message struct { + // sum defines the set of all allowed valid messages defined in modules. + // + // Types that are valid to be assigned to Sum: + // *Message_MsgSend + // *Message_MsgMultiSend + // *Message_MsgVerifyInvariant + // *Message_MsgSetWithdrawAddress + // *Message_MsgWithdrawDelegatorReward + // *Message_MsgWithdrawValidatorCommission + // *Message_MsgFundCommunityPool + // *Message_MsgSubmitEvidence + // *Message_MsgSubmitProposal + // *Message_MsgVote + // *Message_MsgDeposit + // *Message_MsgUnjail + // *Message_MsgCreateValidator + // *Message_MsgEditValidator + // *Message_MsgDelegate + // *Message_MsgBeginRedelegate + // *Message_MsgUndelegate + Sum isMessage_Sum `protobuf_oneof:"sum"` +} + +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_daf09dc2dfa19bb4, []int{8} +} +func (m *Message) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *Message) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_Message.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 *Message) XXX_Merge(src proto.Message) { + xxx_messageInfo_Message.Merge(m, src) +} +func (m *Message) XXX_Size() int { + return m.Size() +} +func (m *Message) XXX_DiscardUnknown() { + xxx_messageInfo_Message.DiscardUnknown(m) +} + +var xxx_messageInfo_Message proto.InternalMessageInfo + +type isMessage_Sum interface { + isMessage_Sum() + MarshalTo([]byte) (int, error) + Size() int +} + +type Message_MsgSend struct { + MsgSend *types7.MsgSend `protobuf:"bytes,1,opt,name=msg_send,json=msgSend,proto3,oneof" json:"msg_send,omitempty"` +} +type Message_MsgMultiSend struct { + MsgMultiSend *types7.MsgMultiSend `protobuf:"bytes,2,opt,name=msg_multi_send,json=msgMultiSend,proto3,oneof" json:"msg_multi_send,omitempty"` +} +type Message_MsgVerifyInvariant struct { + MsgVerifyInvariant *types8.MsgVerifyInvariant `protobuf:"bytes,3,opt,name=msg_verify_invariant,json=msgVerifyInvariant,proto3,oneof" json:"msg_verify_invariant,omitempty"` +} +type Message_MsgSetWithdrawAddress struct { + MsgSetWithdrawAddress *types6.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 *types6.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 *types6.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 *types6.MsgFundCommunityPool `protobuf:"bytes,7,opt,name=msg_fund_community_pool,json=msgFundCommunityPool,proto3,oneof" json:"msg_fund_community_pool,omitempty"` +} +type Message_MsgSubmitEvidence struct { + MsgSubmitEvidence *MsgSubmitEvidence `protobuf:"bytes,8,opt,name=msg_submit_evidence,json=msgSubmitEvidence,proto3,oneof" json:"msg_submit_evidence,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 *types4.MsgVote `protobuf:"bytes,10,opt,name=msg_vote,json=msgVote,proto3,oneof" json:"msg_vote,omitempty"` +} +type Message_MsgDeposit struct { + MsgDeposit *types4.MsgDeposit `protobuf:"bytes,11,opt,name=msg_deposit,json=msgDeposit,proto3,oneof" json:"msg_deposit,omitempty"` +} +type Message_MsgUnjail struct { + MsgUnjail *types9.MsgUnjail `protobuf:"bytes,12,opt,name=msg_unjail,json=msgUnjail,proto3,oneof" json:"msg_unjail,omitempty"` +} +type Message_MsgCreateValidator struct { + MsgCreateValidator *types10.MsgCreateValidator `protobuf:"bytes,13,opt,name=msg_create_validator,json=msgCreateValidator,proto3,oneof" json:"msg_create_validator,omitempty"` +} +type Message_MsgEditValidator struct { + MsgEditValidator *types10.MsgEditValidator `protobuf:"bytes,14,opt,name=msg_edit_validator,json=msgEditValidator,proto3,oneof" json:"msg_edit_validator,omitempty"` +} +type Message_MsgDelegate struct { + MsgDelegate *types10.MsgDelegate `protobuf:"bytes,15,opt,name=msg_delegate,json=msgDelegate,proto3,oneof" json:"msg_delegate,omitempty"` +} +type Message_MsgBeginRedelegate struct { + MsgBeginRedelegate *types10.MsgBeginRedelegate `protobuf:"bytes,16,opt,name=msg_begin_redelegate,json=msgBeginRedelegate,proto3,oneof" json:"msg_begin_redelegate,omitempty"` +} +type Message_MsgUndelegate struct { + MsgUndelegate *types10.MsgUndelegate `protobuf:"bytes,17,opt,name=msg_undelegate,json=msgUndelegate,proto3,oneof" json:"msg_undelegate,omitempty"` +} + +func (*Message_MsgSend) isMessage_Sum() {} +func (*Message_MsgMultiSend) isMessage_Sum() {} +func (*Message_MsgVerifyInvariant) isMessage_Sum() {} +func (*Message_MsgSetWithdrawAddress) isMessage_Sum() {} +func (*Message_MsgWithdrawDelegatorReward) isMessage_Sum() {} +func (*Message_MsgWithdrawValidatorCommission) isMessage_Sum() {} +func (*Message_MsgFundCommunityPool) isMessage_Sum() {} +func (*Message_MsgSubmitEvidence) isMessage_Sum() {} +func (*Message_MsgSubmitProposal) isMessage_Sum() {} +func (*Message_MsgVote) isMessage_Sum() {} +func (*Message_MsgDeposit) isMessage_Sum() {} +func (*Message_MsgUnjail) isMessage_Sum() {} +func (*Message_MsgCreateValidator) isMessage_Sum() {} +func (*Message_MsgEditValidator) isMessage_Sum() {} +func (*Message_MsgDelegate) isMessage_Sum() {} +func (*Message_MsgBeginRedelegate) isMessage_Sum() {} +func (*Message_MsgUndelegate) isMessage_Sum() {} + +func (m *Message) GetSum() isMessage_Sum { + if m != nil { + return m.Sum + } + return nil +} + +func (m *Message) GetMsgSend() *types7.MsgSend { + if x, ok := m.GetSum().(*Message_MsgSend); ok { + return x.MsgSend + } + return nil +} + +func (m *Message) GetMsgMultiSend() *types7.MsgMultiSend { + if x, ok := m.GetSum().(*Message_MsgMultiSend); ok { + return x.MsgMultiSend + } + return nil +} + +func (m *Message) GetMsgVerifyInvariant() *types8.MsgVerifyInvariant { + if x, ok := m.GetSum().(*Message_MsgVerifyInvariant); ok { + return x.MsgVerifyInvariant + } + return nil +} + +func (m *Message) GetMsgSetWithdrawAddress() *types6.MsgSetWithdrawAddress { + if x, ok := m.GetSum().(*Message_MsgSetWithdrawAddress); ok { + return x.MsgSetWithdrawAddress + } + return nil +} + +func (m *Message) GetMsgWithdrawDelegatorReward() *types6.MsgWithdrawDelegatorReward { + if x, ok := m.GetSum().(*Message_MsgWithdrawDelegatorReward); ok { + return x.MsgWithdrawDelegatorReward + } + return nil +} + +func (m *Message) GetMsgWithdrawValidatorCommission() *types6.MsgWithdrawValidatorCommission { + if x, ok := m.GetSum().(*Message_MsgWithdrawValidatorCommission); ok { + return x.MsgWithdrawValidatorCommission + } + return nil +} + +func (m *Message) GetMsgFundCommunityPool() *types6.MsgFundCommunityPool { + if x, ok := m.GetSum().(*Message_MsgFundCommunityPool); ok { + return x.MsgFundCommunityPool + } + return nil +} + +func (m *Message) GetMsgSubmitEvidence() *MsgSubmitEvidence { + if x, ok := m.GetSum().(*Message_MsgSubmitEvidence); ok { + return x.MsgSubmitEvidence + } + return nil +} + +func (m *Message) GetMsgSubmitProposal() *MsgSubmitProposal { + if x, ok := m.GetSum().(*Message_MsgSubmitProposal); ok { + return x.MsgSubmitProposal + } + return nil +} + +func (m *Message) GetMsgVote() *types4.MsgVote { + if x, ok := m.GetSum().(*Message_MsgVote); ok { + return x.MsgVote + } + return nil +} + +func (m *Message) GetMsgDeposit() *types4.MsgDeposit { + if x, ok := m.GetSum().(*Message_MsgDeposit); ok { + return x.MsgDeposit + } + return nil +} + +func (m *Message) GetMsgUnjail() *types9.MsgUnjail { + if x, ok := m.GetSum().(*Message_MsgUnjail); ok { + return x.MsgUnjail + } + return nil +} + +func (m *Message) GetMsgCreateValidator() *types10.MsgCreateValidator { + if x, ok := m.GetSum().(*Message_MsgCreateValidator); ok { + return x.MsgCreateValidator + } + return nil +} + +func (m *Message) GetMsgEditValidator() *types10.MsgEditValidator { + if x, ok := m.GetSum().(*Message_MsgEditValidator); ok { + return x.MsgEditValidator + } + return nil +} + +func (m *Message) GetMsgDelegate() *types10.MsgDelegate { + if x, ok := m.GetSum().(*Message_MsgDelegate); ok { + return x.MsgDelegate + } + return nil +} + +func (m *Message) GetMsgBeginRedelegate() *types10.MsgBeginRedelegate { + if x, ok := m.GetSum().(*Message_MsgBeginRedelegate); ok { + return x.MsgBeginRedelegate + } + return nil +} + +func (m *Message) GetMsgUndelegate() *types10.MsgUndelegate { + if x, ok := m.GetSum().(*Message_MsgUndelegate); ok { + return x.MsgUndelegate + } + return nil +} + +// XXX_OneofWrappers is for the internal use of the proto package. +func (*Message) XXX_OneofWrappers() []interface{} { + return []interface{}{ + (*Message_MsgSend)(nil), + (*Message_MsgMultiSend)(nil), + (*Message_MsgVerifyInvariant)(nil), + (*Message_MsgSetWithdrawAddress)(nil), + (*Message_MsgWithdrawDelegatorReward)(nil), + (*Message_MsgWithdrawValidatorCommission)(nil), + (*Message_MsgFundCommunityPool)(nil), + (*Message_MsgSubmitEvidence)(nil), + (*Message_MsgSubmitProposal)(nil), + (*Message_MsgVote)(nil), + (*Message_MsgDeposit)(nil), + (*Message_MsgUnjail)(nil), + (*Message_MsgCreateValidator)(nil), + (*Message_MsgEditValidator)(nil), + (*Message_MsgDelegate)(nil), + (*Message_MsgBeginRedelegate)(nil), + (*Message_MsgUndelegate)(nil), + } +} + +// SignDoc defines a standard application-level signing document to compose +// signatures for a Transaction. +type SignDoc struct { + types.StdSignDocBase `protobuf:"bytes,1,opt,name=base,proto3,embedded=base" json:""` + Msgs []Message `protobuf:"bytes,2,rep,name=msgs,proto3" json:"msgs"` +} + +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_daf09dc2dfa19bb4, []int{9} +} +func (m *SignDoc) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *SignDoc) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_SignDoc.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 *SignDoc) XXX_Merge(src proto.Message) { + xxx_messageInfo_SignDoc.Merge(m, src) +} +func (m *SignDoc) XXX_Size() int { + return m.Size() +} +func (m *SignDoc) XXX_DiscardUnknown() { + xxx_messageInfo_SignDoc.DiscardUnknown(m) +} + +var xxx_messageInfo_SignDoc proto.InternalMessageInfo + +func (m *SignDoc) GetMsgs() []Message { + if m != nil { + return m.Msgs + } + return nil +} + func init() { proto.RegisterType((*Account)(nil), "cosmos_sdk.codec.std.v1.Account") proto.RegisterType((*Supply)(nil), "cosmos_sdk.codec.std.v1.Supply") @@ -580,67 +957,108 @@ func init() { proto.RegisterType((*MsgSubmitProposal)(nil), "cosmos_sdk.codec.std.v1.MsgSubmitProposal") proto.RegisterType((*Proposal)(nil), "cosmos_sdk.codec.std.v1.Proposal") proto.RegisterType((*Content)(nil), "cosmos_sdk.codec.std.v1.Content") + proto.RegisterType((*Transaction)(nil), "cosmos_sdk.codec.std.v1.Transaction") + proto.RegisterType((*Message)(nil), "cosmos_sdk.codec.std.v1.Message") + proto.RegisterType((*SignDoc)(nil), "cosmos_sdk.codec.std.v1.SignDoc") } func init() { proto.RegisterFile("codec/std/codec.proto", fileDescriptor_daf09dc2dfa19bb4) } var fileDescriptor_daf09dc2dfa19bb4 = []byte{ - // 875 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x56, 0x41, 0x6f, 0xdc, 0x44, - 0x14, 0xb6, 0xa9, 0x9b, 0xac, 0xa6, 0x05, 0xca, 0x88, 0x90, 0x28, 0xa0, 0x4d, 0x1a, 0x44, 0x84, - 0x8a, 0x62, 0xb7, 0x14, 0x68, 0xba, 0x12, 0x6a, 0xbb, 0x4b, 0xd1, 0x22, 0x11, 0x14, 0x6d, 0x80, - 0x03, 0x02, 0x59, 0xde, 0x99, 0xc1, 0x6b, 0xd5, 0xf6, 0x0c, 0x9e, 0xb1, 0xf1, 0xfe, 0x03, 0xc4, - 0x09, 0x89, 0x3f, 0x10, 0xc1, 0x91, 0x6b, 0x8f, 0xfc, 0x80, 0xaa, 0xa7, 0x1c, 0x39, 0x55, 0x28, - 0xb9, 0xf0, 0x33, 0x90, 0x67, 0xc6, 0x5e, 0x5b, 0xf6, 0x6e, 0xd4, 0xcb, 0xca, 0x9e, 0xf7, 0x7d, - 0xef, 0xfb, 0xc6, 0x33, 0xef, 0xbd, 0x05, 0x1b, 0x88, 0x62, 0x82, 0x1c, 0x2e, 0xb0, 0x23, 0x9f, - 0x6c, 0x96, 0x50, 0x41, 0xe1, 0x26, 0xa2, 0x3c, 0xa2, 0xdc, 0xe5, 0xf8, 0x89, 0xad, 0xd6, 0xb9, - 0xc0, 0x76, 0x76, 0x67, 0xfb, 0x03, 0x31, 0x0b, 0x12, 0xec, 0x32, 0x2f, 0x11, 0x73, 0x47, 0x62, - 0x1d, 0x05, 0x3d, 0xa8, 0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0xfc, 0x2e, 0xea, 0x50, 0xac, 0xe2, 0xcb, 0x34, 0xa7, 0x9c, 0xcb, 0x91, 0x39, + 0xa1, 0x34, 0xbc, 0xfb, 0xda, 0x1a, 0xb6, 0x52, 0x92, 0xb5, 0x8c, 0xa3, 0x65, 0x39, 0xf5, 0x60, + 0xac, 0x07, 0xdc, 0x01, 0x73, 0x52, 0xca, 0xa3, 0x24, 0xc4, 0x6e, 0xb1, 0x76, 0x6b, 0x93, 0x4a, + 0xc0, 0x95, 0x7d, 0x05, 0xdc, 0x49, 0x42, 0x5c, 0x28, 0xde, 0x96, 0xe5, 0xc8, 0x7c, 0x19, 0xda, + 0x87, 0x0f, 0xc1, 0x7f, 0xd4, 0x3d, 0xab, 0xc9, 0xe4, 0x66, 0x33, 0x72, 0x6a, 0x38, 0x8d, 0x8a, + 0xc5, 0x32, 0x38, 0x75, 0x5b, 0x96, 0x73, 0x3c, 0x18, 0x9a, 0xe2, 0x45, 0xf6, 0xf4, 0x63, 0xbc, + 0x76, 0xf8, 0x75, 0xd9, 0x73, 0xed, 0xa6, 0xcf, 0x9e, 0x0d, 0xb6, 0x1b, 0xba, 0x16, 0xbb, 0x4c, + 0x90, 0x1a, 0x50, 0x94, 0xa7, 0x46, 0x4d, 0xde, 0x2d, 0x26, 0x88, 0x29, 0x45, 0xf9, 0x08, 0x57, + 0xc1, 0xb4, 0x84, 0x62, 0x12, 0x31, 0x4e, 0x45, 0x6d, 0xba, 0xac, 0xbd, 0xf4, 0xd1, 0xeb, 0xda, + 0xad, 0x65, 0x39, 0x20, 0xc8, 0x56, 0x70, 0x1d, 0xc8, 0x95, 0x9b, 0x84, 0x5f, 0x20, 0xda, 0xa9, + 0xcd, 0x28, 0x8a, 0xb3, 0x03, 0xdf, 0x78, 0xe6, 0x67, 0x8c, 0xe1, 0x79, 0xa0, 0x5c, 0x5b, 0x96, + 0x73, 0x38, 0x48, 0x17, 0xd0, 0xd5, 0x85, 0xec, 0xc5, 0x04, 0x09, 0xd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1, + 0xec, 0x7f, 0x21, 0xed, 0x09, 0xf5, 0xa3, 0xf9, 0xea, 0xdf, 0x01, 0x00, 0x00, 0xff, 0xff, 0xb6, + 0xc7, 0x0e, 0x8b, 0x1f, 0x11, 0x00, 0x00, } func (this *Supply) Equal(that interface{}) bool { @@ -770,10 +1188,10 @@ func (this *MsgSubmitEvidence) Equal(that interface{}) bool { } else if this == nil { return false } - if !this.Evidence.Equal(that1.Evidence) { + if !this.MsgSubmitEvidenceBase.Equal(&that1.MsgSubmitEvidenceBase) { return false } - if !this.MsgSubmitEvidenceBase.Equal(&that1.MsgSubmitEvidenceBase) { + if !this.Evidence.Equal(that1.Evidence) { return false } return true @@ -1128,6 +1546,173 @@ func (this *Content) SetContent(value github_com_cosmos_cosmos_sdk_x_gov_types.C 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.GetMsgSubmitEvidence(); x != nil { + return x + } + if x := this.GetMsgSubmitProposal(); x != nil { + return x + } + if x := this.GetMsgVote(); x != nil { + return x + } + if x := this.GetMsgDeposit(); x != nil { + return x + } + if x := this.GetMsgUnjail(); x != nil { + return x + } + if x := this.GetMsgCreateValidator(); x != nil { + return x + } + if x := this.GetMsgEditValidator(); x != nil { + return x + } + if x := this.GetMsgDelegate(); x != nil { + return x + } + if x := this.GetMsgBeginRedelegate(); x != nil { + return x + } + if x := this.GetMsgUndelegate(); x != nil { + return x + } + return nil +} + +func (this *Message) SetMsg(value github_com_cosmos_cosmos_sdk_types.Msg) error { + if value == nil { + this.Sum = nil + return nil + } + switch vt := value.(type) { + case *types7.MsgSend: + this.Sum = &Message_MsgSend{vt} + return nil + case types7.MsgSend: + this.Sum = &Message_MsgSend{&vt} + return nil + case *types7.MsgMultiSend: + this.Sum = &Message_MsgMultiSend{vt} + return nil + case types7.MsgMultiSend: + this.Sum = &Message_MsgMultiSend{&vt} + return nil + case *types8.MsgVerifyInvariant: + this.Sum = &Message_MsgVerifyInvariant{vt} + return nil + case types8.MsgVerifyInvariant: + this.Sum = &Message_MsgVerifyInvariant{&vt} + return nil + case *types6.MsgSetWithdrawAddress: + this.Sum = &Message_MsgSetWithdrawAddress{vt} + return nil + case types6.MsgSetWithdrawAddress: + this.Sum = &Message_MsgSetWithdrawAddress{&vt} + return nil + case *types6.MsgWithdrawDelegatorReward: + this.Sum = &Message_MsgWithdrawDelegatorReward{vt} + return nil + case types6.MsgWithdrawDelegatorReward: + this.Sum = &Message_MsgWithdrawDelegatorReward{&vt} + return nil + case *types6.MsgWithdrawValidatorCommission: + this.Sum = &Message_MsgWithdrawValidatorCommission{vt} + return nil + case types6.MsgWithdrawValidatorCommission: + this.Sum = &Message_MsgWithdrawValidatorCommission{&vt} + return nil + case *types6.MsgFundCommunityPool: + this.Sum = &Message_MsgFundCommunityPool{vt} + return nil + case types6.MsgFundCommunityPool: + this.Sum = &Message_MsgFundCommunityPool{&vt} + return nil + case *MsgSubmitEvidence: + this.Sum = &Message_MsgSubmitEvidence{vt} + return nil + case MsgSubmitEvidence: + this.Sum = &Message_MsgSubmitEvidence{&vt} + return nil + case *MsgSubmitProposal: + this.Sum = &Message_MsgSubmitProposal{vt} + return nil + case MsgSubmitProposal: + this.Sum = &Message_MsgSubmitProposal{&vt} + return nil + case *types4.MsgVote: + this.Sum = &Message_MsgVote{vt} + return nil + case types4.MsgVote: + this.Sum = &Message_MsgVote{&vt} + return nil + case *types4.MsgDeposit: + this.Sum = &Message_MsgDeposit{vt} + return nil + case types4.MsgDeposit: + this.Sum = &Message_MsgDeposit{&vt} + return nil + case *types9.MsgUnjail: + this.Sum = &Message_MsgUnjail{vt} + return nil + case types9.MsgUnjail: + this.Sum = &Message_MsgUnjail{&vt} + return nil + case *types10.MsgCreateValidator: + this.Sum = &Message_MsgCreateValidator{vt} + return nil + case types10.MsgCreateValidator: + this.Sum = &Message_MsgCreateValidator{&vt} + return nil + case *types10.MsgEditValidator: + this.Sum = &Message_MsgEditValidator{vt} + return nil + case types10.MsgEditValidator: + this.Sum = &Message_MsgEditValidator{&vt} + return nil + case *types10.MsgDelegate: + this.Sum = &Message_MsgDelegate{vt} + return nil + case types10.MsgDelegate: + this.Sum = &Message_MsgDelegate{&vt} + return nil + case *types10.MsgBeginRedelegate: + this.Sum = &Message_MsgBeginRedelegate{vt} + return nil + case types10.MsgBeginRedelegate: + this.Sum = &Message_MsgBeginRedelegate{&vt} + return nil + case *types10.MsgUndelegate: + this.Sum = &Message_MsgUndelegate{vt} + return nil + case types10.MsgUndelegate: + this.Sum = &Message_MsgUndelegate{&vt} + return nil + } + return fmt.Errorf("can't encode value of type %T as message Message", value) +} + func (m *Account) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) @@ -1391,16 +1976,6 @@ func (m *MsgSubmitEvidence) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l - { - size, err := m.MsgSubmitEvidenceBase.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintCodec(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 if m.Evidence != nil { { size, err := m.Evidence.MarshalToSizedBuffer(dAtA[:i]) @@ -1411,8 +1986,18 @@ func (m *MsgSubmitEvidence) MarshalToSizedBuffer(dAtA []byte) (int, error) { i = encodeVarintCodec(dAtA, i, uint64(size)) } i-- - dAtA[i] = 0xa + dAtA[i] = 0x12 } + { + size, err := m.MsgSubmitEvidenceBase.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 } @@ -1641,6 +2226,493 @@ func (m *Content_CommunityPoolSpend) MarshalToSizedBuffer(dAtA []byte) (int, err } 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 { + { + size, err := m.MsgMultiSend.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 *Message_MsgVerifyInvariant) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Message_MsgVerifyInvariant) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + if m.MsgVerifyInvariant != nil { + { + size, err := m.MsgVerifyInvariant.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 *Message_MsgSetWithdrawAddress) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Message_MsgSetWithdrawAddress) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + if m.MsgSetWithdrawAddress != nil { + { + size, err := m.MsgSetWithdrawAddress.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 *Message_MsgWithdrawDelegatorReward) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Message_MsgWithdrawDelegatorReward) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + if m.MsgWithdrawDelegatorReward != nil { + { + size, err := m.MsgWithdrawDelegatorReward.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 *Message_MsgWithdrawValidatorCommission) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Message_MsgWithdrawValidatorCommission) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + if m.MsgWithdrawValidatorCommission != nil { + { + size, err := m.MsgWithdrawValidatorCommission.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintCodec(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x32 + } + return len(dAtA) - i, nil +} +func (m *Message_MsgFundCommunityPool) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Message_MsgFundCommunityPool) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + if m.MsgFundCommunityPool != nil { + { + size, err := m.MsgFundCommunityPool.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintCodec(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x3a + } + return len(dAtA) - i, nil +} +func (m *Message_MsgSubmitEvidence) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Message_MsgSubmitEvidence) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + if m.MsgSubmitEvidence != nil { + { + size, err := m.MsgSubmitEvidence.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintCodec(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x42 + } + 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]) +} + +func (m *Message_MsgVote) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + if m.MsgVote != nil { + { + size, err := m.MsgVote.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintCodec(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x52 + } + return len(dAtA) - i, nil +} +func (m *Message_MsgDeposit) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Message_MsgDeposit) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + if m.MsgDeposit != nil { + { + size, err := m.MsgDeposit.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintCodec(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x5a + } + return len(dAtA) - i, nil +} +func (m *Message_MsgUnjail) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Message_MsgUnjail) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + if m.MsgUnjail != nil { + { + size, err := m.MsgUnjail.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintCodec(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x62 + } + return len(dAtA) - i, nil +} +func (m *Message_MsgCreateValidator) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Message_MsgCreateValidator) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + if m.MsgCreateValidator != nil { + { + size, err := m.MsgCreateValidator.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintCodec(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x6a + } + return len(dAtA) - i, nil +} +func (m *Message_MsgEditValidator) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Message_MsgEditValidator) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + if m.MsgEditValidator != nil { + { + size, err := m.MsgEditValidator.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintCodec(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x72 + } + return len(dAtA) - i, nil +} +func (m *Message_MsgDelegate) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Message_MsgDelegate) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + if m.MsgDelegate != nil { + { + size, err := m.MsgDelegate.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintCodec(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x7a + } + return len(dAtA) - i, nil +} +func (m *Message_MsgBeginRedelegate) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Message_MsgBeginRedelegate) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + if m.MsgBeginRedelegate != nil { + { + size, err := m.MsgBeginRedelegate.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintCodec(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1 + i-- + dAtA[i] = 0x82 + } + return len(dAtA) - i, nil +} +func (m *Message_MsgUndelegate) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Message_MsgUndelegate) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + if m.MsgUndelegate != nil { + { + size, err := m.MsgUndelegate.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintCodec(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1 + i-- + dAtA[i] = 0x8a + } + return len(dAtA) - i, nil +} +func (m *SignDoc) 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 *SignDoc) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *SignDoc) 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.StdSignDocBase.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 encodeVarintCodec(dAtA []byte, offset int, v uint64) int { offset -= sovCodec(v) base := offset @@ -1778,12 +2850,12 @@ func (m *MsgSubmitEvidence) Size() (n int) { } var l int _ = l + l = m.MsgSubmitEvidenceBase.Size() + n += 1 + l + sovCodec(uint64(l)) if m.Evidence != nil { l = m.Evidence.Size() n += 1 + l + sovCodec(uint64(l)) } - l = m.MsgSubmitEvidenceBase.Size() - n += 1 + l + sovCodec(uint64(l)) return n } @@ -1887,6 +2959,255 @@ func (m *Content_CommunityPoolSpend) Size() (n int) { } return n } +func (m *Transaction) 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)) + } + } + return n +} + +func (m *Message) 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_MsgSubmitEvidence) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.MsgSubmitEvidence != nil { + l = m.MsgSubmitEvidence.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) { + if m == nil { + return 0 + } + var l int + _ = l + if m.MsgUnjail != nil { + l = m.MsgUnjail.Size() + n += 1 + l + sovCodec(uint64(l)) + } + return n +} +func (m *Message_MsgCreateValidator) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.MsgCreateValidator != nil { + l = m.MsgCreateValidator.Size() + n += 1 + l + sovCodec(uint64(l)) + } + return n +} +func (m *Message_MsgEditValidator) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.MsgEditValidator != nil { + l = m.MsgEditValidator.Size() + n += 1 + l + sovCodec(uint64(l)) + } + return n +} +func (m *Message_MsgDelegate) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.MsgDelegate != nil { + l = m.MsgDelegate.Size() + n += 1 + l + sovCodec(uint64(l)) + } + return n +} +func (m *Message_MsgBeginRedelegate) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.MsgBeginRedelegate != nil { + l = m.MsgBeginRedelegate.Size() + n += 2 + l + sovCodec(uint64(l)) + } + return n +} +func (m *Message_MsgUndelegate) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + 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 sovCodec(x uint64) (n int) { return (math_bits.Len64(x|1) + 6) / 7 @@ -2328,6 +3649,39 @@ func (m *MsgSubmitEvidence) Unmarshal(dAtA []byte) error { } switch fieldNum { case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field MsgSubmitEvidenceBase", 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.MsgSubmitEvidenceBase.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Evidence", wireType) } @@ -2363,39 +3717,6 @@ func (m *MsgSubmitEvidence) Unmarshal(dAtA []byte) error { return err } iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field MsgSubmitEvidenceBase", 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.MsgSubmitEvidenceBase.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipCodec(dAtA[iNdEx:]) @@ -2889,6 +4210,894 @@ func (m *Content) Unmarshal(dAtA []byte) error { } return nil } +func (m *Transaction) 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: Transaction: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Transaction: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field StdTxBase", 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.StdTxBase.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Msgs", 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 + } + m.Msgs = append(m.Msgs, Message{}) + if err := m.Msgs[len(m.Msgs)-1].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 *Message) 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: Message: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Message: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field MsgSend", 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 := &types7.MsgSend{} + if err := v.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + m.Sum = &Message_MsgSend{v} + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field MsgMultiSend", 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 := &types7.MsgMultiSend{} + if err := v.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + m.Sum = &Message_MsgMultiSend{v} + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field MsgVerifyInvariant", 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 := &types8.MsgVerifyInvariant{} + if err := v.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + m.Sum = &Message_MsgVerifyInvariant{v} + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field MsgSetWithdrawAddress", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowCodec + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthCodec + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthCodec + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + v := &types6.MsgSetWithdrawAddress{} + if err := v.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + m.Sum = &Message_MsgSetWithdrawAddress{v} + iNdEx = postIndex + case 5: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field MsgWithdrawDelegatorReward", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowCodec + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthCodec + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthCodec + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + v := &types6.MsgWithdrawDelegatorReward{} + if err := v.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + m.Sum = &Message_MsgWithdrawDelegatorReward{v} + iNdEx = postIndex + case 6: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field MsgWithdrawValidatorCommission", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowCodec + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthCodec + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthCodec + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + v := &types6.MsgWithdrawValidatorCommission{} + if err := v.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + m.Sum = &Message_MsgWithdrawValidatorCommission{v} + iNdEx = postIndex + case 7: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field MsgFundCommunityPool", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowCodec + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthCodec + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthCodec + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + v := &types6.MsgFundCommunityPool{} + if err := v.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + m.Sum = &Message_MsgFundCommunityPool{v} + iNdEx = postIndex + case 8: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field MsgSubmitEvidence", 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 := &MsgSubmitEvidence{} + if err := v.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + m.Sum = &Message_MsgSubmitEvidence{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) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowCodec + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthCodec + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthCodec + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + v := &types4.MsgVote{} + if err := v.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + m.Sum = &Message_MsgVote{v} + iNdEx = postIndex + case 11: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field MsgDeposit", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowCodec + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthCodec + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthCodec + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + v := &types4.MsgDeposit{} + if err := v.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + m.Sum = &Message_MsgDeposit{v} + iNdEx = postIndex + case 12: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field MsgUnjail", 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 := &types9.MsgUnjail{} + if err := v.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + m.Sum = &Message_MsgUnjail{v} + iNdEx = postIndex + case 13: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field MsgCreateValidator", 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 := &types10.MsgCreateValidator{} + if err := v.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + m.Sum = &Message_MsgCreateValidator{v} + iNdEx = postIndex + case 14: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field MsgEditValidator", 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 := &types10.MsgEditValidator{} + if err := v.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + m.Sum = &Message_MsgEditValidator{v} + iNdEx = postIndex + case 15: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field MsgDelegate", 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 := &types10.MsgDelegate{} + if err := v.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + m.Sum = &Message_MsgDelegate{v} + iNdEx = postIndex + case 16: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field MsgBeginRedelegate", 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 := &types10.MsgBeginRedelegate{} + if err := v.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + m.Sum = &Message_MsgBeginRedelegate{v} + iNdEx = postIndex + case 17: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field MsgUndelegate", 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 := &types10.MsgUndelegate{} + if err := v.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + m.Sum = &Message_MsgUndelegate{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 *SignDoc) 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: SignDoc: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: SignDoc: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field StdSignDocBase", 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.StdSignDocBase.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Msgs", 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 + } + m.Msgs = append(m.Msgs, Message{}) + if err := m.Msgs[len(m.Msgs)-1].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 skipCodec(dAtA []byte) (n int, err error) { l := len(dAtA) iNdEx := 0 diff --git a/codec/std/codec.proto b/codec/std/codec.proto index 94297308a..c7246a69c 100644 --- a/codec/std/codec.proto +++ b/codec/std/codec.proto @@ -5,12 +5,16 @@ import "third_party/proto/cosmos-proto/cosmos.proto"; import "third_party/proto/gogoproto/gogo.proto"; import "x/auth/types/types.proto"; import "x/auth/vesting/types/types.proto"; +import "x/bank/types/types.proto"; +import "x/crisis/types/types.proto"; +import "x/distribution/types/types.proto"; import "x/supply/types/types.proto"; import "x/evidence/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"; -import "x/distribution/types/types.proto"; option go_package = "github.com/cosmos/cosmos-sdk/codec/std"; @@ -57,8 +61,8 @@ message MsgSubmitEvidence { option (gogoproto.equal) = true; option (gogoproto.goproto_getters) = false; - Evidence evidence = 1; - cosmos_sdk.x.evidence.v1.MsgSubmitEvidenceBase base = 2 [(gogoproto.nullable) = false, (gogoproto.embed) = true]; + cosmos_sdk.x.evidence.v1.MsgSubmitEvidenceBase base = 1 [(gogoproto.nullable) = false, (gogoproto.embed) = true]; + Evidence evidence = 2; } // MsgSubmitProposal defines the application-level message type for handling @@ -95,3 +99,49 @@ message Content { 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. +message Transaction { + option (gogoproto.goproto_getters) = false; + + cosmos_sdk.x.auth.v1.StdTxBase base = 1 + [(gogoproto.jsontag) = "", (gogoproto.embed) = true, (gogoproto.nullable) = false]; + repeated Message msgs = 2 [(gogoproto.nullable) = false]; +} + +// Message defines the set of valid concrete message types that can be used to +// construct a transaction. +message Message { + option (cosmos_proto.interface_type) = "github.com/cosmos/cosmos-sdk/types.Msg"; + + // sum defines the set of all allowed valid messages defined in modules. + oneof sum { + cosmos_sdk.x.bank.v1.MsgSend msg_send = 1; + cosmos_sdk.x.bank.v1.MsgMultiSend msg_multi_send = 2; + cosmos_sdk.x.crisis.v1.MsgVerifyInvariant msg_verify_invariant = 3; + cosmos_sdk.x.distribution.v1.MsgSetWithdrawAddress msg_set_withdraw_address = 4; + 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; + MsgSubmitEvidence msg_submit_evidence = 8; + 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; + cosmos_sdk.x.staking.v1.MsgCreateValidator msg_create_validator = 13; + cosmos_sdk.x.staking.v1.MsgEditValidator msg_edit_validator = 14; + cosmos_sdk.x.staking.v1.MsgDelegate msg_delegate = 15; + cosmos_sdk.x.staking.v1.MsgBeginRedelegate msg_begin_redelegate = 16; + cosmos_sdk.x.staking.v1.MsgUndelegate msg_undelegate = 17; + } +} + +// SignDoc defines a standard application-level signing document to compose +// signatures for a Transaction. +message SignDoc { + cosmos_sdk.x.auth.v1.StdSignDocBase base = 1 + [(gogoproto.jsontag) = "", (gogoproto.embed) = true, (gogoproto.nullable) = false]; + repeated Message msgs = 2 [(gogoproto.nullable) = false]; +} diff --git a/codec/std/msgs_test.go b/codec/std/msgs_test.go new file mode 100644 index 000000000..f0bd00efa --- /dev/null +++ b/codec/std/msgs_test.go @@ -0,0 +1,42 @@ +package std_test + +import ( + "testing" + "time" + + "github.com/stretchr/testify/require" + + "github.com/cosmos/cosmos-sdk/codec/std" + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/cosmos/cosmos-sdk/x/evidence" + "github.com/cosmos/cosmos-sdk/x/gov" +) + +func TestNewMsgSubmitEvidence(t *testing.T) { + s := sdk.AccAddress("foo") + e := evidence.Equivocation{ + Height: 100, + Time: time.Now().UTC(), + Power: 40000000000, + ConsensusAddress: sdk.ConsAddress("test"), + } + + msg, err := std.NewMsgSubmitEvidence(e, s) + require.NoError(t, err) + require.Equal(t, msg.GetEvidence(), &e) + require.Equal(t, msg.GetSubmitter(), s) + require.NoError(t, msg.ValidateBasic()) +} + +func TestNewNewMsgSubmitProposal(t *testing.T) { + p := sdk.AccAddress("foo") + d := sdk.NewCoins(sdk.NewInt64Coin("stake", 1000)) + c := gov.TextProposal{Title: "title", Description: "description"} + + 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()) +} diff --git a/codec/std/tx.go b/codec/std/tx.go new file mode 100644 index 000000000..eca3553f3 --- /dev/null +++ b/codec/std/tx.go @@ -0,0 +1,174 @@ +package std + +import ( + clientx "github.com/cosmos/cosmos-sdk/client/tx" + sdk "github.com/cosmos/cosmos-sdk/types" + sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" + "github.com/cosmos/cosmos-sdk/x/auth" +) + +var ( + _ sdk.Tx = (*Transaction)(nil) + _ clientx.ClientTx = (*Transaction)(nil) + _ clientx.Generator = TxGenerator{} +) + +// TxGenerator defines a transaction generator that allows clients to construct +// transactions. +type TxGenerator struct{} + +// NewTx returns a reference to an empty Transaction type. +func (TxGenerator) NewTx() clientx.ClientTx { + return &Transaction{} +} + +func NewTransaction(fee auth.StdFee, memo string, sdkMsgs []sdk.Msg) (*Transaction, error) { + tx := &Transaction{ + StdTxBase: auth.NewStdTxBase(fee, nil, memo), + } + + if err := tx.SetMsgs(sdkMsgs...); err != nil { + return nil, err + } + + return tx, nil +} + +// GetMsgs returns all the messages in a Transaction as a slice of sdk.Msg. +func (tx Transaction) GetMsgs() []sdk.Msg { + msgs := make([]sdk.Msg, len(tx.Msgs)) + + for i, m := range tx.Msgs { + msgs[i] = m.GetMsg() + } + + return msgs +} + +// GetSigners returns the addresses that must sign the transaction. Addresses are +// returned in a deterministic order. They are accumulated from the GetSigners +// method for each Msg in the order they appear in tx.GetMsgs(). Duplicate addresses +// will be omitted. +func (tx Transaction) GetSigners() []sdk.AccAddress { + var signers []sdk.AccAddress + seen := map[string]bool{} + + for _, msg := range tx.GetMsgs() { + for _, addr := range msg.GetSigners() { + if !seen[addr.String()] { + signers = append(signers, addr) + seen[addr.String()] = true + } + } + } + + return signers +} + +// ValidateBasic does a simple and lightweight validation check that doesn't +// require access to any other information. +func (tx Transaction) ValidateBasic() error { + stdSigs := tx.GetSignatures() + + if tx.Fee.Gas > auth.MaxGasWanted { + return sdkerrors.Wrapf( + sdkerrors.ErrInvalidRequest, "invalid gas supplied; %d > %d", tx.Fee.Gas, auth.MaxGasWanted, + ) + } + if tx.Fee.Amount.IsAnyNegative() { + return sdkerrors.Wrapf( + sdkerrors.ErrInsufficientFee, "invalid fee provided: %s", tx.Fee.Amount, + ) + } + if len(stdSigs) == 0 { + return sdkerrors.ErrNoSignatures + } + if len(stdSigs) != len(tx.GetSigners()) { + return sdkerrors.Wrapf( + sdkerrors.ErrUnauthorized, "wrong number of signers; expected %d, got %d", tx.GetSigners(), len(stdSigs), + ) + } + + return nil +} + +// SetMsgs sets the messages for a Transaction. It will overwrite any existing +// messages set. +func (tx *Transaction) SetMsgs(sdkMsgs ...sdk.Msg) error { + msgs := make([]Message, len(sdkMsgs)) + for i, msg := range sdkMsgs { + m := &Message{} + if err := m.SetMsg(msg); err != nil { + return err + } + + msgs[i] = *m + } + + tx.Msgs = msgs + return nil +} + +// GetSignatures returns all the transaction's signatures. +func (tx Transaction) GetSignatures() []sdk.Signature { + sdkSigs := make([]sdk.Signature, len(tx.Signatures)) + for i, sig := range tx.Signatures { + sdkSigs[i] = sig + } + + return sdkSigs +} + +// SetSignatures sets the transaction's signatures. It will overwrite any +// existing signatures set. +func (tx *Transaction) SetSignatures(sdkSigs ...sdk.Signature) { + sigs := make([]auth.StdSignature, len(tx.Signatures)) + for i, sig := range sdkSigs { + sigs[i] = auth.NewStdSignature(sig.GetPubKey(), sig.GetSignature()) + } + + tx.Signatures = sigs +} + +// GetFee returns the transaction's fee. +func (tx Transaction) GetFee() sdk.Fee { + return tx.Fee +} + +// SetFee sets the transaction's fee. It will overwrite any existing fee set. +func (tx *Transaction) SetFee(fee sdk.Fee) { + tx.Fee = auth.NewStdFee(fee.GetGas(), fee.GetAmount()) +} + +// GetMemo returns the transaction's memo. +func (tx Transaction) GetMemo() string { + return tx.Memo +} + +// SetMemo sets the transaction's memo. It will overwrite any existing memo set. +func (tx *Transaction) SetMemo(memo string) { + tx.Memo = memo +} + +// CanonicalSignBytes returns the canonical JSON bytes to sign over for the +// Transaction given a chain ID, account sequence and account number. The JSON +// encoding ensures all field names adhere to their proto definition, default +// values are omitted, and follows the JSON Canonical Form. +func (tx Transaction) CanonicalSignBytes(cid string, num, seq uint64) ([]byte, error) { + return NewSignDoc(num, seq, cid, tx.Memo, tx.Fee, tx.Msgs...).CanonicalSignBytes() +} + +func NewSignDoc(num, seq uint64, cid, memo string, fee auth.StdFee, msgs ...Message) *SignDoc { + return &SignDoc{ + StdSignDocBase: auth.NewStdSignDocBase(num, seq, cid, memo, fee), + Msgs: msgs, + } +} + +// CanonicalSignBytes returns the canonical JSON bytes to sign over, where the +// SignDoc is derived from a Transaction. The JSON encoding ensures all field +// names adhere to their proto definition, default values are omitted, and follows +// the JSON Canonical Form. +func (sd *SignDoc) CanonicalSignBytes() ([]byte, error) { + return sdk.CanonicalSignBytes(sd) +} diff --git a/codec/std/tx_test.go b/codec/std/tx_test.go new file mode 100644 index 000000000..5fce75a67 --- /dev/null +++ b/codec/std/tx_test.go @@ -0,0 +1,38 @@ +package std_test + +import ( + "testing" + + "github.com/stretchr/testify/require" + + "github.com/cosmos/cosmos-sdk/codec/std" + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/cosmos/cosmos-sdk/x/auth" + "github.com/cosmos/cosmos-sdk/x/bank" +) + +func TestTransaction(t *testing.T) { + f := auth.NewStdFee(100, sdk.NewCoins(sdk.NewInt64Coin("stake", 50))) + m := "hello world" + acc1 := sdk.AccAddress("from") + acc2 := sdk.AccAddress("to") + msg1 := bank.NewMsgSend(acc1, acc2, sdk.NewCoins(sdk.NewInt64Coin("stake", 100000))) + sdkMsgs := []sdk.Msg{&msg1} + + tx, err := std.NewTransaction(f, m, sdkMsgs) + require.NoError(t, err) + require.NotNil(t, tx) + require.Equal(t, tx.GetMsgs(), sdkMsgs) + require.Equal(t, tx.GetSigners(), []sdk.AccAddress{acc1}) + require.Equal(t, tx.GetFee(), f) + require.Equal(t, tx.GetMemo(), m) + + // no signatures; validation should fail + require.Empty(t, tx.GetSignatures()) + require.Error(t, tx.ValidateBasic()) + + signDocJSON := `{"base":{"accountNumber":"1","chainId":"chain-test","fee":{"amount":[{"amount":"50","denom":"stake"}],"gas":"100"},"memo":"hello world","sequence":"21"},"msgs":[{"msgSend":{"amount":[{"amount":"100000","denom":"stake"}],"fromAddress":"cosmos1veex7mgzt83cu","toAddress":"cosmos1w3hsjttrfq"}}]}` + bz, err := tx.CanonicalSignBytes("chain-test", 1, 21) + require.NoError(t, err) + require.Equal(t, signDocJSON, string(bz)) +} diff --git a/docs/architecture/adr-020-protobuf-transaction-encoding.md b/docs/architecture/adr-020-protobuf-transaction-encoding.md index 39d3b1421..6689f29e2 100644 --- a/docs/architecture/adr-020-protobuf-transaction-encoding.md +++ b/docs/architecture/adr-020-protobuf-transaction-encoding.md @@ -3,6 +3,7 @@ ## Changelog - 2020 March 06: Initial Draft +- 2020 March 12: API Updates ## Status @@ -43,9 +44,9 @@ message Message { option (cosmos_proto.interface_type) = "github.com/cosmos/cosmos-sdk/types.Msg"; oneof sum { - bank.MsgSend = 1; - staking.MsgCreateValidator = 2; - staking.MsgDelegate = 3; + cosmos_sdk.x.bank.v1.MsgSend msg_send = 1; + cosmos_sdk.x.bank.v1.MsgMultiSend msg_multi_send = 2; + cosmos_sdk.x.crisis.v1.MsgVerifyInvariant msg_verify_invariant = 3; // ... } } @@ -61,10 +62,8 @@ Example: // app/codec/codec.proto message Transaction { - option (cosmos_proto.interface_type) = "github.com/cosmos/cosmos-sdk/types.Tx"; - - StdTxBase base = 1; - repeated Message msgs = 2; + cosmos_sdk.x.auth.v1.StdTxBase base = 1; + repeated Message msgs = 2; } ``` @@ -80,7 +79,8 @@ to provide canonical representation of a `Transaction` to sign over, clients mus obey the following rules: - Encode `SignDoc` (see below) via [Protobuf's canonical JSON encoding](https://developers.google.com/protocol-buffers/docs/proto3#json). - - Default and zero values must be stripped from the output (`0`, `“”`, `null`, `false`, `[]`, and `{}`). + - Default must be stripped from the output! + - JSON keys adhere to their Proto-defined field names. - Generate canonical JSON to sign via the [JSON Canonical Form Spec](https://gibson042.github.io/canonicaljson-spec/). - This spec should be trivial to interpret and implement in any language. @@ -103,9 +103,8 @@ to handle all the types, but also knows how to generate transactions, signatures and messages. ```go -type TxGenerator interface { +type Generator interface { NewTx() ClientTx - SignBytes func(chainID string, num, seq uint64, fee StdFee, msgs []sdk.Msg, memo string) ([]byte, error) } type ClientTx interface { @@ -113,27 +112,22 @@ type ClientTx interface { codec.ProtoMarshaler SetMsgs(...sdk.Msg) error - GetSignatures() []StdSignature - SetSignatures(...StdSignature) error - GetFee() StdFee - SetFee(StdFee) + GetSignatures() []sdk.Signature + SetSignatures(...sdk.Signature) + GetFee() sdk.Fee + SetFee(sdk.Fee) GetMemo() string SetMemo(string) + + CanonicalSignBytes(cid string, num, seq uint64) ([]byte, error) } ``` -We then extend `codec.Marshaler` to also require fulfillment of `TxGenerator`. +We then update `CLIContext` to have two new fields: `Generator` and `Marshler`. -```go -type ClientMarshaler interface { - TxGenerator - codec.Marshaler -} -``` - -Then, each module will at the minimum accept a `ClientMarshaler` instead of a concrete +Then, each module will at the minimum accept a `Marshaler` instead of a concrete Amino codec. If the module needs to work with any interface types, it will use -the `Codec` interface defined by the module which also extends `ClientMarshaler`. +the `Codec` interface defined by the module which also extends `Marshaler`. ## Future Improvements diff --git a/go.mod b/go.mod index 9b7561d2d..76a69ba2e 100644 --- a/go.mod +++ b/go.mod @@ -7,9 +7,10 @@ require ( github.com/btcsuite/btcd v0.0.0-20190115013929-ed77733ec07d github.com/cosmos/go-bip39 v0.0.0-20180819234021-555e2067c45d github.com/cosmos/ledger-cosmos-go v0.11.1 + github.com/gibson042/canonicaljson-go v1.0.3 github.com/gogo/protobuf v1.3.1 github.com/golang/mock v1.4.3 - github.com/golang/protobuf v1.3.5 + github.com/golang/protobuf v1.4.0-rc.4 github.com/gorilla/handlers v1.4.2 github.com/gorilla/mux v1.7.4 github.com/hashicorp/golang-lru v0.5.4 @@ -30,6 +31,7 @@ require ( github.com/tendermint/iavl v0.13.1 github.com/tendermint/tendermint v0.33.2 github.com/tendermint/tm-db v0.5.0 + google.golang.org/protobuf v1.20.1 // indirect gopkg.in/yaml.v2 v2.2.8 ) diff --git a/go.sum b/go.sum index 7e8f83f0a..83bf29675 100644 --- a/go.sum +++ b/go.sum @@ -111,6 +111,8 @@ github.com/franela/goreq v0.0.0-20171204163338-bcd34c9993f8/go.mod h1:ZhphrRTfi2 github.com/fsnotify/fsnotify v1.4.7 h1:IXs+QLmnXW2CcXuY+8Mzv/fWEsPGWxqefPtCP5CnV9I= github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04= +github.com/gibson042/canonicaljson-go v1.0.3 h1:EAyF8L74AWabkyUmrvEFHEt/AGFQeD6RfwbAuf0j1bI= +github.com/gibson042/canonicaljson-go v1.0.3/go.mod h1:DsLpJTThXyGNO+KZlI85C1/KDcImpP67k/RKVjcaEqo= github.com/go-kit/kit v0.8.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= github.com/go-kit/kit v0.9.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= github.com/go-kit/kit v0.10.0 h1:dXFJfIHVvUcpSgDOV+Ne6t7jXri8Tfv2uOLHUZ2XNuo= @@ -130,8 +132,6 @@ github.com/golang/groupcache v0.0.0-20160516000752-02826c3e7903/go.mod h1:cIg4er github.com/golang/groupcache v0.0.0-20190129154638-5b532d6fd5ef/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= github.com/golang/groupcache v0.0.0-20190702054246-869f871628b6/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= -github.com/golang/mock v1.4.2 h1:fXIkPzOBCwDUPvYmOPzETABgbqpYlYNigQ2o64eMr5c= -github.com/golang/mock v1.4.2/go.mod h1:UOMv5ysSaYNkG+OFQykRIcU/QvvxJf3p21QfJ2Bt3cw= github.com/golang/mock v1.4.3 h1:GV+pQPG/EUUbkh47niozDcADz6go/dUwhVzdUQHIVRw= github.com/golang/mock v1.4.3/go.mod h1:UOMv5ysSaYNkG+OFQykRIcU/QvvxJf3p21QfJ2Bt3cw= github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= @@ -140,8 +140,11 @@ 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 h1:F768QJ1E9tib+q5Sc8MkdJi1RxLTbRcTf8LJV56aRls= -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= +github.com/golang/protobuf v1.4.0-rc.4 h1:+EOh4OY6tjM6ZueeUKinl1f0U2820HzQOuf1iqMnsks= +github.com/golang/protobuf v1.4.0-rc.4/go.mod h1:WU3c8KckQ9AFe+yFwt9sWVRKCVIyN9cPHBJSNnbL67w= github.com/golang/snappy v0.0.0-20180518054509-2e65f85255db/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= github.com/golang/snappy v0.0.1 h1:Qgr9rKW7uDUkrbSmQeiDsGa8SjGyCOGtuasMWwvp2P4= github.com/golang/snappy v0.0.1/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= @@ -558,6 +561,12 @@ google.golang.org/grpc v1.26.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8 google.golang.org/grpc v1.27.1/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= google.golang.org/grpc v1.28.0 h1:bO/TA4OxCOummhSf10siHuG7vJOiwh7SpRpFZDkOgl4= google.golang.org/grpc v1.28.0/go.mod h1:rpkK4SK4GF4Ach/+MFLZUBavHOvF2JJB5uozKKal+60= +google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= +google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= +google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= +google.golang.org/protobuf v1.20.1-0.20200309200217-e05f789c0967/go.mod h1:A+miEFZTKqfCUM6K7xSMQL9OKL/b6hQv+e19PK+JZNE= +google.golang.org/protobuf v1.20.1 h1:ESRXHgpUBG5D2I5mmsQIyYxB/tQIZfSZ8wLyFDf/N/U= +google.golang.org/protobuf v1.20.1/go.mod h1:KqelGeouBkcbcuB3HCk4/YH2tmNLk6YSWA5LIWeI/lY= gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= @@ -585,9 +594,7 @@ honnef.co/go/tools v0.0.0-20180728063816-88497007e858/go.mod h1:rf3lG4BRIbNafJWh honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= honnef.co/go/tools v0.0.1-2019.2.3/go.mod h1:a3bituU0lyd329TUQxRnasdCoJDkEUEAqEt0JzvZhAg= -rsc.io/quote/v3 v3.1.0 h1:9JKUTTIUgS6kzR9mK1YuGKv6Nl+DijDNIc0ghT58FaY= rsc.io/quote/v3 v3.1.0/go.mod h1:yEA65RcK8LyAZtP9Kv3t0HmxON59tX3rD+tICJqUlj0= -rsc.io/sampler v1.3.0 h1:7uVkIFmeBqHfdjD+gZwtXXI+RODJ2Wc4O7MPEh/QiW4= rsc.io/sampler v1.3.0/go.mod h1:T1hPZKmBbMNahiBKFy5HrXp6adAjACjK9JXDnKaTXpA= sigs.k8s.io/yaml v1.1.0/go.mod h1:UJmg0vDUVViEyp3mgSv9WPwZCDxu4rQW1olrI1uml+o= sourcegraph.com/sourcegraph/appdash v0.0.0-20190731080439-ebfcffb1b5c0/go.mod h1:hI742Nqp5OhwiqlzhgfbWU4mW4yO10fP+LoT9WOswdU= diff --git a/simapp/helpers/test_helpers.go b/simapp/helpers/test_helpers.go index 2341635ee..ef265c823 100644 --- a/simapp/helpers/test_helpers.go +++ b/simapp/helpers/test_helpers.go @@ -39,7 +39,7 @@ func GenTx(msgs []sdk.Msg, feeAmt sdk.Coins, gas uint64, chainID string, accnums } sigs[i] = auth.StdSignature{ - PubKey: p.PubKey(), + PubKey: p.PubKey().Bytes(), Signature: sig, } } diff --git a/types/codec.go b/types/codec.go index fdd884bd5..21cd26904 100644 --- a/types/codec.go +++ b/types/codec.go @@ -1,6 +1,11 @@ package types import ( + "bytes" + + jsonc "github.com/gibson042/canonicaljson-go" + "github.com/gogo/protobuf/jsonpb" + "github.com/cosmos/cosmos-sdk/codec" ) @@ -9,3 +14,27 @@ func RegisterCodec(cdc *codec.Codec) { cdc.RegisterInterface((*Msg)(nil), nil) cdc.RegisterInterface((*Tx)(nil), nil) } + +// CanonicalSignBytes returns a canonical JSON encoding of a Proto message that +// can be signed over. The JSON encoding ensures all field names adhere to their +// Proto definition, default values are omitted, and follows the JSON Canonical +// Form. +func CanonicalSignBytes(m codec.ProtoMarshaler) ([]byte, error) { + jm := &jsonpb.Marshaler{EmitDefaults: false, OrigName: false} + buf := new(bytes.Buffer) + + // first, encode via canonical Protocol Buffer JSON + if err := jm.Marshal(buf, m); err != nil { + return nil, err + } + + genericJSON := make(map[string]interface{}) + + // decode canonical proto encoding into a generic map + if err := jsonc.Unmarshal(buf.Bytes(), &genericJSON); err != nil { + return nil, err + } + + // finally, return the canonical JSON encoding via JSON Canonical Form + return jsonc.Marshal(genericJSON) +} diff --git a/types/tx_msg.go b/types/tx_msg.go index 1b0da612b..b81eb26f5 100644 --- a/types/tx_msg.go +++ b/types/tx_msg.go @@ -2,45 +2,59 @@ package types import ( "encoding/json" + + "github.com/tendermint/tendermint/crypto" ) -// Transactions messages must fulfill the Msg -type Msg interface { +type ( + // Msg defines the interface a transaction message must fulfill. + Msg interface { - // Return the message type. - // Must be alphanumeric or empty. - Route() string + // Return the message type. + // Must be alphanumeric or empty. + Route() string - // Returns a human-readable string for the message, intended for utilization - // within tags - Type() string + // Returns a human-readable string for the message, intended for utilization + // within tags + Type() string - // ValidateBasic does a simple validation check that - // doesn't require access to any other information. - ValidateBasic() error + // ValidateBasic does a simple validation check that + // doesn't require access to any other information. + ValidateBasic() error - // Get the canonical byte representation of the Msg. - GetSignBytes() []byte + // Get the canonical byte representation of the Msg. + GetSignBytes() []byte - // Signers returns the addrs of signers that must sign. - // CONTRACT: All signatures must be present to be valid. - // CONTRACT: Returns addrs in some deterministic order. - GetSigners() []AccAddress -} + // Signers returns the addrs of signers that must sign. + // CONTRACT: All signatures must be present to be valid. + // CONTRACT: Returns addrs in some deterministic order. + GetSigners() []AccAddress + } -//__________________________________________________________ + // Fee defines an interface for an application application-defined concrete + // transaction type to be able to set and return the transaction fee. + Fee interface { + GetGas() uint64 + GetAmount() Coins + } -// Transactions objects must fulfill the Tx -type Tx interface { - // Gets the all the transaction's messages. - GetMsgs() []Msg + // Signature defines an interface for an application application-defined + // concrete transaction type to be able to set and return transaction signatures. + Signature interface { + GetPubKey() crypto.PubKey + GetSignature() []byte + } - // ValidateBasic does a simple and lightweight validation check that doesn't - // require access to any other information. - ValidateBasic() error -} + // Tx defines the interface a transaction must fulfill. + Tx interface { + // Gets the all the transaction's messages. + GetMsgs() []Msg -//__________________________________________________________ + // ValidateBasic does a simple and lightweight validation check that doesn't + // require access to any other information. + ValidateBasic() error + } +) // TxDecoder unmarshals transaction bytes type TxDecoder func(txBytes []byte) (Tx, error) diff --git a/x/auth/alias.go b/x/auth/alias.go index 6c242caf5..e34b9ec68 100644 --- a/x/auth/alias.go +++ b/x/auth/alias.go @@ -22,6 +22,7 @@ const ( DefaultSigVerifyCostSecp256k1 = types.DefaultSigVerifyCostSecp256k1 QueryAccount = types.QueryAccount QueryParams = types.QueryParams + MaxGasWanted = types.MaxGasWanted ) var ( @@ -58,6 +59,9 @@ var ( MakeSignature = types.MakeSignature ValidateGenAccounts = types.ValidateGenAccounts GetGenesisStateFromAppState = types.GetGenesisStateFromAppState + NewStdSignature = types.NewStdSignature + NewStdTxBase = types.NewStdTxBase + NewStdSignDocBase = types.NewStdSignDocBase // variable aliases ModuleCdc = types.ModuleCdc @@ -87,4 +91,6 @@ type ( TxBuilder = types.TxBuilder GenesisAccountIterator = types.GenesisAccountIterator Codec = types.Codec + StdSignDocBase = types.StdSignDocBase + StdTxBase = types.StdTxBase ) diff --git a/x/auth/ante/basic.go b/x/auth/ante/basic.go index 37bc4f1c0..f4a60a87e 100644 --- a/x/auth/ante/basic.go +++ b/x/auth/ante/basic.go @@ -127,7 +127,7 @@ func (cgts ConsumeTxSizeGasDecorator) AnteHandle(ctx sdk.Context, tx sdk.Tx, sim // use stdsignature to mock the size of a full signature simSig := types.StdSignature{ Signature: simSecp256k1Sig[:], - PubKey: pubkey, + PubKey: pubkey.Bytes(), } sigBz := codec.Cdc.MustMarshalBinaryBare(simSig) diff --git a/x/auth/client/cli/tx_multisign.go b/x/auth/client/cli/tx_multisign.go index f1ea091d0..f5bf16ca2 100644 --- a/x/auth/client/cli/tx_multisign.go +++ b/x/auth/client/cli/tx_multisign.go @@ -106,15 +106,15 @@ func makeMultiSignCmd(cdc *codec.Codec) func(cmd *cobra.Command, args []string) txBldr.ChainID(), txBldr.AccountNumber(), txBldr.Sequence(), stdTx.Fee, stdTx.GetMsgs(), stdTx.GetMemo(), ) - if ok := stdSig.PubKey.VerifyBytes(sigBytes, stdSig.Signature); !ok { + if ok := stdSig.GetPubKey().VerifyBytes(sigBytes, stdSig.Signature); !ok { return fmt.Errorf("couldn't verify signature") } - if err := multisigSig.AddSignatureFromPubKey(stdSig.Signature, stdSig.PubKey, multisigPub.PubKeys); err != nil { + if err := multisigSig.AddSignatureFromPubKey(stdSig.Signature, stdSig.GetPubKey(), multisigPub.PubKeys); err != nil { return err } } - newStdSig := types.StdSignature{Signature: cdc.MustMarshalBinaryBare(multisigSig), PubKey: multisigPub} + newStdSig := types.StdSignature{Signature: cdc.MustMarshalBinaryBare(multisigSig), PubKey: multisigPub.Bytes()} newTx := types.NewStdTx(stdTx.GetMsgs(), stdTx.Fee, []types.StdSignature{newStdSig}, stdTx.GetMemo()) sigOnly := viper.GetBool(flagSigOnly) diff --git a/x/auth/client/cli/tx_sign.go b/x/auth/client/cli/tx_sign.go index a6434be7e..6d95c47ef 100644 --- a/x/auth/client/cli/tx_sign.go +++ b/x/auth/client/cli/tx_sign.go @@ -208,7 +208,7 @@ func printAndValidateSigs( } for i, sig := range sigs { - sigAddr := sdk.AccAddress(sig.Address()) + sigAddr := sdk.AccAddress(sig.GetPubKey().Address()) sigSanity := "OK" var ( @@ -235,13 +235,13 @@ func printAndValidateSigs( stdTx.Fee, stdTx.GetMsgs(), stdTx.GetMemo(), ) - if ok := sig.VerifyBytes(sigBytes, sig.Signature); !ok { + if ok := sig.GetPubKey().VerifyBytes(sigBytes, sig.Signature); !ok { sigSanity = "ERROR: signature invalid" success = false } } - multiPK, ok := sig.PubKey.(multisig.PubKeyMultisigThreshold) + multiPK, ok := sig.GetPubKey().(multisig.PubKeyMultisigThreshold) if ok { var multiSig multisig.Multisignature cliCtx.Codec.MustUnmarshalBinaryBare(sig.Signature, &multiSig) diff --git a/x/auth/types/stdtx.go b/x/auth/types/stdtx.go index 6c5d38c1b..12e4aecd0 100644 --- a/x/auth/types/stdtx.go +++ b/x/auth/types/stdtx.go @@ -14,11 +14,137 @@ import ( "github.com/cosmos/cosmos-sdk/x/auth/exported" ) -var ( - _ sdk.Tx = (*StdTx)(nil) +// MaxGasWanted defines the max gas allowed. +const MaxGasWanted = uint64((1 << 63) - 1) - maxGasWanted = uint64((1 << 63) - 1) -) +// NewStdFee returns a new instance of StdFee +func NewStdFee(gas uint64, amount sdk.Coins) StdFee { + return StdFee{ + Amount: amount, + Gas: gas, + } +} + +// GetGas returns the fee's (wanted) gas. +func (fee StdFee) GetGas() uint64 { + return fee.Gas +} + +// GetAmount returns the fee's amount. +func (fee StdFee) GetAmount() sdk.Coins { + return fee.Amount +} + +// Bytes returns the encoded bytes of a StdFee. +func (fee StdFee) Bytes() []byte { + if len(fee.Amount) == 0 { + fee.Amount = sdk.NewCoins() + } + + bz, err := codec.Cdc.MarshalJSON(fee) + if err != nil { + panic(err) + } + + return bz +} + +// GasPrices returns the gas prices for a StdFee. +// +// NOTE: The gas prices returned are not the true gas prices that were +// originally part of the submitted transaction because the fee is computed +// as fee = ceil(gasWanted * gasPrices). +func (fee StdFee) GasPrices() sdk.DecCoins { + return sdk.NewDecCoinsFromCoins(fee.Amount...).QuoDec(sdk.NewDec(int64(fee.Gas))) +} + +func NewStdSignature(pk crypto.PubKey, sig []byte) StdSignature { + return StdSignature{PubKey: pk.Bytes(), Signature: sig} +} + +// GetSignature returns the raw signature bytes. +func (ss StdSignature) GetSignature() []byte { + return ss.Signature +} + +// GetPubKey returns the public key of a signature as a crypto.PubKey using the +// Amino codec. +func (ss StdSignature) GetPubKey() (pk crypto.PubKey) { + if len(ss.PubKey) == 0 { + return nil + } + + codec.Cdc.MustUnmarshalBinaryBare(ss.PubKey, &pk) + return pk +} + +// MarshalYAML returns the YAML representation of the signature. +func (ss StdSignature) MarshalYAML() (interface{}, error) { + var ( + bz []byte + pubkey string + err error + ) + + if ss.PubKey != nil { + pubkey, err = sdk.Bech32ifyPubKey(sdk.Bech32PubKeyTypeAccPub, ss.GetPubKey()) + if err != nil { + return nil, err + } + } + + bz, err = yaml.Marshal(struct { + PubKey string + Signature string + }{ + PubKey: pubkey, + Signature: fmt.Sprintf("%X", ss.Signature), + }) + if err != nil { + return nil, err + } + + return string(bz), err +} + +func NewStdTxBase(fee StdFee, sigs []StdSignature, memo string) StdTxBase { + return StdTxBase{ + Fee: fee, + Signatures: sigs, + Memo: memo, + } +} + +func NewStdSignDocBase(num, seq uint64, cid, memo string, fee StdFee) StdSignDocBase { + return StdSignDocBase{ + ChainID: cid, + AccountNumber: num, + Sequence: seq, + Memo: memo, + Fee: fee, + } +} + +// CountSubKeys counts the total number of keys for a multi-sig public key. +func CountSubKeys(pub crypto.PubKey) int { + v, ok := pub.(multisig.PubKeyMultisigThreshold) + if !ok { + return 1 + } + + numKeys := 0 + for _, subkey := range v.PubKeys { + numKeys += CountSubKeys(subkey) + } + + return numKeys +} + +// --------------------------------------------------------------------------- +// DEPRECATED +// --------------------------------------------------------------------------- + +var _ sdk.Tx = (*StdTx)(nil) // StdTx is a standard way to wrap a Msg with Fee and Signatures. // NOTE: the first signature is the fee payer (Signatures must not be nil). @@ -46,10 +172,10 @@ func (tx StdTx) GetMsgs() []sdk.Msg { return tx.Msgs } func (tx StdTx) ValidateBasic() error { stdSigs := tx.GetSignatures() - if tx.Fee.Gas > maxGasWanted { + if tx.Fee.Gas > MaxGasWanted { return sdkerrors.Wrapf( sdkerrors.ErrInvalidRequest, - "invalid gas supplied; %d > %d", tx.Fee.Gas, maxGasWanted, + "invalid gas supplied; %d > %d", tx.Fee.Gas, MaxGasWanted, ) } if tx.Fee.Amount.IsAnyNegative() { @@ -71,29 +197,15 @@ func (tx StdTx) ValidateBasic() error { return nil } -// CountSubKeys counts the total number of keys for a multi-sig public key. -func CountSubKeys(pub crypto.PubKey) int { - v, ok := pub.(multisig.PubKeyMultisigThreshold) - if !ok { - return 1 - } - - numKeys := 0 - for _, subkey := range v.PubKeys { - numKeys += CountSubKeys(subkey) - } - - return numKeys -} - // GetSigners returns the addresses that must sign the transaction. // Addresses are returned in a deterministic order. // They are accumulated from the GetSigners method for each Msg // in the order they appear in tx.GetMsgs(). // Duplicate addresses will be omitted. func (tx StdTx) GetSigners() []sdk.AccAddress { - seen := map[string]bool{} var signers []sdk.AccAddress + seen := map[string]bool{} + for _, msg := range tx.GetMsgs() { for _, addr := range msg.GetSigners() { if !seen[addr.String()] { @@ -102,6 +214,7 @@ func (tx StdTx) GetSigners() []sdk.AccAddress { } } } + return signers } @@ -127,9 +240,11 @@ func (tx StdTx) GetSignatures() [][]byte { // If pubkey is not included in the signature, then nil is in the slice instead func (tx StdTx) GetPubKeys() []crypto.PubKey { pks := make([]crypto.PubKey, len(tx.Signatures)) + for i, stdSig := range tx.Signatures { - pks[i] = stdSig.PubKey + pks[i] = stdSig.GetPubKey() } + return pks } @@ -163,43 +278,6 @@ func (tx StdTx) FeePayer() sdk.AccAddress { return sdk.AccAddress{} } -// NewStdFee returns a new instance of StdFee -func NewStdFee(gas uint64, amount sdk.Coins) StdFee { - return StdFee{ - Amount: amount, - Gas: gas, - } -} - -// Bytes for signing later -func (fee StdFee) Bytes() []byte { - // normalize. XXX - // this is a sign of something ugly - // (in the lcd_test, client side its null, - // server side its []) - if len(fee.Amount) == 0 { - fee.Amount = sdk.NewCoins() - } - - bz, err := codec.Cdc.MarshalJSON(fee) // TODO - if err != nil { - panic(err) - } - - return bz -} - -// GasPrices returns the gas prices for a StdFee. -// -// NOTE: The gas prices returned are not the true gas prices that were -// originally part of the submitted transaction because the fee is computed -// as fee = ceil(gasWanted * gasPrices). -func (fee StdFee) GasPrices() sdk.DecCoins { - return sdk.NewDecCoinsFromCoins(fee.Amount...).QuoDec(sdk.NewDec(int64(fee.Gas))) -} - -//__________________________________________________________ - // StdSignDoc is replay-prevention structure. // It includes the result of msg.GetSignBytes(), // as well as the ChainID (prevent cross chain replay) @@ -237,12 +315,6 @@ func StdSignBytes(chainID string, accnum uint64, sequence uint64, fee StdFee, ms return sdk.MustSortJSON(bz) } -// StdSignature represents a sig -type StdSignature struct { - crypto.PubKey `json:"pub_key" yaml:"pub_key"` // optional - Signature []byte `json:"signature" yaml:"signature"` -} - // DefaultTxDecoder logic for standard transaction decoding func DefaultTxDecoder(cdc *codec.Codec) sdk.TxDecoder { return func(txBytes []byte) (sdk.Tx, error) { @@ -269,32 +341,3 @@ func DefaultTxEncoder(cdc *codec.Codec) sdk.TxEncoder { return cdc.MarshalBinaryBare(tx) } } - -// MarshalYAML returns the YAML representation of the signature. -func (ss StdSignature) MarshalYAML() (interface{}, error) { - var ( - bz []byte - pubkey string - err error - ) - - if ss.PubKey != nil { - pubkey, err = sdk.Bech32ifyPubKey(sdk.Bech32PubKeyTypeAccPub, ss.PubKey) - if err != nil { - return nil, err - } - } - - bz, err = yaml.Marshal(struct { - PubKey string - Signature string - }{ - PubKey: pubkey, - Signature: fmt.Sprintf("%s", ss.Signature), - }) - if err != nil { - return nil, err - } - - return string(bz), err -} diff --git a/x/auth/types/stdtx_test.go b/x/auth/types/stdtx_test.go index 676a6bef7..09230d03e 100644 --- a/x/auth/types/stdtx_test.go +++ b/x/auth/types/stdtx_test.go @@ -152,11 +152,11 @@ func TestStdSignatureMarshalYAML(t *testing.T) { "|\n pubkey: \"\"\n signature: \"\"\n", }, { - StdSignature{PubKey: pubKey, Signature: []byte("dummySig")}, - fmt.Sprintf("|\n pubkey: %s\n signature: dummySig\n", sdk.MustBech32ifyPubKey(sdk.Bech32PubKeyTypeAccPub, pubKey)), + StdSignature{PubKey: pubKey.Bytes(), Signature: []byte("dummySig")}, + fmt.Sprintf("|\n pubkey: %s\n signature: 64756D6D79536967\n", sdk.MustBech32ifyPubKey(sdk.Bech32PubKeyTypeAccPub, pubKey)), }, { - StdSignature{PubKey: pubKey, Signature: nil}, + StdSignature{PubKey: pubKey.Bytes(), Signature: nil}, fmt.Sprintf("|\n pubkey: %s\n signature: \"\"\n", sdk.MustBech32ifyPubKey(sdk.Bech32PubKeyTypeAccPub, pubKey)), }, } diff --git a/x/auth/types/test_utils.go b/x/auth/types/test_utils.go index 9e2ba20e9..a5024e7f8 100644 --- a/x/auth/types/test_utils.go +++ b/x/auth/types/test_utils.go @@ -42,7 +42,7 @@ func NewTestTx(ctx sdk.Context, msgs []sdk.Msg, privs []crypto.PrivKey, accNums panic(err) } - sigs[i] = StdSignature{PubKey: priv.PubKey(), Signature: sig} + sigs[i] = StdSignature{PubKey: priv.PubKey().Bytes(), Signature: sig} } tx := NewStdTx(msgs, fee, sigs, "") @@ -59,7 +59,7 @@ func NewTestTxWithMemo(ctx sdk.Context, msgs []sdk.Msg, privs []crypto.PrivKey, panic(err) } - sigs[i] = StdSignature{PubKey: priv.PubKey(), Signature: sig} + sigs[i] = StdSignature{PubKey: priv.PubKey().Bytes(), Signature: sig} } tx := NewStdTx(msgs, fee, sigs, memo) @@ -74,7 +74,7 @@ func NewTestTxWithSignBytes(msgs []sdk.Msg, privs []crypto.PrivKey, accNums []ui panic(err) } - sigs[i] = StdSignature{PubKey: priv.PubKey(), Signature: sig} + sigs[i] = StdSignature{PubKey: priv.PubKey().Bytes(), Signature: sig} } tx := NewStdTx(msgs, fee, sigs, memo) diff --git a/x/auth/types/txbuilder.go b/x/auth/types/txbuilder.go index 4ffd327d6..47c79d390 100644 --- a/x/auth/types/txbuilder.go +++ b/x/auth/types/txbuilder.go @@ -286,8 +286,9 @@ func MakeSignature(keybase keys.Keybase, name, passphrase string, if err != nil { return } + return StdSignature{ - PubKey: pubkey, + PubKey: pubkey.Bytes(), Signature: sigBytes, }, nil } diff --git a/x/auth/types/types.pb.go b/x/auth/types/types.pb.go index f5fa313fb..69e8d5a86 100644 --- a/x/auth/types/types.pb.go +++ b/x/auth/types/types.pb.go @@ -108,19 +108,45 @@ func (m *StdFee) XXX_DiscardUnknown() { var xxx_messageInfo_StdFee proto.InternalMessageInfo -func (m *StdFee) GetAmount() github_com_cosmos_cosmos_sdk_types.Coins { - if m != nil { - return m.Amount - } - return nil +// StdSignature defines a signature structure that contains the signature of a +// transaction and an optional public key. +type StdSignature struct { + PubKey []byte `protobuf:"bytes,1,opt,name=pub_key,json=pubKey,proto3" json:"public_key,omitempty" yaml:"public_key"` + Signature []byte `protobuf:"bytes,2,opt,name=signature,proto3" json:"signature,omitempty"` } -func (m *StdFee) GetGas() uint64 { - if m != nil { - return m.Gas - } - return 0 +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_2d526fa662daab74, []int{2} } +func (m *StdSignature) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *StdSignature) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_StdSignature.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 *StdSignature) XXX_Merge(src proto.Message) { + xxx_messageInfo_StdSignature.Merge(m, src) +} +func (m *StdSignature) XXX_Size() int { + return m.Size() +} +func (m *StdSignature) XXX_DiscardUnknown() { + xxx_messageInfo_StdSignature.DiscardUnknown(m) +} + +var xxx_messageInfo_StdSignature proto.InternalMessageInfo // Params defines the parameters for the auth module. type Params struct { @@ -134,7 +160,7 @@ type Params struct { func (m *Params) Reset() { *m = Params{} } func (*Params) ProtoMessage() {} func (*Params) Descriptor() ([]byte, []int) { - return fileDescriptor_2d526fa662daab74, []int{2} + return fileDescriptor_2d526fa662daab74, []int{3} } func (m *Params) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -198,56 +224,210 @@ func (m *Params) GetSigVerifyCostSecp256k1() uint64 { return 0 } +// StdTxBase defines a transaction base which application-level concrete transaction +// types can extend. +type StdTxBase struct { + Fee StdFee `protobuf:"bytes,1,opt,name=fee,proto3" json:"fee"` + Signatures []StdSignature `protobuf:"bytes,2,rep,name=signatures,proto3" json:"signatures"` + Memo string `protobuf:"bytes,3,opt,name=memo,proto3" json:"memo,omitempty"` +} + +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_2d526fa662daab74, []int{4} +} +func (m *StdTxBase) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *StdTxBase) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_StdTxBase.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 *StdTxBase) XXX_Merge(src proto.Message) { + xxx_messageInfo_StdTxBase.Merge(m, src) +} +func (m *StdTxBase) XXX_Size() int { + return m.Size() +} +func (m *StdTxBase) XXX_DiscardUnknown() { + xxx_messageInfo_StdTxBase.DiscardUnknown(m) +} + +var xxx_messageInfo_StdTxBase proto.InternalMessageInfo + +func (m *StdTxBase) GetFee() StdFee { + if m != nil { + return m.Fee + } + return StdFee{} +} + +func (m *StdTxBase) GetSignatures() []StdSignature { + if m != nil { + return m.Signatures + } + return nil +} + +func (m *StdTxBase) GetMemo() string { + if m != nil { + return m.Memo + } + return "" +} + +// StdSignDocBase defines the base structure for which applications can extend +// to define the concrete structure that signers sign over. +type StdSignDocBase struct { + ChainID string `protobuf:"bytes,1,opt,name=chain_id,json=chainId,proto3" json:"chain_id,omitempty" yaml:"chain_id"` + AccountNumber uint64 `protobuf:"varint,2,opt,name=account_number,json=accountNumber,proto3" json:"account_number,omitempty" yaml:"account_number"` + Sequence uint64 `protobuf:"varint,3,opt,name=sequence,proto3" json:"sequence,omitempty"` + Memo string `protobuf:"bytes,4,opt,name=memo,proto3" json:"memo,omitempty"` + Fee StdFee `protobuf:"bytes,5,opt,name=fee,proto3" json:"fee"` +} + +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_2d526fa662daab74, []int{5} +} +func (m *StdSignDocBase) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *StdSignDocBase) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_StdSignDocBase.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 *StdSignDocBase) XXX_Merge(src proto.Message) { + xxx_messageInfo_StdSignDocBase.Merge(m, src) +} +func (m *StdSignDocBase) XXX_Size() int { + return m.Size() +} +func (m *StdSignDocBase) XXX_DiscardUnknown() { + xxx_messageInfo_StdSignDocBase.DiscardUnknown(m) +} + +var xxx_messageInfo_StdSignDocBase proto.InternalMessageInfo + +func (m *StdSignDocBase) GetChainID() string { + if m != nil { + return m.ChainID + } + return "" +} + +func (m *StdSignDocBase) GetAccountNumber() uint64 { + if m != nil { + return m.AccountNumber + } + return 0 +} + +func (m *StdSignDocBase) GetSequence() uint64 { + if m != nil { + return m.Sequence + } + return 0 +} + +func (m *StdSignDocBase) GetMemo() string { + if m != nil { + return m.Memo + } + return "" +} + +func (m *StdSignDocBase) GetFee() StdFee { + if m != nil { + return m.Fee + } + return StdFee{} +} + func init() { proto.RegisterType((*BaseAccount)(nil), "cosmos_sdk.x.auth.v1.BaseAccount") proto.RegisterType((*StdFee)(nil), "cosmos_sdk.x.auth.v1.StdFee") + proto.RegisterType((*StdSignature)(nil), "cosmos_sdk.x.auth.v1.StdSignature") proto.RegisterType((*Params)(nil), "cosmos_sdk.x.auth.v1.Params") + proto.RegisterType((*StdTxBase)(nil), "cosmos_sdk.x.auth.v1.StdTxBase") + proto.RegisterType((*StdSignDocBase)(nil), "cosmos_sdk.x.auth.v1.StdSignDocBase") } func init() { proto.RegisterFile("x/auth/types/types.proto", fileDescriptor_2d526fa662daab74) } var fileDescriptor_2d526fa662daab74 = []byte{ - // 630 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x54, 0xbf, 0x6f, 0xd3, 0x4e, - 0x14, 0x8f, 0x9b, 0x7c, 0xd3, 0xea, 0xda, 0x2f, 0x22, 0x6e, 0xda, 0xba, 0x11, 0xf2, 0x45, 0x1e, - 0x50, 0x90, 0xa8, 0x43, 0x8a, 0x8a, 0xd4, 0x0c, 0x88, 0x3a, 0xd0, 0xa5, 0x50, 0x55, 0x8e, 0xc4, - 0x80, 0x84, 0xac, 0xb3, 0x7d, 0x38, 0x56, 0x7a, 0x39, 0xd7, 0x77, 0xae, 0xec, 0x2e, 0xac, 0x88, - 0x89, 0x91, 0xb1, 0x33, 0x7f, 0x49, 0xc7, 0x8e, 0x4c, 0x2e, 0x4a, 0x17, 0xc4, 0xe8, 0x91, 0x09, - 0xd9, 0x97, 0xb6, 0x69, 0x29, 0x88, 0xc5, 0xbe, 0xf7, 0xde, 0xe7, 0xc7, 0xf9, 0xbd, 0xf3, 0x01, - 0x25, 0x6e, 0xa3, 0x88, 0x0f, 0xda, 0x3c, 0x09, 0x30, 0x13, 0x4f, 0x3d, 0x08, 0x29, 0xa7, 0x72, - 0xdd, 0xa1, 0x8c, 0x50, 0x66, 0x31, 0x77, 0xa8, 0xc7, 0x7a, 0x0e, 0xd2, 0x0f, 0x3b, 0x8d, 0xfb, - 0x7c, 0xe0, 0x87, 0xae, 0x15, 0xa0, 0x90, 0x27, 0xed, 0x02, 0xd8, 0xf6, 0xa8, 0x47, 0xaf, 0x56, - 0x82, 0xdd, 0xa8, 0xfd, 0x26, 0xa8, 0x7d, 0x9c, 0x01,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, 0x17, 0xcf, 0x8b, 0x7a, 0x96, 0x42, 0x55, 0xb8, 0xfd, 0x41, - 0x40, 0x33, 0xeb, 0xec, 0x1a, 0x4f, 0xa4, 0xe5, 0x04, 0xac, 0xde, 0x64, 0x30, 0xec, 0x04, 0xeb, - 0x1b, 0x4f, 0x86, 0x1d, 0xe5, 0xbf, 0xc2, 0xf4, 0xe9, 0x38, 0x85, 0xcb, 0xd7, 0x4c, 0xfb, 0x17, - 0x88, 0x2c, 0x85, 0xcd, 0xdb, 0x6d, 0x2f, 0x45, 0x34, 0x73, 0x99, 0xdd, 0xca, 0xed, 0xce, 0xe5, - 0xc7, 0x2b, 0x9f, 0xb0, 0xd1, 0x3b, 0x19, 0xab, 0xd2, 0xe9, 0x58, 0x95, 0xbe, 0x8d, 0x55, 0xe9, - 0xd3, 0xb9, 0x5a, 0x3a, 0x3d, 0x57, 0x4b, 0x5f, 0xcf, 0xd5, 0xd2, 0x9b, 0x07, 0x7f, 0x3d, 0x45, - 0xd3, 0x37, 0x82, 0x5d, 0x2d, 0xfe, 0xdd, 0xc7, 0xbf, 0x02, 0x00, 0x00, 0xff, 0xff, 0xce, 0x6d, - 0xf3, 0x2e, 0x28, 0x04, 0x00, 0x00, + // 803 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xa4, 0x55, 0xcf, 0x8f, 0xdb, 0x44, + 0x14, 0x8e, 0x37, 0x6e, 0x36, 0x99, 0x5d, 0x0a, 0x99, 0x4d, 0xdb, 0x34, 0x5a, 0x79, 0x22, 0x1f, + 0x50, 0x90, 0x58, 0x87, 0x04, 0x16, 0x69, 0x73, 0x40, 0xac, 0xb3, 0x54, 0x54, 0x85, 0xaa, 0x9a, + 0x20, 0x0e, 0x48, 0xc8, 0x9a, 0xd8, 0x53, 0xc7, 0xca, 0x3a, 0x76, 0x3d, 0xe3, 0x55, 0xbc, 0x57, + 0x2e, 0x88, 0x13, 0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x00, 0x00, 0xff, 0xff, 0xc0, 0xb1, 0x78, 0x7e, 0x41, + 0x06, 0x00, 0x00, } func (this *StdFee) Equal(that interface{}) bool { @@ -407,6 +587,43 @@ func (m *StdFee) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } +func (m *StdSignature) 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 *StdSignature) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *StdSignature) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Signature) > 0 { + i -= len(m.Signature) + copy(dAtA[i:], m.Signature) + i = encodeVarintTypes(dAtA, i, uint64(len(m.Signature))) + i-- + dAtA[i] = 0x12 + } + if len(m.PubKey) > 0 { + i -= len(m.PubKey) + copy(dAtA[i:], m.PubKey) + i = encodeVarintTypes(dAtA, i, uint64(len(m.PubKey))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + func (m *Params) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) @@ -455,6 +672,117 @@ func (m *Params) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } +func (m *StdTxBase) 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 *StdTxBase) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *StdTxBase) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Memo) > 0 { + i -= len(m.Memo) + copy(dAtA[i:], m.Memo) + i = encodeVarintTypes(dAtA, i, uint64(len(m.Memo))) + i-- + dAtA[i] = 0x1a + } + if len(m.Signatures) > 0 { + for iNdEx := len(m.Signatures) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Signatures[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTypes(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + } + { + size, err := m.Fee.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTypes(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil +} + +func (m *StdSignDocBase) 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 *StdSignDocBase) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *StdSignDocBase) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + { + size, err := m.Fee.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTypes(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x2a + if len(m.Memo) > 0 { + i -= len(m.Memo) + copy(dAtA[i:], m.Memo) + i = encodeVarintTypes(dAtA, i, uint64(len(m.Memo))) + i-- + dAtA[i] = 0x22 + } + if m.Sequence != 0 { + i = encodeVarintTypes(dAtA, i, uint64(m.Sequence)) + i-- + dAtA[i] = 0x18 + } + if m.AccountNumber != 0 { + i = encodeVarintTypes(dAtA, i, uint64(m.AccountNumber)) + i-- + dAtA[i] = 0x10 + } + if len(m.ChainID) > 0 { + i -= len(m.ChainID) + copy(dAtA[i:], m.ChainID) + i = encodeVarintTypes(dAtA, i, uint64(len(m.ChainID))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + func encodeVarintTypes(dAtA []byte, offset int, v uint64) int { offset -= sovTypes(v) base := offset @@ -507,6 +835,23 @@ func (m *StdFee) Size() (n int) { 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 + sovTypes(uint64(l)) + } + l = len(m.Signature) + if l > 0 { + n += 1 + l + sovTypes(uint64(l)) + } + return n +} + func (m *Params) Size() (n int) { if m == nil { return 0 @@ -531,6 +876,52 @@ func (m *Params) Size() (n int) { return n } +func (m *StdTxBase) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.Fee.Size() + n += 1 + l + sovTypes(uint64(l)) + if len(m.Signatures) > 0 { + for _, e := range m.Signatures { + l = e.Size() + n += 1 + l + sovTypes(uint64(l)) + } + } + l = len(m.Memo) + if l > 0 { + n += 1 + l + sovTypes(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 + sovTypes(uint64(l)) + } + if m.AccountNumber != 0 { + n += 1 + sovTypes(uint64(m.AccountNumber)) + } + if m.Sequence != 0 { + n += 1 + sovTypes(uint64(m.Sequence)) + } + l = len(m.Memo) + if l > 0 { + n += 1 + l + sovTypes(uint64(l)) + } + l = m.Fee.Size() + n += 1 + l + sovTypes(uint64(l)) + return n +} + func sovTypes(x uint64) (n int) { return (math_bits.Len64(x|1) + 6) / 7 } @@ -802,6 +1193,127 @@ func (m *StdFee) Unmarshal(dAtA []byte) error { } return nil } +func (m *StdSignature) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: StdSignature: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: StdSignature: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field PubKey", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.PubKey = append(m.PubKey[:0], dAtA[iNdEx:postIndex]...) + if m.PubKey == nil { + m.PubKey = []byte{} + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Signature", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Signature = append(m.Signature[:0], dAtA[iNdEx:postIndex]...) + if m.Signature == nil { + m.Signature = []byte{} + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipTypes(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} func (m *Params) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -950,6 +1462,346 @@ func (m *Params) Unmarshal(dAtA []byte) error { } return nil } +func (m *StdTxBase) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: StdTxBase: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: StdTxBase: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Fee", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.Fee.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Signatures", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Signatures = append(m.Signatures, StdSignature{}) + if err := m.Signatures[len(m.Signatures)-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 Memo", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Memo = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipTypes(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *StdSignDocBase) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: StdSignDocBase: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: StdSignDocBase: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ChainID", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ChainID = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field AccountNumber", wireType) + } + m.AccountNumber = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.AccountNumber |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 3: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Sequence", wireType) + } + m.Sequence = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Sequence |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Memo", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Memo = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 5: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Fee", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.Fee.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipTypes(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} func skipTypes(dAtA []byte) (n int, err error) { l := len(dAtA) iNdEx := 0 diff --git a/x/auth/types/types.proto b/x/auth/types/types.proto index 60e7a8d8b..305b5368f 100644 --- a/x/auth/types/types.proto +++ b/x/auth/types/types.proto @@ -23,13 +23,23 @@ message BaseAccount { // gas to be used by the transaction. The ratio yields an effective "gasprice", // which must be above some miminum to be accepted into the mempool. message StdFee { - option (gogoproto.equal) = true; + option (gogoproto.goproto_getters) = false; + option (gogoproto.equal) = true; repeated cosmos_sdk.v1.Coin amount = 1 [(gogoproto.nullable) = false, (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins"]; uint64 gas = 2; } +// StdSignature defines a signature structure that contains the signature of a +// transaction and an optional public key. +message StdSignature { + option (gogoproto.goproto_getters) = false; + + bytes pub_key = 1 [(gogoproto.jsontag) = "public_key,omitempty", (gogoproto.moretags) = "yaml:\"public_key\""]; + bytes signature = 2; +} + // Params defines the parameters for the auth module. message Params { option (gogoproto.equal) = true; @@ -43,3 +53,21 @@ message Params { uint64 sig_verify_cost_secp256k1 = 5 [(gogoproto.customname) = "SigVerifyCostSecp256k1", (gogoproto.moretags) = "yaml:\"sig_verify_cost_secp256k1\""]; } + +// StdTxBase defines a transaction base which application-level concrete transaction +// types can extend. +message StdTxBase { + StdFee fee = 1 [(gogoproto.nullable) = false]; + repeated StdSignature signatures = 2 [(gogoproto.nullable) = false]; + string memo = 3; +} + +// StdSignDocBase defines the base structure for which applications can extend +// to define the concrete structure that signers sign over. +message StdSignDocBase { + string chain_id = 1 [(gogoproto.customname) = "ChainID", (gogoproto.moretags) = "yaml:\"chain_id\""]; + uint64 account_number = 2 [(gogoproto.moretags) = "yaml:\"account_number\""]; + uint64 sequence = 3; + string memo = 4; + StdFee fee = 5 [(gogoproto.nullable) = false]; +}