Skip to content

Commit

Permalink
[FAB-3868] NodeSDK - update proto files to latest
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
harrisob committed May 11, 2017
1 parent f2fdae3 commit 38eda84
Show file tree
Hide file tree
Showing 32 changed files with 291 additions and 43 deletions.
6 changes: 3 additions & 3 deletions fabric-client/lib/Block.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,17 +28,17 @@ 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;
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;

Expand Down
6 changes: 3 additions & 3 deletions fabric-client/lib/Chain.js
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand Down
6 changes: 3 additions & 3 deletions fabric-client/lib/ChannelConfig.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,17 +31,17 @@ 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;
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};

Expand Down
2 changes: 1 addition & 1 deletion fabric-client/lib/EventHub.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion fabric-client/lib/Policy.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {
Expand Down
6 changes: 3 additions & 3 deletions fabric-client/lib/msp/identity.js
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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();
}
};
Expand Down
4 changes: 2 additions & 2 deletions fabric-client/lib/msp/msp-manager.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 3 additions & 3 deletions fabric-client/lib/msp/msp.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;


/**
Expand Down Expand Up @@ -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);
Expand Down
6 changes: 4 additions & 2 deletions fabric-client/lib/protos/common/common.proto
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand All @@ -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.
}
Expand Down
1 change: 1 addition & 0 deletions fabric-client/lib/protos/common/configtx.proto
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
1 change: 1 addition & 0 deletions fabric-client/lib/protos/common/ledger.proto
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
5 changes: 3 additions & 2 deletions fabric-client/lib/protos/common/policies.proto
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -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 {
Expand Down
41 changes: 41 additions & 0 deletions fabric-client/lib/protos/ledger/queryresult/kv_query_result.proto
Original file line number Diff line number Diff line change
@@ -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;
}
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand All @@ -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;
}
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -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;

}

Expand Down
3 changes: 2 additions & 1 deletion fabric-client/lib/protos/orderer/ab.proto
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,15 @@ 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;

message BroadcastResponse {
common.Status status = 1;
}

message SeekNewest { }
message SeekNewest { }

message SeekOldest { }

Expand Down
3 changes: 3 additions & 0 deletions fabric-client/lib/protos/peer/admin.proto
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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 {
Expand Down
4 changes: 2 additions & 2 deletions fabric-client/lib/protos/peer/chaincode.proto
Original file line number Diff line number Diff line change
@@ -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.
Expand All @@ -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";

Expand Down
Original file line number Diff line number Diff line change
@@ -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.
Expand All @@ -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";


Expand Down
Loading

0 comments on commit 38eda84

Please sign in to comment.