From 615fcd7645f9434505d255433f06a7fde859627b Mon Sep 17 00:00:00 2001 From: Aleksandr Bezobchuk Date: Thu, 12 Mar 2020 09:30:05 -0400 Subject: [PATCH 01/17] Define message proto --- codec/std/codec.pb.go | 1859 +++++++++++++++++++++++++++++++++++++++-- codec/std/codec.proto | 33 +- 2 files changed, 1835 insertions(+), 57 deletions(-) diff --git a/codec/std/codec.pb.go b/codec/std/codec.pb.go index ef4c65543..e330bd97e 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" @@ -572,6 +577,290 @@ func (*Content) XXX_OneofWrappers() []interface{} { } } +// 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{7} +} +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), + } +} + func init() { proto.RegisterType((*Account)(nil), "cosmos_sdk.codec.std.v1.Account") proto.RegisterType((*Supply)(nil), "cosmos_sdk.codec.std.v1.Supply") @@ -580,67 +869,101 @@ 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((*Message)(nil), "cosmos_sdk.codec.std.v1.Message") } 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, 0x3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x45, 0xdf, - 0xf8, 0x6e, 0x7f, 0x65, 0xca, 0xea, 0xcf, 0xd2, 0x74, 0x4d, 0x8e, 0xf1, 0xbb, 0xff, 0x07, 0x00, - 0x00, 0xff, 0xff, 0xf7, 0xf2, 0xb6, 0xa2, 0x40, 0x09, 0x00, 0x00, + // 1394 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x57, 0x4d, 0x6f, 0xd4, 0xc6, + 0x1b, 0xf7, 0xfe, 0x59, 0x92, 0x30, 0x09, 0x10, 0xe6, 0x0f, 0xcd, 0x2a, 0x85, 0x0d, 0x84, 0x16, + 0xb5, 0xa0, 0xac, 0x79, 0x69, 0x0b, 0xac, 0x5a, 0x01, 0x9b, 0x80, 0x96, 0xaa, 0x69, 0x91, 0x29, + 0xa9, 0x5a, 0xd1, 0x5a, 0xb3, 0x9e, 0xc1, 0x99, 0x66, 0xed, 0x71, 0x3d, 0xe3, 0xcd, 0xe6, 0xd0, + 0x7b, 0xdb, 0x53, 0xa5, 0x7e, 0x01, 0xd4, 0x1e, 0x7b, 0xe5, 0xd8, 0x73, 0x85, 0x38, 0x71, 0xec, + 0x09, 0x55, 0x70, 0xe9, 0xc7, 0xa8, 0xe6, 0xc5, 0x5e, 0x7b, 0xed, 0xdd, 0xd0, 0xcb, 0x6a, 0x67, + 0x9e, 0xe7, 0xf7, 0x32, 0x9e, 0x79, 0xe6, 0xb1, 0xc1, 0x09, 0x8f, 0x61, 0xe2, 0xd9, 0x5c, 0x60, + 0x5b, 0xfd, 0x6b, 0x45, 0x31, 0x13, 0x0c, 0x2e, 0x79, 0x8c, 0x07, 0x8c, 0xbb, 0x1c, 0xef, 0xb4, + 0xf4, 0x3c, 0x17, 0xb8, 0x35, 0xb8, 0xb4, 0x7c, 0x41, 0x6c, 0xd3, 0x18, 0xbb, 0x11, 0x8a, 0xc5, + 0x9e, 0xad, 0x72, 0x6d, 0x9d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0xfa, 0x23, 0x8a, 0xfe, + 0xdd, 0x69, 0xf4, 0xb7, 0x31, 0x15, 0x79, 0xf2, 0xc5, 0x60, 0x6c, 0x0e, 0xde, 0x05, 0x0b, 0xfa, + 0x29, 0xaa, 0x62, 0x22, 0x8d, 0xa3, 0x8a, 0xf4, 0xad, 0x69, 0xa4, 0xa6, 0xf0, 0xe4, 0x66, 0xcc, + 0x07, 0xa3, 0x61, 0xfa, 0x18, 0x7a, 0xc4, 0xa7, 0xa1, 0x1b, 0x93, 0x8c, 0x72, 0x71, 0xff, 0xc7, + 0xd0, 0x91, 0x18, 0x27, 0x83, 0x98, 0xc7, 0x30, 0x36, 0x0b, 0x3f, 0xd3, 0x97, 0x6f, 0x12, 0x66, + 0xd4, 0xc7, 0xaa, 0xde, 0x35, 0x8b, 0xd4, 0x0f, 0xc2, 0x1c, 0xeb, 0xe1, 0x20, 0x3f, 0xd1, 0x3e, + 0xff, 0xec, 0xc9, 0xda, 0xb9, 0xa9, 0x2d, 0x45, 0x37, 0x13, 0xe9, 0x50, 0x37, 0x92, 0xce, 0xcd, + 0xa7, 0x2f, 0x9b, 0xb5, 0xe7, 0x2f, 0x9b, 0xb5, 0xbf, 0x5f, 0x36, 0x6b, 0x3f, 0xbf, 0x6a, 0x5a, + 0xcf, 0x5f, 0x35, 0xad, 0xbf, 0x5e, 0x35, 0xad, 0xaf, 0xa6, 0x13, 0x65, 0x9f, 0xf9, 0xbd, 0x19, + 0xf5, 0x3d, 0x78, 0xe5, 0xdf, 0x00, 0x00, 0x00, 0xff, 0xff, 0x3d, 0x1a, 0xad, 0x47, 0xfa, 0x0f, + 0x00, 0x00, } func (this *Supply) Equal(that interface{}) bool { @@ -1128,6 +1451,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) @@ -1641,6 +2131,399 @@ func (m *Content_CommunityPoolSpend) MarshalToSizedBuffer(dAtA []byte) (int, err } 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 encodeVarintCodec(dAtA []byte, offset int, v uint64) int { offset -= sovCodec(v) base := offset @@ -1887,6 +2770,222 @@ func (m *Content_CommunityPoolSpend) Size() (n int) { } 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 sovCodec(x uint64) (n int) { return (math_bits.Len64(x|1) + 6) / 7 @@ -2889,6 +3988,654 @@ func (m *Content) Unmarshal(dAtA []byte) error { } 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 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..612709a9b 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"; @@ -95,3 +99,30 @@ message Content { cosmos_sdk.x.distribution.v1.CommunityPoolSpendProposal community_pool_spend = 5; } } + +// 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; + } +} From 3a94f42e119354e0cfca2dd67ab678625f507581 Mon Sep 17 00:00:00 2001 From: Aleksandr Bezobchuk Date: Thu, 12 Mar 2020 10:53:27 -0400 Subject: [PATCH 02/17] Implement app-level tx --- codec/std/codec.pb.go | 416 +++++++++--- codec/std/codec.proto | 10 + codec/std/tx.go | 67 ++ .../adr-020-protobuf-transaction-encoding.md | 12 +- simapp/helpers/test_helpers.go | 2 +- x/auth/alias.go | 1 + x/auth/ante/basic.go | 2 +- x/auth/client/cli/tx_multisign.go | 6 +- x/auth/client/cli/tx_sign.go | 6 +- x/auth/types/stdtx.go | 40 +- x/auth/types/stdtx_test.go | 4 +- x/auth/types/test_utils.go | 6 +- x/auth/types/txbuilder.go | 3 +- x/auth/types/types.pb.go | 603 ++++++++++++++++-- x/auth/types/types.proto | 17 + 15 files changed, 1026 insertions(+), 169 deletions(-) create mode 100644 codec/std/tx.go diff --git a/codec/std/codec.pb.go b/codec/std/codec.pb.go index e330bd97e..13998ffad 100644 --- a/codec/std/codec.pb.go +++ b/codec/std/codec.pb.go @@ -577,6 +577,47 @@ 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 { + Base *types.StdTxBase `protobuf:"bytes,1,opt,name=base,proto3" json:"base,omitempty"` + Msgs []*Message `protobuf:"bytes,2,rep,name=msgs,proto3" json:"msgs,omitempty"` +} + +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 { @@ -607,7 +648,7 @@ func (m *Message) Reset() { *m = Message{} } func (m *Message) String() string { return proto.CompactTextString(m) } func (*Message) ProtoMessage() {} func (*Message) Descriptor() ([]byte, []int) { - return fileDescriptor_daf09dc2dfa19bb4, []int{7} + return fileDescriptor_daf09dc2dfa19bb4, []int{8} } func (m *Message) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -869,101 +910,105 @@ 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") } func init() { proto.RegisterFile("codec/std/codec.proto", fileDescriptor_daf09dc2dfa19bb4) } var fileDescriptor_daf09dc2dfa19bb4 = []byte{ - // 1394 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x57, 0x4d, 0x6f, 0xd4, 0xc6, - 0x1b, 0xf7, 0xfe, 0x59, 0x92, 0x30, 0x09, 0x10, 0xe6, 0x0f, 0xcd, 0x2a, 0x85, 0x0d, 0x84, 0x16, - 0xb5, 0xa0, 0xac, 0x79, 0x69, 0x0b, 0xac, 0x5a, 0x01, 0x9b, 0x80, 0x96, 0xaa, 0x69, 0x91, 0x29, - 0xa9, 0x5a, 0xd1, 0x5a, 0xb3, 0x9e, 0xc1, 0x99, 0x66, 0xed, 0x71, 0x3d, 0xe3, 0xcd, 0xe6, 0xd0, - 0x7b, 0xdb, 0x53, 0xa5, 0x7e, 0x01, 0xd4, 0x1e, 0x7b, 0xe5, 0xd8, 0x73, 0x85, 0x38, 0x71, 0xec, - 0x09, 0x55, 0x70, 0xe9, 0xc7, 0xa8, 0xe6, 0xc5, 0x5e, 0x7b, 0xed, 0xdd, 0xd0, 0xcb, 0x6a, 0x67, - 0x9e, 0xe7, 0xf7, 0x32, 0x9e, 0x79, 0xe6, 0xb1, 0xc1, 0x09, 0x8f, 0x61, 0xe2, 0xd9, 0x5c, 0x60, - 0x5b, 0xfd, 0x6b, 0x45, 0x31, 0x13, 0x0c, 0x2e, 0x79, 0x8c, 0x07, 0x8c, 0xbb, 0x1c, 0xef, 0xb4, - 0xf4, 0x3c, 0x17, 0xb8, 0x35, 0xb8, 0xb4, 0x7c, 0x41, 0x6c, 0xd3, 0x18, 0xbb, 0x11, 0x8a, 0xc5, - 0x9e, 0xad, 0x72, 0x6d, 0x9d, 0xba, 0x96, 0x1f, 0x68, 0x96, 0xe5, 0x73, 0xe5, 0x64, 0x9f, 0xf9, - 0x6c, 0xf4, 0xcf, 0xe4, 0x35, 0x86, 0x36, 0x4a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 0xfa, - 0x29, 0xaa, 0x62, 0x22, 0x8d, 0xa3, 0x8a, 0xf4, 0xad, 0x69, 0xa4, 0xa6, 0xf0, 0xe4, 0x66, 0xcc, - 0x07, 0xa3, 0x61, 0xfa, 0x18, 0x7a, 0xc4, 0xa7, 0xa1, 0x1b, 0x93, 0x8c, 0x72, 0x71, 0xff, 0xc7, - 0xd0, 0x91, 0x18, 0x27, 0x83, 0x98, 0xc7, 0x30, 0x36, 0x0b, 0x3f, 0xd3, 0x97, 0x6f, 0x12, 0x66, - 0xd4, 0xc7, 0xaa, 0xde, 0x35, 0x8b, 0xd4, 0x0f, 0xc2, 0x1c, 0xeb, 0xe1, 0x20, 0x3f, 0xd1, 0x3e, - 0xff, 0xec, 0xc9, 0xda, 0xb9, 0xa9, 0x2d, 0x45, 0x37, 0x13, 0xe9, 0x50, 0x37, 0x92, 0xce, 0xcd, - 0xa7, 0x2f, 0x9b, 0xb5, 0xe7, 0x2f, 0x9b, 0xb5, 0xbf, 0x5f, 0x36, 0x6b, 0x3f, 0xbf, 0x6a, 0x5a, - 0xcf, 0x5f, 0x35, 0xad, 0xbf, 0x5e, 0x35, 0xad, 0xaf, 0xa6, 0x13, 0x65, 0x9f, 0xf9, 0xbd, 0x19, - 0xf5, 0x3d, 0x78, 0xe5, 0xdf, 0x00, 0x00, 0x00, 0xff, 0xff, 0x3d, 0x1a, 0xad, 0x47, 0xfa, 0x0f, - 0x00, 0x00, + // 1443 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x58, 0xcf, 0x6f, 0xd4, 0xc6, + 0x17, 0xf7, 0xc2, 0x92, 0x2c, 0x93, 0x00, 0x61, 0xbe, 0xf0, 0x8d, 0x95, 0xc2, 0x26, 0x84, 0x16, + 0xb5, 0xa0, 0xac, 0x81, 0xd0, 0x02, 0xab, 0x56, 0xc0, 0x26, 0xa0, 0xa5, 0x6a, 0x5a, 0xe4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0x49, 0xa4, 0xba, 0xf0, 0xc4, 0x61, + 0xcc, 0x04, 0x83, 0x61, 0xfa, 0x1a, 0x3a, 0xc4, 0xf3, 0x43, 0x27, 0x26, 0x19, 0xe5, 0xdc, 0xfe, + 0xaf, 0xa1, 0x25, 0x30, 0x76, 0x06, 0xd1, 0xaf, 0x61, 0x68, 0x16, 0x7e, 0xa6, 0x2e, 0xdf, 0x24, + 0xcc, 0xa8, 0x4f, 0x96, 0x7d, 0xeb, 0x16, 0xa9, 0x1f, 0x85, 0x39, 0xd6, 0x63, 0x41, 0x7e, 0xa2, + 0x79, 0xf1, 0xc5, 0xb3, 0x95, 0x0b, 0x13, 0x5b, 0x9a, 0x6a, 0x66, 0xc2, 0xa1, 0x6a, 0x64, 0xad, + 0xdb, 0xcf, 0x5f, 0xd7, 0x2b, 0x2f, 0x5f, 0xd7, 0x2b, 0x7f, 0xbf, 0xae, 0x57, 0x7e, 0x7e, 0x53, + 0x37, 0x5e, 0xbe, 0xa9, 0x1b, 0x7f, 0xbd, 0xa9, 0x1b, 0x5f, 0x4e, 0x26, 0xca, 0xfe, 0xcd, 0xd0, + 0x99, 0x92, 0xbf, 0x47, 0x57, 0xff, 0x0d, 0x00, 0x00, 0xff, 0xff, 0xed, 0xa0, 0xda, 0x1d, 0x7a, + 0x10, 0x00, 0x00, } func (this *Supply) Equal(that interface{}) bool { @@ -2131,6 +2176,55 @@ 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 + } + } + if m.Base != nil { + { + size, err := m.Base.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) @@ -2770,6 +2864,25 @@ func (m *Content_CommunityPoolSpend) Size() (n int) { } return n } +func (m *Transaction) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Base != nil { + l = m.Base.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 @@ -3988,6 +4101,129 @@ 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 Base", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowCodec + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthCodec + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthCodec + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Base == nil { + m.Base = &types.StdTxBase{} + } + if err := m.Base.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 diff --git a/codec/std/codec.proto b/codec/std/codec.proto index 612709a9b..545597db7 100644 --- a/codec/std/codec.proto +++ b/codec/std/codec.proto @@ -100,6 +100,16 @@ message Content { } } +// 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; + repeated Message msgs = 2; +} + // Message defines the set of valid concrete message types that can be used to // construct a transaction. message Message { diff --git a/codec/std/tx.go b/codec/std/tx.go new file mode 100644 index 000000000..b26172671 --- /dev/null +++ b/codec/std/tx.go @@ -0,0 +1,67 @@ +package std + +import ( + 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{} + +// 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.Base.GetSignatures() + + if tx.Base.Fee.Gas > auth.MaxGasWanted { + return sdkerrors.Wrapf( + sdkerrors.ErrInvalidRequest, "invalid gas supplied; %d > %d", tx.Base.Fee.Gas, auth.MaxGasWanted, + ) + } + if tx.Base.Fee.Amount.IsAnyNegative() { + return sdkerrors.Wrapf( + sdkerrors.ErrInsufficientFee, "invalid fee provided: %s", tx.Base.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 +} diff --git a/docs/architecture/adr-020-protobuf-transaction-encoding.md b/docs/architecture/adr-020-protobuf-transaction-encoding.md index 39d3b1421..d61d65ade 100644 --- a/docs/architecture/adr-020-protobuf-transaction-encoding.md +++ b/docs/architecture/adr-020-protobuf-transaction-encoding.md @@ -43,9 +43,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 +61,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; } ``` 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/x/auth/alias.go b/x/auth/alias.go index 6c242caf5..f21e285cc 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 ( diff --git a/x/auth/ante/basic.go b/x/auth/ante/basic.go index 05e570ca2..d8abf8c9d 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.MustMarshalBinaryLengthPrefixed(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 a9a6cd3e9..e784f48ae 100644 --- a/x/auth/types/stdtx.go +++ b/x/auth/types/stdtx.go @@ -14,11 +14,10 @@ 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) -) +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 +45,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() { @@ -92,8 +91,9 @@ func CountSubKeys(pub crypto.PubKey) int { // 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 +102,7 @@ func (tx StdTx) GetSigners() []sdk.AccAddress { } } } + return signers } @@ -127,9 +128,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 } @@ -237,12 +240,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) { @@ -270,6 +267,17 @@ func DefaultTxEncoder(cdc *codec.Codec) sdk.TxEncoder { } } +// 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 ( @@ -279,7 +287,7 @@ func (ss StdSignature) MarshalYAML() (interface{}, error) { ) if ss.PubKey != nil { - pubkey, err = sdk.Bech32ifyPubKey(sdk.Bech32PubKeyTypeAccPub, ss.PubKey) + pubkey, err = sdk.Bech32ifyPubKey(sdk.Bech32PubKeyTypeAccPub, ss.GetPubKey()) if err != nil { return nil, err } @@ -290,7 +298,7 @@ func (ss StdSignature) MarshalYAML() (interface{}, error) { Signature string }{ PubKey: pubkey, - Signature: fmt.Sprintf("%s", ss.Signature), + Signature: fmt.Sprintf("%X", ss.Signature), }) if err != nil { return nil, err diff --git a/x/auth/types/stdtx_test.go b/x/auth/types/stdtx_test.go index a8ce9d721..38e1a3348 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")}, + StdSignature{PubKey: pubKey.Bytes(), Signature: []byte("dummySig")}, fmt.Sprintf("|\n pubkey: %s\n signature: dummySig\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..cc3837b4d 100644 --- a/x/auth/types/types.pb.go +++ b/x/auth/types/types.pb.go @@ -122,6 +122,46 @@ func (m *StdFee) GetGas() uint64 { return 0 } +// 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 *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 { MaxMemoCharacters uint64 `protobuf:"varint,1,opt,name=max_memo_characters,json=maxMemoCharacters,proto3" json:"max_memo_characters,omitempty" yaml:"max_memo_characters"` @@ -134,7 +174,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 +238,126 @@ 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,omitempty"` + Signatures []*StdSignature `protobuf:"bytes,2,rep,name=signatures,proto3" json:"signatures,omitempty"` + 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 nil +} + +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 "" +} + 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") } 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,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, 0x96, 0x9d, 0x70, 0x3c, 0x99, - 0x42, 0x33, 0x4b, 0xe1, 0xbd, 0x29, 0x8d, 0x9b, 0x30, 0xcd, 0xac, 0xe5, 0x62, 0x47, 0xb8, 0x47, - 0x19, 0xdf, 0xc3, 0xa1, 0x91, 0x70, 0x2c, 0x1f, 0x80, 0x95, 0xdc, 0xed, 0x10, 0x87, 0xfe, 0xbb, - 0x44, 0xe0, 0xb1, 0xbb, 0xbe, 0xb1, 0xd1, 0xd9, 0x14, 0xf3, 0x31, 0xba, 0xe3, 0x14, 0xd6, 0xfb, - 0xbe, 0xf7, 0xba, 0x40, 0xe4, 0xd4, 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, + // 727 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00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, 0xa6, 0x08, 0x41, 0xfd, + 0xff, 0xbf, 0x34, 0x3f, 0x4a, 0x90, 0x2a, 0xab, 0x3d, 0x20, 0xa0, 0xe1, 0x22, 0xbb, 0xc3, 0x93, + 0x61, 0x18, 0x83, 0x8d, 0xfb, 0x0c, 0x46, 0xad, 0xa0, 0xb1, 0xfd, 0x77, 0xaf, 0x5e, 0xfa, 0x29, + 0x2d, 0xfa, 0xcf, 0x30, 0x41, 0x6b, 0x77, 0x8a, 0xb6, 0x6f, 0x10, 0xa3, 0x04, 0x55, 0x66, 0x97, + 0x9d, 0x88, 0x68, 0x78, 0x8d, 0xcd, 0xe4, 0x36, 0x17, 0x84, 0xb5, 0x53, 0x77, 0xbd, 0x51, 0xc0, + 0x62, 0x9b, 0xdb, 0x4f, 0x06, 0x62, 0xe0, 0xa1, 0x0e, 0xb2, 0x47, 0x94, 0xa6, 0x97, 0xba, 0xd4, + 0xd8, 0xd4, 0x67, 0x3d, 0x2c, 0xba, 0x9c, 0x06, 0x2c, 0x80, 0xd0, 0x00, 0x60, 0x62, 0x19, 0x61, + 0x5d, 0x31, 0x16, 0xda, 0x83, 0xb4, 0x89, 0x87, 0xf1, 0x14, 0x0b, 0x42, 0x90, 0x13, 0x7e, 0x49, + 0x2f, 0x6f, 0x11, 0xa7, 0x6b, 0xa3, 0x75, 0x31, 0x54, 0x95, 0xcb, 0xa1, 0xaa, 0x7c, 0x18, 0xaa, + 0xca, 0xeb, 0x6b, 0x35, 0x73, 0x79, 0xad, 0x66, 0xde, 0x5f, 0xab, 0x99, 0x67, 0xbf, 0x7f, 0x73, + 0xae, 0xa6, 0xdf, 0xc8, 0x4e, 0x3e, 0x7d, 0xcd, 0xfe, 0xfa, 0x12, 0x00, 0x00, 0xff, 0xff, 0xf4, + 0x66, 0x9d, 0x7a, 0x3a, 0x05, 0x00, 0x00, } func (this *StdFee) Equal(that interface{}) bool { @@ -407,6 +517,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 +602,62 @@ 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 + } + } + if m.Fee != nil { + { + 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 encodeVarintTypes(dAtA []byte, offset int, v uint64) int { offset -= sovTypes(v) base := offset @@ -507,6 +710,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 +751,29 @@ func (m *Params) Size() (n int) { return n } +func (m *StdTxBase) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Fee != nil { + 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 sovTypes(x uint64) (n int) { return (math_bits.Len64(x|1) + 6) / 7 } @@ -802,6 +1045,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 +1314,161 @@ 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 m.Fee == nil { + m.Fee = &StdFee{} + } + 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 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..9cc76719f 100644 --- a/x/auth/types/types.proto +++ b/x/auth/types/types.proto @@ -30,6 +30,15 @@ message StdFee { 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 +52,11 @@ 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; + repeated StdSignature signatures = 2; + string memo = 3; +} From 34f9fc439a5f35922991330918d9c7c563a31c58 Mon Sep 17 00:00:00 2001 From: Aleksandr Bezobchuk Date: Thu, 12 Mar 2020 13:32:03 -0400 Subject: [PATCH 03/17] Implement canonical signing --- codec/std/codec.pb.go | 450 ++++++++++++---- codec/std/codec.proto | 12 +- codec/std/tx.go | 50 ++ .../adr-020-protobuf-transaction-encoding.md | 3 +- go.mod | 4 +- go.sum | 13 + x/auth/alias.go | 1 + x/auth/types/stdtx.go | 182 ++++--- x/auth/types/types.pb.go | 485 +++++++++++++++--- x/auth/types/types.proto | 14 +- 10 files changed, 935 insertions(+), 279 deletions(-) diff --git a/codec/std/codec.pb.go b/codec/std/codec.pb.go index 13998ffad..d5e09db4d 100644 --- a/codec/std/codec.pb.go +++ b/codec/std/codec.pb.go @@ -581,8 +581,8 @@ func (*Content) XXX_OneofWrappers() []interface{} { // processed by the state-machine. It contains a base of common fields and // repeated set of Message types. type Transaction struct { - Base *types.StdTxBase `protobuf:"bytes,1,opt,name=base,proto3" json:"base,omitempty"` - Msgs []*Message `protobuf:"bytes,2,rep,name=msgs,proto3" json:"msgs,omitempty"` + Base types.StdTxBase `protobuf:"bytes,1,opt,name=base,proto3" json:"base"` + Msgs []Message `protobuf:"bytes,2,rep,name=msgs,proto3" json:"msgs"` } func (m *Transaction) Reset() { *m = Transaction{} } @@ -902,6 +902,53 @@ func (*Message) XXX_OneofWrappers() []interface{} { } } +// 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") @@ -912,103 +959,106 @@ func init() { 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{ - // 1443 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x58, 0xcf, 0x6f, 0xd4, 0xc6, - 0x17, 0xf7, 0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e3, 0x92, - 0xfe, 0xbd, 0x49, 0xf4, 0x77, 0xb1, 0xcf, 0xf3, 0xe4, 0x73, 0xc1, 0xd0, 0x1c, 0xbc, 0x0f, 0x66, - 0xd5, 0x5b, 0x94, 0xc5, 0x44, 0xcc, 0x13, 0x92, 0xf4, 0xed, 0x49, 0xa4, 0xba, 0xf0, 0xc4, 0x61, - 0xcc, 0x04, 0x83, 0x61, 0xfa, 0x1a, 0x3a, 0xc4, 0xf3, 0x43, 0x27, 0x26, 0x19, 0xe5, 0xdc, 0xfe, - 0xaf, 0xa1, 0x25, 0x30, 0x76, 0x06, 0xd1, 0xaf, 0x61, 0x68, 0x16, 0x7e, 0xa6, 0x2e, 0xdf, 0x24, - 0xcc, 0xa8, 0x4f, 0x96, 0x7d, 0xeb, 0x16, 0xa9, 0x1f, 0x85, 0x39, 0xd6, 0x63, 0x41, 0x7e, 0xa2, - 0x79, 0xf1, 0xc5, 0xb3, 0x95, 0x0b, 0x13, 0x5b, 0x9a, 0x6a, 0x66, 0xc2, 0xa1, 0x6a, 0x64, 0xad, - 0xdb, 0xcf, 0x5f, 0xd7, 0x2b, 0x2f, 0x5f, 0xd7, 0x2b, 0x7f, 0xbf, 0xae, 0x57, 0x7e, 0x7e, 0x53, - 0x37, 0x5e, 0xbe, 0xa9, 0x1b, 0x7f, 0xbd, 0xa9, 0x1b, 0x5f, 0x4e, 0x26, 0xca, 0xfe, 0xcd, 0xd0, - 0x99, 0x92, 0xbf, 0x47, 0x57, 0xff, 0x0d, 0x00, 0x00, 0xff, 0xff, 0xed, 0xa0, 0xda, 0x1d, 0x7a, - 0x10, 0x00, 0x00, + // 1476 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x58, 0xcd, 0x6f, 0xd4, 0xc6, + 0x1b, 0xf6, 0xc2, 0x92, 0x84, 0x49, 0x80, 0x30, 0x3f, 0xf8, 0x65, 0x95, 0xc2,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x37, 0x14, 0xaf, 0xaa, 0xe2, 0xbd, 0x33, 0x3e, + 0xde, 0x3d, 0x83, 0x1e, 0x0a, 0xf8, 0xff, 0xa8, 0xd4, 0x02, 0x3f, 0x06, 0x47, 0x03, 0x86, 0x93, + 0x4e, 0xff, 0x8a, 0x0e, 0xa9, 0x38, 0x6f, 0x16, 0xe3, 0xe8, 0x04, 0x95, 0x11, 0x36, 0x94, 0x77, + 0x9f, 0xf8, 0x48, 0x90, 0xdf, 0x68, 0xae, 0x3c, 0x7b, 0xb2, 0xfc, 0xee, 0x05, 0x9f, 0x8a, 0xed, + 0xa4, 0xdd, 0xf0, 0x58, 0x60, 0xca, 0x34, 0x2d, 0x5d, 0x8e, 0x77, 0x6c, 0x53, 0x68, 0xa4, 0x17, + 0xb1, 0x58, 0x10, 0xdc, 0x30, 0xd0, 0xd5, 0x43, 0xe0, 0x20, 0x4f, 0x82, 0xa5, 0xef, 0x2b, 0x60, + 0x62, 0x53, 0x85, 0x83, 0xd7, 0xc1, 0x84, 0x0e, 0x6c, 0xf2, 0xa6, 0x3e, 0x4a, 0x94, 0xf6, 0x6f, + 0x59, 0x8e, 0xf1, 0x6f, 0xde, 0xf8, 0xeb, 0xf1, 0x42, 0xe5, 0xd9, 0x93, 0xe5, 0x6b, 0xfb, 0x49, + 0x31, 0x95, 0x97, 0x89, 0xd1, 0x4c, 0x77, 0x53, 0x31, 0x3f, 0x57, 0xc0, 0xd4, 0x6d, 0x53, 0x80, + 0xf0, 0x23, 0x30, 0x43, 0xbe, 0x4e, 0x68, 0x97, 0x79, 0x48, 0x96, 0xb2, 0x11, 0x75, 0xbe, 0x28, + 0x2a, 0x2d, 0x57, 0x29, 0xeb, 0x76, 0xce, 0xbb, 0x65, 0x39, 0x05, 0x74, 0xf3, 0x96, 0x91, 0xb8, + 0xb2, 0x8f, 0xc2, 0xac, 0xfe, 0x33, 0x8d, 0xa9, 0xa0, 0x54, 0xe4, 0xaf, 0x15, 0x70, 0x7c, 0x83, + 0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 0x4f, 0x3e, 0x1b, 0x0c, 0xec, 0xc1, + 0xbb, 0x60, 0x46, 0xbf, 0x45, 0x55, 0x4c, 0xa4, 0x76, 0x4c, 0x91, 0x9e, 0x1b, 0x47, 0x6a, 0x0a, + 0x4f, 0x5e, 0xc6, 0x74, 0xd0, 0x5f, 0xa6, 0xaf, 0xa1, 0x4d, 0x7c, 0x1a, 0xba, 0x31, 0xc9, 0x28, + 0x67, 0xf7, 0x7f, 0x0d, 0xab, 0x12, 0xe3, 0x64, 0x10, 0xf3, 0x1a, 0x06, 0x76, 0xe1, 0x27, 0xba, + 0xf9, 0x26, 0x61, 0x46, 0x7d, 0xbc, 0xec, 0xc3, 0xb7, 0x48, 0xfd, 0x20, 0xcc, 0xb1, 0x1e, 0x09, + 0xf2, 0x1b, 0xcd, 0x0b, 0xcf, 0x9e, 0x2c, 0x9f, 0x1f, 0x3b, 0xdf, 0xf4, 0x64, 0x93, 0x0a, 0xcd, + 0x54, 0xfb, 0xa1, 0x02, 0x26, 0x37, 0xa9, 0x1f, 0xae, 0x33, 0x0f, 0xde, 0x29, 0x4c, 0xb4, 0x73, + 0x23, 0x27, 0x9a, 0xf1, 0x57, 0x63, 0x6d, 0x26, 0xfd, 0x20, 0xfb, 0xfb, 0x3f, 0x19, 0x6f, 0xab, + 0x37, 0x9f, 0xbe, 0xac, 0x57, 0x9e, 0xbf, 0xac, 0x57, 0xfe, 0x7c, 0x59, 0xaf, 0xfc, 0xf8, 0xaa, + 0x6e, 0x3d, 0x7f, 0x55, 0xb7, 0xfe, 0x78, 0x55, 0xb7, 0x3e, 0x1f, 0x7f, 0xb0, 0xec, 0x7f, 0x20, + 0xed, 0x09, 0xf5, 0x63, 0xf9, 0xea, 0x3f, 0x01, 0x00, 0x00, 0xff, 0xff, 0x8c, 0xf7, 0xe4, 0x03, + 0x17, 0x11, 0x00, 0x00, } func (this *Supply) Equal(that interface{}) bool { @@ -2210,18 +2260,16 @@ func (m *Transaction) MarshalToSizedBuffer(dAtA []byte) (int, error) { dAtA[i] = 0x12 } } - if m.Base != nil { - { - size, err := m.Base.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintCodec(dAtA, i, uint64(size)) + { + size, err := m.Base.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err } - i-- - dAtA[i] = 0xa + i -= size + i = encodeVarintCodec(dAtA, i, uint64(size)) } + i-- + dAtA[i] = 0xa return len(dAtA) - i, nil } @@ -2618,6 +2666,53 @@ func (m *Message_MsgUndelegate) MarshalToSizedBuffer(dAtA []byte) (int, error) { } 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 @@ -2870,10 +2965,8 @@ func (m *Transaction) Size() (n int) { } var l int _ = l - if m.Base != nil { - l = m.Base.Size() - n += 1 + l + sovCodec(uint64(l)) - } + l = m.Base.Size() + n += 1 + l + sovCodec(uint64(l)) if len(m.Msgs) > 0 { for _, e := range m.Msgs { l = e.Size() @@ -3099,6 +3192,22 @@ func (m *Message_MsgUndelegate) Size() (n int) { } 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 @@ -4159,9 +4268,6 @@ func (m *Transaction) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - if m.Base == nil { - m.Base = &types.StdTxBase{} - } if err := m.Base.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } @@ -4195,7 +4301,7 @@ func (m *Transaction) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.Msgs = append(m.Msgs, &Message{}) + m.Msgs = append(m.Msgs, Message{}) if err := m.Msgs[len(m.Msgs)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } @@ -4872,6 +4978,126 @@ func (m *Message) Unmarshal(dAtA []byte) error { } 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 545597db7..f5ec7b987 100644 --- a/codec/std/codec.proto +++ b/codec/std/codec.proto @@ -106,8 +106,8 @@ message Content { message Transaction { option (gogoproto.goproto_getters) = false; - cosmos_sdk.x.auth.v1.StdTxBase base = 1; - repeated Message msgs = 2; + cosmos_sdk.x.auth.v1.StdTxBase base = 1 [(gogoproto.nullable) = false]; + repeated Message msgs = 2 [(gogoproto.nullable) = false]; } // Message defines the set of valid concrete message types that can be used to @@ -136,3 +136,11 @@ message Message { 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/tx.go b/codec/std/tx.go index b26172671..0437eef92 100644 --- a/codec/std/tx.go +++ b/codec/std/tx.go @@ -1,6 +1,11 @@ package std import ( + "bytes" + + jsonc "github.com/gibson042/canonicaljson-go" + "github.com/gogo/protobuf/jsonpb" + sdk "github.com/cosmos/cosmos-sdk/types" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" "github.com/cosmos/cosmos-sdk/x/auth" @@ -65,3 +70,48 @@ func (tx Transaction) ValidateBasic() error { return nil } + +// 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, a, s uint64) ([]byte, error) { + return NewSignDoc(a, s, cid, tx.Base.Memo, tx.Base.Fee, tx.Msgs...).SignBytes() +} + +func NewSignDoc(a, s uint64, cid, m string, f auth.StdFee, msgs ...Message) *SignDoc { + return &SignDoc{ + StdSignDocBase: auth.StdSignDocBase{ + ChainID: cid, + AccountNumber: a, + Sequence: s, + Memo: m, + Fee: f, + }, + 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) { + jm := &jsonpb.Marshaler{EmitDefaults: false, OrigName: false} + buf := new(bytes.Buffer) + + // first, encode via canonical Protocol Buffer JSON + if err := jm.Marshal(buf, sd); 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/docs/architecture/adr-020-protobuf-transaction-encoding.md b/docs/architecture/adr-020-protobuf-transaction-encoding.md index d61d65ade..1244cf24d 100644 --- a/docs/architecture/adr-020-protobuf-transaction-encoding.md +++ b/docs/architecture/adr-020-protobuf-transaction-encoding.md @@ -78,7 +78,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. diff --git a/go.mod b/go.mod index 446acc15d..d9fe6d045 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.1 - github.com/golang/protobuf v1.3.4 + 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.0 github.com/tendermint/tendermint v0.33.2 github.com/tendermint/tm-db v0.4.1 + google.golang.org/protobuf v1.20.1 gopkg.in/yaml.v2 v2.2.8 ) diff --git a/go.sum b/go.sum index a1723495d..3eeefa416 100644 --- a/go.sum +++ b/go.sum @@ -110,6 +110,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 h1:wDJmvq38kDhkVxi50ni9ykkdUr1PKgqKOoi01fa0Mdk= github.com/go-kit/kit v0.9.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= @@ -139,6 +141,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.4 h1:87PNWwrRvUSnqS4dlcBU/ftvOIBep4sYuBLlh6rX2wk= github.com/golang/protobuf v1.3.4/go.mod h1:vzj43D7+SQXF/4pzW/hwtAqwc6iTitCiVSaWz5lYuqw= +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= @@ -568,6 +575,12 @@ google.golang.org/grpc v1.23.1/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyac google.golang.org/grpc v1.26.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= google.golang.org/grpc v1.27.1 h1:zvIju4sqAGvwKspUQOhwnpcqSbzi7/H6QomNNjTL4sk= google.golang.org/grpc v1.27.1/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= +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 h1:qIbj1fsPNlZgppZ+VLlY7N33q108Sa+fhmuc+sWQYwY= diff --git a/x/auth/alias.go b/x/auth/alias.go index f21e285cc..ce005797b 100644 --- a/x/auth/alias.go +++ b/x/auth/alias.go @@ -88,4 +88,5 @@ type ( TxBuilder = types.TxBuilder GenesisAccountIterator = types.GenesisAccountIterator Codec = types.Codec + StdSignDocBase = types.StdSignDocBase ) diff --git a/x/auth/types/stdtx.go b/x/auth/types/stdtx.go index e784f48ae..a6a5e79c3 100644 --- a/x/auth/types/stdtx.go +++ b/x/auth/types/stdtx.go @@ -17,6 +17,96 @@ import ( // MaxGasWanted defines the max gas allowed. const 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, + } +} + +// 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))) +} + +// 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 +} + +// 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. @@ -70,21 +160,6 @@ 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 @@ -166,43 +241,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) @@ -266,43 +304,3 @@ func DefaultTxEncoder(cdc *codec.Codec) sdk.TxEncoder { return cdc.MarshalBinaryLengthPrefixed(tx) } } - -// 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 -} diff --git a/x/auth/types/types.pb.go b/x/auth/types/types.pb.go index cc3837b4d..699182bc8 100644 --- a/x/auth/types/types.pb.go +++ b/x/auth/types/types.pb.go @@ -241,9 +241,9 @@ func (m *Params) GetSigVerifyCostSecp256k1() uint64 { // 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,omitempty"` - Signatures []*StdSignature `protobuf:"bytes,2,rep,name=signatures,proto3" json:"signatures,omitempty"` - Memo string `protobuf:"bytes,3,opt,name=memo,proto3" json:"memo,omitempty"` + 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{} } @@ -279,14 +279,14 @@ func (m *StdTxBase) XXX_DiscardUnknown() { var xxx_messageInfo_StdTxBase proto.InternalMessageInfo -func (m *StdTxBase) GetFee() *StdFee { +func (m *StdTxBase) GetFee() StdFee { if m != nil { return m.Fee } - return nil + return StdFee{} } -func (m *StdTxBase) GetSignatures() []*StdSignature { +func (m *StdTxBase) GetSignatures() []StdSignature { if m != nil { return m.Signatures } @@ -300,64 +300,148 @@ func (m *StdTxBase) GetMemo() string { 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{ - // 727 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xa4, 0x54, 0x41, 0x4f, 0xdb, 0x48, - 0x14, 0x8e, 0x49, 0x36, 0xc0, 0xc0, 0xae, 0x36, 0x43, 0x80, 0x10, 0x21, 0x4f, 0xe4, 0xc3, 0x2a, - 0x2b, 0x2d, 0xce, 0x26, 0x2b, 0x56, 0x22, 0x87, 0xd5, 0xe2, 0xec, 0x72, 0xa1, 0x45, 0x68, 0x52, - 0xf5, 0x50, 0xa9, 0xb2, 0x26, 0xf6, 0xe0, 0x58, 0xc1, 0xb1, 0xf1, 0x8c, 0x51, 0xcc, 0xa5, 0xd7, - 0xaa, 0xa7, 0x4a, 0xbd, 0xf4, 0xc8, 0xb9, 0xbf, 0x84, 0x23, 0xc7, 0x9e, 0x4c, 0x15, 0x2e, 0x55, - 0x8f, 0x39, 0xf6, 0x54, 0x8d, 0x27, 0x84, 0x40, 0x43, 0x55, 0xa9, 0x97, 0x64, 0xe6, 0xbd, 0xef, - 0xfb, 0xde, 0xf8, 0xcd, 0xf7, 0x06, 0x94, 0x06, 0x35, 0x12, 0xf1, 0x6e, 0x8d, 0xc7, 0x01, 0x65, - 0xf2, 0x57, 0x0f, 0x42, 0x9f, 0xfb, 0xb0, 0x68, 0xf9, 0xcc, 0xf3, 0x99, 0xc9, 0xec, 0x9e, 0x3e, - 0xd0, 0x05, 0x48, 0x3f, 0xad, 0x97, 0x7f, 0xe3, 0x5d, 0x37, 0xb4, 0xcd, 0x80, 0x84, 0x3c, 0xae, - 0xa5, 0xc0, 0x9a, 0xe3, 0x3b, 0xfe, 0xed, 0x4a, 0xb2, 0xcb, 0x85, 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x8a, 0x3e, 0xd5, 0xf8, 0xd3, 0xba, 0xde, 0xf2, 0xdd, 0xbe, 0xf1, 0xe7, 0x45, 0x82, 0x32, - 0xef, 0xae, 0x50, 0xf5, 0x3b, 0xda, 0x23, 0x08, 0x0c, 0x8f, 0x45, 0xe1, 0xaf, 0x20, 0xeb, 0x10, - 0x96, 0x36, 0x25, 0x87, 0xc5, 0xb2, 0x99, 0xfb, 0x78, 0x8e, 0x14, 0xed, 0x0c, 0x2c, 0xb7, 0xb9, - 0xdd, 0x76, 0x9d, 0x3e, 0xe1, 0x51, 0x48, 0xa7, 0x1b, 0xa8, 0xfc, 0x48, 0x03, 0x37, 0xc1, 0x22, - 0xbb, 0x11, 0x95, 0x57, 0x81, 0x6f, 0x03, 0xcd, 0x9c, 0x68, 0x80, 0x76, 0x95, 0x05, 0xf9, 0x43, - 0x12, 0x12, 0x8f, 0xc1, 0x03, 0xb0, 0xe2, 0x91, 0x81, 0xe9, 0x51, 0xcf, 0x37, 0xad, 0x2e, 0x09, - 0x89, 0xc5, 0x69, 0x28, 0x0d, 0x91, 0x33, 0xd4, 0x51, 0x82, 0xca, 0xb2, 0xd4, 0x0c, 0x90, 0x86, - 0x0b, 0x1e, 0x19, 0x3c, 0xa6, 0x9e, 0xdf, 0x9a, 0xc4, 0xe0, 0x0e, 0x58, 0xe6, 0x03, 0x93, 0xb9, - 0x8e, 0x79, 0xec, 0x7a, 0x2e, 0x97, 0xdf, 0x6d, 0xac, 0x8f, 0x12, 0xb4, 0x22, 0x85, 0xa6, 0xb3, - 0x1a, 0x06, 0x7c, 0xd0, 0x76, 0x9d, 0x47, 0x62, 0x03, 0x31, 0x58, 0x4d, 0x93, 0x67, 0xd4, 0xb4, - 0x7c, 0xc6, 0xcd, 0x80, 0x86, 0x66, 0x27, 0xe6, 0x74, 0xec, 0x80, 0xca, 0x28, 0x41, 0x9b, 0x53, - 0x1a, 0xf7, 0x61, 0x1a, 0x2e, 0x08, 0xb1, 0x33, 0xda, 0xf2, 0x19, 0x3f, 0xa4, 0xa1, 0x11, 0x73, - 0x0a, 0x4f, 0xc0, 0xba, 0xa8, 0x76, 0x4a, 0x43, 0xf7, 0x28, 0x96, 0x78, 0x6a, 0x37, 0xb6, 0xb7, - 0xeb, 0x3b, 0xd2, 0x1b, 0x46, 0x73, 0x98, 0xa0, 0x62, 0xdb, 0x75, 0x9e, 0xa6, 0x08, 0x41, 0xfd, - 0xff, 0xbf, 0x34, 0x3f, 0x4a, 0x90, 0x2a, 0xab, 0x3d, 0x20, 0xa0, 0xe1, 0x22, 0xbb, 0xc3, 0x93, - 0x61, 0x18, 0x83, 0x8d, 0xfb, 0x0c, 0x46, 0xad, 0xa0, 0xb1, 0xfd, 0x77, 0xaf, 0x5e, 0xfa, 0x29, - 0x2d, 0xfa, 0xcf, 0x30, 0x41, 0x6b, 0x77, 0x8a, 0xb6, 0x6f, 0x10, 0xa3, 0x04, 0x55, 0x66, 0x97, - 0x9d, 0x88, 0x68, 0x78, 0x8d, 0xcd, 0xe4, 0x36, 0x17, 0x84, 0xb5, 0x53, 0x77, 0xbd, 0x51, 0xc0, - 0x62, 0x9b, 0xdb, 0x4f, 0x06, 0x62, 0xe0, 0xa1, 0x0e, 0xb2, 0x47, 0x94, 0xa6, 0x97, 0xba, 0xd4, - 0xd8, 0xd4, 0x67, 0x3d, 0x2c, 0xba, 0x9c, 0x06, 0x2c, 0x80, 0xd0, 0x00, 0x60, 0x62, 0x19, 0x61, - 0x5d, 0x31, 0x16, 0xda, 0x83, 0xb4, 0x89, 0x87, 0xf1, 0x14, 0x0b, 0x42, 0x90, 0x13, 0x7e, 0x49, - 0x2f, 0x6f, 0x11, 0xa7, 0x6b, 0xa3, 0x75, 0x31, 0x54, 0x95, 0xcb, 0xa1, 0xaa, 0x7c, 0x18, 0xaa, - 0xca, 0xeb, 0x6b, 0x35, 0x73, 0x79, 0xad, 0x66, 0xde, 0x5f, 0xab, 0x99, 0x67, 0xbf, 0x7f, 0x73, - 0xae, 0xa6, 0xdf, 0xc8, 0x4e, 0x3e, 0x7d, 0xcd, 0xfe, 0xfa, 0x12, 0x00, 0x00, 0xff, 0xff, 0xf4, - 0x66, 0x9d, 0x7a, 0x3a, 0x05, 0x00, 0x00, + // 803 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xa4, 0x55, 0xcf, 0x6f, 0x1b, 0x45, + 0x14, 0xf6, 0xc6, 0x5b, 0x27, 0x99, 0x84, 0x42, 0x26, 0x6e, 0xeb, 0x5a, 0xd1, 0x8e, 0xb5, 0x07, + 0x64, 0x24, 0xb2, 0xc6, 0x86, 0x20, 0xc5, 0x07, 0x44, 0xd6, 0xa1, 0xa2, 0x2a, 0x54, 0xd5, 0x18, + 0x71, 0x40, 0x42, 0xab, 0xf1, 0xee, 0x74, 0xbd, 0x72, 0xd6, 0xbb, 0xdd, 0x99, 0x8d, 0xbc, 0xb9, + 0x70, 0x45, 0x9c, 0x38, 0x72, 0x23, 0x67, 0xfe, 0x92, 0x1e, 0x7b, 0xe4, 0xb4, 0x45, 0xce, 0x05, + 0x71, 0x5c, 0x6e, 0x9c, 0xd0, 0xcc, 0xf8, 0x67, 0x71, 0x11, 0xa8, 0x17, 0x7b, 0xe6, 0xcd, 0xfb, + 0xbe, 0xf7, 0xfc, 0xcd, 0x37, 0xcf, 0xa0, 0x36, 0x69, 0x91, 0x94, 0x0f, 0x5b, 0x3c, 0x8b, 0x29, + 0x53, 0x9f, 0x56, 0x9c, 0x44, 0x3c, 0x82, 0x55, 0x37, 0x62, 0x61, 0xc4, 0x1c, 0xe6, 0x8d, 0xac, + 0x89, 0x25, 0x92, 0xac, 0xcb, 0x76, 0xfd, 0x5d, 0x3e, 0x0c, 0x12, 0xcf, 0x89, 0x49, 0xc2, 0xb3, + 0x96, 0x4c, 0x6c, 0xf9, 0x91, 0x1f, 0x2d, 0x57, 0x0a, 0x5d, 0x3f, 0xf8, 0x07, 0xa1,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 0xc6, 0x34, 0x47, 0xdb, 0x3d, 0x11, 0x7b, 0x78, 0x5e, 0xe4, 0xe8, 0x6d, + 0xa5, 0xcc, 0x3c, 0xc9, 0xc4, 0xdb, 0x72, 0xf9, 0xd0, 0xdb, 0x30, 0x36, 0xb6, 0xde, 0x60, 0x6c, + 0x94, 0xd7, 0xc7, 0xc6, 0xa2, 0x7f, 0x7d, 0xd9, 0xff, 0x5c, 0xd3, 0x5b, 0xff, 0x4b, 0x53, 0xbb, + 0xf7, 0x7c, 0x6a, 0x68, 0x2f, 0xa6, 0x86, 0xf6, 0xdb, 0xd4, 0xd0, 0x7e, 0xbc, 0x31, 0x4a, 0x2f, + 0x6e, 0x8c, 0xd2, 0xaf, 0x37, 0x46, 0xe9, 0x9b, 0xf7, 0xfe, 0x75, 0xb2, 0xac, 0xfe, 0x4b, 0x0c, + 0x2a, 0x72, 0x9e, 0x7f, 0xf8, 0x77, 0x00, 0x00, 0x00, 0xff, 0xff, 0xc2, 0xcf, 0xcb, 0xc3, 0x3c, + 0x06, 0x00, 0x00, } func (this *StdFee) Equal(that interface{}) bool { @@ -643,15 +727,70 @@ func (m *StdTxBase) MarshalToSizedBuffer(dAtA []byte) (int, error) { dAtA[i] = 0x12 } } - if m.Fee != nil { - { - size, err := m.Fee.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintTypes(dAtA, i, uint64(size)) + { + 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 } @@ -757,10 +896,8 @@ func (m *StdTxBase) Size() (n int) { } var l int _ = l - if m.Fee != nil { - l = m.Fee.Size() - n += 1 + l + sovTypes(uint64(l)) - } + l = m.Fee.Size() + n += 1 + l + sovTypes(uint64(l)) if len(m.Signatures) > 0 { for _, e := range m.Signatures { l = e.Size() @@ -774,6 +911,31 @@ func (m *StdTxBase) Size() (n int) { 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 } @@ -1372,9 +1534,6 @@ func (m *StdTxBase) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - if m.Fee == nil { - m.Fee = &StdFee{} - } if err := m.Fee.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } @@ -1408,7 +1567,7 @@ func (m *StdTxBase) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.Signatures = append(m.Signatures, &StdSignature{}) + m.Signatures = append(m.Signatures, StdSignature{}) if err := m.Signatures[len(m.Signatures)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } @@ -1469,6 +1628,194 @@ func (m *StdTxBase) Unmarshal(dAtA []byte) error { } 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 9cc76719f..e15e0342f 100644 --- a/x/auth/types/types.proto +++ b/x/auth/types/types.proto @@ -56,7 +56,17 @@ message Params { // StdTxBase defines a transaction base which application-level concrete transaction // types can extend. message StdTxBase { - StdFee fee = 1; - repeated StdSignature signatures = 2; + 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]; +} From 53a43dc2a14279d78c465ac3ae213ab83dac8645 Mon Sep 17 00:00:00 2001 From: Aleksandr Bezobchuk Date: Thu, 12 Mar 2020 13:46:35 -0400 Subject: [PATCH 04/17] Fix API --- codec/std/tx.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/codec/std/tx.go b/codec/std/tx.go index 0437eef92..595fbd848 100644 --- a/codec/std/tx.go +++ b/codec/std/tx.go @@ -76,7 +76,7 @@ func (tx Transaction) ValidateBasic() error { // 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, a, s uint64) ([]byte, error) { - return NewSignDoc(a, s, cid, tx.Base.Memo, tx.Base.Fee, tx.Msgs...).SignBytes() + return NewSignDoc(a, s, cid, tx.Base.Memo, tx.Base.Fee, tx.Msgs...).CanonicalSignBytes() } func NewSignDoc(a, s uint64, cid, m string, f auth.StdFee, msgs ...Message) *SignDoc { From 55139277784784713273a6316be4700c07adf672 Mon Sep 17 00:00:00 2001 From: Aleksandr Bezobchuk Date: Thu, 12 Mar 2020 13:52:55 -0400 Subject: [PATCH 05/17] Fix TestStdSignatureMarshalYAML --- x/auth/types/stdtx_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/x/auth/types/stdtx_test.go b/x/auth/types/stdtx_test.go index 38e1a3348..7c269e419 100644 --- a/x/auth/types/stdtx_test.go +++ b/x/auth/types/stdtx_test.go @@ -153,7 +153,7 @@ func TestStdSignatureMarshalYAML(t *testing.T) { }, { StdSignature{PubKey: pubKey.Bytes(), Signature: []byte("dummySig")}, - fmt.Sprintf("|\n pubkey: %s\n signature: dummySig\n", sdk.MustBech32ifyPubKey(sdk.Bech32PubKeyTypeAccPub, pubKey)), + fmt.Sprintf("|\n pubkey: %s\n signature: 64756D6D79536967\n", sdk.MustBech32ifyPubKey(sdk.Bech32PubKeyTypeAccPub, pubKey)), }, { StdSignature{PubKey: pubKey.Bytes(), Signature: nil}, From b38d3ae69afe64b74d8513af2b38b8f2008db884 Mon Sep 17 00:00:00 2001 From: Aleksandr Bezobchuk Date: Thu, 12 Mar 2020 15:35:22 -0400 Subject: [PATCH 06/17] Update ADR and types --- client/tx.go | 42 ++++ codec/std/codec.pb.go | 200 +++++++++--------- codec/std/codec.proto | 5 +- .../adr-020-protobuf-transaction-encoding.md | 11 +- types/tx_msg.go | 71 ++++--- x/auth/alias.go | 4 + x/auth/types/types.pb.go | 114 +++++----- x/auth/types/types.proto | 3 +- 8 files changed, 250 insertions(+), 200 deletions(-) create mode 100644 client/tx.go diff --git a/client/tx.go b/client/tx.go new file mode 100644 index 000000000..d7fdb8298 --- /dev/null +++ b/client/tx.go @@ -0,0 +1,42 @@ +package client + +import ( + "github.com/cosmos/cosmos-sdk/codec" + sdk "github.com/cosmos/cosmos-sdk/types" +) + +type ( + // ClientMarshaler defines an interface that REST and CLI handler will use to + // create application-specific transactions and be able to serialize types + // specific to the application including transactions. + ClientMarshaler interface { + TxGenerator + codec.Marshaler + } + + // TxGenerator defines an interface a client can utilize to generate an + // application-defined concrete transaction type. The type returned must + // implement ClientTx. + TxGenerator 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(cid string, num, seq uint64) ([]byte, error) + } +) diff --git a/codec/std/codec.pb.go b/codec/std/codec.pb.go index d5e09db4d..4330171f9 100644 --- a/codec/std/codec.pb.go +++ b/codec/std/codec.pb.go @@ -581,8 +581,8 @@ func (*Content) XXX_OneofWrappers() []interface{} { // processed by the state-machine. It contains a base of common fields and // repeated set of Message types. type Transaction struct { - Base types.StdTxBase `protobuf:"bytes,1,opt,name=base,proto3" json:"base"` - Msgs []Message `protobuf:"bytes,2,rep,name=msgs,proto3" json:"msgs"` + 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{} } @@ -965,100 +965,100 @@ func init() { func init() { proto.RegisterFile("codec/std/codec.proto", fileDescriptor_daf09dc2dfa19bb4) } var fileDescriptor_daf09dc2dfa19bb4 = []byte{ - // 1476 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x58, 0xcd, 0x6f, 0xd4, 0xc6, - 0x1b, 0xf6, 0xc2, 0x92, 0x84, 0x49, 0x80, 0x30, 0x3f, 0xf8, 0x65, 0x95, 0xc2, 0x26, 0x04, 0x8a, - 0x5a, 0x50, 0xd6, 0x7c, 0xb4, 0x85, 0xac, 0x5a, 0x01, 0x49, 0x40, 0x4b, 0xd5, 0xb4, 0xc8, 0x81, - 0x54, 0xad, 0x68, 0xad, 0x59, 0xcf, 0xe0, 0x4c, 0xb3, 0xf6, 0xb8, 0x9e, 0xf1, 0x66, 0x73, 0xe8, - 0xbd, 0xad, 0x54, 0xa9, 0x52, 0xff, 0x01, 0xd4, 0x1e, 0x7b, 0xe5, 0xd8, 0x73, 0x85, 0x38, 0x71, - 0xec, 0x09, 0x55, 0x70, 0xa9, 0xfa, 0x57, 0x54, 0xf3, 0x61, 0xaf, 0xbd, 0xeb, 0xdd, 0x50, 0xa9, - 0x97, 0xc8, 0x33, 0xef, 0xfb, 0x3c, 0xef, 0x33, 0x9e, 0xf7, 0xc3, 0x1b, 0x70, 0xd2, 0x63, 0x98, - 0x78, 0x36, 0x17, 0xd8, 0x56, 0x4f, 0x8d, 0x28, 0x66, 0x82, 0xc1, 0x39, 0x8f, 0xf1, 0x80, 0x71, - 0x97, 0xe3, 0x9d, 0x86, 0xde, 0xe7, 0x02, 0x37, 0xba, 0x97, 0xe7, 0x2f, 0x8a, 0x6d, 0x1a, 0x63, - 0x37, 0x42, 0xb1, 0xd8, 0xb3, 0x95, 0xaf, 0xad, 0x5d, 0x97, 0xf3, 0x0b, 0xcd, 0x32, 0x7f, 0x7e, - 0xd8, 0xd9, 0x67, 0x3e, 0xeb, 0x3f, 0x19, 0xbf, 0x5a, 0xcf, 0x46, 0x89, 0xd8, 0xb6, 0xc5, 0x5e, - 0x44, 0xb8, 0xfe, 0x6b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, 0x06, 0x60, 0x0e, 0x93, 0x0e, 0xda, 0x23, 0x78, - 0x28, 0xe8, 0x41, 0x15, 0xf4, 0xea, 0xf8, 0xa0, 0xeb, 0x1a, 0x3c, 0x14, 0xf1, 0x24, 0x2e, 0x33, - 0xc0, 0x08, 0xd4, 0x22, 0x12, 0x53, 0x86, 0xa9, 0x37, 0x14, 0xaf, 0xaa, 0xe2, 0xbd, 0x33, 0x3e, - 0xde, 0x3d, 0x83, 0x1e, 0x0a, 0xf8, 0xff, 0xa8, 0xd4, 0x02, 0x3f, 0x06, 0x47, 0x03, 0x86, 0x93, - 0x4e, 0xff, 0x8a, 0x0e, 0xa9, 0x38, 0x6f, 0x16, 0xe3, 0xe8, 0x04, 0x95, 0x11, 0x36, 0x94, 0x77, - 0x9f, 0xf8, 0x48, 0x90, 0xdf, 0x68, 0xae, 0x3c, 0x7b, 0xb2, 0xfc, 0xee, 0x05, 0x9f, 0x8a, 0xed, - 0xa4, 0xdd, 0xf0, 0x58, 0x60, 0xca, 0x34, 0x2d, 0x5d, 0x8e, 0x77, 0x6c, 0x53, 0x68, 0xa4, 0x17, - 0xb1, 0x58, 0x10, 0xdc, 0x30, 0xd0, 0xd5, 0x43, 0xe0, 0x20, 0x4f, 0x82, 0xa5, 0xef, 0x2b, 0x60, - 0x62, 0x53, 0x85, 0x83, 0xd7, 0xc1, 0x84, 0x0e, 0x6c, 0xf2, 0xa6, 0x3e, 0x4a, 0x94, 0xf6, 0x6f, - 0x59, 0x8e, 0xf1, 0x6f, 0xde, 0xf8, 0xeb, 0xf1, 0x42, 0xe5, 0xd9, 0x93, 0xe5, 0x6b, 0xfb, 0x49, - 0x31, 0x95, 0x97, 0x89, 0xd1, 0x4c, 0x77, 0x53, 0x31, 0x3f, 0x57, 0xc0, 0xd4, 0x6d, 0x53, 0x80, - 0xf0, 0x23, 0x30, 0x43, 0xbe, 0x4e, 0x68, 0x97, 0x79, 0x48, 0x96, 0xb2, 0x11, 0x75, 0xbe, 0x28, - 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, 0x20, - 0xed, 0x09, 0xf5, 0x63, 0xf9, 0xea, 0x3f, 0x01, 0x00, 0x00, 0xff, 0xff, 0x8c, 0xf7, 0xe4, 0x03, - 0x17, 0x11, 0x00, 0x00, + // 1478 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4, 0x58, 0xcd, 0x6f, 0xd4, 0x46, + 0x1b, 0xf7, 0xc2, 0x92, 0x84, 0x49, 0x80, 0x30, 0x2f, 0xbc, 0x59, 0xe5, 0x85, 0x4d, 0x08, 0xbc, + 0xa8, 0x05, 0x65, 0xcd, 0x47, 0x5b, 0x60, 0xd5, 0x0a, 0xf2, 0x01, 0x5a, 0xaa, 0xa6, 0x45, 0x0e, + 0xa4, 0x6a, 0x45, 0x6b, 0xcd, 0x7a, 0x06, 0x67, 0x9a, 0xb5, 0xc7, 0xf5, 0x8c, 0x37, 0x9b, 0x43, + 0xef, 0x6d, 0xa5, 0x4a, 0x55, 0xfb, 0x0f, 0xa0, 0xf6, 0xd8, 0x2b, 0xc7, 0x9e, 0x2b, 0xc4, 0x89, + 0x63, 0x4f, 0xa8, 0x82, 0x4b, 0xd5, 0xbf, 0xa2, 0x9a, 0x0f, 0x7b, 0xed, 0x5d, 0xef, 0x86, 0x1e, + 0x7a, 0x89, 0x3c, 0xf3, 0x3c, 0xbf, 0xdf, 0xf3, 0x1b, 0xcf, 0xf3, 0xe1, 0x0d, 0x38, 0xe9, 0x31, + 0x4c, 0x3c, 0x9b, 0x0b, 0x6c, 0xab, 0xa7, 0x46, 0x14, 0x33, 0xc1, 0xe0, 0x9c, 0xc7, 0x78, 0xc0, + 0xb8, 0xcb, 0xf1, 0x4e, 0x43, 0xef, 0x73, 0x81, 0x1b, 0xdd, 0xcb, 0xf3, 0x17, 0xc5, 0x36, 0x8d, + 0xb1, 0x1b, 0xa1, 0x58, 0xec, 0xd9, 0xca, 0xd7, 0xd6, 0xae, 0xcb, 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0xa7, 0x32, 0x77, 0x26, 0xcd, 0xdc, 0xbf, 0x64, 0xfa, 0xa5, + 0x15, 0x55, 0x0d, 0xb8, 0xcf, 0x6b, 0x07, 0x16, 0x0f, 0x8e, 0x4d, 0xdd, 0x0d, 0xc2, 0x39, 0xf2, + 0x89, 0x49, 0x5d, 0x85, 0x69, 0x56, 0x65, 0x45, 0x2d, 0xfd, 0x36, 0x03, 0x26, 0x8d, 0x15, 0x36, + 0xc1, 0x54, 0xc0, 0x7d, 0x97, 0xcb, 0x77, 0xa8, 0x45, 0x9d, 0x2e, 0x8a, 0x92, 0x1f, 0x59, 0x69, + 0xb9, 0x93, 0x10, 0xb7, 0x2c, 0x67, 0x32, 0xd0, 0x8f, 0xf0, 0x7d, 0x70, 0x54, 0x62, 0x83, 0xa4, + 0x23, 0xa8, 0x66, 0xd0, 0x89, 0xbb, 0x34, 0x92, 0x61, 0x43, 0xba, 0x1a, 0x9a, 0x99, 0x20, 0xb7, + 0x86, 0x9f, 0x83, 0x13, 0x92, 0xab, 0x4b, 0x62, 0xfa, 0x68, 0xcf, 0xa5, 0x61, 0x17, 0xc5, 0x14, + 0x65, 0x73, 0x7d, 0xa0, 0x03, 0xe9, 0xcf, 0x3b, 0xc3, 0xb9, 0xa5, 0x20, 0x77, 0x53, 0x84, 0xbc, + 0xc9, 0x60, 0x68, 0x17, 0x86, 0xa0, 0xa6, 0xcf, 0x29, 0xdc, 0x5d, 0x2a, 0xb6, 0x71, 0x8c, 0x76, + 0x5d, 0x84, 0x71, 0x4c, 0x38, 0x37, 0xa9, 0x7a, 0x75, 0x7c, 0xee, 0xa8, 0xf3, 0x8b, 0x8f, 0x0d, + 0x76, 0x45, 0x43, 0x65, 0x9e, 0x06, 0x65, 0x06, 0xf8, 0x15, 0x38, 0x2d, 0xe3, 0x65, 0xb1, 0x30, + 0xe9, 0x10, 0x1f, 0x09, 0x16, 0xbb, 0x31, 0xd9, 0x45, 0xf1, 0x6b, 0x26, 0xec, 0x06, 0xf7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 0x57, 0xfe, 0x78, 0x59, 0xaf, 0x7c, + 0xff, 0xaa, 0x6e, 0x3d, 0x7f, 0x55, 0xb7, 0x7e, 0x7f, 0x55, 0xb7, 0x3e, 0x1d, 0x7f, 0xb0, 0xec, + 0x7f, 0x21, 0xed, 0x09, 0xf5, 0xa3, 0xf9, 0xea, 0xdf, 0x01, 0x00, 0x00, 0xff, 0xff, 0x54, 0x48, + 0xa8, 0xb7, 0x1f, 0x11, 0x00, 0x00, } func (this *Supply) Equal(that interface{}) bool { @@ -2261,7 +2261,7 @@ func (m *Transaction) MarshalToSizedBuffer(dAtA []byte) (int, error) { } } { - size, err := m.Base.MarshalToSizedBuffer(dAtA[:i]) + size, err := m.StdTxBase.MarshalToSizedBuffer(dAtA[:i]) if err != nil { return 0, err } @@ -2965,7 +2965,7 @@ func (m *Transaction) Size() (n int) { } var l int _ = l - l = m.Base.Size() + l = m.StdTxBase.Size() n += 1 + l + sovCodec(uint64(l)) if len(m.Msgs) > 0 { for _, e := range m.Msgs { @@ -4241,7 +4241,7 @@ func (m *Transaction) Unmarshal(dAtA []byte) error { switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Base", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field StdTxBase", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -4268,7 +4268,7 @@ func (m *Transaction) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - if err := m.Base.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + if err := m.StdTxBase.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex diff --git a/codec/std/codec.proto b/codec/std/codec.proto index f5ec7b987..4f3f8034a 100644 --- a/codec/std/codec.proto +++ b/codec/std/codec.proto @@ -106,8 +106,9 @@ message Content { message Transaction { option (gogoproto.goproto_getters) = false; - cosmos_sdk.x.auth.v1.StdTxBase base = 1 [(gogoproto.nullable) = false]; - repeated Message msgs = 2 [(gogoproto.nullable) = 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 diff --git a/docs/architecture/adr-020-protobuf-transaction-encoding.md b/docs/architecture/adr-020-protobuf-transaction-encoding.md index 1244cf24d..6fd37bda8 100644 --- a/docs/architecture/adr-020-protobuf-transaction-encoding.md +++ b/docs/architecture/adr-020-protobuf-transaction-encoding.md @@ -104,7 +104,6 @@ and messages. ```go type TxGenerator interface { NewTx() ClientTx - SignBytes func(chainID string, num, seq uint64, fee StdFee, msgs []sdk.Msg, memo string) ([]byte, error) } type ClientTx interface { @@ -112,12 +111,14 @@ 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) } ``` diff --git a/types/tx_msg.go b/types/tx_msg.go index 1b0da612b..20ead7db1 100644 --- a/types/tx_msg.go +++ b/types/tx_msg.go @@ -2,45 +2,60 @@ 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 ce005797b..e34b9ec68 100644 --- a/x/auth/alias.go +++ b/x/auth/alias.go @@ -59,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 @@ -89,4 +92,5 @@ type ( GenesisAccountIterator = types.GenesisAccountIterator Codec = types.Codec StdSignDocBase = types.StdSignDocBase + StdTxBase = types.StdTxBase ) diff --git a/x/auth/types/types.pb.go b/x/auth/types/types.pb.go index 699182bc8..69e8d5a86 100644 --- a/x/auth/types/types.pb.go +++ b/x/auth/types/types.pb.go @@ -108,20 +108,6 @@ 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 -} - -func (m *StdFee) GetGas() uint64 { - if m != nil { - return m.Gas - } - return 0 -} - // StdSignature defines a signature structure that contains the signature of a // transaction and an optional public key. type StdSignature struct { @@ -391,56 +377,56 @@ func init() { proto.RegisterFile("x/auth/types/types.proto", fileDescriptor_2d52 var fileDescriptor_2d526fa662daab74 = []byte{ // 803 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xa4, 0x55, 0xcf, 0x6f, 0x1b, 0x45, - 0x14, 0xf6, 0xc6, 0x5b, 0x27, 0x99, 0x84, 0x42, 0x26, 0x6e, 0xeb, 0x5a, 0xd1, 0x8e, 0xb5, 0x07, - 0x64, 0x24, 0xb2, 0xc6, 0x86, 0x20, 0xc5, 0x07, 0x44, 0xd6, 0xa1, 0xa2, 0x2a, 0x54, 0xd5, 0x18, - 0x71, 0x40, 0x42, 0xab, 0xf1, 0xee, 0x74, 0xbd, 0x72, 0xd6, 0xbb, 0xdd, 0x99, 0x8d, 0xbc, 0xb9, - 0x70, 0x45, 0x9c, 0x38, 0x72, 0x23, 0x67, 0xfe, 0x92, 0x1e, 0x7b, 0xe4, 0xb4, 0x45, 0xce, 0x05, - 0x71, 0x5c, 0x6e, 0x9c, 0xd0, 0xcc, 0xf8, 0x67, 0x71, 0x11, 0xa8, 0x17, 0x7b, 0xe6, 0xcd, 0xfb, - 0xbe, 0xf7, 0xfc, 0xcd, 0x37, 0xcf, 0xa0, 0x36, 0x69, 0x91, 0x94, 0x0f, 0x5b, 0x3c, 0x8b, 0x29, - 0x53, 0x9f, 0x56, 0x9c, 0x44, 0x3c, 0x82, 0x55, 0x37, 0x62, 0x61, 0xc4, 0x1c, 0xe6, 0x8d, 0xac, - 0x89, 0x25, 0x92, 0xac, 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37, 0x62, 0xdc, 0x89, 0x69, 0xe2, 0x0c, 0x32, 0x4e, 0x67, 0x0e, 0x68, 0x14, 0x39, 0x3a, - 0x5a, 0xe1, 0x78, 0x35, 0xcd, 0xc4, 0x07, 0x82, 0xec, 0x8a, 0xf6, 0x22, 0xc6, 0x9f, 0xd0, 0xc4, - 0xce, 0x38, 0x85, 0xcf, 0xc0, 0x3d, 0x51, 0xed, 0x92, 0x26, 0xc1, 0xd3, 0x4c, 0xe5, 0x53, 0xaf, - 0x73, 0x72, 0xd2, 0x3e, 0x55, 0xde, 0xb0, 0xbb, 0xd3, 0x1c, 0x55, 0xfb, 0x81, 0xff, 0xb5, 0xcc, - 0x10, 0xd0, 0xcf, 0xce, 0xe5, 0x79, 0x91, 0x23, 0x43, 0x55, 0x7b, 0x0d, 0x81, 0x89, 0xab, 0x6c, - 0x0d, 0xa7, 0xc2, 0x30, 0x03, 0xf7, 0x5f, 0x45, 0x30, 0xea, 0xc6, 0x9d, 0x93, 0x8f, 0x47, 0xed, - 0xda, 0x2d, 0x59, 0xf4, 0x93, 0x69, 0x8e, 0xee, 0xae, 0x15, 0xed, 0xcf, 0x33, 0x8a, 0x1c, 0x35, - 0x36, 0x97, 0x5d, 0x90, 0x98, 0xf8, 0x2e, 0xdb, 0x88, 0xed, 0xee, 0x08, 0x6b, 0x4b, 0x77, 0xfd, - 0xac, 0x81, 0xdd, 0x3e, 0xf7, 0xbe, 0x9a, 0x88, 0x07, 0x0f, 0x3f, 0x02, 0xe5, 0xa7, 0x94, 0xca, - 0x4b, 0xdd, 0xeb, 0x1c, 0x59, 0x9b, 0x06, 0x8b, 0xa5, 0x5e, 0x83, 0xad, 0x0b, 0xa3, 0x63, 0x91, - 0x0e, 0x3f, 0x07, 0x60, 0x61, 0x1c, 0x61, 0x60, 0xf1, 0x38, 0xcc, 0xd7, 0x82, 0x17, 0x4e, 0x9e, - 0x51, 0xac, 0x60, 0x21, 0x04, 0xba, 0xf0, 0x8e, 0xbc, 0xc8,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x7f, 0xfc, 0x4f, 0x00, 0x00, 0x00, 0xff, 0xff, 0xc0, 0xb1, 0x78, 0x7e, 0x41, 0x06, 0x00, 0x00, } diff --git a/x/auth/types/types.proto b/x/auth/types/types.proto index e15e0342f..305b5368f 100644 --- a/x/auth/types/types.proto +++ b/x/auth/types/types.proto @@ -23,7 +23,8 @@ 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"]; From edb0927c53a06423f5d53c854bec03f6169cb154 Mon Sep 17 00:00:00 2001 From: Aleksandr Bezobchuk Date: Fri, 13 Mar 2020 09:34:55 -0400 Subject: [PATCH 07/17] reorder fields --- codec/std/codec.pb.go | 260 +++++++++++++++++++++--------------------- codec/std/codec.proto | 4 +- 2 files changed, 132 insertions(+), 132 deletions(-) diff --git a/codec/std/codec.pb.go b/codec/std/codec.pb.go index 4330171f9..2d1c5b232 100644 --- a/codec/std/codec.pb.go +++ b/codec/std/codec.pb.go @@ -324,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{} } @@ -965,14 +965,14 @@ func init() { func init() { proto.RegisterFile("codec/std/codec.proto", fileDescriptor_daf09dc2dfa19bb4) } var fileDescriptor_daf09dc2dfa19bb4 = []byte{ - // 1478 bytes of a gzipped FileDescriptorProto + // 1479 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4, 0x58, 0xcd, 0x6f, 0xd4, 0x46, 0x1b, 0xf7, 0xc2, 0x92, 0x84, 0x49, 0x80, 0x30, 0x2f, 0xbc, 0x59, 0xe5, 0x85, 0x4d, 0x08, 0xbc, 0xa8, 0x05, 0x65, 0xcd, 0x47, 0x5b, 0x60, 0xd5, 0x0a, 0xf2, 0x01, 0x5a, 0xaa, 0xa6, 0x45, 0x0e, 0xa4, 0x6a, 0x45, 0x6b, 0xcd, 0x7a, 0x06, 0x67, 0x9a, 0xb5, 0xc7, 0xf5, 0x8c, 0x37, 0x9b, 0x43, 0xef, 0x6d, 0xa5, 0x4a, 0x55, 0xfb, 0x0f, 0xa0, 0xf6, 0xd8, 0x2b, 0xc7, 0x9e, 0x2b, 0xc4, 0x89, 0x63, 0x4f, 0xa8, 0x82, 0x4b, 0xd5, 0xbf, 0xa2, 0x9a, 0x0f, 0x7b, 0xed, 0x5d, 0xef, 0x86, 0x1e, - 0x7a, 0x89, 0x3c, 0xf3, 0x3c, 0xbf, 0xdf, 0xf3, 0x1b, 0xcf, 0xf3, 0xe1, 0x0d, 0x38, 0xe9, 0x31, + 0x7a, 0x89, 0x3c, 0xf3, 0x3c, 0xbf, 0xdf, 0xf3, 0xf3, 0xcc, 0xf3, 0xe1, 0x0d, 0x38, 0xe9, 0x31, 0x4c, 0x3c, 0x9b, 0x0b, 0x6c, 0xab, 0xa7, 0x46, 0x14, 0x33, 0xc1, 0xe0, 0x9c, 0xc7, 0x78, 0xc0, 0xb8, 0xcb, 0xf1, 0x4e, 0x43, 0xef, 0x73, 0x81, 0x1b, 0xdd, 0xcb, 0xf3, 0x17, 0xc5, 0x36, 0x8d, 0xb1, 0x1b, 0xa1, 0x58, 0xec, 0xd9, 0xca, 0xd7, 0xd6, 0xae, 0xcb, 0xf9, 0x85, 0x66, 0x99, 0x3f, @@ -981,84 +981,84 @@ var fileDescriptor_daf09dc2dfa19bb4 = []byte{ 0x7a, 0x76, 0x1b, 0x85, 0x3b, 0x25, 0x96, 0xf9, 0x9e, 0xed, 0xc5, 0x94, 0x53, 0x5e, 0xce, 0x8b, 0x29, 0x17, 0x31, 0x6d, 0x27, 0x82, 0xb2, 0xb0, 0x1c, 0xcd, 0x93, 0x28, 0xea, 0xec, 0x95, 0xd8, 0x4e, 0xf5, 0x6c, 0xd2, 0xa5, 0x98, 0x84, 0x1e, 0x29, 0xb1, 0xce, 0xf5, 0x6c, 0x9f, 0x75, 0xcb, - 0x61, 0xbc, 0x83, 0xf8, 0x76, 0xf9, 0x41, 0xfe, 0xd7, 0xb3, 0xb9, 0x40, 0x3b, 0xe5, 0xc6, 0xb3, - 0x3d, 0x3b, 0x42, 0x31, 0x0a, 0xd2, 0xb3, 0x44, 0x31, 0x8b, 0x18, 0x47, 0x9d, 0x41, 0x86, 0x24, - 0xf2, 0x63, 0x84, 0x4b, 0x54, 0x2d, 0xfd, 0x5a, 0x05, 0x93, 0x2b, 0x9e, 0xc7, 0x92, 0x50, 0xc0, - 0x3b, 0x60, 0xa6, 0x8d, 0x38, 0x71, 0x91, 0x5e, 0xd7, 0x2a, 0x8b, 0x95, 0x37, 0xa6, 0xaf, 0x9c, - 0x69, 0xe4, 0x2e, 0xbd, 0xd7, 0x90, 0xef, 0xbd, 0xd1, 0xbd, 0xdc, 0x58, 0x45, 0x9c, 0x18, 0x60, - 0xcb, 0x72, 0xa6, 0xdb, 0xfd, 0x25, 0xec, 0x82, 0x79, 0x8f, 0x85, 0x82, 0x86, 0x09, 0x4b, 0xb8, - 0x6b, 0xee, 0x28, 0x63, 0x3d, 0xa0, 0x58, 0xdf, 0x29, 0x63, 0xd5, 0x9e, 0x92, 0x7d, 0x2d, 0xc3, - 0x6f, 0xe9, 0xcd, 0x7e, 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x0f, 0x8e, 0x4d, 0xdd, 0x0d, 0xc2, 0x39, 0xf2, - 0x89, 0x49, 0x5d, 0x85, 0x69, 0x56, 0x65, 0x45, 0x2d, 0xfd, 0x36, 0x03, 0x26, 0x8d, 0x15, 0x36, - 0xc1, 0x54, 0xc0, 0x7d, 0x97, 0xcb, 0x77, 0xa8, 0x45, 0x9d, 0x2e, 0x8a, 0x92, 0x1f, 0x59, 0x69, - 0xb9, 0x93, 0x10, 0xb7, 0x2c, 0x67, 0x32, 0xd0, 0x8f, 0xf0, 0x7d, 0x70, 0x54, 0x62, 0x83, 0xa4, - 0x23, 0xa8, 0x66, 0xd0, 0x89, 0xbb, 0x34, 0x92, 0x61, 0x43, 0xba, 0x1a, 0x9a, 0x99, 0x20, 0xb7, - 0x86, 0x9f, 0x83, 0x13, 0x92, 0xab, 0x4b, 0x62, 0xfa, 0x68, 0xcf, 0xa5, 0x61, 0x17, 0xc5, 0x14, - 0x65, 0x73, 0x7d, 0xa0, 0x03, 0xe9, 0xcf, 0x3b, 0xc3, 0xb9, 0xa5, 0x20, 0x77, 0x53, 0x84, 0xbc, - 0xc9, 0x60, 0x68, 0x17, 0x86, 0xa0, 0xa6, 0xcf, 0x29, 0xdc, 0x5d, 0x2a, 0xb6, 0x71, 0x8c, 0x76, - 0x5d, 0x84, 0x71, 0x4c, 0x38, 0x37, 0xa9, 0x7a, 0x75, 0x7c, 0xee, 0xa8, 0xf3, 0x8b, 0x8f, 0x0d, - 0x76, 0x45, 0x43, 0x65, 0x9e, 0x06, 0x65, 0x06, 0xf8, 0x15, 0x38, 0x2d, 0xe3, 0x65, 0xb1, 0x30, - 0xe9, 0x10, 0x1f, 0x09, 0x16, 0xbb, 0x31, 0xd9, 0x45, 0xf1, 0x6b, 0x26, 0xec, 0x06, 0xf7, 0x53, - 0xe2, 0xf5, 0x94, 0xc0, 0x51, 0xf8, 0x96, 0xe5, 0xcc, 0x07, 0x23, 0xad, 0xf0, 0x9b, 0x0a, 0x38, - 0x53,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0xdf, 0xc6, 0x54, 0xe4, 0xc9, 0x67, 0x83, 0x81, 0x3d, 0x78, 0x17, 0xcc, 0xe8, 0x53, 0x54, + 0xc5, 0x44, 0x6a, 0xc7, 0x14, 0xe9, 0xb9, 0x71, 0xa4, 0xa6, 0xf0, 0xe4, 0x65, 0x4c, 0x07, 0xfd, + 0x65, 0x7a, 0x0c, 0x6d, 0xe2, 0xd3, 0xd0, 0x8d, 0x49, 0x46, 0x39, 0xbb, 0xff, 0x31, 0xac, 0x4a, + 0x8c, 0x93, 0x41, 0xcc, 0x31, 0x0c, 0xec, 0xc2, 0x8f, 0x74, 0xf3, 0x4d, 0xc2, 0x8c, 0xfa, 0x78, + 0xd9, 0x07, 0x70, 0x91, 0xfa, 0x41, 0x98, 0x63, 0x3d, 0x12, 0xe4, 0x37, 0x9a, 0x17, 0x9e, 0x3d, + 0x59, 0x3e, 0x3f, 0x76, 0xce, 0xe9, 0x09, 0x27, 0x15, 0x9a, 0xe9, 0xf6, 0x5d, 0x05, 0x4c, 0x6e, + 0x52, 0x3f, 0x5c, 0x67, 0x1e, 0xbc, 0x53, 0x98, 0x6c, 0xe7, 0x46, 0x4e, 0x36, 0xe3, 0xff, 0x6f, + 0x8c, 0xb7, 0xd5, 0x5b, 0x4f, 0x5f, 0xd6, 0x2b, 0xcf, 0x5f, 0xd6, 0x2b, 0x7f, 0xbc, 0xac, 0x57, + 0xbe, 0x7f, 0x55, 0xb7, 0x9e, 0xbf, 0xaa, 0x5b, 0xbf, 0xbf, 0xaa, 0x5b, 0x9f, 0x8e, 0x7f, 0xb1, + 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 { @@ -1188,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 @@ -1976,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]) @@ -1996,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 } @@ -2850,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 } @@ -3649,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) } @@ -3684,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:]) diff --git a/codec/std/codec.proto b/codec/std/codec.proto index 4f3f8034a..c7246a69c 100644 --- a/codec/std/codec.proto +++ b/codec/std/codec.proto @@ -61,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 From d635de4c47cc7abd0cba368be27101e6b1a7aee4 Mon Sep 17 00:00:00 2001 From: Aleksandr Bezobchuk Date: Fri, 13 Mar 2020 09:35:03 -0400 Subject: [PATCH 08/17] Msgs tests --- codec/std/msgs_test.go | 46 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 codec/std/msgs_test.go diff --git a/codec/std/msgs_test.go b/codec/std/msgs_test.go new file mode 100644 index 000000000..bd3063ecb --- /dev/null +++ b/codec/std/msgs_test.go @@ -0,0 +1,46 @@ +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" +) + +type BadEvidence struct { + *std.Evidence_Equivocation +} + +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()) +} From 690f6290c8d3201f13456109aa8d62b78289c57a Mon Sep 17 00:00:00 2001 From: Aleksandr Bezobchuk Date: Fri, 13 Mar 2020 09:35:14 -0400 Subject: [PATCH 09/17] Update ADR --- docs/architecture/adr-020-protobuf-transaction-encoding.md | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/architecture/adr-020-protobuf-transaction-encoding.md b/docs/architecture/adr-020-protobuf-transaction-encoding.md index 6fd37bda8..75cc85e32 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 From 0b76411469b15b006df370f1207cac1793d98163 Mon Sep 17 00:00:00 2001 From: Aleksandr Bezobchuk Date: Fri, 13 Mar 2020 09:36:29 -0400 Subject: [PATCH 10/17] Update StdTx --- x/auth/types/stdtx.go | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/x/auth/types/stdtx.go b/x/auth/types/stdtx.go index a6a5e79c3..7d30c87af 100644 --- a/x/auth/types/stdtx.go +++ b/x/auth/types/stdtx.go @@ -25,6 +25,16 @@ func NewStdFee(gas uint64, amount sdk.Coins) StdFee { } } +// 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 { @@ -48,6 +58,15 @@ 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) { @@ -88,6 +107,24 @@ func (ss StdSignature) MarshalYAML() (interface{}, error) { 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) From 0a79849d6e1ecd539c625478919bdc40bb8b0586 Mon Sep 17 00:00:00 2001 From: Aleksandr Bezobchuk Date: Fri, 13 Mar 2020 09:51:11 -0400 Subject: [PATCH 11/17] Test tx --- codec/std/tx.go | 102 +++++++++++++++++++++++++++++++++++-------- codec/std/tx_test.go | 38 ++++++++++++++++ 2 files changed, 123 insertions(+), 17 deletions(-) create mode 100644 codec/std/tx_test.go diff --git a/codec/std/tx.go b/codec/std/tx.go index 595fbd848..b37094523 100644 --- a/codec/std/tx.go +++ b/codec/std/tx.go @@ -6,12 +6,28 @@ import ( jsonc "github.com/gibson042/canonicaljson-go" "github.com/gogo/protobuf/jsonpb" + "github.com/cosmos/cosmos-sdk/client" 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{} +var ( + _ sdk.Tx = (*Transaction)(nil) + _ client.ClientTx = (*Transaction)(nil) +) + +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 { @@ -47,16 +63,16 @@ func (tx Transaction) GetSigners() []sdk.AccAddress { // ValidateBasic does a simple and lightweight validation check that doesn't // require access to any other information. func (tx Transaction) ValidateBasic() error { - stdSigs := tx.Base.GetSignatures() + stdSigs := tx.GetSignatures() - if tx.Base.Fee.Gas > auth.MaxGasWanted { + if tx.Fee.Gas > auth.MaxGasWanted { return sdkerrors.Wrapf( - sdkerrors.ErrInvalidRequest, "invalid gas supplied; %d > %d", tx.Base.Fee.Gas, auth.MaxGasWanted, + sdkerrors.ErrInvalidRequest, "invalid gas supplied; %d > %d", tx.Fee.Gas, auth.MaxGasWanted, ) } - if tx.Base.Fee.Amount.IsAnyNegative() { + if tx.Fee.Amount.IsAnyNegative() { return sdkerrors.Wrapf( - sdkerrors.ErrInsufficientFee, "invalid fee provided: %s", tx.Base.Fee.Amount, + sdkerrors.ErrInsufficientFee, "invalid fee provided: %s", tx.Fee.Amount, ) } if len(stdSigs) == 0 { @@ -71,24 +87,76 @@ func (tx Transaction) ValidateBasic() error { 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, a, s uint64) ([]byte, error) { - return NewSignDoc(a, s, cid, tx.Base.Memo, tx.Base.Fee, tx.Msgs...).CanonicalSignBytes() +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(a, s uint64, cid, m string, f auth.StdFee, msgs ...Message) *SignDoc { +func NewSignDoc(num, seq uint64, cid, memo string, fee auth.StdFee, msgs ...Message) *SignDoc { return &SignDoc{ - StdSignDocBase: auth.StdSignDocBase{ - ChainID: cid, - AccountNumber: a, - Sequence: s, - Memo: m, - Fee: f, - }, - Msgs: msgs, + StdSignDocBase: auth.NewStdSignDocBase(num, seq, cid, memo, fee), + Msgs: msgs, } } 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)) +} From 217cae2021d7e02e52bf43c3c704940940f612a1 Mon Sep 17 00:00:00 2001 From: Aleksandr Bezobchuk Date: Fri, 13 Mar 2020 09:57:15 -0400 Subject: [PATCH 12/17] DRY code --- codec/std/tx.go | 23 +---------------------- types/codec.go | 27 +++++++++++++++++++++++++++ types/tx_msg.go | 5 ++--- 3 files changed, 30 insertions(+), 25 deletions(-) diff --git a/codec/std/tx.go b/codec/std/tx.go index b37094523..a8aadf089 100644 --- a/codec/std/tx.go +++ b/codec/std/tx.go @@ -1,11 +1,6 @@ package std import ( - "bytes" - - jsonc "github.com/gibson042/canonicaljson-go" - "github.com/gogo/protobuf/jsonpb" - "github.com/cosmos/cosmos-sdk/client" sdk "github.com/cosmos/cosmos-sdk/types" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" @@ -165,21 +160,5 @@ func NewSignDoc(num, seq uint64, cid, memo string, fee auth.StdFee, msgs ...Mess // names adhere to their proto definition, default values are omitted, and follows // the JSON Canonical Form. func (sd *SignDoc) CanonicalSignBytes() ([]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, sd); 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) + return sdk.CanonicalSignBytes(sd) } diff --git a/types/codec.go b/types/codec.go index fdd884bd5..6f7d03e5c 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,25 @@ func RegisterCodec(cdc *codec.Codec) { cdc.RegisterInterface((*Msg)(nil), nil) cdc.RegisterInterface((*Tx)(nil), nil) } + +// CanonicalSignBytes returns a canonical JSON encoding of a message that can be +// signed over. +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 20ead7db1..b81eb26f5 100644 --- a/types/tx_msg.go +++ b/types/tx_msg.go @@ -7,7 +7,7 @@ import ( ) type ( -// Msg defines the interface a transaction message must fulfill. + // Msg defines the interface a transaction message must fulfill. Msg interface { // Return the message type. @@ -45,7 +45,7 @@ type ( GetSignature() []byte } -// Tx defines the interface a transaction must fulfill. + // Tx defines the interface a transaction must fulfill. Tx interface { // Gets the all the transaction's messages. GetMsgs() []Msg @@ -56,7 +56,6 @@ type ( } ) - // TxDecoder unmarshals transaction bytes type TxDecoder func(txBytes []byte) (Tx, error) From 7838d750e10bc1d1a21835a4f31cb935115e85cf Mon Sep 17 00:00:00 2001 From: Aleksandr Bezobchuk Date: Fri, 13 Mar 2020 09:58:53 -0400 Subject: [PATCH 13/17] Update godoc --- types/codec.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/types/codec.go b/types/codec.go index 6f7d03e5c..21cd26904 100644 --- a/types/codec.go +++ b/types/codec.go @@ -15,8 +15,10 @@ func RegisterCodec(cdc *codec.Codec) { cdc.RegisterInterface((*Tx)(nil), nil) } -// CanonicalSignBytes returns a canonical JSON encoding of a message that can be -// signed over. +// 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) From c49af0b8dd1db91dfa3a79a749ca8f287922ab7d Mon Sep 17 00:00:00 2001 From: Aleksandr Bezobchuk Date: Fri, 13 Mar 2020 13:59:14 -0400 Subject: [PATCH 14/17] Update context --- client/context/context.go | 20 ++++++++++++++++++- client/{ => tx}/tx.go | 10 +--------- codec/std/tx.go | 16 ++++++++++++--- .../adr-020-protobuf-transaction-encoding.md | 13 +++--------- 4 files changed, 36 insertions(+), 23 deletions(-) rename client/{ => tx}/tx.go (75%) diff --git a/client/context/context.go b/client/context/context.go index 28bfe8e83..eec74e7fe 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.TxGenerator + 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.TxGenerator) 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.go b/client/tx/tx.go similarity index 75% rename from client/tx.go rename to client/tx/tx.go index d7fdb8298..ead819f33 100644 --- a/client/tx.go +++ b/client/tx/tx.go @@ -1,4 +1,4 @@ -package client +package tx import ( "github.com/cosmos/cosmos-sdk/codec" @@ -6,14 +6,6 @@ import ( ) type ( - // ClientMarshaler defines an interface that REST and CLI handler will use to - // create application-specific transactions and be able to serialize types - // specific to the application including transactions. - ClientMarshaler interface { - TxGenerator - codec.Marshaler - } - // TxGenerator defines an interface a client can utilize to generate an // application-defined concrete transaction type. The type returned must // implement ClientTx. diff --git a/codec/std/tx.go b/codec/std/tx.go index a8aadf089..2a9b9af29 100644 --- a/codec/std/tx.go +++ b/codec/std/tx.go @@ -1,17 +1,27 @@ package std import ( - "github.com/cosmos/cosmos-sdk/client" + 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) - _ client.ClientTx = (*Transaction)(nil) + _ sdk.Tx = (*Transaction)(nil) + _ clientx.ClientTx = (*Transaction)(nil) + _ clientx.TxGenerator = 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), diff --git a/docs/architecture/adr-020-protobuf-transaction-encoding.md b/docs/architecture/adr-020-protobuf-transaction-encoding.md index 75cc85e32..d5a72f3af 100644 --- a/docs/architecture/adr-020-protobuf-transaction-encoding.md +++ b/docs/architecture/adr-020-protobuf-transaction-encoding.md @@ -123,18 +123,11 @@ type ClientTx interface { } ``` -We then extend `codec.Marshaler` to also require fulfillment of `TxGenerator`. +We then update `CLIContext` to have two new fields: `TxGenerator` and `TxGenerator`. -```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 From 98f62db2427531476039375ea77beaf141e616f3 Mon Sep 17 00:00:00 2001 From: Aleksandr Bezobchuk Date: Sun, 15 Mar 2020 14:10:15 -0400 Subject: [PATCH 15/17] Fix linting --- client/context/context.go | 4 ++-- client/tx/tx.go | 4 ++-- codec/std/msgs_test.go | 4 ---- codec/std/tx.go | 6 +++--- docs/architecture/adr-020-protobuf-transaction-encoding.md | 4 ++-- 5 files changed, 9 insertions(+), 13 deletions(-) diff --git a/client/context/context.go b/client/context/context.go index eec74e7fe..ae0576122 100644 --- a/client/context/context.go +++ b/client/context/context.go @@ -26,7 +26,7 @@ type CLIContext struct { FromAddress sdk.AccAddress Client rpcclient.Client ChainID string - TxGenerator clientx.TxGenerator + TxGenerator clientx.Generator Marshaler codec.Marshaler Keybase keys.Keybase Input io.Reader @@ -136,7 +136,7 @@ func (ctx CLIContext) WithInput(r io.Reader) CLIContext { } // WithTxGenerator returns a copy of the CLIContext with an updated TxGenerator. -func (ctx CLIContext) WithTxGenerator(txg clientx.TxGenerator) CLIContext { +func (ctx CLIContext) WithTxGenerator(txg clientx.Generator) CLIContext { ctx.TxGenerator = txg return ctx } diff --git a/client/tx/tx.go b/client/tx/tx.go index ead819f33..84c918832 100644 --- a/client/tx/tx.go +++ b/client/tx/tx.go @@ -6,10 +6,10 @@ import ( ) type ( - // TxGenerator defines an interface a client can utilize to generate an + // Generator defines an interface a client can utilize to generate an // application-defined concrete transaction type. The type returned must // implement ClientTx. - TxGenerator interface { + Generator interface { NewTx() ClientTx } diff --git a/codec/std/msgs_test.go b/codec/std/msgs_test.go index bd3063ecb..f0bd00efa 100644 --- a/codec/std/msgs_test.go +++ b/codec/std/msgs_test.go @@ -12,10 +12,6 @@ import ( "github.com/cosmos/cosmos-sdk/x/gov" ) -type BadEvidence struct { - *std.Evidence_Equivocation -} - func TestNewMsgSubmitEvidence(t *testing.T) { s := sdk.AccAddress("foo") e := evidence.Equivocation{ diff --git a/codec/std/tx.go b/codec/std/tx.go index 2a9b9af29..eca3553f3 100644 --- a/codec/std/tx.go +++ b/codec/std/tx.go @@ -8,9 +8,9 @@ import ( ) var ( - _ sdk.Tx = (*Transaction)(nil) - _ clientx.ClientTx = (*Transaction)(nil) - _ clientx.TxGenerator = TxGenerator{} + _ sdk.Tx = (*Transaction)(nil) + _ clientx.ClientTx = (*Transaction)(nil) + _ clientx.Generator = TxGenerator{} ) // TxGenerator defines a transaction generator that allows clients to construct diff --git a/docs/architecture/adr-020-protobuf-transaction-encoding.md b/docs/architecture/adr-020-protobuf-transaction-encoding.md index d5a72f3af..8038cea80 100644 --- a/docs/architecture/adr-020-protobuf-transaction-encoding.md +++ b/docs/architecture/adr-020-protobuf-transaction-encoding.md @@ -103,7 +103,7 @@ to handle all the types, but also knows how to generate transactions, signatures and messages. ```go -type TxGenerator interface { +type Generator interface { NewTx() ClientTx } @@ -123,7 +123,7 @@ type ClientTx interface { } ``` -We then update `CLIContext` to have two new fields: `TxGenerator` and `TxGenerator`. +We then update `CLIContext` to have two new fields: `Generator` and `Generator`. 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 From e0021ad409bf7acf8a5fc4b8953d3e56ea0e0722 Mon Sep 17 00:00:00 2001 From: Alexander Bezobchuk Date: Mon, 16 Mar 2020 10:48:37 -0400 Subject: [PATCH 16/17] Update docs/architecture/adr-020-protobuf-transaction-encoding.md Co-Authored-By: Marko --- docs/architecture/adr-020-protobuf-transaction-encoding.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/architecture/adr-020-protobuf-transaction-encoding.md b/docs/architecture/adr-020-protobuf-transaction-encoding.md index 8038cea80..6689f29e2 100644 --- a/docs/architecture/adr-020-protobuf-transaction-encoding.md +++ b/docs/architecture/adr-020-protobuf-transaction-encoding.md @@ -123,7 +123,7 @@ type ClientTx interface { } ``` -We then update `CLIContext` to have two new fields: `Generator` and `Generator`. +We then update `CLIContext` to have two new fields: `Generator` and `Marshler`. 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 From b557d4278f71282c09ad89d436564bc1a41e384b Mon Sep 17 00:00:00 2001 From: Aleksandr Bezobchuk Date: Mon, 16 Mar 2020 11:52:07 -0400 Subject: [PATCH 17/17] Update CanonicalSignBytes godoc --- client/tx/tx.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/client/tx/tx.go b/client/tx/tx.go index 84c918832..be25ec754 100644 --- a/client/tx/tx.go +++ b/client/tx/tx.go @@ -29,6 +29,10 @@ type ( 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) } )