From b6c5b56e9a2b52bb1b8b067a199b815b51159e35 Mon Sep 17 00:00:00 2001 From: Matthew B White Date: Fri, 17 Jan 2020 14:15:31 +0000 Subject: [PATCH] [FABCN-373] Compatibility Matrix Ammended all the node-engines in package.json to match that in the docker image Signed-off-by: Matthew B White Change-Id: Ia536ed66daf857679adf9f858b35d206a4f1007f --- COMPATIBILITY.md | 51 ++++++++++++++++++++ README.md | 4 ++ apis/fabric-contract-api/package.json | 2 +- apis/fabric-shim-api/package.json | 2 +- libraries/fabric-shim-crypto/package.json | 2 +- libraries/fabric-shim/package.json | 2 +- libraries/fabric-shim/test/unit/chaincode.js | 2 +- package.json | 18 ++----- test/chaincodes/annotations/package.json | 2 +- test/chaincodes/clientidentity/package.json | 2 +- test/chaincodes/crosschaincode/package.json | 2 +- test/chaincodes/crosschaincode2/package.json | 2 +- test/chaincodes/crud/package.json | 2 +- test/chaincodes/encryption/package.json | 2 +- test/chaincodes/events/package.json | 2 +- test/chaincodes/query/package.json | 2 +- test/chaincodes/scenario/package.json | 2 +- test/fv/package.json | 2 +- 18 files changed, 73 insertions(+), 30 deletions(-) create mode 100644 COMPATIBILITY.md diff --git a/COMPATIBILITY.md b/COMPATIBILITY.md new file mode 100644 index 00000000..10f8f477 --- /dev/null +++ b/COMPATIBILITY.md @@ -0,0 +1,51 @@ +# Support and Compatibility for fabric-chaincode-java + +Github is used for code base management, issues should reported in the [FABCN](https://jira.hyperledger.org/projects/FABCN/issues/) component in JIRA. + + +## Summary of Compatibility + +This table shows the summary of the compatibility of the Node modules at versions 1.4 and 2.0, together with the Nodejs runtime they require and the Fabric Peer versions they can communicate with. + +| | Peer Connectivity v1.4 | NodeJS 8 | Peer Connectivity v2.0 | NodeJS12 | +| --------------------- | ---------------------- | -------- | ---------------------- | -------- | +| Node modules **v1.4** | Yes | Yes | Yes | Yes | +| Node modules **v2.0** | Yes | No | Yes | Yes | + +By default a Fabric Peer v1.4 will create a Nodejs v8 , and a Fabric Peer v2.0 will create a Nodejs v12 runtime. Whilst is the default, the docker image used to host the chaincode and contracts can be altered. Set the environment variable `CORE_CHAINCODE_NODE_RUNTIME` on the peer to the name of the docker image. For example `CORE_CHAINCODE_NODE_RUNTIME=example/customNodeRuntime:latest` + +The Node modules will connect to the peer whilst running; this is referred to as 'Fabric Peer Connectivity' in the table. For example, whilst the Fabric Peer v1.4 will create a Nodejs 8 fruntime, if a Nodejs 12 runtime was configured, the Node modules at v2.0.0 still function when connecting to the Fabric Peer v1.4. + +## Compatibility + +The key elements are :  + +- the version of the Fabric Contract Node modules used +- the version of the Nodejs runtime used to run the code +- When starting a chaincode container to run a Smart Contract the version of the runtime that is used is determined by these factors: + +Fabric v1.4.2, and Fabric v2.0.0 will, by default, start up docker image to host the chaincode and contracts. The version of the docker image used is defined by the version of Fabric in use. + +With Fabric v2.0.0, the chaincode container can be configured to be started by other means, and not the Peer. In this case, the environment used is not in the control of Fabric. + +Node modules that are produced are `fabric-contract-api`, `fabric-shim`, `fabric-shim-crypto` & `fabric-shim-api` + +### Supported Runtimes + +v1.4.x and v2.0.0 Node modules are supported running in Nodejs 12.13 with the x86_64 architecture. Later Nodejs 12 versions are supported but are not tested. + +v1.4.x Node modules are supported running Nodejs 8.16.1 with the  x86_64 architecture. Later Nodejs 8 versions are supported but are not tested. + +Architecture Support: all docker images, runtimes, tools are tested under x86_64 ONLY + +### Default Peer Runtime selection + +When using Fabric 2.0.0, the default docker image that is used to run the Node chaincode is node:12.13.0-alpine  + +*Note:* With the default docker image used by Fabric 2.0.0 the packaged code will be installed with npm. If a `package-lock.json` or a `npm-shrinkwrap.json` file is present, `npm ci --only=production` will be used. Otherwise `npm install --production` will be used.  + +When using Fabric 1.4.4, the docker image that is used to run the Node chaincode is node v8.16.1. It is installed with npm install --production + +### Supported Runtime communication with the Peer +  +Subject to a suitable runtime environment, the 1.4.4 Node modules and 2.0.0 Node modules can used to communicate with a Fabric 2.0.0 or 1.4.4 Peer - with the level of functionality that is implied by the Fabric version in use.  \ No newline at end of file diff --git a/README.md b/README.md index 58b82e94..e09e1345 100644 --- a/README.md +++ b/README.md @@ -30,6 +30,10 @@ As an application developer, to learn about how to implement **"Smart Contracts" - docker images - [fabric-nodeenv](https://hub.docker.com/r/hyperledger/fabric-nodeenv) +## Compatibility + +For details on what Nodejs runtime and versions of Hyperledger Fabric can be used please see the [compatibility document](COMPATIBILITY.md). + --- ## License diff --git a/apis/fabric-contract-api/package.json b/apis/fabric-contract-api/package.json index 0d912307..04f311ff 100644 --- a/apis/fabric-contract-api/package.json +++ b/apis/fabric-contract-api/package.json @@ -22,7 +22,7 @@ "Fabric Shim" ], "engines": { - "node": "10.15.2", + "node": "^12.13.0", "npm": "^6.4.1" }, "license": "Apache-2.0", diff --git a/apis/fabric-shim-api/package.json b/apis/fabric-shim-api/package.json index 0eacd525..9c59d836 100644 --- a/apis/fabric-shim-api/package.json +++ b/apis/fabric-shim-api/package.json @@ -17,7 +17,7 @@ "Fabric Shim" ], "engines": { - "node": "10.15.2", + "node": "^12.13.0", "npm": "^6.4.1", "eslint": "6.6.0" }, diff --git a/libraries/fabric-shim-crypto/package.json b/libraries/fabric-shim-crypto/package.json index 1c26702b..5b35636a 100644 --- a/libraries/fabric-shim-crypto/package.json +++ b/libraries/fabric-shim-crypto/package.json @@ -20,7 +20,7 @@ "Fabric Shim" ], "engines": { - "node": "10.15.2", + "node": "^12.13.0", "npm": "^6.4.1" }, "license": "Apache-2.0", diff --git a/libraries/fabric-shim/package.json b/libraries/fabric-shim/package.json index 67b29954..b01e55e5 100644 --- a/libraries/fabric-shim/package.json +++ b/libraries/fabric-shim/package.json @@ -29,7 +29,7 @@ "Fabric Shim" ], "engines": { - "node": "10.15.2", + "node": "^12.13.0", "npm": "^6.4.1" }, "yargs": { diff --git a/libraries/fabric-shim/test/unit/chaincode.js b/libraries/fabric-shim/test/unit/chaincode.js index c1842dc0..9fcdcc05 100644 --- a/libraries/fabric-shim/test/unit/chaincode.js +++ b/libraries/fabric-shim/test/unit/chaincode.js @@ -257,7 +257,7 @@ describe('Chaincode', () => { expect(typeof testOpts[attr]).to.deep.equal('string'); const json = JSON.parse(testOpts[attr]); - expect(json.name).to.deep.equal('fabric-shim-test'); + expect(json.name).to.deep.equal('fabric-chaincode-node'); }); Chaincode.__set__('Handler', handlerClass); diff --git a/package.json b/package.json index 48a93fcb..844df0be 100644 --- a/package.json +++ b/package.json @@ -1,23 +1,11 @@ { - "name": "fabric-shim-test", + "name": "fabric-chaincode-node", "version": "2.1.0-unstable", "tag": "unstable", - "description": "fabric-shim, fabric-shim-crypto", + "description": "fabric-chaincode-node monorepo, built with rush", "testFabricVersion": "master", "testFabricCAVersion": "1.4.4", "testFabricThirdParty": "0.4.15", "docsLatestVersion": "release-1.4", - "engines": { - "node": "10.15.2", - "npm": "^6.4.1" - }, - "engineStrict": true, - "license": "Apache-2.0", - "scripts": { - }, - "dependencies": { - }, - "devDependencies": { - - } + "license": "Apache-2.0" } diff --git a/test/chaincodes/annotations/package.json b/test/chaincodes/annotations/package.json index 883ef41f..f5befa8f 100644 --- a/test/chaincodes/annotations/package.json +++ b/test/chaincodes/annotations/package.json @@ -2,7 +2,7 @@ "name": "ts_chaincode", "description": "Chaincode testing typescript functionality and annotations", "engines": { - "node": ">=8.4.0", + "node": "^12.13.0", "npm": ">=5.3.0" }, "scripts": { diff --git a/test/chaincodes/clientidentity/package.json b/test/chaincodes/clientidentity/package.json index d2336119..523ff85e 100644 --- a/test/chaincodes/clientidentity/package.json +++ b/test/chaincodes/clientidentity/package.json @@ -2,7 +2,7 @@ "name": "chaincode", "description": "Chaincode testing ClientIdentity functionality", "engines": { - "node": ">=8.4.0", + "node": "^12.13.0", "npm": ">=5.3.0" }, "scripts": { diff --git a/test/chaincodes/crosschaincode/package.json b/test/chaincodes/crosschaincode/package.json index 52f3282a..e14cf6e2 100644 --- a/test/chaincodes/crosschaincode/package.json +++ b/test/chaincodes/crosschaincode/package.json @@ -2,7 +2,7 @@ "name": "chaincode", "description": "Chaincode testing cross chaincode functionality", "engines": { - "node": ">=8.4.0", + "node": "^12.13.0", "npm": ">=5.3.0" }, "scripts": { diff --git a/test/chaincodes/crosschaincode2/package.json b/test/chaincodes/crosschaincode2/package.json index 52f3282a..e14cf6e2 100644 --- a/test/chaincodes/crosschaincode2/package.json +++ b/test/chaincodes/crosschaincode2/package.json @@ -2,7 +2,7 @@ "name": "chaincode", "description": "Chaincode testing cross chaincode functionality", "engines": { - "node": ">=8.4.0", + "node": "^12.13.0", "npm": ">=5.3.0" }, "scripts": { diff --git a/test/chaincodes/crud/package.json b/test/chaincodes/crud/package.json index 38cc609d..35f84f92 100644 --- a/test/chaincodes/crud/package.json +++ b/test/chaincodes/crud/package.json @@ -2,7 +2,7 @@ "name": "chaincode", "description": "Chaincode testing crud functionality", "engines": { - "node": ">=8.4.0", + "node": "^12.13.0", "npm": ">=5.3.0" }, "scripts": { diff --git a/test/chaincodes/encryption/package.json b/test/chaincodes/encryption/package.json index 47ce8016..0d81c0f4 100644 --- a/test/chaincodes/encryption/package.json +++ b/test/chaincodes/encryption/package.json @@ -2,7 +2,7 @@ "name": "chaincode", "description": "Chaincode testing encryption functionality", "engines": { - "node": ">=8.4.0", + "node": "^12.13.0", "npm": ">=5.3.0" }, "scripts": { diff --git a/test/chaincodes/events/package.json b/test/chaincodes/events/package.json index f84d64b0..19c621ad 100644 --- a/test/chaincodes/events/package.json +++ b/test/chaincodes/events/package.json @@ -2,7 +2,7 @@ "name": "chaincode", "description": "Chaincode testing events functionality", "engines": { - "node": ">=8.4.0", + "node": "^12.13.0", "npm": ">=5.3.0" }, "scripts": { diff --git a/test/chaincodes/query/package.json b/test/chaincodes/query/package.json index 782d6ac3..658e44d9 100644 --- a/test/chaincodes/query/package.json +++ b/test/chaincodes/query/package.json @@ -2,7 +2,7 @@ "name": "chaincode", "description": "Chaincode testing query functionality", "engines": { - "node": ">=8.4.0", + "node": "^12.13.0", "npm": ">=5.3.0" }, "scripts": { diff --git a/test/chaincodes/scenario/package.json b/test/chaincodes/scenario/package.json index 7eb41a83..0f0de97c 100644 --- a/test/chaincodes/scenario/package.json +++ b/test/chaincodes/scenario/package.json @@ -2,7 +2,7 @@ "name": "chaincode", "description": "My first exciting chaincode implemented in node.js", "engines": { - "node": ">=8.4.0", + "node": "^12.13.0", "npm": ">=5.3.0" }, "scripts": { diff --git a/test/fv/package.json b/test/fv/package.json index 0daa67ce..6f60a7d3 100644 --- a/test/fv/package.json +++ b/test/fv/package.json @@ -6,7 +6,7 @@ "testFabricThirdParty": "0.4.15", "docsLatestVersion": "release-1.4", "engines": { - "node": "10.15.2", + "node": "^12.13.0", "npm": "^6.4.1" }, "engineStrict": true,