Skip to content

Commit

Permalink
Merge pull request #731 from nklincoln/orderer-objects
Browse files Browse the repository at this point in the history
Build orderer objects instead of names in cache
  • Loading branch information
aklenik authored Feb 19, 2020
2 parents cd33821 + 5c3b79f commit cdfd535
Show file tree
Hide file tree
Showing 6 changed files with 32 additions and 5 deletions.
2 changes: 1 addition & 1 deletion packages/caliper-ethereum/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
"devDependencies": {
"web3": "1.2.2",
"chai": "^3.5.0",
"eslint": "^4.19.1",
"eslint": "^5.16.0",
"mocha": "3.4.2",
"nyc": "11.1.0",
"rewire": "^4.0.0",
Expand Down
11 changes: 10 additions & 1 deletion packages/caliper-fabric/lib/adaptor-versions/v1/fabric-v1.js
Original file line number Diff line number Diff line change
Expand Up @@ -1793,12 +1793,21 @@ class Fabric extends BlockchainInterface {
///////////////////////////////////////////

let targetOrderer = invokeSettings.orderer || this._getRandomTargetOrderer(invokeSettings.channel);
let orderer;

if (typeof(targetOrderer) === 'string' || targetOrderer instanceof String) {
// Using an orderer name
orderer = channel.getOrderer(targetOrderer);
} else {
// Have been passed an orderer as an object within invokeSettings.orderer
throw new Error('Orderer object passed within invokeSettings: must reference target orderer by name');
}

/** @link{TransactionRequest} */
const transactionRequest = {
proposalResponses: proposalResponses,
proposal: proposal,
orderer: targetOrderer
orderer
};

/** @link{BroadcastResponse} */
Expand Down
11 changes: 10 additions & 1 deletion packages/caliper-fabric/lib/adaptor-versions/v2/fabric-v2.js
Original file line number Diff line number Diff line change
Expand Up @@ -1793,12 +1793,21 @@ class Fabric extends BlockchainInterface {
///////////////////////////////////////////

let targetOrderer = invokeSettings.orderer || this._getRandomTargetOrderer(invokeSettings.channel);
let orderer;

if (!(typeof(targetOrderer) === 'string' || targetOrderer instanceof String)) {
// Using an orderer name
orderer = channel.getOrderer(targetOrderer);
} else {
// Have been passed an orderer as an object within invokeSettings.orderer, which is not permitted
throw new Error('Orderer object passed within invokeSettings: must reference target orderer by name');
}

/** @link{TransactionRequest} */
const transactionRequest = {
proposalResponses: proposalResponses,
proposal: proposal,
orderer: targetOrderer
orderer
};

/** @link{BroadcastResponse} */
Expand Down
9 changes: 9 additions & 0 deletions packages/caliper-fabric/lib/fabricNetwork.js
Original file line number Diff line number Diff line change
Expand Up @@ -571,6 +571,15 @@ class FabricNetwork {
return new Set(this.network.channels[channel].orderers);
}

/**
* Get the orderer object from the network definition
* @param {string} ordererName the orderer name to return
* @returns {object} orderer object
*/
getOrdererObject(ordererName) {
return this.network.orderers[ordererName];
}

/**
* Gets the organization that the given CA belongs to.
* @param {string} ca The name of the CA.
Expand Down
2 changes: 1 addition & 1 deletion packages/caliper-gui-server/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
"mongodb": "^3.3.0",
"multer": "^1.4.2",
"shelljs": "^0.8.3",
"yargs": "10.0.3"
"yargs": "14.2.0"
},
"devDependencies": {
"babel-eslint": "10.0.1",
Expand Down
2 changes: 1 addition & 1 deletion packages/caliper-publish/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
"npm": ">=5.6.0"
},
"dependencies": {
"yargs": "^14.2.0"
"yargs": "14.2.0"
},
"devDependencies": {
"chai": "^3.5.0",
Expand Down

0 comments on commit cdfd535

Please sign in to comment.