From 574992062a610ee7911498d51e70eea67485c1dd Mon Sep 17 00:00:00 2001 From: Elli Androulaki Date: Fri, 27 Jul 2018 09:08:02 +0200 Subject: [PATCH] [FAB-11172] Token transaction proto message This changeset contains the definition of a transaction message accommodating token issue, and transfer, TokenTransaction. For TokenTransaction to be possible to integrate in the common.Envelope structure recognised by the orderers, we extend common.HeaderType with a "Token" type. HeaderType indicates the type of message (payload) included in a common.Envelope. Peers who receive common.Envelope messages with Envelope.Header including a HeaderType of "Token" would parse Envelope.Payload as TokenTransaction. Change-Id: Ica1a5407a14a22f5941de40e43b6ef0c71f83486 Signed-off-by: Elli Androulaki Signed-off-by: Angelo De Caro Signed-off-by: Mathias Bjoerkqvist --- protos/common/common.pb.go | 157 +++--- protos/common/common.proto | 1 + protos/orderer/etcdraft/configuration.pb.go | 8 +- protos/token/transaction.pb.go | 516 ++++++++++++++++++++ protos/token/transaction.proto | 111 +++++ 5 files changed, 712 insertions(+), 81 deletions(-) create mode 100644 protos/token/transaction.pb.go create mode 100644 protos/token/transaction.proto diff --git a/protos/common/common.pb.go b/protos/common/common.pb.go index b05aff42e7f..df8e792fd11 100644 --- a/protos/common/common.pb.go +++ b/protos/common/common.pb.go @@ -61,7 +61,7 @@ func (x Status) String() string { return proto.EnumName(Status_name, int32(x)) } func (Status) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_common_6e2445e92a14525f, []int{0} + return fileDescriptor_common_b374fafc5e1c956e, []int{0} } type HeaderType int32 @@ -75,6 +75,7 @@ const ( HeaderType_DELIVER_SEEK_INFO HeaderType = 5 HeaderType_CHAINCODE_PACKAGE HeaderType = 6 HeaderType_PEER_ADMIN_OPERATION HeaderType = 8 + HeaderType_TOKEN_TRANSACTION HeaderType = 9 ) var HeaderType_name = map[int32]string{ @@ -86,6 +87,7 @@ var HeaderType_name = map[int32]string{ 5: "DELIVER_SEEK_INFO", 6: "CHAINCODE_PACKAGE", 8: "PEER_ADMIN_OPERATION", + 9: "TOKEN_TRANSACTION", } var HeaderType_value = map[string]int32{ "MESSAGE": 0, @@ -96,13 +98,14 @@ var HeaderType_value = map[string]int32{ "DELIVER_SEEK_INFO": 5, "CHAINCODE_PACKAGE": 6, "PEER_ADMIN_OPERATION": 8, + "TOKEN_TRANSACTION": 9, } func (x HeaderType) String() string { return proto.EnumName(HeaderType_name, int32(x)) } func (HeaderType) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_common_6e2445e92a14525f, []int{1} + return fileDescriptor_common_b374fafc5e1c956e, []int{1} } // This enum enlists indexes of the block metadata array @@ -132,7 +135,7 @@ func (x BlockMetadataIndex) String() string { return proto.EnumName(BlockMetadataIndex_name, int32(x)) } func (BlockMetadataIndex) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_common_6e2445e92a14525f, []int{2} + return fileDescriptor_common_b374fafc5e1c956e, []int{2} } // LastConfig is the encoded value for the Metadata message which is encoded in the LAST_CONFIGURATION block metadata index @@ -147,7 +150,7 @@ func (m *LastConfig) Reset() { *m = LastConfig{} } func (m *LastConfig) String() string { return proto.CompactTextString(m) } func (*LastConfig) ProtoMessage() {} func (*LastConfig) Descriptor() ([]byte, []int) { - return fileDescriptor_common_6e2445e92a14525f, []int{0} + return fileDescriptor_common_b374fafc5e1c956e, []int{0} } func (m *LastConfig) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_LastConfig.Unmarshal(m, b) @@ -187,7 +190,7 @@ func (m *Metadata) Reset() { *m = Metadata{} } func (m *Metadata) String() string { return proto.CompactTextString(m) } func (*Metadata) ProtoMessage() {} func (*Metadata) Descriptor() ([]byte, []int) { - return fileDescriptor_common_6e2445e92a14525f, []int{1} + return fileDescriptor_common_b374fafc5e1c956e, []int{1} } func (m *Metadata) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_Metadata.Unmarshal(m, b) @@ -233,7 +236,7 @@ func (m *MetadataSignature) Reset() { *m = MetadataSignature{} } func (m *MetadataSignature) String() string { return proto.CompactTextString(m) } func (*MetadataSignature) ProtoMessage() {} func (*MetadataSignature) Descriptor() ([]byte, []int) { - return fileDescriptor_common_6e2445e92a14525f, []int{2} + return fileDescriptor_common_b374fafc5e1c956e, []int{2} } func (m *MetadataSignature) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_MetadataSignature.Unmarshal(m, b) @@ -279,7 +282,7 @@ func (m *Header) Reset() { *m = Header{} } func (m *Header) String() string { return proto.CompactTextString(m) } func (*Header) ProtoMessage() {} func (*Header) Descriptor() ([]byte, []int) { - return fileDescriptor_common_6e2445e92a14525f, []int{3} + return fileDescriptor_common_b374fafc5e1c956e, []int{3} } func (m *Header) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_Header.Unmarshal(m, b) @@ -352,7 +355,7 @@ func (m *ChannelHeader) Reset() { *m = ChannelHeader{} } func (m *ChannelHeader) String() string { return proto.CompactTextString(m) } func (*ChannelHeader) ProtoMessage() {} func (*ChannelHeader) Descriptor() ([]byte, []int) { - return fileDescriptor_common_6e2445e92a14525f, []int{4} + return fileDescriptor_common_b374fafc5e1c956e, []int{4} } func (m *ChannelHeader) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_ChannelHeader.Unmarshal(m, b) @@ -442,7 +445,7 @@ func (m *SignatureHeader) Reset() { *m = SignatureHeader{} } func (m *SignatureHeader) String() string { return proto.CompactTextString(m) } func (*SignatureHeader) ProtoMessage() {} func (*SignatureHeader) Descriptor() ([]byte, []int) { - return fileDescriptor_common_6e2445e92a14525f, []int{5} + return fileDescriptor_common_b374fafc5e1c956e, []int{5} } func (m *SignatureHeader) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_SignatureHeader.Unmarshal(m, b) @@ -491,7 +494,7 @@ func (m *Payload) Reset() { *m = Payload{} } func (m *Payload) String() string { return proto.CompactTextString(m) } func (*Payload) ProtoMessage() {} func (*Payload) Descriptor() ([]byte, []int) { - return fileDescriptor_common_6e2445e92a14525f, []int{6} + return fileDescriptor_common_b374fafc5e1c956e, []int{6} } func (m *Payload) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_Payload.Unmarshal(m, b) @@ -540,7 +543,7 @@ func (m *Envelope) Reset() { *m = Envelope{} } func (m *Envelope) String() string { return proto.CompactTextString(m) } func (*Envelope) ProtoMessage() {} func (*Envelope) Descriptor() ([]byte, []int) { - return fileDescriptor_common_6e2445e92a14525f, []int{7} + return fileDescriptor_common_b374fafc5e1c956e, []int{7} } func (m *Envelope) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_Envelope.Unmarshal(m, b) @@ -591,7 +594,7 @@ func (m *Block) Reset() { *m = Block{} } func (m *Block) String() string { return proto.CompactTextString(m) } func (*Block) ProtoMessage() {} func (*Block) Descriptor() ([]byte, []int) { - return fileDescriptor_common_6e2445e92a14525f, []int{8} + return fileDescriptor_common_b374fafc5e1c956e, []int{8} } func (m *Block) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_Block.Unmarshal(m, b) @@ -648,7 +651,7 @@ func (m *BlockHeader) Reset() { *m = BlockHeader{} } func (m *BlockHeader) String() string { return proto.CompactTextString(m) } func (*BlockHeader) ProtoMessage() {} func (*BlockHeader) Descriptor() ([]byte, []int) { - return fileDescriptor_common_6e2445e92a14525f, []int{9} + return fileDescriptor_common_b374fafc5e1c956e, []int{9} } func (m *BlockHeader) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_BlockHeader.Unmarshal(m, b) @@ -700,7 +703,7 @@ func (m *BlockData) Reset() { *m = BlockData{} } func (m *BlockData) String() string { return proto.CompactTextString(m) } func (*BlockData) ProtoMessage() {} func (*BlockData) Descriptor() ([]byte, []int) { - return fileDescriptor_common_6e2445e92a14525f, []int{10} + return fileDescriptor_common_b374fafc5e1c956e, []int{10} } func (m *BlockData) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_BlockData.Unmarshal(m, b) @@ -738,7 +741,7 @@ func (m *BlockMetadata) Reset() { *m = BlockMetadata{} } func (m *BlockMetadata) String() string { return proto.CompactTextString(m) } func (*BlockMetadata) ProtoMessage() {} func (*BlockMetadata) Descriptor() ([]byte, []int) { - return fileDescriptor_common_6e2445e92a14525f, []int{11} + return fileDescriptor_common_b374fafc5e1c956e, []int{11} } func (m *BlockMetadata) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_BlockMetadata.Unmarshal(m, b) @@ -783,68 +786,68 @@ func init() { proto.RegisterEnum("common.BlockMetadataIndex", BlockMetadataIndex_name, BlockMetadataIndex_value) } -func init() { proto.RegisterFile("common/common.proto", fileDescriptor_common_6e2445e92a14525f) } +func init() { proto.RegisterFile("common/common.proto", fileDescriptor_common_b374fafc5e1c956e) } -var fileDescriptor_common_6e2445e92a14525f = []byte{ - // 952 bytes of a gzipped FileDescriptorProto +var fileDescriptor_common_b374fafc5e1c956e = []byte{ + // 959 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x84, 0x55, 0xcf, 0x6f, 0xe3, 0x44, - 0x18, 0x5d, 0xc7, 0xf9, 0xf9, 0xb9, 0x69, 0xdd, 0x49, 0xcb, 0x9a, 0xc2, 0x6a, 0x2b, 0xc3, 0xa2, - 0xd2, 0x4a, 0xa9, 0x28, 0x17, 0x38, 0x3a, 0xf6, 0xb4, 0xb5, 0x9a, 0xda, 0x61, 0xec, 0x2c, 0x62, - 0x17, 0xc9, 0x72, 0x92, 0x69, 0x12, 0x91, 0xd8, 0x91, 0x3d, 0xa9, 0xda, 0x33, 0x77, 0x84, 0x04, - 0x57, 0xfe, 0x0a, 0xfe, 0x01, 0x8e, 0xfc, 0x41, 0x20, 0xae, 0x68, 0x3c, 0xb6, 0x37, 0x29, 0x2b, - 0x71, 0xca, 0xbc, 0x37, 0x2f, 0xdf, 0xf7, 0xe6, 0x7b, 0x63, 0x1b, 0x3a, 0xe3, 0x78, 0xb9, 0x8c, - 0xa3, 0x73, 0xf1, 0xd3, 0x5d, 0x25, 0x31, 0x8b, 0x51, 0x5d, 0xa0, 0xa3, 0x97, 0xd3, 0x38, 0x9e, - 0x2e, 0xe8, 0x79, 0xc6, 0x8e, 0xd6, 0x77, 0xe7, 0x6c, 0xbe, 0xa4, 0x29, 0x0b, 0x97, 0x2b, 0x21, - 0xd4, 0x75, 0x80, 0x7e, 0x98, 0x32, 0x33, 0x8e, 0xee, 0xe6, 0x53, 0x74, 0x00, 0xb5, 0x79, 0x34, - 0xa1, 0x0f, 0x9a, 0x74, 0x2c, 0x9d, 0x54, 0x89, 0x00, 0xfa, 0x5b, 0x68, 0xde, 0x52, 0x16, 0x4e, - 0x42, 0x16, 0x72, 0xc5, 0x7d, 0xb8, 0x58, 0xd3, 0x4c, 0xb1, 0x43, 0x04, 0x40, 0x5f, 0x03, 0xa4, - 0xf3, 0x69, 0x14, 0xb2, 0x75, 0x42, 0x53, 0xad, 0x72, 0x2c, 0x9f, 0x28, 0x17, 0x1f, 0x76, 0x73, - 0x47, 0xc5, 0x7f, 0xbd, 0x42, 0x41, 0x36, 0xc4, 0xfa, 0xf7, 0xb0, 0xff, 0x1f, 0x01, 0xfa, 0x1c, - 0xd4, 0x52, 0x12, 0xcc, 0x68, 0x38, 0xa1, 0x49, 0xde, 0x70, 0xaf, 0xe4, 0xaf, 0x33, 0x1a, 0x7d, - 0x0c, 0xad, 0x92, 0xd2, 0x2a, 0x99, 0xe6, 0x1d, 0xa1, 0xbf, 0x81, 0x7a, 0xae, 0x7b, 0x05, 0xbb, - 0xe3, 0x59, 0x18, 0x45, 0x74, 0xb1, 0x5d, 0xb0, 0x9d, 0xb3, 0xb9, 0xec, 0x7d, 0x9d, 0x2b, 0xef, - 0xed, 0xac, 0xff, 0x58, 0x81, 0xb6, 0xb9, 0xf5, 0x67, 0x04, 0x55, 0xf6, 0xb8, 0x12, 0xb3, 0xa9, - 0x91, 0x6c, 0x8d, 0x34, 0x68, 0xdc, 0xd3, 0x24, 0x9d, 0xc7, 0x51, 0x56, 0xa7, 0x46, 0x0a, 0x88, - 0xbe, 0x82, 0x56, 0x99, 0x86, 0x26, 0x1f, 0x4b, 0x27, 0xca, 0x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2, 0xfe, + 0xc0, 0x30, 0x6f, 0x44, 0xff, 0x9a, 0x68, 0x30, 0xc0, 0x98, 0xfa, 0x86, 0x75, 0x6b, 0x13, 0xdf, + 0x19, 0x60, 0x6a, 0xa4, 0x75, 0x1a, 0x62, 0x83, 0xe7, 0xdc, 0x60, 0xb2, 0x55, 0xbe, 0x79, 0xfa, + 0x16, 0xd0, 0x56, 0x78, 0xb6, 0x78, 0xb1, 0xa3, 0x5d, 0x00, 0xd7, 0xbe, 0x22, 0x86, 0x37, 0xa4, + 0xd8, 0x55, 0x9f, 0xa1, 0x3d, 0x68, 0xf5, 0x0d, 0xd7, 0xf3, 0x8b, 0xb3, 0x3d, 0x87, 0xce, 0x46, + 0x1d, 0xd7, 0xbf, 0xb4, 0xfb, 0x1e, 0xa6, 0x6a, 0x59, 0x4c, 0x23, 0x3b, 0x87, 0xaa, 0xf4, 0x5c, + 0xf8, 0x34, 0x8a, 0xa7, 0xdd, 0xd9, 0xe3, 0x8a, 0xc5, 0x0b, 0x36, 0x99, 0xb2, 0xb8, 0x7b, 0x17, + 0x8c, 0xe2, 0xf9, 0x58, 0xbe, 0xc6, 0x92, 0xec, 0x8e, 0xbf, 0x39, 0x9b, 0xce, 0xf9, 0x6c, 0x3d, + 0x12, 0xf0, 0x7c, 0x43, 0x7c, 0x2e, 0xc5, 0xf2, 0x1b, 0x95, 0x64, 0xdf, 0xb1, 0x51, 0x2d, 0x85, + 0x5f, 0xfe, 0x1b, 0x00, 0x00, 0xff, 0xff, 0x63, 0x9b, 0x9f, 0x8b, 0xdf, 0x06, 0x00, 0x00, } diff --git a/protos/common/common.proto b/protos/common/common.proto index 4044233314c..e93d5117cbe 100644 --- a/protos/common/common.proto +++ b/protos/common/common.proto @@ -50,6 +50,7 @@ enum HeaderType { DELIVER_SEEK_INFO = 5; // Used as the type for Envelope messages submitted to instruct the Deliver API to seek CHAINCODE_PACKAGE = 6; // Used for packaging chaincode artifacts for install PEER_ADMIN_OPERATION = 8; // Used for invoking an administrative operation on a peer + TOKEN_TRANSACTION = 9; // Used to denote transactions that invoke token management operations } // This enum enlists indexes of the block metadata array diff --git a/protos/orderer/etcdraft/configuration.pb.go b/protos/orderer/etcdraft/configuration.pb.go index eb26c783cc0..94e7d532976 100644 --- a/protos/orderer/etcdraft/configuration.pb.go +++ b/protos/orderer/etcdraft/configuration.pb.go @@ -31,7 +31,7 @@ func (m *Metadata) Reset() { *m = Metadata{} } func (m *Metadata) String() string { return proto.CompactTextString(m) } func (*Metadata) ProtoMessage() {} func (*Metadata) Descriptor() ([]byte, []int) { - return fileDescriptor_configuration_e5d86074f0d935a8, []int{0} + return fileDescriptor_configuration_d24fbe9bcd75d252, []int{0} } func (m *Metadata) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_Metadata.Unmarshal(m, b) @@ -73,7 +73,7 @@ func (m *Consenter) Reset() { *m = Consenter{} } func (m *Consenter) String() string { return proto.CompactTextString(m) } func (*Consenter) ProtoMessage() {} func (*Consenter) Descriptor() ([]byte, []int) { - return fileDescriptor_configuration_e5d86074f0d935a8, []int{1} + return fileDescriptor_configuration_d24fbe9bcd75d252, []int{1} } func (m *Consenter) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_Consenter.Unmarshal(m, b) @@ -127,10 +127,10 @@ func init() { } func init() { - proto.RegisterFile("orderer/etcdraft/configuration.proto", fileDescriptor_configuration_e5d86074f0d935a8) + proto.RegisterFile("orderer/etcdraft/configuration.proto", fileDescriptor_configuration_d24fbe9bcd75d252) } -var fileDescriptor_configuration_e5d86074f0d935a8 = []byte{ +var fileDescriptor_configuration_d24fbe9bcd75d252 = []byte{ // 246 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x5c, 0x90, 0xb1, 0x6b, 0xf3, 0x30, 0x10, 0xc5, 0xd1, 0x97, 0xf0, 0x91, 0xa8, 0x0d, 0x05, 0x75, 0xf1, 0x68, 0x42, 0x29, 0x9e, 0x24, diff --git a/protos/token/transaction.pb.go b/protos/token/transaction.pb.go new file mode 100644 index 00000000000..ee06b37331e --- /dev/null +++ b/protos/token/transaction.pb.go @@ -0,0 +1,516 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// source: token/transaction.proto + +package token // import "github.com/hyperledger/fabric/protos/token" + +import proto "github.com/golang/protobuf/proto" +import fmt "fmt" +import math "math" + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package + +// TokenTransaction governs the structure of Payload.data, when +// the transaction's envelope header indicates a transaction of type +// "Token" +type TokenTransaction struct { + // action carries the content of this transaction. + // + // Types that are valid to be assigned to Action: + // *TokenTransaction_PlainAction + Action isTokenTransaction_Action `protobuf_oneof:"action"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *TokenTransaction) Reset() { *m = TokenTransaction{} } +func (m *TokenTransaction) String() string { return proto.CompactTextString(m) } +func (*TokenTransaction) ProtoMessage() {} +func (*TokenTransaction) Descriptor() ([]byte, []int) { + return fileDescriptor_transaction_3ad285c2bea2948b, []int{0} +} +func (m *TokenTransaction) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_TokenTransaction.Unmarshal(m, b) +} +func (m *TokenTransaction) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_TokenTransaction.Marshal(b, m, deterministic) +} +func (dst *TokenTransaction) XXX_Merge(src proto.Message) { + xxx_messageInfo_TokenTransaction.Merge(dst, src) +} +func (m *TokenTransaction) XXX_Size() int { + return xxx_messageInfo_TokenTransaction.Size(m) +} +func (m *TokenTransaction) XXX_DiscardUnknown() { + xxx_messageInfo_TokenTransaction.DiscardUnknown(m) +} + +var xxx_messageInfo_TokenTransaction proto.InternalMessageInfo + +type isTokenTransaction_Action interface { + isTokenTransaction_Action() +} + +type TokenTransaction_PlainAction struct { + PlainAction *PlainTokenAction `protobuf:"bytes,1,opt,name=plain_action,json=plainAction,oneof"` +} + +func (*TokenTransaction_PlainAction) isTokenTransaction_Action() {} + +func (m *TokenTransaction) GetAction() isTokenTransaction_Action { + if m != nil { + return m.Action + } + return nil +} + +func (m *TokenTransaction) GetPlainAction() *PlainTokenAction { + if x, ok := m.GetAction().(*TokenTransaction_PlainAction); ok { + return x.PlainAction + } + return nil +} + +// XXX_OneofFuncs is for the internal use of the proto package. +func (*TokenTransaction) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{}) { + return _TokenTransaction_OneofMarshaler, _TokenTransaction_OneofUnmarshaler, _TokenTransaction_OneofSizer, []interface{}{ + (*TokenTransaction_PlainAction)(nil), + } +} + +func _TokenTransaction_OneofMarshaler(msg proto.Message, b *proto.Buffer) error { + m := msg.(*TokenTransaction) + // action + switch x := m.Action.(type) { + case *TokenTransaction_PlainAction: + b.EncodeVarint(1<<3 | proto.WireBytes) + if err := b.EncodeMessage(x.PlainAction); err != nil { + return err + } + case nil: + default: + return fmt.Errorf("TokenTransaction.Action has unexpected type %T", x) + } + return nil +} + +func _TokenTransaction_OneofUnmarshaler(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error) { + m := msg.(*TokenTransaction) + switch tag { + case 1: // action.plain_action + if wire != proto.WireBytes { + return true, proto.ErrInternalBadWireType + } + msg := new(PlainTokenAction) + err := b.DecodeMessage(msg) + m.Action = &TokenTransaction_PlainAction{msg} + return true, err + default: + return false, nil + } +} + +func _TokenTransaction_OneofSizer(msg proto.Message) (n int) { + m := msg.(*TokenTransaction) + // action + switch x := m.Action.(type) { + case *TokenTransaction_PlainAction: + s := proto.Size(x.PlainAction) + n += 1 // tag and wire + n += proto.SizeVarint(uint64(s)) + n += s + case nil: + default: + panic(fmt.Sprintf("proto: unexpected type %T in oneof", x)) + } + return n +} + +// PlainTokenAction governs the structure of a token action that is +// subjected to no privacy restrictions +type PlainTokenAction struct { + // Types that are valid to be assigned to Data: + // *PlainTokenAction_PlainImport + // *PlainTokenAction_PlainTransfer + Data isPlainTokenAction_Data `protobuf_oneof:"data"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *PlainTokenAction) Reset() { *m = PlainTokenAction{} } +func (m *PlainTokenAction) String() string { return proto.CompactTextString(m) } +func (*PlainTokenAction) ProtoMessage() {} +func (*PlainTokenAction) Descriptor() ([]byte, []int) { + return fileDescriptor_transaction_3ad285c2bea2948b, []int{1} +} +func (m *PlainTokenAction) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_PlainTokenAction.Unmarshal(m, b) +} +func (m *PlainTokenAction) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_PlainTokenAction.Marshal(b, m, deterministic) +} +func (dst *PlainTokenAction) XXX_Merge(src proto.Message) { + xxx_messageInfo_PlainTokenAction.Merge(dst, src) +} +func (m *PlainTokenAction) XXX_Size() int { + return xxx_messageInfo_PlainTokenAction.Size(m) +} +func (m *PlainTokenAction) XXX_DiscardUnknown() { + xxx_messageInfo_PlainTokenAction.DiscardUnknown(m) +} + +var xxx_messageInfo_PlainTokenAction proto.InternalMessageInfo + +type isPlainTokenAction_Data interface { + isPlainTokenAction_Data() +} + +type PlainTokenAction_PlainImport struct { + PlainImport *PlainImport `protobuf:"bytes,1,opt,name=plain_import,json=plainImport,oneof"` +} +type PlainTokenAction_PlainTransfer struct { + PlainTransfer *PlainTransfer `protobuf:"bytes,2,opt,name=plain_transfer,json=plainTransfer,oneof"` +} + +func (*PlainTokenAction_PlainImport) isPlainTokenAction_Data() {} +func (*PlainTokenAction_PlainTransfer) isPlainTokenAction_Data() {} + +func (m *PlainTokenAction) GetData() isPlainTokenAction_Data { + if m != nil { + return m.Data + } + return nil +} + +func (m *PlainTokenAction) GetPlainImport() *PlainImport { + if x, ok := m.GetData().(*PlainTokenAction_PlainImport); ok { + return x.PlainImport + } + return nil +} + +func (m *PlainTokenAction) GetPlainTransfer() *PlainTransfer { + if x, ok := m.GetData().(*PlainTokenAction_PlainTransfer); ok { + return x.PlainTransfer + } + return nil +} + +// XXX_OneofFuncs is for the internal use of the proto package. +func (*PlainTokenAction) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{}) { + return _PlainTokenAction_OneofMarshaler, _PlainTokenAction_OneofUnmarshaler, _PlainTokenAction_OneofSizer, []interface{}{ + (*PlainTokenAction_PlainImport)(nil), + (*PlainTokenAction_PlainTransfer)(nil), + } +} + +func _PlainTokenAction_OneofMarshaler(msg proto.Message, b *proto.Buffer) error { + m := msg.(*PlainTokenAction) + // data + switch x := m.Data.(type) { + case *PlainTokenAction_PlainImport: + b.EncodeVarint(1<<3 | proto.WireBytes) + if err := b.EncodeMessage(x.PlainImport); err != nil { + return err + } + case *PlainTokenAction_PlainTransfer: + b.EncodeVarint(2<<3 | proto.WireBytes) + if err := b.EncodeMessage(x.PlainTransfer); err != nil { + return err + } + case nil: + default: + return fmt.Errorf("PlainTokenAction.Data has unexpected type %T", x) + } + return nil +} + +func _PlainTokenAction_OneofUnmarshaler(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error) { + m := msg.(*PlainTokenAction) + switch tag { + case 1: // data.plain_import + if wire != proto.WireBytes { + return true, proto.ErrInternalBadWireType + } + msg := new(PlainImport) + err := b.DecodeMessage(msg) + m.Data = &PlainTokenAction_PlainImport{msg} + return true, err + case 2: // data.plain_transfer + if wire != proto.WireBytes { + return true, proto.ErrInternalBadWireType + } + msg := new(PlainTransfer) + err := b.DecodeMessage(msg) + m.Data = &PlainTokenAction_PlainTransfer{msg} + return true, err + default: + return false, nil + } +} + +func _PlainTokenAction_OneofSizer(msg proto.Message) (n int) { + m := msg.(*PlainTokenAction) + // data + switch x := m.Data.(type) { + case *PlainTokenAction_PlainImport: + s := proto.Size(x.PlainImport) + n += 1 // tag and wire + n += proto.SizeVarint(uint64(s)) + n += s + case *PlainTokenAction_PlainTransfer: + s := proto.Size(x.PlainTransfer) + n += 1 // tag and wire + n += proto.SizeVarint(uint64(s)) + n += s + case nil: + default: + panic(fmt.Sprintf("proto: unexpected type %T in oneof", x)) + } + return n +} + +// PlainImport specifies an import of one or more tokens in plaintext format +type PlainImport struct { + // An import transaction may contain one or more outputs + Outputs []*PlainOutput `protobuf:"bytes,1,rep,name=outputs" json:"outputs,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *PlainImport) Reset() { *m = PlainImport{} } +func (m *PlainImport) String() string { return proto.CompactTextString(m) } +func (*PlainImport) ProtoMessage() {} +func (*PlainImport) Descriptor() ([]byte, []int) { + return fileDescriptor_transaction_3ad285c2bea2948b, []int{2} +} +func (m *PlainImport) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_PlainImport.Unmarshal(m, b) +} +func (m *PlainImport) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_PlainImport.Marshal(b, m, deterministic) +} +func (dst *PlainImport) XXX_Merge(src proto.Message) { + xxx_messageInfo_PlainImport.Merge(dst, src) +} +func (m *PlainImport) XXX_Size() int { + return xxx_messageInfo_PlainImport.Size(m) +} +func (m *PlainImport) XXX_DiscardUnknown() { + xxx_messageInfo_PlainImport.DiscardUnknown(m) +} + +var xxx_messageInfo_PlainImport proto.InternalMessageInfo + +func (m *PlainImport) GetOutputs() []*PlainOutput { + if m != nil { + return m.Outputs + } + return nil +} + +// PlainTransfer specifies a transfer or one or more plaintext tokens to one or more outputs +type PlainTransfer struct { + // The inputs to the transfer transaction are specified by their ID + Inputs []*InputId `protobuf:"bytes,1,rep,name=inputs" json:"inputs,omitempty"` + // A transfer transaction may contain one or more outputs + Outputs []*PlainOutput `protobuf:"bytes,2,rep,name=outputs" json:"outputs,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *PlainTransfer) Reset() { *m = PlainTransfer{} } +func (m *PlainTransfer) String() string { return proto.CompactTextString(m) } +func (*PlainTransfer) ProtoMessage() {} +func (*PlainTransfer) Descriptor() ([]byte, []int) { + return fileDescriptor_transaction_3ad285c2bea2948b, []int{3} +} +func (m *PlainTransfer) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_PlainTransfer.Unmarshal(m, b) +} +func (m *PlainTransfer) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_PlainTransfer.Marshal(b, m, deterministic) +} +func (dst *PlainTransfer) XXX_Merge(src proto.Message) { + xxx_messageInfo_PlainTransfer.Merge(dst, src) +} +func (m *PlainTransfer) XXX_Size() int { + return xxx_messageInfo_PlainTransfer.Size(m) +} +func (m *PlainTransfer) XXX_DiscardUnknown() { + xxx_messageInfo_PlainTransfer.DiscardUnknown(m) +} + +var xxx_messageInfo_PlainTransfer proto.InternalMessageInfo + +func (m *PlainTransfer) GetInputs() []*InputId { + if m != nil { + return m.Inputs + } + return nil +} + +func (m *PlainTransfer) GetOutputs() []*PlainOutput { + if m != nil { + return m.Outputs + } + return nil +} + +// A PlainOutput is the result of import and transfer transactions using plaintext tokens +type PlainOutput struct { + // The owner is the serialization of a SerializedIdentity struct + Owner []byte `protobuf:"bytes,1,opt,name=owner,proto3" json:"owner,omitempty"` + // The token type + Type string `protobuf:"bytes,2,opt,name=type" json:"type,omitempty"` + // The quantity of tokens + Quantity uint64 `protobuf:"varint,3,opt,name=quantity" json:"quantity,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *PlainOutput) Reset() { *m = PlainOutput{} } +func (m *PlainOutput) String() string { return proto.CompactTextString(m) } +func (*PlainOutput) ProtoMessage() {} +func (*PlainOutput) Descriptor() ([]byte, []int) { + return fileDescriptor_transaction_3ad285c2bea2948b, []int{4} +} +func (m *PlainOutput) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_PlainOutput.Unmarshal(m, b) +} +func (m *PlainOutput) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_PlainOutput.Marshal(b, m, deterministic) +} +func (dst *PlainOutput) XXX_Merge(src proto.Message) { + xxx_messageInfo_PlainOutput.Merge(dst, src) +} +func (m *PlainOutput) XXX_Size() int { + return xxx_messageInfo_PlainOutput.Size(m) +} +func (m *PlainOutput) XXX_DiscardUnknown() { + xxx_messageInfo_PlainOutput.DiscardUnknown(m) +} + +var xxx_messageInfo_PlainOutput proto.InternalMessageInfo + +func (m *PlainOutput) GetOwner() []byte { + if m != nil { + return m.Owner + } + return nil +} + +func (m *PlainOutput) GetType() string { + if m != nil { + return m.Type + } + return "" +} + +func (m *PlainOutput) GetQuantity() uint64 { + if m != nil { + return m.Quantity + } + return 0 +} + +// An InputId specifies an output using the transaction ID and the index of the output in the transaction +type InputId struct { + // The transaction ID + TxId []byte `protobuf:"bytes,1,opt,name=tx_id,json=txId,proto3" json:"tx_id,omitempty"` + // The index of the output in the transaction + Index uint32 `protobuf:"varint,2,opt,name=index" json:"index,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *InputId) Reset() { *m = InputId{} } +func (m *InputId) String() string { return proto.CompactTextString(m) } +func (*InputId) ProtoMessage() {} +func (*InputId) Descriptor() ([]byte, []int) { + return fileDescriptor_transaction_3ad285c2bea2948b, []int{5} +} +func (m *InputId) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_InputId.Unmarshal(m, b) +} +func (m *InputId) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_InputId.Marshal(b, m, deterministic) +} +func (dst *InputId) XXX_Merge(src proto.Message) { + xxx_messageInfo_InputId.Merge(dst, src) +} +func (m *InputId) XXX_Size() int { + return xxx_messageInfo_InputId.Size(m) +} +func (m *InputId) XXX_DiscardUnknown() { + xxx_messageInfo_InputId.DiscardUnknown(m) +} + +var xxx_messageInfo_InputId proto.InternalMessageInfo + +func (m *InputId) GetTxId() []byte { + if m != nil { + return m.TxId + } + return nil +} + +func (m *InputId) GetIndex() uint32 { + if m != nil { + return m.Index + } + return 0 +} + +func init() { + proto.RegisterType((*TokenTransaction)(nil), "TokenTransaction") + proto.RegisterType((*PlainTokenAction)(nil), "PlainTokenAction") + proto.RegisterType((*PlainImport)(nil), "PlainImport") + proto.RegisterType((*PlainTransfer)(nil), "PlainTransfer") + proto.RegisterType((*PlainOutput)(nil), "PlainOutput") + proto.RegisterType((*InputId)(nil), "InputId") +} + +func init() { + proto.RegisterFile("token/transaction.proto", fileDescriptor_transaction_3ad285c2bea2948b) +} + +var fileDescriptor_transaction_3ad285c2bea2948b = []byte{ + // 340 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x7c, 0x92, 0x4f, 0x4f, 0xc2, 0x40, + 0x10, 0xc5, 0x29, 0x94, 0x82, 0xc3, 0x9f, 0xe0, 0x6a, 0x62, 0xe3, 0xa9, 0xe9, 0xc1, 0x10, 0x63, + 0xda, 0xf8, 0xff, 0x2c, 0x27, 0x7a, 0xd2, 0xac, 0x5c, 0xf4, 0x42, 0x0a, 0x5d, 0x60, 0x23, 0xec, + 0xd6, 0x65, 0x1b, 0xe1, 0x0b, 0xf8, 0xb9, 0x4d, 0x67, 0x0b, 0x54, 0x0f, 0xde, 0xfa, 0xde, 0xcc, + 0xfc, 0xe6, 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0x73, 0x68, 0x7e, 0x66, 0xb1, 0xd0, 0x5c, + 0x6f, 0xdd, 0x9a, 0x67, 0xf5, 0x6d, 0xba, 0xd7, 0xfe, 0x1d, 0x34, 0x8a, 0x3c, 0xe4, 0x04, 0xea, + 0x7a, 0x33, 0xe6, 0x49, 0x01, 0xb4, 0xf5, 0x26, 0x4a, 0xf2, 0x2d, 0x5c, 0x24, 0x6c, 0x83, 0xc0, + 0x0e, 0x35, 0x62, 0x70, 0xf5, 0x7e, 0x39, 0xe7, 0x7a, 0x91, 0x4d, 0x82, 0xa9, 0x5c, 0x85, 0x8b, + 0x6d, 0xca, 0xd4, 0x92, 0x25, 0x73, 0xa6, 0xc2, 0x59, 0x3c, 0x51, 0x7c, 0x1a, 0xe2, 0x89, 0xac, + 0x43, 0xbc, 0x9d, 0x89, 0x83, 0xea, 0xf6, 0x27, 0x00, 0x00, 0xff, 0xff, 0x11, 0x6e, 0x94, 0xbf, + 0x4b, 0x02, 0x00, 0x00, +} diff --git a/protos/token/transaction.proto b/protos/token/transaction.proto new file mode 100644 index 00000000000..cb95944114e --- /dev/null +++ b/protos/token/transaction.proto @@ -0,0 +1,111 @@ +/* +Copyright IBM Corp. All Rights Reserved. + +SPDX-License-Identifier: Apache-2.0 +*/ + +syntax = "proto3"; + +option go_package = "github.com/hyperledger/fabric/protos/token"; + + +// ================ Existing Fabric Transaction structure =============== +// +//In Summary, Fabric supports the following transaction structure: +// +// Envelope +// |\_ Signature (signature on the common.Payload message +// | including the transaction by the creator +// | specified in the Payload.header) +// \_ Payload +// |\_ Header (1) (the header of the proposal that requested this +// | action; containing channel header, and +// | signature header) +// \_ Data (1) (serialised Transaction message) +// \_ Transaction +// \_ TransactionAction (1...n) +// |\_ Header (1) (the header of the proposal that +// | requested this action) +// \_ ChaincodeActionPayload (1) +// +// +// +// +// =============== Changes to Existing Fabric Transaction structure =============== +// For envelopes that carry FabToken transaction we still maintain the same structure +// such that the orderers functionality is not disturbed: +// +// Envelope +// |\_ Signature (signature on the Payload message including +// | the transaction by the creator +// | specified in the Payload.header) +// \_ Payload +// |\_ Header (1) (the header of the proposal that requested +// | this action; containing +// | channel header, and signature header) +// \_ Data (1) (serialised Transaction message) +// \_ TokenTransaction (1) +// \_ action (1) (a oneof for the different types of transactions) + + + +// TokenTransaction governs the structure of Payload.data, when +// the transaction's envelope header indicates a transaction of type +// "Token" +message TokenTransaction { + // action carries the content of this transaction. + oneof action { + PlainTokenAction plain_action = 1; + } +} + +// PlainTokenAction governs the structure of a token action that is +// subjected to no privacy restrictions +message PlainTokenAction { + oneof data { + // A plaintext token import transaction + PlainImport plain_import = 1; + // A plaintext token transfer transaction + PlainTransfer plain_transfer = 2; + } +} + +// PlainImport specifies an import of one or more tokens in plaintext format +message PlainImport { + + // An import transaction may contain one or more outputs + repeated PlainOutput outputs = 1; +} + +// PlainTransfer specifies a transfer or one or more plaintext tokens to one or more outputs +message PlainTransfer { + + // The inputs to the transfer transaction are specified by their ID + repeated InputId inputs = 1; + + // A transfer transaction may contain one or more outputs + repeated PlainOutput outputs = 2; +} + +// A PlainOutput is the result of import and transfer transactions using plaintext tokens +message PlainOutput { + + // The owner is the serialization of a SerializedIdentity struct + bytes owner = 1; + + // The token type + string type = 2; + + // The quantity of tokens + uint64 quantity = 3; +} + +// An InputId specifies an output using the transaction ID and the index of the output in the transaction +message InputId { + + // The transaction ID + bytes tx_id = 1; + + // The index of the output in the transaction + uint32 index = 2; +}