From 38eda8451ff2b4461e67f2565a7f906a69a0d96d Mon Sep 17 00:00:00 2001 From: Bret Harrison Date: Thu, 11 May 2017 11:33:51 -0400 Subject: [PATCH] [FAB-3868] NodeSDK - update proto files to latest Update the NodeSDK set of protos with the latest from Fabric. Update code where filenames have changed and fieldnames have changed. Change-Id: I1f5210c9e6502eac30522f79246c3d4771f4603f Signed-off-by: Bret Harrison --- fabric-client/lib/Block.js | 6 +- fabric-client/lib/Chain.js | 6 +- fabric-client/lib/ChannelConfig.js | 6 +- fabric-client/lib/EventHub.js | 2 +- fabric-client/lib/Policy.js | 2 +- fabric-client/lib/msp/identity.js | 6 +- fabric-client/lib/msp/msp-manager.js | 4 +- fabric-client/lib/msp/msp.js | 6 +- fabric-client/lib/protos/common/common.proto | 6 +- .../lib/protos/common/configtx.proto | 1 + fabric-client/lib/protos/common/ledger.proto | 1 + .../lib/protos/common/policies.proto | 5 +- .../ledger/queryresult/kv_query_result.proto | 41 +++++++ .../{identity.proto => msp/identities.proto} | 7 +- .../msp/{mspconfig.proto => msp_config.proto} | 36 +++++- .../{common => msp}/msp_principal.proto | 5 +- fabric-client/lib/protos/orderer/ab.proto | 3 +- fabric-client/lib/protos/peer/admin.proto | 3 + fabric-client/lib/protos/peer/chaincode.proto | 4 +- ...ncodeevent.proto => chaincode_event.proto} | 5 +- .../lib/protos/peer/chaincode_shim.proto | 107 ++++++++++++++++++ .../lib/protos/peer/configuration.proto | 1 + fabric-client/lib/protos/peer/events.proto | 4 +- fabric-client/lib/protos/peer/peer.proto | 1 + fabric-client/lib/protos/peer/proposal.proto | 2 + .../lib/protos/peer/proposal_response.proto | 2 + fabric-client/lib/protos/peer/query.proto | 5 +- .../lib/protos/peer/signed_cc_dep_spec.proto | 42 +++++++ .../lib/protos/peer/transaction.proto | 9 ++ test/integration/get-config.js | 2 +- test/unit/chain.js | 2 +- test/unit/msp.js | 2 +- 32 files changed, 291 insertions(+), 43 deletions(-) create mode 100644 fabric-client/lib/protos/ledger/queryresult/kv_query_result.proto rename fabric-client/lib/protos/{identity.proto => msp/identities.proto} (84%) rename fabric-client/lib/protos/msp/{mspconfig.proto => msp_config.proto} (75%) rename fabric-client/lib/protos/{common => msp}/msp_principal.proto (97%) rename fabric-client/lib/protos/peer/{chaincodeevent.proto => chaincode_event.proto} (84%) mode change 100755 => 100644 create mode 100644 fabric-client/lib/protos/peer/chaincode_shim.proto create mode 100644 fabric-client/lib/protos/peer/signed_cc_dep_spec.proto diff --git a/fabric-client/lib/Block.js b/fabric-client/lib/Block.js index a7d90e7582..39781bd3ba 100644 --- a/fabric-client/lib/Block.js +++ b/fabric-client/lib/Block.js @@ -28,7 +28,7 @@ var _proposalProto = grpc.load(__dirname + '/protos/peer/proposal.proto').protos var _responseProto = grpc.load(__dirname + '/protos/peer/proposal_response.proto').protos; var _queryProto = grpc.load(__dirname + '/protos/peer/query.proto').protos; var _peerConfigurationProto = grpc.load(__dirname + '/protos/peer/configuration.proto').protos; -var _mspPrProto = grpc.load(__dirname + '/protos/common/msp_principal.proto').common; +var _mspPrProto = grpc.load(__dirname + '/protos/msp/msp_principal.proto').common; var _commonProto = grpc.load(__dirname + '/protos/common/common.proto').common; var _configtxProto = grpc.load(__dirname + '/protos/common/configtx.proto').common; var _policiesProto = grpc.load(__dirname + '/protos/common/policies.proto').common; @@ -36,9 +36,9 @@ var _ledgerProto = grpc.load(__dirname + '/protos/common/ledger.proto').common; var _commonConfigurationProto = grpc.load(__dirname + '/protos/common/configuration.proto').common; var _ordererConfigurationProto = grpc.load(__dirname + '/protos/orderer/configuration.proto').orderer; var _abProto = grpc.load(__dirname + '/protos/orderer/ab.proto').orderer; -var _mspConfigProto = grpc.load(__dirname + '/protos/msp/mspconfig.proto').msp; +var _mspConfigProto = grpc.load(__dirname + '/protos/msp/msp_config.proto').msp; var _timestampProto = grpc.load(__dirname + '/protos/google/protobuf/timestamp.proto').google.protobuf; -var _identityProto = grpc.load(path.join(__dirname, '/protos/identity.proto')).msp; +var _identityProto = grpc.load(path.join(__dirname, '/protos/msp/identities.proto')).msp; var _rwsetProto = grpc.load(path.join(__dirname, '/protos/ledger/rwset/rwset.proto')).rwset; var _kv_rwsetProto = grpc.load(path.join(__dirname, '/protos/ledger/rwset/kvrwset/kv_rwset.proto')).kvrwset; diff --git a/fabric-client/lib/Chain.js b/fabric-client/lib/Chain.js index 9827caaf86..f55dab7f7f 100755 --- a/fabric-client/lib/Chain.js +++ b/fabric-client/lib/Chain.js @@ -48,10 +48,10 @@ var _ledgerProto = grpc.load(__dirname + '/protos/common/ledger.proto').common; var _commonConfigurationProto = grpc.load(__dirname + '/protos/common/configuration.proto').common; var _ordererConfigurationProto = grpc.load(__dirname + '/protos/orderer/configuration.proto').orderer; var _abProto = grpc.load(__dirname + '/protos/orderer/ab.proto').orderer; -var _mspConfigProto = grpc.load(__dirname + '/protos/msp/mspconfig.proto').msp; -var _mspPrincipalProto = grpc.load(__dirname + '/protos/common/msp_principal.proto').common; +var _mspConfigProto = grpc.load(__dirname + '/protos/msp/msp_config.proto').msp; +var _mspPrincipalProto = grpc.load(__dirname + '/protos/msp/msp_principal.proto').common; var _timestampProto = grpc.load(__dirname + '/protos/google/protobuf/timestamp.proto').google.protobuf; -var _identityProto = grpc.load(path.join(__dirname, '/protos/identity.proto')).msp; +var _identityProto = grpc.load(path.join(__dirname, '/protos/msp/identities.proto')).msp; const ImplicitMetaPolicy_Rule = {0: 'ANY', 1:'ALL', 2:'MAJORITY'}; var Long = require('long'); diff --git a/fabric-client/lib/ChannelConfig.js b/fabric-client/lib/ChannelConfig.js index e51fd0bd90..965fdb3d8c 100644 --- a/fabric-client/lib/ChannelConfig.js +++ b/fabric-client/lib/ChannelConfig.js @@ -31,7 +31,7 @@ var _proposalProto = grpc.load(__dirname + '/protos/peer/proposal.proto').protos var _responseProto = grpc.load(__dirname + '/protos/peer/proposal_response.proto').protos; var _queryProto = grpc.load(__dirname + '/protos/peer/query.proto').protos; var _peerConfigurationProto = grpc.load(__dirname + '/protos/peer/configuration.proto').protos; -var _mspPrProto = grpc.load(__dirname + '/protos/common/msp_principal.proto').common; +var _mspPrProto = grpc.load(__dirname + '/protos/msp/msp_principal.proto').common; var _commonProto = grpc.load(__dirname + '/protos/common/common.proto').common; var _configtxProto = grpc.load(__dirname + '/protos/common/configtx.proto').common; var _policiesProto = grpc.load(__dirname + '/protos/common/policies.proto').common; @@ -39,9 +39,9 @@ var _ledgerProto = grpc.load(__dirname + '/protos/common/ledger.proto').common; var _commonConfigurationProto = grpc.load(__dirname + '/protos/common/configuration.proto').common; var _ordererConfigurationProto = grpc.load(__dirname + '/protos/orderer/configuration.proto').orderer; var _abProto = grpc.load(__dirname + '/protos/orderer/ab.proto').orderer; -var _mspConfigProto = grpc.load(__dirname + '/protos/msp/mspconfig.proto').msp; +var _mspConfigProto = grpc.load(__dirname + '/protos/msp/msp_config.proto').msp; var _timestampProto = grpc.load(__dirname + '/protos/google/protobuf/timestamp.proto').google.protobuf; -var _identityProto = grpc.load(path.join(__dirname, '/protos/identity.proto')).msp; +var _identityProto = grpc.load(path.join(__dirname, '/protos/msp/identities.proto')).msp; const ImplicitMetaPolicy_Rule = {ANY:0, ALL:1, MAJORITY:2}; diff --git a/fabric-client/lib/EventHub.js b/fabric-client/lib/EventHub.js index 1add021b08..b8f61a5b73 100644 --- a/fabric-client/lib/EventHub.js +++ b/fabric-client/lib/EventHub.js @@ -28,7 +28,7 @@ var _ccTransProto = grpc.load(__dirname + '/protos/peer/transaction.proto').prot var _transProto = grpc.load(__dirname + '/protos/peer/transaction.proto').protos; var _responseProto = grpc.load(__dirname + '/protos/peer/proposal_response.proto').protos; var _ccProposalProto = grpc.load(__dirname + '/protos/peer/proposal.proto').protos; -var _ccEventProto = grpc.load(__dirname + '/protos/peer/chaincodeevent.proto').protos; +var _ccEventProto = grpc.load(__dirname + '/protos/peer/chaincode_event.proto').protos; var _validation_codes = {}; var keys = Object.keys(_transProto.TxValidationCode); diff --git a/fabric-client/lib/Policy.js b/fabric-client/lib/Policy.js index 9df63ba375..a7d7da6fe1 100644 --- a/fabric-client/lib/Policy.js +++ b/fabric-client/lib/Policy.js @@ -19,7 +19,7 @@ var grpc = require('grpc'); var util = require('util'); -var _mspPrProto = grpc.load(__dirname + '/protos/common/msp_principal.proto').common; +var _mspPrProto = grpc.load(__dirname + '/protos/msp/msp_principal.proto').common; var _policiesProto = grpc.load(__dirname + '/protos/common/policies.proto').common; var IDENTITY_TYPE = { diff --git a/fabric-client/lib/msp/identity.js b/fabric-client/lib/msp/identity.js index 3fc12f6563..668eef479a 100755 --- a/fabric-client/lib/msp/identity.js +++ b/fabric-client/lib/msp/identity.js @@ -2,7 +2,7 @@ var grpc = require('grpc'); -var identityProto = grpc.load(__dirname + '/../protos/identity.proto').msp; +var identityProto = grpc.load(__dirname + '/../protos/msp/identities.proto').msp; /** * This interface is shared within the peer and client API of the membership service provider. @@ -111,8 +111,8 @@ var Identity = class { */ serialize() { var serializedIdentity = new identityProto.SerializedIdentity(); - serializedIdentity.Mspid = this.getMSPId(); - serializedIdentity.IdBytes = Buffer.from(this._certificate); + serializedIdentity.setMspid(this.getMSPId()); + serializedIdentity.setIdBytes(Buffer.from(this._certificate)); return serializedIdentity.toBuffer(); } }; diff --git a/fabric-client/lib/msp/msp-manager.js b/fabric-client/lib/msp/msp-manager.js index 9f8d5c818a..f336e977e3 100755 --- a/fabric-client/lib/msp/msp-manager.js +++ b/fabric-client/lib/msp/msp-manager.js @@ -28,8 +28,8 @@ var idModule = require('./identity.js'); var SigningIdentity = idModule.SigningIdentity; var Signer = idModule.Signer; -var mspProto = grpc.load(path.join(__dirname, '../protos/msp/mspconfig.proto')).msp; -var identityProto = grpc.load(path.join(__dirname, '../protos/identity.proto')).msp; +var mspProto = grpc.load(path.join(__dirname, '../protos/msp/msp_config.proto')).msp; +var identityProto = grpc.load(path.join(__dirname, '../protos/msp/identities.proto')).msp; /** * MSPManager is an interface defining a manager of one or more MSPs. This essentially acts diff --git a/fabric-client/lib/msp/msp.js b/fabric-client/lib/msp/msp.js index 92af4319d7..beabecc8ba 100755 --- a/fabric-client/lib/msp/msp.js +++ b/fabric-client/lib/msp/msp.js @@ -8,8 +8,8 @@ var utils = require('../utils.js'); var logger = utils.getLogger('msp.js'); var grpc = require('grpc'); -var identityProto = grpc.load(__dirname + '/../protos/identity.proto').msp; -var _mspConfigProto = grpc.load(__dirname + '/../protos/msp/mspconfig.proto').msp; +var identityProto = grpc.load(__dirname + '/../protos/msp/identities.proto').msp; +var _mspConfigProto = grpc.load(__dirname + '/../protos/msp/msp_config.proto').msp; /** @@ -143,7 +143,7 @@ var MSP = class { store_key = storeKey; } var sid = identityProto.SerializedIdentity.decode(serializedIdentity); - var cert = sid.IdBytes.toBinary(); + var cert = sid.getIdBytes().toBinary(); logger.debug('Encoded cert from deserialized identity: %s', cert); if(!store_key) { var publicKey =this.cryptoSuite.importKey(cert, { algorithm: api.CryptoAlgorithms.X509Certificate }, false); diff --git a/fabric-client/lib/protos/common/common.proto b/fabric-client/lib/protos/common/common.proto index 4e60d10ef9..81caefa549 100644 --- a/fabric-client/lib/protos/common/common.proto +++ b/fabric-client/lib/protos/common/common.proto @@ -19,6 +19,7 @@ syntax = "proto3"; import "../google/protobuf/timestamp.proto"; option go_package = "github.com/hyperledger/fabric/protos/common"; +option java_package = "org.hyperledger.fabric.protos.common"; package common; @@ -41,13 +42,14 @@ enum HeaderType { ENDORSER_TRANSACTION = 3; // Used by the SDK to submit endorser based transactions ORDERER_TRANSACTION = 4; // Used internally by the orderer for management 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 } // This enum enlists indexes of the block metadata array enum BlockMetadataIndex { SIGNATURES = 0; // Block metadata array position for block signatures - LAST_CONFIG = 1; // Block metadata array poistion to store last configuration block sequence number - TRANSACTIONS_FILTER = 2; // Block metadata array poistion to store serialized bit array filter of invalid transactions + LAST_CONFIG = 1; // Block metadata array position to store last configuration block sequence number + TRANSACTIONS_FILTER = 2; // Block metadata array position to store serialized bit array filter of invalid transactions ORDERER = 3; // Block metadata array position to store operational metadata for orderers // e.g. For Kafka, this is where we store the last offset written to the local ledger. } diff --git a/fabric-client/lib/protos/common/configtx.proto b/fabric-client/lib/protos/common/configtx.proto index 614ed7a976..74f6ef669d 100644 --- a/fabric-client/lib/protos/common/configtx.proto +++ b/fabric-client/lib/protos/common/configtx.proto @@ -20,6 +20,7 @@ import "common.proto"; import "policies.proto"; option go_package = "github.com/hyperledger/fabric/protos/common"; +option java_package = "org.hyperledger.fabric.protos.common"; package common; diff --git a/fabric-client/lib/protos/common/ledger.proto b/fabric-client/lib/protos/common/ledger.proto index 573ca34002..a9b99711c3 100644 --- a/fabric-client/lib/protos/common/ledger.proto +++ b/fabric-client/lib/protos/common/ledger.proto @@ -16,6 +16,7 @@ limitations under the License. syntax = "proto3"; option go_package = "github.com/hyperledger/fabric/protos/common"; +option java_package = "org.hyperledger.fabric.protos.common"; package common; diff --git a/fabric-client/lib/protos/common/policies.proto b/fabric-client/lib/protos/common/policies.proto index 7852c283c6..6ab984e9b6 100644 --- a/fabric-client/lib/protos/common/policies.proto +++ b/fabric-client/lib/protos/common/policies.proto @@ -16,9 +16,10 @@ limitations under the License. syntax = "proto3"; -import "msp_principal.proto"; +import "../msp/msp_principal.proto"; option go_package = "github.com/hyperledger/fabric/protos/common"; +option java_package = "org.hyperledger.fabric.protos.common"; package common; @@ -50,7 +51,7 @@ message SignaturePolicyEnvelope { // and will be the CA for more traditional certificates message SignaturePolicy { message NOutOf { - int32 N = 1; + int32 n = 1; repeated SignaturePolicy policies = 2; } oneof Type { diff --git a/fabric-client/lib/protos/ledger/queryresult/kv_query_result.proto b/fabric-client/lib/protos/ledger/queryresult/kv_query_result.proto new file mode 100644 index 0000000000..5215fa1edc --- /dev/null +++ b/fabric-client/lib/protos/ledger/queryresult/kv_query_result.proto @@ -0,0 +1,41 @@ +/* +Copyright IBM Corp. 2017 All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +syntax = "proto3"; + +package queryresult; + +option go_package = "github.com/hyperledger/fabric/protos/ledger/queryresult"; +option java_package = "org.hyperledger.fabric.protos.ledger.queryresult"; + +import "../../google/protobuf/timestamp.proto"; + + +// KV -- QueryResult for range/execute query. Holds a key and corresponding value. +message KV { + string namespace = 1; + string key = 2; + bytes value = 3; +} + +// KeyModification -- QueryResult for history query. Holds a transaction ID, value, +// timestamp, and delete marker which resulted from a history query. +message KeyModification { + string tx_id = 1; + bytes value = 2; + google.protobuf.Timestamp timestamp = 3; + bool is_delete = 4; +} diff --git a/fabric-client/lib/protos/identity.proto b/fabric-client/lib/protos/msp/identities.proto similarity index 84% rename from fabric-client/lib/protos/identity.proto rename to fabric-client/lib/protos/msp/identities.proto index dd37c474de..7046248c57 100644 --- a/fabric-client/lib/protos/identity.proto +++ b/fabric-client/lib/protos/msp/identities.proto @@ -16,7 +16,8 @@ limitations under the License. syntax = "proto3"; -option go_package = "github.com/hyperledger/fabric/msp"; +option go_package = "github.com/hyperledger/fabric/protos/msp"; +option java_package = "org.hyperledger.fabric.protos.msp"; package msp; @@ -25,8 +26,8 @@ package msp; // to serialize it and deserialize it message SerializedIdentity { // The identifier of the associated membership service provider - string Mspid = 1; + string mspid = 1; // the Identity, serialized according to the rules of its MPS - bytes IdBytes = 2; + bytes id_bytes = 2; } diff --git a/fabric-client/lib/protos/msp/mspconfig.proto b/fabric-client/lib/protos/msp/msp_config.proto similarity index 75% rename from fabric-client/lib/protos/msp/mspconfig.proto rename to fabric-client/lib/protos/msp/msp_config.proto index 12fae9e955..307ae77ac9 100644 --- a/fabric-client/lib/protos/msp/mspconfig.proto +++ b/fabric-client/lib/protos/msp/msp_config.proto @@ -17,6 +17,8 @@ limitations under the License. syntax = "proto3"; option go_package = "github.com/hyperledger/fabric/protos/msp"; +option java_package = "org.hyperledger.fabric.protos.msp"; +option java_outer_classname = "MspConfigPackage"; package msp; @@ -78,6 +80,27 @@ message FabricMSPConfig { // fabric organizational unit identifiers that belong to // this MSP configuration repeated FabricOUIdentifier organizational_unit_identifiers = 7; + + // FabricCryptoConfig contains the configuration parameters + // for the cryptographic algorithms used by this MSP + FabricCryptoConfig crypto_config = 8; +} + +// FabricCryptoConfig contains configuration parameters +// for the cryptographic algorithms used by the MSP +// this configuration refers to +message FabricCryptoConfig { + + // SignatureHashFamily is a string representing the hash family to be used + // during sign and verify operations. + // Allowed values are "SHA2" and "SHA3". + string signature_hash_family = 1; + + // IdentityIdentifierHashFunction is a string representing the hash function + // to be used during the computation of the identity identifier of an MSP identity. + // Allowed values are "SHA256", "SHA384" and "SHA3_256", "SHA3_384". + string identity_identifier_hash_function = 2; + } // SigningIdentityInfo represents the configuration information @@ -109,13 +132,18 @@ message KeyInfo { bytes key_material = 2; } -// FabricOUIdentifier represents an organizazional unit and +// FabricOUIdentifier represents an organizational unit and // its related chain of trust identifier. message FabricOUIdentifier { - // CertifiersIdentifier is the hash of certificates chain of trust - // related to this organizational unit - bytes certifiers_identifier = 1; + // Certificate represents the second certificate in a certification chain. + // (Notice that the first certificate in a certification chain is supposed + // to be the certificate of an identity). + // It must correspond to the certificate of root or intermediate CA + // recognized by the MSP this message belongs to. + // Starting from this certificate, a certification chain is computed + // and boud to the OrganizationUnitIdentifier specified + bytes certificate = 1; // OrganizationUnitIdentifier defines the organizational unit under the // MSP identified with MSPIdentifier diff --git a/fabric-client/lib/protos/common/msp_principal.proto b/fabric-client/lib/protos/msp/msp_principal.proto similarity index 97% rename from fabric-client/lib/protos/common/msp_principal.proto rename to fabric-client/lib/protos/msp/msp_principal.proto index a46a086aaf..d9e3cec43b 100644 --- a/fabric-client/lib/protos/common/msp_principal.proto +++ b/fabric-client/lib/protos/msp/msp_principal.proto @@ -17,7 +17,8 @@ limitations under the License. syntax = "proto3"; -option go_package = "github.com/hyperledger/fabric/protos/common"; +option go_package = "github.com/hyperledger/fabric/protos/msp"; +option java_package = "org.hyperledger.fabric.protos.common"; package common; @@ -112,7 +113,7 @@ message MSPRole { // MSPRoleType defines which of the available, pre-defined MSP-roles // an identiy should posess inside the MSP with identifier MSPidentifier - MSPRoleType Role = 2; + MSPRoleType role = 2; } diff --git a/fabric-client/lib/protos/orderer/ab.proto b/fabric-client/lib/protos/orderer/ab.proto index c8e57e1851..c4ed04fc35 100644 --- a/fabric-client/lib/protos/orderer/ab.proto +++ b/fabric-client/lib/protos/orderer/ab.proto @@ -19,6 +19,7 @@ syntax = "proto3"; import "../common/common.proto"; option go_package = "github.com/hyperledger/fabric/protos/orderer"; +option java_package = "org.hyperledger.fabric.protos.orderer"; package orderer; @@ -26,7 +27,7 @@ message BroadcastResponse { common.Status status = 1; } -message SeekNewest { } +message SeekNewest { } message SeekOldest { } diff --git a/fabric-client/lib/protos/peer/admin.proto b/fabric-client/lib/protos/peer/admin.proto index e1d0c6d4cd..cd761c45a6 100644 --- a/fabric-client/lib/protos/peer/admin.proto +++ b/fabric-client/lib/protos/peer/admin.proto @@ -16,6 +16,8 @@ limitations under the License. syntax = "proto3"; +option java_package = "org.hyperledger.fabric.protos.peer"; +option java_outer_classname = "AdminPackage"; option go_package = "github.com/hyperledger/fabric/protos/peer"; package protos; @@ -30,6 +32,7 @@ service Admin { rpc StopServer(google.protobuf.Empty) returns (ServerStatus) {} rpc GetModuleLogLevel(LogLevelRequest) returns (LogLevelResponse) {} rpc SetModuleLogLevel(LogLevelRequest) returns (LogLevelResponse) {} + rpc RevertLogLevels(google.protobuf.Empty) returns (google.protobuf.Empty) {} } message ServerStatus { diff --git a/fabric-client/lib/protos/peer/chaincode.proto b/fabric-client/lib/protos/peer/chaincode.proto index 8bc6e69752..8af59f3218 100644 --- a/fabric-client/lib/protos/peer/chaincode.proto +++ b/fabric-client/lib/protos/peer/chaincode.proto @@ -1,5 +1,5 @@ /* -Copyright IBM Corp. 2016 All Rights Reserved. +Copyright IBM Corp. 2017 All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -17,7 +17,7 @@ limitations under the License. syntax = "proto3"; package protos; -option java_package = "org.hyperledger.protos"; +option java_package = "org.hyperledger.fabric.protos.peer"; option go_package = "github.com/hyperledger/fabric/protos/peer"; import "../google/protobuf/timestamp.proto"; diff --git a/fabric-client/lib/protos/peer/chaincodeevent.proto b/fabric-client/lib/protos/peer/chaincode_event.proto old mode 100755 new mode 100644 similarity index 84% rename from fabric-client/lib/protos/peer/chaincodeevent.proto rename to fabric-client/lib/protos/peer/chaincode_event.proto index c11786555e..87d2a4020b --- a/fabric-client/lib/protos/peer/chaincodeevent.proto +++ b/fabric-client/lib/protos/peer/chaincode_event.proto @@ -1,5 +1,5 @@ /* -Copyright IBM Corp. 2016 All Rights Reserved. +Copyright IBM Corp. 2017 All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -15,7 +15,8 @@ limitations under the License. */ syntax = "proto3"; package protos; -option java_package = "org.hyperledger.protos"; +option java_package = "org.hyperledger.fabric.protos.peer"; +option java_outer_classname = "ChaincodeEventPackage"; option go_package = "github.com/hyperledger/fabric/protos/peer"; diff --git a/fabric-client/lib/protos/peer/chaincode_shim.proto b/fabric-client/lib/protos/peer/chaincode_shim.proto new file mode 100644 index 0000000000..5550320463 --- /dev/null +++ b/fabric-client/lib/protos/peer/chaincode_shim.proto @@ -0,0 +1,107 @@ +/* +Copyright IBM Corp. 2017 All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +syntax = "proto3"; + +package protos; +option java_package = "org.hyperledger.fabric.protos.peer"; +option go_package = "github.com/hyperledger/fabric/protos/peer"; +import "chaincode_event.proto"; +import "proposal.proto"; +import "../google/protobuf/timestamp.proto"; + + +message ChaincodeMessage { + + enum Type { + UNDEFINED = 0; + REGISTER = 1; + REGISTERED = 2; + INIT = 3; + READY = 4; + TRANSACTION = 5; + COMPLETED = 6; + ERROR = 7; + GET_STATE = 8; + PUT_STATE = 9; + DEL_STATE = 10; + INVOKE_CHAINCODE = 11; + RESPONSE = 13; + GET_STATE_BY_RANGE = 14; + GET_QUERY_RESULT = 15; + QUERY_STATE_NEXT = 16; + QUERY_STATE_CLOSE = 17; + KEEPALIVE = 18; + GET_HISTORY_FOR_KEY = 19; + } + + Type type = 1; + google.protobuf.Timestamp timestamp = 2; + bytes payload = 3; + string txid = 4; + + SignedProposal proposal = 5; + + //event emmited by chaincode. Used only with Init or Invoke. + // This event is then stored (currently) + //with Block.NonHashData.TransactionResult + ChaincodeEvent chaincode_event = 6; +} + +message PutStateInfo { + string key = 1; + bytes value = 2; +} + +message GetStateByRange { + string startKey = 1; + string endKey = 2; +} + +message GetQueryResult { + string query = 1; +} + +message GetHistoryForKey { + string key = 1; +} + +message QueryStateNext { + string id = 1; +} + +message QueryStateClose { + string id = 1; +} + +message QueryResultBytes { + bytes resultBytes = 1; +} + +message QueryResponse { + repeated QueryResultBytes results = 1; + bool has_more = 2; + string id = 3; +} + +// Interface that provides support to chaincode execution. ChaincodeContext +// provides the context necessary for the server to respond appropriately. +service ChaincodeSupport { + + rpc Register(stream ChaincodeMessage) returns (stream ChaincodeMessage) {} + + +} diff --git a/fabric-client/lib/protos/peer/configuration.proto b/fabric-client/lib/protos/peer/configuration.proto index 8d43f00b1d..6578910151 100644 --- a/fabric-client/lib/protos/peer/configuration.proto +++ b/fabric-client/lib/protos/peer/configuration.proto @@ -16,6 +16,7 @@ limitations under the License. syntax = "proto3"; +option java_package = "org.hyperledger.fabric.protos.peer"; option go_package = "github.com/hyperledger/fabric/protos/peer"; package protos; diff --git a/fabric-client/lib/protos/peer/events.proto b/fabric-client/lib/protos/peer/events.proto index fb902d8086..8b73f2495f 100644 --- a/fabric-client/lib/protos/peer/events.proto +++ b/fabric-client/lib/protos/peer/events.proto @@ -17,9 +17,11 @@ limitations under the License. syntax = "proto3"; import "../common/common.proto"; -import "chaincodeevent.proto"; +import "chaincode_event.proto"; import "transaction.proto"; +option java_package = "org.hyperledger.fabric.protos.peer"; +option java_outer_classname = "EventsPackage"; option go_package = "github.com/hyperledger/fabric/protos/peer"; package protos; diff --git a/fabric-client/lib/protos/peer/peer.proto b/fabric-client/lib/protos/peer/peer.proto index 57184175bf..c46fceb1a9 100644 --- a/fabric-client/lib/protos/peer/peer.proto +++ b/fabric-client/lib/protos/peer/peer.proto @@ -15,6 +15,7 @@ limitations under the License. */ syntax = "proto3"; +option java_package = "org.hyperledger.fabric.protos.peer"; option go_package = "github.com/hyperledger/fabric/protos/peer"; package protos; diff --git a/fabric-client/lib/protos/peer/proposal.proto b/fabric-client/lib/protos/peer/proposal.proto index 1e1cd99a8e..ffe924002c 100644 --- a/fabric-client/lib/protos/peer/proposal.proto +++ b/fabric-client/lib/protos/peer/proposal.proto @@ -17,6 +17,8 @@ limitations under the License. syntax = "proto3"; option go_package = "github.com/hyperledger/fabric/protos/peer"; +option java_package = "org.hyperledger.fabric.protos.peer"; +option java_outer_classname = "ProposalPackage"; package protos; diff --git a/fabric-client/lib/protos/peer/proposal_response.proto b/fabric-client/lib/protos/peer/proposal_response.proto index 268bd0ae74..8734ca4be7 100644 --- a/fabric-client/lib/protos/peer/proposal_response.proto +++ b/fabric-client/lib/protos/peer/proposal_response.proto @@ -17,6 +17,8 @@ limitations under the License. syntax = "proto3"; option go_package = "github.com/hyperledger/fabric/protos/peer"; +option java_package = "org.hyperledger.fabric.protos.peer"; +option java_outer_classname = "ProposalResponsePackage"; package protos; diff --git a/fabric-client/lib/protos/peer/query.proto b/fabric-client/lib/protos/peer/query.proto index 99d4da16bf..8dc3ec4d90 100644 --- a/fabric-client/lib/protos/peer/query.proto +++ b/fabric-client/lib/protos/peer/query.proto @@ -16,12 +16,13 @@ limitations under the License. syntax = "proto3"; +option java_package = "org.hyperledger.fabric.protos.peer"; option go_package = "github.com/hyperledger/fabric/protos/peer"; package protos; // ChaincodeQueryResponse returns information about each chaincode that pertains -// to a query in lccc.go, such as GetChaincodes (returns all chaincodes +// to a query in lscc.go, such as GetChaincodes (returns all chaincodes // instantiated on a channel), and GetInstalledChaincodes (returns all chaincodes // installed on a peer) message ChaincodeQueryResponse { @@ -47,7 +48,7 @@ message ChaincodeInfo { } // ChannelQueryResponse returns information about each channel that pertains -// to a query in lccc.go, such as GetChannels (returns all channels for a +// to a query in lscc.go, such as GetChannels (returns all channels for a // given peer) message ChannelQueryResponse { repeated ChannelInfo channels = 1; diff --git a/fabric-client/lib/protos/peer/signed_cc_dep_spec.proto b/fabric-client/lib/protos/peer/signed_cc_dep_spec.proto new file mode 100644 index 0000000000..d4a238655d --- /dev/null +++ b/fabric-client/lib/protos/peer/signed_cc_dep_spec.proto @@ -0,0 +1,42 @@ +/* +Copyright IBM Corp. 2017 All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ +syntax = "proto3"; + +option java_package = "org.hyperledger.fabric.protos.peer"; +option go_package = "github.com/hyperledger/fabric/protos/peer"; + +package protos; + +import "proposal_response.proto"; + +// SignedChaincodeDeploymentSpec carries the CDS along with endorsements +message SignedChaincodeDeploymentSpec { + + // This is the bytes of the ChaincodeDeploymentSpec + bytes chaincode_deployment_spec = 1; + + // This is the instantiation policy which is identical in structure + // to endorsement policy. This policy is checked by the VSCC at commit + // time on the instantiation (all peers will get the same policy as it + // will be part of the LSCC instantation record and will be part of the + // hash as well) + bytes instantiation_policy = 2; + + // The endorsements of the above deployment spec, the owner's signature over + // chaincode_deployment_spec and Endorsement.endorser. + repeated Endorsement owner_endorsements = 3; +} + diff --git a/fabric-client/lib/protos/peer/transaction.proto b/fabric-client/lib/protos/peer/transaction.proto index 3ebf1fa900..4889392638 100644 --- a/fabric-client/lib/protos/peer/transaction.proto +++ b/fabric-client/lib/protos/peer/transaction.proto @@ -17,6 +17,8 @@ limitations under the License. syntax = "proto3"; option go_package = "github.com/hyperledger/fabric/protos/peer"; +option java_package = "org.hyperledger.fabric.protos.peer"; +option java_outer_classname = "TransactionPackage"; package protos; @@ -138,5 +140,12 @@ enum TxValidationCode { TARGET_CHAIN_NOT_FOUND = 14; MARSHAL_TX_ERROR = 15; NIL_TXACTION = 16; + EXPIRED_CHAINCODE = 17; + CHAINCODE_VERSION_CONFLICT = 18; + BAD_HEADER_EXTENSION = 19; + BAD_CHANNEL_HEADER = 20; + BAD_RESPONSE_PAYLOAD = 21; + BAD_RWSET = 22; + ILLEGAL_WRITESET = 23; INVALID_OTHER_REASON = 255; } diff --git a/test/integration/get-config.js b/test/integration/get-config.js index 08779542ac..bdc60d3182 100644 --- a/test/integration/get-config.js +++ b/test/integration/get-config.js @@ -46,7 +46,7 @@ var _ccTransProto = grpc.load(__dirname + '/../../fabric-client/lib/protos/peer/ var _transProto = grpc.load(__dirname + '/../../fabric-client/lib/protos/peer/transaction.proto').protos; var _responseProto = grpc.load(__dirname + '/../../fabric-client/lib/protos/peer/proposal_response.proto').protos; var _ccProposalProto = grpc.load(__dirname + '/../../fabric-client/lib/protos/peer/proposal.proto').protos; -var _ccEventProto = grpc.load(__dirname + '/../../fabric-client/lib/protos/peer/chaincodeevent.proto').protos; +var _ccEventProto = grpc.load(__dirname + '/../../fabric-client/lib/protos/peer/chaincode_event.proto').protos; var client = new hfc(); // IMPORTANT ------>>>>> MUST RUN e2e/create-channel.js FIRST diff --git a/test/unit/chain.js b/test/unit/chain.js index 8e8cebda3e..23093e7783 100644 --- a/test/unit/chain.js +++ b/test/unit/chain.js @@ -25,7 +25,7 @@ var gunzip = require('gunzip-maybe'); var fs = require('fs-extra'); var grpc = require('grpc'); var _policiesProto = grpc.load(__dirname + '/../../fabric-client/lib/protos/common/policies.proto').common; -var _mspPrProto = grpc.load(__dirname + '/../../fabric-client/lib/protos/common/msp_principal.proto').common; +var _mspPrProto = grpc.load(__dirname + '/../../fabric-client/lib/protos/msp/msp_principal.proto').common; var hfc = require('fabric-client'); var testutil = require('./util.js'); diff --git a/test/unit/msp.js b/test/unit/msp.js index 3660cd9031..8ceaa905f0 100644 --- a/test/unit/msp.js +++ b/test/unit/msp.js @@ -30,7 +30,7 @@ var MSPM = require('fabric-client/lib/msp/msp-manager.js'); var idModule = require('fabric-client/lib/msp/identity.js'); var Identity = idModule.Identity; -var mspProto = grpc.load(path.join(__dirname, '../../fabric-client/lib/protos/msp/mspconfig.proto')).msp; +var mspProto = grpc.load(path.join(__dirname, '../../fabric-client/lib/protos/msp/msp_config.proto')).msp; const FABRIC = 0; const TEST_CERT_PEM = '-----BEGIN CERTIFICATE-----' +