diff --git a/fabric-client/test/Channel.js b/fabric-client/test/Channel.js index fb1668c0e4..5245237d80 100644 --- a/fabric-client/test/Channel.js +++ b/fabric-client/test/Channel.js @@ -3496,7 +3496,7 @@ describe('Channel', () => { // prepare token transaction request tokenTx = new fabprotos.token.TokenTransaction(); - tokenTx.set('plain_action', new fabprotos.token.PlainTokenAction()); + tokenTx.set('token_action', new fabprotos.token.TokenAction()); request = {tokenTransaction: tokenTx, txId: txIdStub}; }); diff --git a/fabric-client/test/TokenClient.js b/fabric-client/test/TokenClient.js index 6a4138c934..85983d90e3 100644 --- a/fabric-client/test/TokenClient.js +++ b/fabric-client/test/TokenClient.js @@ -717,7 +717,7 @@ describe('TokenClient', () => { command.setHeader(commandHeader); tokenTx = new fabprotos.token.TokenTransaction(); - tokenTx.set('plain_action', new fabprotos.token.PlainTokenAction()); + tokenTx.set('token_action', new fabprotos.token.TokenAction()); // create stubs sha2_256Stub = sinon.stub(); diff --git a/fabric-protos/bundle.json b/fabric-protos/bundle.json index 716bc69d71..ffdeb53a48 100644 --- a/fabric-protos/bundle.json +++ b/fabric-protos/bundle.json @@ -4483,8 +4483,8 @@ "fields": [ { "rule": "optional", - "type": "PlainTokenAction", - "name": "plain_action", + "type": "TokenAction", + "name": "token_action", "id": 1, "oneof": "action" } @@ -4496,52 +4496,36 @@ } }, { - "name": "PlainTokenAction", + "name": "TokenAction", "syntax": "proto3", "fields": [ { "rule": "optional", - "type": "PlainImport", - "name": "plain_import", + "type": "Issue", + "name": "issue", "id": 1, "oneof": "data" }, { "rule": "optional", - "type": "PlainTransfer", - "name": "plain_transfer", + "type": "Transfer", + "name": "transfer", "id": 2, "oneof": "data" }, { "rule": "optional", - "type": "PlainTransfer", - "name": "plain_redeem", + "type": "Transfer", + "name": "redeem", "id": 3, "oneof": "data" - }, - { - "rule": "optional", - "type": "PlainApprove", - "name": "plain_approve", - "id": 4, - "oneof": "data" - }, - { - "rule": "optional", - "type": "PlainTransferFrom", - "name": "plain_transfer_From", - "id": 5, - "oneof": "data" } ], "oneofs": { "data": [ 1, 2, - 3, - 4, - 5 + 3 ] } }, @@ -4576,19 +4560,19 @@ ] }, { - "name": "PlainImport", + "name": "Issue", "syntax": "proto3", "fields": [ { "rule": "repeated", - "type": "PlainOutput", + "type": "Token", "name": "outputs", "id": 1 } ] }, { - "name": "PlainTransfer", + "name": "Transfer", "syntax": "proto3", "fields": [ { @@ -4599,62 +4583,14 @@ }, { "rule": "repeated", - "type": "PlainOutput", + "type": "Token", "name": "outputs", "id": 2 } ] }, { - "name": "PlainApprove", - "syntax": "proto3", - "fields": [ - { - "rule": "repeated", - "type": "TokenId", - "name": "inputs", - "id": 1 - }, - { - "rule": "repeated", - "type": "PlainDelegatedOutput", - "name": "delegated_outputs", - "id": 2 - }, - { - "rule": "optional", - "type": "PlainOutput", - "name": "output", - "id": 3 - } - ] - }, - { - "name": "PlainTransferFrom", - "syntax": "proto3", - "fields": [ - { - "rule": "repeated", - "type": "TokenId", - "name": "inputs", - "id": 1 - }, - { - "rule": "repeated", - "type": "PlainOutput", - "name": "outputs", - "id": 2 - }, - { - "rule": "optional", - "type": "PlainDelegatedOutput", - "name": "delegated_output", - "id": 3 - } - ] - }, - { - "name": "PlainOutput", + "name": "Token", "syntax": "proto3", "fields": [ { @@ -4695,36 +4631,6 @@ } ] }, - { - "name": "PlainDelegatedOutput", - "syntax": "proto3", - "fields": [ - { - "rule": "optional", - "type": "TokenOwner", - "name": "owner", - "id": 1 - }, - { - "rule": "repeated", - "type": "TokenOwner", - "name": "delegatees", - "id": 2 - }, - { - "rule": "optional", - "type": "string", - "name": "type", - "id": 3 - }, - { - "rule": "optional", - "type": "uint64", - "name": "quantity", - "id": 4 - } - ] - }, { "name": "TokenExpectation", "syntax": "proto3", @@ -4775,7 +4681,7 @@ "fields": [ { "rule": "repeated", - "type": "PlainOutput", + "type": "Token", "name": "outputs", "id": 1 } @@ -4937,48 +4843,6 @@ } ] }, - { - "name": "AllowanceRecipientShare", - "syntax": "proto3", - "fields": [ - { - "rule": "optional", - "type": "TokenOwner", - "name": "recipient", - "id": 1 - }, - { - "rule": "optional", - "type": "uint64", - "name": "quantity", - "id": 2 - } - ] - }, - { - "name": "ApproveRequest", - "syntax": "proto3", - "fields": [ - { - "rule": "optional", - "type": "bytes", - "name": "credential", - "id": 1 - }, - { - "rule": "repeated", - "type": "AllowanceRecipientShare", - "name": "allowance_shares", - "id": 2 - }, - { - "rule": "repeated", - "type": "TokenId", - "name": "token_ids", - "id": 3 - } - ] - }, { "name": "ExpectationRequest", "syntax": "proto3", @@ -5077,25 +4941,11 @@ "id": 5, "oneof": "payload" }, - { - "rule": "optional", - "type": "ApproveRequest", - "name": "approve_request", - "id": 6, - "oneof": "payload" - }, - { - "rule": "optional", - "type": "TransferRequest", - "name": "transfer_from_request", - "id": 7, - "oneof": "payload" - }, { "rule": "optional", "type": "ExpectationRequest", "name": "expectation_request", - "id": 8, + "id": 6, "oneof": "payload" } ], @@ -5105,9 +4955,7 @@ 3, 4, 5, - 6, - 7, - 8 + 6 ] } }, @@ -6762,20 +6610,6 @@ } ], "enums": [ - { - "name": "ConfidentialityLevel", - "syntax": "proto3", - "values": [ - { - "name": "PUBLIC", - "id": 0 - }, - { - "name": "CONFIDENTIAL", - "id": 1 - } - ] - }, { "name": "TxValidationCode", "syntax": "proto3", @@ -6897,6 +6731,10 @@ { "name": "VALIDATION_PARAMETER", "id": 0 + }, + { + "name": "VALIDATION_PARAMETER_V2", + "id": 1 } ] } @@ -7185,7 +7023,7 @@ ] }, { - "name": "DefineChaincodeForMyOrgArgs", + "name": "ApproveChaincodeDefinitionForMyOrgArgs", "syntax": "proto3", "fields": [ { @@ -7239,12 +7077,12 @@ ] }, { - "name": "DefineChaincodeForMyOrgResult", + "name": "ApproveChaincodeDefinitionForMyOrgResult", "syntax": "proto3", "fields": [] }, { - "name": "DefineChaincodeArgs", + "name": "CommitChaincodeDefinitionArgs", "syntax": "proto3", "fields": [ { @@ -7298,12 +7136,12 @@ ] }, { - "name": "DefineChaincodeResult", + "name": "CommitChaincodeDefinitionResult", "syntax": "proto3", "fields": [] }, { - "name": "QueryDefinedChaincodeArgs", + "name": "QueryChaincodeDefinitionArgs", "syntax": "proto3", "fields": [ { @@ -7315,7 +7153,7 @@ ] }, { - "name": "QueryDefinedChaincodeResult", + "name": "QueryChaincodeDefinitionResult", "syntax": "proto3", "fields": [ { @@ -7324,57 +7162,51 @@ "name": "sequence", "id": 1 }, - { - "rule": "optional", - "type": "string", - "name": "name", - "id": 2 - }, { "rule": "optional", "type": "string", "name": "version", - "id": 3 + "id": 2 }, { "rule": "optional", "type": "bytes", "name": "hash", - "id": 4 + "id": 3 }, { "rule": "optional", "type": "string", "name": "endorsement_plugin", - "id": 5 + "id": 4 }, { "rule": "optional", "type": "string", "name": "validation_plugin", - "id": 6 + "id": 5 }, { "rule": "optional", "type": "bytes", "name": "validation_parameter", - "id": 7 + "id": 6 }, { "rule": "optional", "type": "common.CollectionConfigPackage", "name": "collections", - "id": 8 + "id": 7 } ] }, { - "name": "QueryDefinedNamespacesArgs", + "name": "QueryNamespaceDefinitionsArgs", "syntax": "proto3", "fields": [] }, { - "name": "QueryDefinedNamespacesResult", + "name": "QueryNamespaceDefinitionsResult", "syntax": "proto3", "fields": [ { diff --git a/fabric-protos/protos/peer/chaincode.proto b/fabric-protos/protos/peer/chaincode.proto index ae4d9fba11..baaa4c09e2 100644 --- a/fabric-protos/protos/peer/chaincode.proto +++ b/fabric-protos/protos/peer/chaincode.proto @@ -21,13 +21,6 @@ option java_package = "org.hyperledger.fabric.protos.peer"; option go_package = "github.com/hyperledger/fabric/protos/peer"; -// Confidentiality Levels -enum ConfidentialityLevel { - PUBLIC = 0; - CONFIDENTIAL = 1; -} - - //ChaincodeID contains the path as specified by the deploy transaction //that created it as well as the hashCode that is generated by the //system for the path. From the user level (ie, CLI, REST API and so on) diff --git a/fabric-protos/protos/peer/lifecycle/lifecycle.proto b/fabric-protos/protos/peer/lifecycle/lifecycle.proto index 2ccd908722..46d3ebf2be 100644 --- a/fabric-protos/protos/peer/lifecycle/lifecycle.proto +++ b/fabric-protos/protos/peer/lifecycle/lifecycle.proto @@ -14,7 +14,7 @@ option java_package = "org.hyperledger.fabric.protos.peer.lifecycle"; option go_package = "github.com/hyperledger/fabric/protos/peer/lifecycle"; // InstallChaincodeArgs is the message used as the argument to -// '+lifecycle.InstallChaincode' +// '_lifecycle.InstallChaincode' message InstallChaincodeArgs { string name = 1; string version = 2; @@ -22,32 +22,32 @@ message InstallChaincodeArgs { } // InstallChaincodeArgs is the message returned by -// '+lifecycle.InstallChaincode' +// '_lifecycle.InstallChaincode' message InstallChaincodeResult { bytes hash = 1; } // QueryInstalledChaincodeArgs is the message used as arguments -// '+lifecycle.QueryInstalledChaincode' +// '_lifecycle.QueryInstalledChaincode' message QueryInstalledChaincodeArgs { string name = 1; string version = 2; } // QueryInstalledChaincodeResult is the message returned by -// '+lifecycle.QueryInstalledChaincode' +// '_lifecycle.QueryInstalledChaincode' message QueryInstalledChaincodeResult { bytes hash = 1; } // QueryInstalledChaincodesArgs currently is an empty argument to -// '+lifecycle.QueryInstalledChaincodes'. In the future, it may be +// '_lifecycle.QueryInstalledChaincodes'. In the future, it may be // extended to have parameters. message QueryInstalledChaincodesArgs { } // QueryInstalledChaincodesResult is the message returned by -// '+lifecycle.QueryInstalledChaincodes'. It returns a list of +// '_lifecycle.QueryInstalledChaincodes'. It returns a list of // installed chaincodes. message QueryInstalledChaincodesResult { message InstalledChaincode { @@ -58,9 +58,9 @@ message QueryInstalledChaincodesResult { repeated InstalledChaincode installed_chaincodes = 1; } -// DefineChaincodeForMyOrgArgs is the message used as arguments to -// `+lifecycle.DefineChaincodeForMyOrg`. -message DefineChaincodeForMyOrgArgs { +// ApproveChaincodeDefinitionForMyOrgArgs is the message used as arguments to +// `_lifecycle.ApproveChaincodeDefinitionForMyOrg`. +message ApproveChaincodeDefinitionForMyOrgArgs { int64 sequence = 1; string name = 2; string version = 3; @@ -71,15 +71,15 @@ message DefineChaincodeForMyOrgArgs { common.CollectionConfigPackage collections = 8; } -// DefineChaincodeForMyOrgResult is the message returned by -// `+lifecycle.DefineChaincodeForMyOrg`. Currently it returns +// ApproveChaincodeDefinitionForMyOrgResult is the message returned by +// `_lifecycle.ApproveChaincodeDefinitionForMyOrg`. Currently it returns // nothing, but may be extended in the future. -message DefineChaincodeForMyOrgResult { +message ApproveChaincodeDefinitionForMyOrgResult { } -// DefineChaincodeArgs is the message used as arguments to -// `+lifecycle.DefineChaincode`. -message DefineChaincodeArgs { +// CommitChaincodeDefinitionArgs is the message used as arguments to +// `_lifecycle.CommitChaincodeDefinition`. +message CommitChaincodeDefinitionArgs { int64 sequence = 1; string name = 2; string version = 3; @@ -90,39 +90,38 @@ message DefineChaincodeArgs { common.CollectionConfigPackage collections = 8; } -// DefineChaincodeResult is the message returned by -// `+lifecycle.DefineChaincode`. Currently it returns +// CommitChaincodeDefinitionResult is the message returned by +// `_lifecycle.CommitChaincodeDefinition`. Currently it returns // nothing, but may be extended in the future. -message DefineChaincodeResult { +message CommitChaincodeDefinitionResult { } -// QueryDefinedChaincode is the message used as arguments to -// `+lifecycle.QueryDefinedChaincode`. -message QueryDefinedChaincodeArgs { +// QueryChaincodeDefinition is the message used as arguments to +// `_lifecycle.QueryChaincodeDefinition`. +message QueryChaincodeDefinitionArgs { string name = 1; } -// DefineChaincodeResult is the message returned by -// `+lifecycle.QueryDefinedChaincode`. -message QueryDefinedChaincodeResult { +// CommitChaincodeDefinitionResult is the message returned by +// `_lifecycle.QueryChaincodeDefinition`. +message QueryChaincodeDefinitionResult { int64 sequence = 1; - string name = 2; - string version = 3; - bytes hash = 4; - string endorsement_plugin = 5; - string validation_plugin = 6; - bytes validation_parameter = 7; - common.CollectionConfigPackage collections = 8; + string version = 2; + bytes hash = 3; + string endorsement_plugin = 4; + string validation_plugin = 5; + bytes validation_parameter = 6; + common.CollectionConfigPackage collections = 7; } -// QueryDefinedNamespaces is the message used as arguments to -// `+lifecycle.QueryDefinedNamespaces`. -message QueryDefinedNamespacesArgs { +// QueryNamespaceDefinitions is the message used as arguments to +// `_lifecycle.QueryNamespaceDefinitions`. +message QueryNamespaceDefinitionsArgs { } -// QueryDefinedNamespaces is the message returned by -// `+lifecycle.QueryDefinedNamespaces`. -message QueryDefinedNamespacesResult { +// QueryNamespaceDefinitions is the message returned by +// `_lifecycle.QueryNamespaceDefinitions`. +message QueryNamespaceDefinitionsResult { message Namespace{ string type = 1; } diff --git a/fabric-protos/protos/peer/transaction.proto b/fabric-protos/protos/peer/transaction.proto index 1b8c694f86..cf4948ba39 100644 --- a/fabric-protos/protos/peer/transaction.proto +++ b/fabric-protos/protos/peer/transaction.proto @@ -144,4 +144,5 @@ enum TxValidationCode { // Reserved entries in the key-level metadata map enum MetaDataKeys { VALIDATION_PARAMETER = 0; + VALIDATION_PARAMETER_V2 = 1; } diff --git a/fabric-protos/protos/token/expectations.proto b/fabric-protos/protos/token/expectations.proto index b9e13de1e7..80fa59d6af 100644 --- a/fabric-protos/protos/token/expectations.proto +++ b/fabric-protos/protos/token/expectations.proto @@ -11,7 +11,6 @@ option java_package = "org.hyperledger.fabric.protos.token"; package token; -import "google/protobuf/timestamp.proto"; import "token/transaction.proto"; // TokenExpectation represent the belief that someone should achieve in terms of a token action @@ -36,5 +35,5 @@ message PlainExpectation { // certain outputs will be matched message PlainTokenExpectation { // Outputs contains the expected outputs - repeated PlainOutput outputs = 1; + repeated Token outputs = 1; } diff --git a/fabric-protos/protos/token/prover.proto b/fabric-protos/protos/token/prover.proto index 5b74650de8..edc792b334 100644 --- a/fabric-protos/protos/token/prover.proto +++ b/fabric-protos/protos/token/prover.proto @@ -90,27 +90,6 @@ message RedeemRequest { uint64 quantity_to_redeem = 3; } -// ALlowance defines how many and what tokens a recipient can transfer on behalf of their actual owner -message AllowanceRecipientShare { - // Recipient refers to the entity allowed to spend the specified quantity from the tokens identified by token IDs - TokenOwner recipient = 1; - - // Quantity is how many tokens are delegated to the recipient - uint64 quantity = 2; -} - -// ApproveRequest is used to request the creation of allowance from one owner to another -message ApproveRequest{ - // Credential refers to the public credential of the request creator - bytes credential = 1; - - // Allowance describes the tokens the creator of the request is willing to delegate - repeated AllowanceRecipientShare allowance_shares = 2; - - // TokenIds are the token identifiers used to create the allowance - repeated TokenId token_ids = 3; -} - // ExpectationRequest is used to request indirect token import or transfer based on the token expectation message ExpectationRequest { // credential contains information for the party who is requesting the operation @@ -158,9 +137,7 @@ message Command { TransferRequest transfer_request = 3; ListRequest list_request = 4; RedeemRequest redeem_request = 5; - ApproveRequest approve_request = 6; - TransferRequest transfer_from_request = 7; - ExpectationRequest expectation_request = 8; + ExpectationRequest expectation_request = 6; } } diff --git a/fabric-protos/protos/token/transaction.proto b/fabric-protos/protos/token/transaction.proto index 642903e262..d1e772bdca 100644 --- a/fabric-protos/protos/token/transaction.proto +++ b/fabric-protos/protos/token/transaction.proto @@ -54,26 +54,22 @@ package token; // the transaction's envelope header indicates a transaction of type // "Token" message TokenTransaction { - // action carries the content of this transaction. + // TokenAction carries the content of this transaction. oneof action { - PlainTokenAction plain_action = 1; + TokenAction token_action = 1; } } -// PlainTokenAction governs the structure of a token action that is -// subjected to no privacy restrictions -message PlainTokenAction { +// TokenAction governs the structure of the action +// that a token undertakes +message TokenAction { oneof data { - // A plaintext token import transaction - PlainImport plain_import = 1; - // A plaintext token transfer transaction - PlainTransfer plain_transfer = 2; - // A plaintext token redeem transaction - PlainTransfer plain_redeem = 3; - // A plaintext token approve transaction - PlainApprove plain_approve = 4; - // A plaintext token transfer from transaction - PlainTransferFrom plain_transfer_From = 5; + // An issue transaction + Issue issue = 1; + // A transfer transaction + Transfer transfer = 2; + // A redeem transaction + Transfer redeem = 3; } } @@ -89,66 +85,42 @@ message TokenOwner { // The type of the identity Type type = 1; - // The serialization of an identity + // The serialization of the identity bytes raw = 2; } -// PlainImport specifies an import of one or more tokens in plaintext format -message PlainImport { +// Issue specifies an issue of one or more tokens +message Issue { - // An import transaction may contain one or more outputs - repeated PlainOutput outputs = 1; + // An issue transaction may contain one or more tokens + repeated Token outputs = 1; } -// PlainTransfer specifies a transfer of one or more plaintext tokens to one or more outputs -message PlainTransfer { +// Transfer specifies a transfer of one or more tokens +message Transfer { // The inputs to the transfer transaction are specified by their ID repeated TokenId inputs = 1; - // A transfer transaction may contain one or more outputs - repeated PlainOutput outputs = 2; + // A transfer transaction results in one or more tokens + repeated Token outputs = 2; } -// PlainApprove specifies an approve of one or more tokens in plaintext format -message PlainApprove { - // The inputs to the transfer transaction are specified by their ID - repeated TokenId inputs = 1; - - // An approve transaction contains one or more plain delegated outputs - repeated PlainDelegatedOutput delegated_outputs = 2; - - // An approve transaction contains one plain output - PlainOutput output = 3; -} - -// PlainTransferFrom specifies a transfer of one or more plaintext delegated tokens to one or more outputs -// an to a delegated output -message PlainTransferFrom { - // The inputs to the transfer transaction are specified by their ID - repeated TokenId inputs = 1; - - // A transferFrom transaction contains multiple outputs - repeated PlainOutput outputs = 2; +// Token is the result of issue and transfer transactions using plaintext tokens +message Token { - // A transferFrom transaction may contain one delegatable output - PlainDelegatedOutput delegated_output = 3; -} - -// A PlainOutput is the result of import and transfer transactions using plaintext tokens -message PlainOutput { - - // The owner is the serialization of a SerializedIdentity struct + // The token owner TokenOwner owner = 1; // The token type string type = 2; - // The quantity of tokens + // The quantity of units carried in the tokens uint64 quantity = 3; } -// A TokenId specifies an output using the transaction ID and the index of the output in the transaction +// A TokenId specifies a token using the transaction ID and the index of the token in the transaction +// that creates it message TokenId { // The transaction ID @@ -157,19 +129,3 @@ message TokenId { // The index of the output in the transaction uint32 index = 2; } - -// A PlainDelegatedOutput is the result of approve transactions using plaintext tokens -message PlainDelegatedOutput { - // The owner is the serialization of a SerializedIdentity struct - TokenOwner owner = 1; - - // The delegatees is an arrary of the serialized identities that can spend the output on behalf - // the owner - repeated TokenOwner delegatees = 2; - - // The token type - string type = 3; - - // The quantity of tokens - uint64 quantity = 4; -} \ No newline at end of file