Skip to content
This repository was archived by the owner on Apr 22, 2025. It is now read-only.

Commit 1e3c1b2

Browse files
committed
nodeSDK Rename Deployment to Instantiate
The function sendDeploymentProposal needs to be renamed to sendInstantiateProposal to conform with the fabric naming convention. Other miscellaneous changes are included from deploy to instantiate. Change-Id: I346732b2c16984917570786cc14f05a25c26cd45 Signed-off-by: cdaughtr <cdaughtr@us.ibm.com>
1 parent 0344555 commit 1e3c1b2

File tree

16 files changed

+78
-71
lines changed

16 files changed

+78
-71
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ To build and test, the following pre-requisites must be installed first:
1919
Clone the project and launch the following commands to install the dependencies and perform various tasks.
2020

2121
This project publishes two separate npm packages:
22-
* `fabric-client` - main client for the Hyperledger Fabric. Applications can use this package to deploy chaincodes, submit transactions and make queries against a Hyperledger Fabric-based blockchain network.
22+
* `fabric-client` - main client for the Hyperledger Fabric. Applications can use this package to install and instantiate chaincodes, submit transactions and make queries against a Hyperledger Fabric-based blockchain network.
2323
* `fabric-ca-client` - client for the optional component in Hyperledger Fabric, [fabric-ca](https://github.com/hyperledger/fabric-ca). The fabric-ca component allows applications to enroll Peers and application users to establish trusted identities on the blockchain network. It also provides support for pseudonymous transaction submissions with Transaction Certificates. If the target blockchain network is configured with standard Certificate Authorities for trust anchors, then the application does not need to use this package.
2424

2525
In the project root folder:

build/tasks/test.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ gulp.task('test', ['lint', 'test-headless'], function() {
2424
// 'test/integration/ca-tests.js',
2525
'test/integration/chain-fabriccop-tests.js',
2626
'test/integration/endorser-tests.js',
27-
'test/integration/orderer-tests.js',
2827
'test/integration/orderer-chain-tests.js'
2928
])
3029
.pipe(tape({

examples/balance-transfer/deploy.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ hfc.newDefaultKeyValueStore({
7676
txId: tx_id,
7777
nonce: nonce,
7878
};
79-
return chain.sendDeploymentProposal(request);
79+
return chain.sendInstantiateProposal(request);
8080
}
8181
).then(
8282
function(results) {

fabric-client/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
## Hyperledger Fabric Client for Node.js
22

3-
This package encapsulates the APIs to interact with Peers and Orderers of the Fabric network to deploy chaincodes, send transaction invocations and perform chaincode queries. There is a separate package that interacts with the Fabric member service to manage user certificates lifecycle such as register, enroll, renew and revoke, and that is called `fabric-ca-client`.
3+
This package encapsulates the APIs to interact with Peers and Orderers of the Fabric network to install and instantiate chaincodes, send transaction invocations and perform chaincode queries. There is a separate package that interacts with the Fabric member service to manage user certificates lifecycle such as register, enroll, renew and revoke, and that is called `fabric-ca-client`.
44

55
For application developer documentations, please visit [http://fabric-sdk-node.readthedocs.io/en/master/](http://fabric-sdk-node.readthedocs.io/en/master/)

fabric-client/lib/Chain.js

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1145,7 +1145,7 @@ var Chain = class {
11451145
logger.error('Chain.sendInstallProposal error ' + errorMsg);
11461146
return Promise.reject(new Error(errorMsg));
11471147
}
1148-
errorMsg = Chain._checkInstallDeployRequest(request);
1148+
errorMsg = Chain._checkInstallInstantiateRequest(request);
11491149
if (errorMsg) {
11501150
logger.error('Chain.sendInstallProposal error ' + errorMsg);
11511151
return Promise.reject(new Error(errorMsg));
@@ -1228,7 +1228,7 @@ var Chain = class {
12281228
}
12291229

12301230
/**
1231-
* Sends a deployment / initialize proposal to one or more endorsing peers.
1231+
* Sends an instantiate proposal to one or more endorsing peers.
12321232
*
12331233
* @param {Object} request - An object containing the following fields:
12341234
* <br>`chaincodePath` : required - String of the path to location of
@@ -1239,13 +1239,13 @@ var Chain = class {
12391239
* <br>`txId` : required - String of the transaction id
12401240
* <br>`nonce` : required - Integer of the once time number
12411241
* <br>`fcn` : optional - String of the function to be called on
1242-
* the chaincode once deployed (default 'init')
1242+
* the chaincode once instantiated (default 'init')
12431243
* <br>`args` : optional - String Array arguments specific to
1244-
* the chaincode being deployed
1244+
* the chaincode being instantiated
12451245
* @returns {Promise} A Promise for a `ProposalResponse`
12461246
* @see /protos/peer/fabric_proposal_response.proto
12471247
*/
1248-
sendDeploymentProposal(request) {
1248+
sendInstantiateProposal(request) {
12491249
var errorMsg = null;
12501250

12511251
var peers = null;
@@ -1255,7 +1255,7 @@ var Chain = class {
12551255
for (let p = 0; p < peers.length; p++) {
12561256
if (!this.isValidPeer(peers[p])) {
12571257
errorMsg = 'Request targets peer object '+ peers[p] +' not in chain';
1258-
logger.error('Chain.sendDeploymentProposal error '+ errorMsg);
1258+
logger.error('Chain.sendInstantiateProposal error '+ errorMsg);
12591259
return Promise.reject(new Error(errorMsg));
12601260
}
12611261
}
@@ -1266,19 +1266,19 @@ var Chain = class {
12661266
}
12671267
// Verify that a Peer has been added
12681268
if (peers.length < 1) {
1269-
errorMsg = 'Missing peer objects in Deployment proposal chain';
1270-
logger.error('Chain.sendDeploymentProposal error '+ errorMsg);
1269+
errorMsg = 'Missing peer objects in Instantiate proposal chain';
1270+
logger.error('Chain.sendInstantiateProposal error '+ errorMsg);
12711271
return Promise.reject(new Error(errorMsg));
12721272
}
12731273

12741274
errorMsg = Chain._checkProposalRequest(request);
12751275
if (errorMsg) {
1276-
logger.error('Chain.sendDeploymentProposal error ' + errorMsg);
1276+
logger.error('Chain.sendInstantiateProposal error ' + errorMsg);
12771277
return Promise.reject(new Error(errorMsg));
12781278
}
1279-
errorMsg = Chain._checkInstallDeployRequest(request);
1279+
errorMsg = Chain._checkInstallInstantiateRequest(request);
12801280
if (errorMsg) {
1281-
logger.error('Chain.sendDeploymentProposal error ' + errorMsg);
1281+
logger.error('Chain.sendInstantiateProposal error ' + errorMsg);
12821282
return Promise.reject(new Error(errorMsg));
12831283
}
12841284

@@ -1708,7 +1708,7 @@ var Chain = class {
17081708
/*
17091709
* @private
17101710
*/
1711-
static _checkInstallDeployRequest(request) {
1711+
static _checkInstallInstantiateRequest(request) {
17121712
var errorMsg = null;
17131713

17141714
if (request) {
@@ -1815,7 +1815,7 @@ function packageChaincode(devmode, request) {
18151815

18161816
if (!request.chaincodePath || request.chaincodePath === '') {
18171817
// Verify that chaincodePath is being passed
1818-
return reject(new Error('Missing chaincodePath parameter in Deployment proposal request'));
1818+
return reject(new Error('Missing chaincodePath parameter in Install proposal request'));
18191819
}
18201820

18211821
var chaincodePath = request.chaincodePath;
@@ -1841,7 +1841,7 @@ function packageChaincode(devmode, request) {
18411841
let targzFilePath = path.join(folder, 'deployment-package.tar.gz');
18421842
return utils.generateTarGz(folder, targzFilePath)
18431843
.then(function() {
1844-
logger.debug('Chain.sendDeployment- Successfully generated chaincode deploy archive %s and name (%s)', targzFilePath, chaincodeId);
1844+
logger.debug('Chain.sendInstantiateProposal - Successfully generated chaincode instantiate archive %s and name (%s)', targzFilePath, chaincodeId);
18451845
return readFile(targzFilePath)
18461846
.then((data) => {
18471847
return resolve(data);

fabric-client/lib/EventHub.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -259,7 +259,7 @@ var EventHub = class {
259259
/**
260260
* Register a callback function to receive transactional events.<p>
261261
* Note: transactional event registration is primarily used by
262-
* the sdk to track deploy and invoke completion events. Nodejs
262+
* the sdk to track instantiate and invoke completion events. Nodejs
263263
* clients generally should not need to call directly.
264264
* @param {string} txid string transaction id
265265
* @param {function} callback Function that takes a single parameter which

fabric-client/lib/Peer.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ var Peer = class extends Remote {
7676
/**
7777
* A network call that discovers if at least one listener has been connected to the target
7878
* Peer for a given event. This helps application instance to decide whether it needs to
79-
* connect to the event source in a crash recovery or multiple instance deployment.
79+
* connect to the event source in a crash recovery or multiple instance instantiation.
8080
* @param {string} eventName required
8181
* @param {Chain} chain optional
8282
* @result {boolean} Whether the said event has been listened on by some application instance on that chain.

fabric-client/lib/User.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,11 +30,12 @@ var LocalMSP = require('./msp/msp.js');
3030
* The User class represents users that have been enrolled and represented by
3131
* an enrollment certificate (ECert) and a signing key. The ECert must have
3232
* been signed by one of the CAs the blockchain network has been configured to trust.
33-
* An enrolled user (having a signing key and ECert) can conduct chaincode deployments,
33+
* An enrolled user (having a signing key and ECert) can conduct chaincode instantiate,
3434
* transactions and queries with the Chain.
3535
*
36-
* User ECerts can be obtained from a CA beforehand as part of deploying the application,
37-
* or it can be obtained from the optional Fabric CA service via its enrollment process.
36+
* User ECerts can be obtained from a CA beforehand as part of installing and instantiating
37+
* the application, or it can be obtained from the optional Fabric CA service via its
38+
* enrollment process.
3839
*
3940
* Sometimes User identities are confused with Peer identities. User identities represent
4041
* signing capability because it has access to the private key, while Peer identities in

fabric-client/lib/utils.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -272,7 +272,7 @@ module.exports.getConfig = function() {
272272
module.exports.generateTarGz = function(src, dest) {
273273
// A list of file extensions that should be packaged into the .tar.gz.
274274
// Files with all other file extenstions will be excluded to minimize the size
275-
// of the deployment transaction payload.
275+
// of the install payload.
276276
var keep = [
277277
'.go',
278278
'.yaml',

test/integration/end-to-end.js

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ chain.addOrderer(new Orderer('grpc://localhost:7050'));
6969
chain.addPeer(peer0);
7070
chain.addPeer(peer1);
7171

72-
test('End-to-end flow of chaincode install, deploy, transaction invocation, and query', (t) => {
72+
test('End-to-end flow of chaincode install, instantiate, transaction invocation, and query', (t) => {
7373

7474
hfc.newDefaultKeyValueStore({
7575
path: testUtil.KVS
@@ -172,7 +172,7 @@ test('End-to-end flow of chaincode install, deploy, transaction invocation, and
172172
nonce: nonce
173173
};
174174

175-
return chain.sendDeploymentProposal(request);
175+
return chain.sendInstantiateProposal(request);
176176

177177
},
178178
(err) => {
@@ -188,9 +188,9 @@ test('End-to-end flow of chaincode install, deploy, transaction invocation, and
188188
let one_good = false;
189189
if (proposalResponses && proposalResponses[0].response && proposalResponses[0].response.status === 200) {
190190
one_good = true;
191-
logger.info('deploy proposal was good');
191+
logger.info('instantiate proposal was good');
192192
} else {
193-
logger.error('deploy proposal was bad');
193+
logger.error('instantiate proposal was bad');
194194
}
195195
all_good = all_good & one_good;
196196
}
@@ -210,7 +210,7 @@ test('End-to-end flow of chaincode install, deploy, transaction invocation, and
210210
var handle = setTimeout(reject, 30000);
211211

212212
eh.registerTxEvent(deployId, (tx) => {
213-
t.pass('The chaincode deploy transaction has been successfully committed');
213+
t.pass('The chaincode instantiate transaction has been successfully committed');
214214
clearTimeout(handle);
215215
eh.unregisterTxEvent(deployId);
216216

@@ -227,27 +227,27 @@ test('End-to-end flow of chaincode install, deploy, transaction invocation, and
227227
return Promise.all([sendPromise, txPromise]).then((results) => {
228228
return results[0]; // the first returned value is from the 'sendPromise' which is from the 'sendTransaction()' call
229229
}).catch((err) => {
230-
t.fail('Failed to send deploy transaction and get notifications within the timeout period. ');
230+
t.fail('Failed to send instantiate transaction and get notifications within the timeout period. ');
231231
t.end();
232232
});
233233
} else {
234-
t.fail('Failed to send Proposal or receive valid response. Response null or status is not 200. exiting...');
234+
t.fail('Failed to send instantiate Proposal or receive valid response. Response null or status is not 200. exiting...');
235235
t.end();
236236
}
237237
},
238238
(err) => {
239-
t.fail('Failed to send deployment proposal due to error: ' + err.stack ? err.stack : err);
239+
t.fail('Failed to send instantiate proposal due to error: ' + err.stack ? err.stack : err);
240240
t.end();
241241
}).then((response) => {
242242
if (response.status === 'SUCCESS') {
243-
t.pass('Successfully sent deployment transaction to the orderer.');
243+
t.pass('Successfully sent instantiate transaction to the orderer.');
244244
} else {
245-
t.fail('Failed to order the deployment endorsement. Error code: ' + response.status);
245+
t.fail('Failed to order the instantiate endorsement. Error code: ' + response.status);
246246
t.end();
247247
}
248248
},
249249
(err) => {
250-
t.fail('Failed to send deployment e due to error: ' + err.stack ? err.stack : err);
250+
t.fail('Failed to send instantiate due to error: ' + err.stack ? err.stack : err);
251251
t.end();
252252
});
253253
}
@@ -305,7 +305,7 @@ test('End-to-end flow of chaincode install, deploy, transaction invocation, and
305305
var handle = setTimeout(reject, 30000);
306306

307307
eh.registerTxEvent(txId.toString(), (tx) => {
308-
t.pass('The chaincode deploy transaction has been successfully committed');
308+
t.pass('The chaincode instantiate transaction has been successfully committed');
309309
clearTimeout(handle);
310310
eh.unregisterTxEvent(txId);
311311

0 commit comments

Comments
 (0)