From 3a94f42e119354e0cfca2dd67ab678625f507581 Mon Sep 17 00:00:00 2001 From: Aleksandr Bezobchuk Date: Thu, 12 Mar 2020 10:53:27 -0400 Subject: [PATCH] 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, - 0x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0x26, 0xa8, 0xcb, 0x02, 0x34, 0xb5, 0x65, 0x4f, 0x5e, 0x64, 0x49, 0x59, 0x96, 0x71, 0x67, - 0xee, 0xe9, 0x8b, 0x15, 0xeb, 0xf9, 0x8b, 0x95, 0x9a, 0xa3, 0x68, 0xda, 0x73, 0x3f, 0x3c, 0x5e, - 0xb1, 0xe4, 0x8a, 0x57, 0x7f, 0xcb, 0xbb, 0xbd, 0x67, 0x6e, 0x17, 0xd8, 0x35, 0x72, 0xda, 0xe9, - 0xf9, 0xa2, 0x9c, 0xcf, 0x06, 0x05, 0xa5, 0x14, 0x55, 0xa5, 0x04, 0xdb, 0x60, 0x56, 0x96, 0x33, - 0xc9, 0xee, 0x85, 0xd3, 0x13, 0x97, 0xbd, 0xae, 0xf3, 0x9c, 0x14, 0x90, 0x73, 0xf9, 0x4b, 0x0d, - 0xcc, 0x65, 0xe6, 0x6e, 0x14, 0xcc, 0x9d, 0xa9, 0x34, 0x37, 0xd5, 0xd3, 0xcd, 0xff, 0xec, 0xa9, - 0x53, 0x97, 0x14, 0x23, 0x67, 0x75, 0xe5, 0xea, 0x71, 0x1d, 0xcc, 0x9a, 0x04, 0x78, 0x15, 0xd4, - 0x05, 0x19, 0x8a, 0xa9, 0xa6, 0x3e, 0x27, 0xc3, 0xec, 0x61, 0x75, 0x2d, 0x47, 0x01, 0xe0, 0x43, - 0xb0, 0xa8, 0x6e, 0x78, 0x22, 0x48, 0xec, 0x7a, 0xdb, 0x28, 0xf4, 0x27, 0xec, 0xb2, 0xee, 0x03, - 0x6a, 0x71, 0x69, 0xfe, 0xba, 0x4a, 0xcf, 0x51, 0x1e, 0x8d, 0x8a, 0x21, 0xf8, 0x35, 0x58, 0xe4, - 0xec, 0x91, 0xd8, 0x45, 0x31, 0x71, 0x4d, 0x8f, 0x30, 0x57, 0xe5, 0xc5, 0x22, 0xbb, 0x09, 0xaa, - 0xf2, 0x35, 0x80, 0x07, 0x7a, 0x2a, 0x4f, 0xcf, 0x8b, 0x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, 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, 0x40, + 0xaa, 0x56, 0xb4, 0xd6, 0xac, 0x67, 0x70, 0xdc, 0xac, 0x3d, 0xae, 0x67, 0xbc, 0xd9, 0x1c, 0xda, + 0x73, 0xdb, 0x53, 0xa5, 0xfe, 0x03, 0xa8, 0x3d, 0xf6, 0xca, 0xb1, 0xe7, 0x0a, 0x71, 0xe2, 0xd8, + 0x13, 0xaa, 0xe0, 0xd2, 0x3f, 0xa3, 0x9a, 0x1f, 0xf6, 0xda, 0xbb, 0xde, 0x4d, 0x7a, 0x89, 0x3c, + 0x33, 0xef, 0xf3, 0x63, 0x3c, 0xef, 0xcd, 0xf3, 0x06, 0x9c, 0x76, 0x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, 0x16, + 0xe5, 0x4c, 0xb2, 0x7b, 0x61, 0x69, 0xec, 0xb6, 0xd7, 0x54, 0x9c, 0x9d, 0x02, 0x72, 0x2e, 0x7f, + 0xa9, 0x80, 0x5a, 0x66, 0xee, 0x56, 0xc1, 0xdc, 0xb9, 0x52, 0x73, 0x13, 0x3d, 0xdd, 0xfe, 0xcf, + 0x9e, 0x5a, 0x55, 0x41, 0x31, 0x70, 0x56, 0x95, 0xae, 0x9e, 0x56, 0xc1, 0xb4, 0x0e, 0x80, 0xd7, + 0x41, 0x95, 0x93, 0x3e, 0x9f, 0x68, 0xea, 0x21, 0xe9, 0x67, 0x2f, 0xab, 0x6d, 0xd8, 0x12, 0x00, + 0x1f, 0x83, 0x39, 0x79, 0xc3, 0x13, 0x4e, 0x62, 0xc7, 0xdd, 0x46, 0xa1, 0x37, 0xe6, 0x94, 0x55, + 0x1f, 0x90, 0x9b, 0x4b, 0xe3, 0xd7, 0x64, 0x78, 0x8e, 0xf2, 0x44, 0x54, 0x5c, 0x82, 0x5f, 0x81, + 0x39, 0x46, 0x9f, 0xf0, 0x5d, 0x14, 0x13, 0x47, 0xf7, 0x08, 0x7d, 0x55, 0x5e, 0x2e, 0xb2, 0xeb, + 0x45, 0x59, 0xbe, 0x1a, 0xf0, 0x48, 0x4d, 0xe5, 0xe9, 0x59, 0x71, 0x09, 0x46, 0x60, 0xde, 0x45, + 0xa1, 0x4b, 0xba, 0xce, 0x88, 0x4a, 0xb5, 0xac, 0x0b, 0xe4, 0x54, 0xd6, 0x24, 0x6e, 0xbc, 0xd6, + 0x69, 0xb7, 0x2c, 0x00, 0x76, 0xc1, 0x29, 0x97, 0x06, 0x41, 0x12, 0xfa, 0x7c, 0xcf, 0x89, 0x28, + 0xed, 0x3a, 0x2c, 0x22, 0x21, 0xd6, 0xf7, 0xe4, 0x8d, 0xa2, 0x5c, 0xbe, 0xd5, 0xab, 0xd3, 0xd4, + 0xc8, 0x07, 0x94, 0x76, 0x37, 0x05, 0x2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x5b, 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, 0xf3, 0x01, - 0x25, 0x6e, 0xa3, 0x88, 0x0f, 0xda, 0x3c, 0x09, 0x30, 0x13, 0x4f, 0x3d, 0x08, 0x29, 0xa7, 0x72, - 0xdd, 0xa1, 0x8c, 0x50, 0x66, 0x31, 0x77, 0xa8, 0xc7, 0x7a, 0x0e, 0xd2, 0x0f, 0x3b, 0x8d, 0xfb, - 0x7c, 0xe0, 0x87, 0xae, 0x15, 0xa0, 0x90, 0x27, 0xed, 0x02, 0xd8, 0xf6, 0xa8, 0x47, 0xaf, 0x56, - 0x82, 0xdd, 0xa8, 0xfd, 0x26, 0xa8, 0x7d, 0x9c, 0x01, 0xf3, 0x06, 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 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, 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, 0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x84, 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; +}