Skip to content

Commit

Permalink
Support Fabric 1.2 (hyperledger-archives#4296)
Browse files Browse the repository at this point in the history
- Version bump to 0.20.0
- Use fabric-shim 1.2.0
- Use fabric-client 1.2.1
- Use fabric-ca 1.2.1
- Fixes to hlfconnection for Node SDK changes
- Use Fabric 1.2 docker images in functional and integration tests
- Add v0.19 build label for docs
- Pull Fabric Docker versions into a single script
- Change docs to refer to Fabric 1.2 instead of 1.1

Signed-off-by: Mark S. Lewis <[email protected]>
  • Loading branch information
bestbeforetoday authored Aug 3, 2018
1 parent ce8de75 commit 166ae5c
Show file tree
Hide file tree
Showing 51 changed files with 408 additions and 353 deletions.
26 changes: 13 additions & 13 deletions .travis/base.sh
Original file line number Diff line number Diff line change
Expand Up @@ -37,25 +37,25 @@ if [ ! -f ${DIR}/build.cfg ]; then
echo "ABORT_BUILD=false" > ${DIR}/build.cfg
echo "ABORT_CODE=0" >> ${DIR}/build.cfg
## regexp to match the various versions required
V16_REGEXP=v0\.16\.\([0-9]{1,2}\|x\)
V16_REGEXP='v0\.16\.([0-9]+|x)'
V19_REGEXP='v0\.19\.([0-9]+|x)'

## determine the build type here
if [[ "${TRAVIS_BRANCH}" =~ ${V16_REGEXP} ]]; then
BUILD_FOCUS='v0.16'
elif [[ "${TRAVIS_BRANCH}" =~ ${V19_REGEXP} ]]; then
BUILD_FOCUS='v0.19'
else
BUILD_FOCUS='latest'
fi

if [ -z "${TRAVIS_TAG}" ]; then
BUILD_RELEASE="unstable"
if [[ "${TRAVIS_BRANCH}" =~ ${V16_REGEXP} ]]; then
BUILD_FOCUS="v0.16"
else
BUILD_FOCUS="latest"
fi
BUILD_RELEASE='unstable'
else
BUILD_RELEASE="stable"
if [[ "${TRAVIS_BRANCH}" =~ ${V16_REGEXP} ]]; then
BUILD_FOCUS="v0.16"
else
BUILD_FOCUS="latest"
fi
BUILD_RELEASE='stable'
fi


echo "BUILD_FOCUS=${BUILD_FOCUS}" >> ${DIR}/build.cfg
echo "BUILD_RELEASE=${BUILD_RELEASE}" >> ${DIR}/build.cfg
fi
Expand Down
2 changes: 1 addition & 1 deletion .travis/deploy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ for i in ${PUBLISH_DOCKER_IMAGES[@]}; do
done

# Push to public Bluemix for stable and unstable, latest and next release builds
if [[ "${BUILD_FOCUS}" != "v0.16" ]]; then
if [[ "${BUILD_FOCUS}" == 'latest' ]]; then
pushd ${DIR}/packages/composer-playground
rm -rf ${DIR}/packages/composer-playground/node_modules
cf login -a https://api.ng.bluemix.net -u ${CF_USERNAME} -p ${CF_PASSWORD} -o ${CF_ORGANIZATION} -s ${CF_SPACE}
Expand Down
6 changes: 6 additions & 0 deletions .travis/script.sh
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,9 @@ if [ "${DOCS}" != "" ]; then
elif [[ "${BUILD_FOCUS}" == "v0.16" ]]; then
npm run full:v0.16-unstable
npm run linkcheck:v0.16-unstable
elif [[ "${BUILD_FOCUS}" == 'v0.19' ]]; then
npm run full:v0.19-unstable
npm run linkcheck:v0.19-unstable
else
_exit "Unknown build focus" 1
fi
Expand All @@ -65,6 +68,9 @@ if [ "${DOCS}" != "" ]; then
elif [[ "${BUILD_FOCUS}" == "v0.16" ]]; then
npm run full:v0.16
npm run linkcheck:v0.16
elif [[ "${BUILD_FOCUS}" == 'v0.19' ]]; then
npm run full:v0.19
npm run linkcheck:v0.19
else
_exit "Unknown build focus" 1
fi
Expand Down
2 changes: 1 addition & 1 deletion lerna.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@
"packages": [
"packages/*"
],
"version": "0.19.14",
"version": "0.20.0",
"hoist": true
}
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
},
"name": "composer",
"description": "You must install [Lerna](https://lernajs.io) to build this multi-package repository.",
"version": "0.19.14",
"version": "0.20.0",
"main": "index.js",
"private": true,
"scripts": {
Expand Down
12 changes: 6 additions & 6 deletions packages/composer-admin/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "composer-admin",
"version": "0.19.14",
"version": "0.20.0",
"description": "Hyperledger Composer Admin, code that manages business networks deployed to Hyperledger Fabric",
"engines": {
"node": ">=8",
Expand Down Expand Up @@ -43,11 +43,11 @@
"sinon": "2.3.8"
},
"dependencies": {
"composer-common": "0.19.14",
"composer-connector-hlfv1": "0.19.14",
"composer-connector-proxy": "0.19.14",
"composer-wallet-filesystem": "0.19.14",
"composer-wallet-inmemory": "0.19.14"
"composer-common": "0.20.0",
"composer-connector-hlfv1": "0.20.0",
"composer-connector-proxy": "0.20.0",
"composer-wallet-filesystem": "0.20.0",
"composer-wallet-inmemory": "0.20.0"
},
"license-check-and-add-config": {
"folder": ".",
Expand Down
16 changes: 8 additions & 8 deletions packages/composer-cli/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "composer-cli",
"version": "0.19.14",
"version": "0.20.0",
"description": "Hyperledger Composer command line interfaces (CLIs)",
"engines": {
"node": ">=8",
Expand Down Expand Up @@ -44,13 +44,13 @@
"ajv": "6.1.1",
"chalk": "1.1.3",
"cli-table": "0.3.1",
"composer-admin": "0.19.14",
"composer-client": "0.19.14",
"composer-common": "0.19.14",
"composer-documentation": "0.19.14",
"composer-report": "0.19.14",
"composer-wallet-filesystem": "0.19.14",
"composer-wallet-inmemory": "0.19.14",
"composer-admin": "0.20.0",
"composer-client": "0.20.0",
"composer-common": "0.20.0",
"composer-documentation": "0.20.0",
"composer-report": "0.20.0",
"composer-wallet-filesystem": "0.20.0",
"composer-wallet-inmemory": "0.20.0",
"js-yaml": "3.10.0",
"mkdirp": "0.5.1",
"moment": "2.19.3",
Expand Down
12 changes: 6 additions & 6 deletions packages/composer-client/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "composer-client",
"version": "0.19.14",
"version": "0.20.0",
"description": "The node.js client library for Hyperledger Composer, a development framework for Hyperledger Fabric",
"engines": {
"node": ">=8",
Expand Down Expand Up @@ -71,11 +71,11 @@
}
},
"dependencies": {
"composer-common": "0.19.14",
"composer-connector-hlfv1": "0.19.14",
"composer-connector-proxy": "0.19.14",
"composer-wallet-filesystem": "0.19.14",
"composer-wallet-inmemory": "0.19.14",
"composer-common": "0.20.0",
"composer-connector-hlfv1": "0.20.0",
"composer-connector-proxy": "0.20.0",
"composer-wallet-filesystem": "0.20.0",
"composer-wallet-inmemory": "0.20.0",
"uuid": "3.0.1"
},
"devDependencies": {
Expand Down
2 changes: 1 addition & 1 deletion packages/composer-common/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "composer-common",
"version": "0.19.14",
"version": "0.20.0",
"description": "Hyperledger Composer Common, code that is common across client, admin and runtime.",
"engines": {
"node": ">=8",
Expand Down
8 changes: 4 additions & 4 deletions packages/composer-connector-embedded/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "composer-connector-embedded",
"version": "0.19.14",
"version": "0.20.0",
"description": "The embedded client connector for Hyperledger Composer",
"engines": {
"node": ">=8",
Expand Down Expand Up @@ -74,9 +74,9 @@
"watchify": "3.7.0"
},
"dependencies": {
"composer-common": "0.19.14",
"composer-runtime": "0.19.14",
"composer-runtime-embedded": "0.19.14"
"composer-common": "0.20.0",
"composer-runtime": "0.20.0",
"composer-runtime-embedded": "0.20.0"
},
"nyc": {
"exclude": [
Expand Down
36 changes: 19 additions & 17 deletions packages/composer-connector-hlfv1/lib/hlfconnection.js
Original file line number Diff line number Diff line change
Expand Up @@ -481,12 +481,9 @@ class HLFConnection extends Connection {
chaincodeVersion: businessNetworkDefinition.getVersion(),
chaincodeId: businessNetworkDefinition.getName(),
txId: txId,
targets: this.getChannelPeersInOrg([FABRIC_CONSTANTS.NetworkConfig.ENDORSING_PEER_ROLE, FABRIC_CONSTANTS.NetworkConfig.CHAINCODE_QUERY_ROLE])
channelNames: this.channel.getName()
};
LOG.debug(method, 'Install chaincode request', request);
// the following should have been used for request but the node sdk is broken
// channelNames: this.channel.getName() // this will drive getting all the Peers to install on


try {
const results = await this.client.installChaincode(request);
Expand Down Expand Up @@ -712,11 +709,7 @@ class HLFConnection extends Connection {
try {
await eventHandler.waitForEvents();
} catch (error) {
// Investigate proposal response results and log if they differ and rethrow
if (!this.channel.compareProposalResponseResults(validResponses)) {
const warning = 'Peers do not agree, Read Write sets differ';
LOG.warn(method, warning);
}
LOG.error(method, error);
throw error;
}

Expand Down Expand Up @@ -935,6 +928,7 @@ class HLFConnection extends Connection {
let txId = this._validateTxId(options);

let eventHandler;
let validResponses;

try {

Expand All @@ -957,7 +951,7 @@ class HLFConnection extends Connection {
// Validate the endorsement results.
LOG.debug(method, `Received ${results.length} result(s) from invoking the composer runtime chaincode`, results);
const proposalResponses = results[0];
let {validResponses} = this._validatePeerResponses(proposalResponses, true);
validResponses = this._validatePeerResponses(proposalResponses, true).validResponses;

// Extract the response data, if any.
const firstValidResponse = validResponses[0];
Expand Down Expand Up @@ -996,8 +990,16 @@ class HLFConnection extends Connection {
return result;

} catch (error) {
// Log first in case anything below fails and masks the original error
LOG.error(method, error);

// Investigate proposal response results and log if they differ and rethrow
if (validResponses && validResponses.length >= 2 && !this.channel.compareProposalResponseResults(validResponses)) {
const warning = 'Peers do not agree, Read Write sets differ';
LOG.warn(method, warning);
}

const newError = new Error('Error trying invoke business network. ' + error);
LOG.error(method, newError);
throw newError;
}
}
Expand Down Expand Up @@ -1193,14 +1195,14 @@ class HLFConnection extends Connection {
/**
* return the Channel peers that are in the organisation which matches the requested roles
* @param {Array} peerRoles the peer roles that the returned list of peers need to satisfy
* @returns {Array} the list of any peers that satisfy all the criteria.
* @returns {Array} the list of any ChannelPeer objects that satisfy all the criteria.
*/
getChannelPeersInOrg(peerRoles) {
let peers = this.client.getPeersForOrgOnChannel(this.channel.getName());
return peers.filter((cPeer) => {
return peerRoles.every((peerRole) => {
return cPeer.isInRole(peerRole);
});
const organizationId = this.client.getMspid();
const channelPeers = this.channel.getChannelPeers();
return channelPeers.filter((channelPeer) => {
return channelPeer.isInOrg(organizationId) &&
peerRoles.every((role) => channelPeer.isInRole(role));
});
}

Expand Down
8 changes: 4 additions & 4 deletions packages/composer-connector-hlfv1/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "composer-connector-hlfv1",
"version": "0.19.14",
"version": "0.20.0",
"description": "The Hyperledger Fabric v1.x Client connector for Hyperledger Composer",
"engines": {
"node": ">=8",
Expand Down Expand Up @@ -64,8 +64,8 @@
}
},
"dependencies": {
"fabric-ca-client": "1.1.2",
"fabric-client": "1.1.2",
"fabric-ca-client": "1.2.1",
"fabric-client": "1.2.1",
"fs-extra": "1.0.0",
"jsrsasign": "8.0.3",
"lodash": "4.17.4",
Expand All @@ -77,7 +77,7 @@
"devDependencies": {
"chai": "3.5.0",
"chai-as-promised": "6.0.0",
"composer-common": "0.19.14",
"composer-common": "0.20.0",
"eslint": "3.17.1",
"jsdoc": "3.5.5",
"license-check-and-add": "2.3.1",
Expand Down
Loading

0 comments on commit 166ae5c

Please sign in to comment.