Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/release-2.x' into merge-2.3
Browse files Browse the repository at this point in the history
Signed-off-by: James Taylor <jamest@uk.ibm.com>

# Conflicts:
#	CHANGELOG.md
#	COMPATIBILITY.md
#	TUTORIAL.md
#	apis/fabric-contract-api/README.md
#	apis/fabric-contract-api/package.json
#	apis/fabric-contract-api/test/unit/metadata.json
#	apis/fabric-shim-api/README.md
#	apis/fabric-shim-api/package.json
#	ci/azure-pipelines.yml
#	common/config/rush/pnpm-lock.yaml
#	docs/_config.yml
#	docs/_includes/header.html
#	docs/_jsdoc.json
#	docs/_jsdoc/index.md
#	docs/_jsdoc/tutorials/annotated-contract-metadata.md
#	docs/_jsdoc/tutorials/deep-dive-contract-interface.md
#	docs/_jsdoc/tutorials/using-chaincodeinterface.md
#	docs/_jsdoc/tutorials/using-contractinterface.md
#	docs/_jsdoc/tutorials/using-iterators.md
#	docs/index.md
#	docs/package.json
#	libraries/fabric-shim-crypto/README.md
#	libraries/fabric-shim-crypto/package.json
#	libraries/fabric-shim/README.md
#	libraries/fabric-shim/lib/contract-spi/chaincodefromcontract.js
#	libraries/fabric-shim/package.json
#	libraries/fabric-shim/test/unit/contract-spi/chaincodefromcontract.js
#	libraries/fabric-shim/test/unit/server.js
#	package.json
#	release_notes/v2.0.0.txt
#	test/chaincodes/annotations/package.json
#	test/chaincodes/annotations/src/test_contract/expected-metadata.json
#	test/chaincodes/clientidentity/package.json
#	test/chaincodes/crosschaincode/package.json
#	test/chaincodes/crosschaincode2/package.json
#	test/chaincodes/crud/package.json
#	test/chaincodes/encryption/package.json
#	test/chaincodes/events/package.json
#	test/chaincodes/query/package.json
#	test/chaincodes/scenario/package.json
#	test/chaincodes/server/package.json
#	test/e2e/scenario.js
#	test/fv/package.json
#	tools/getEdgeDocker.sh
#	tools/toolchain/fabric.js
#	tools/toolchain/network/docker-compose/docker-compose-base.yaml
  • Loading branch information
jt-nti committed Nov 10, 2020
2 parents ae5a352 + 4f44108 commit 5c32dc6
Show file tree
Hide file tree
Showing 42 changed files with 331 additions and 146 deletions.
67 changes: 66 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,72 @@
## v2.3.0
Tue 3 Nov 15:40:46 GMT 2020

* [f71eb0c](https://github.com/hyperledger/fabric-chaincode-node/commit/f71eb0c) [FABCN-432](https://jira.hyperledger.org/browse/FABCN-432) - Update class transformer dependency (#213)
* [fc32346](https://github.com/hyperledger/fabric-chaincode-node/commit/fc32346) [FABCN-430](https://jira.hyperledger.org/browse/FABCN-430) Fix type for timestamp.second (#194) (#209)
* [85188f5](https://github.com/hyperledger/fabric-chaincode-node/commit/85188f5) v2.x tutorials updated (#217)
* [05df03f](https://github.com/hyperledger/fabric-chaincode-node/commit/05df03f) [FABCN-435](https://jira.hyperledger.org/browse/FABCN-435) OOM on Large Arg Size (#207)
* [58387e8](https://github.com/hyperledger/fabric-chaincode-node/commit/58387e8) [FABCN-241](https://jira.hyperledger.org/browse/FABCN-241) Remove to.be.ok (#204)
* [c9a1f5d](https://github.com/hyperledger/fabric-chaincode-node/commit/c9a1f5d) [FABCN-433](https://jira.hyperledger.org/browse/FABCN-433) Update typescript and @types/node (#199)
* [eb39270](https://github.com/hyperledger/fabric-chaincode-node/commit/eb39270) [FABCN-422](https://jira.hyperledger.org/browse/FABCN-422) Add release guide (#187)
* [be2ef68](https://github.com/hyperledger/fabric-chaincode-node/commit/be2ef68) Fix: ChaincodeStub.getMspID should be in lowerCamelCASE
* [7de3c12](https://github.com/hyperledger/fabric-chaincode-node/commit/7de3c12) Bump version to 2.2.1 (#184)

## v2.2.0
Thu 2 Jul 11:40:02 BST 2020

* [0f1b616](https://github.com/hyperledger/fabric-chaincode-node/commit/0f1b616) [FABCN-421](https://jira.hyperledger.org/browse/FABCN-421) release: 2.2.0 LTS release
* [9f30e90](https://github.com/hyperledger/fabric-chaincode-node/commit/9f30e90) Use Official CouchDB 3.1 Image (#180)
* [eeca625](https://github.com/hyperledger/fabric-chaincode-node/commit/eeca625) [FABCN-420](https://jira.hyperledger.org/browse/FABCN-420) Remove Azure pipeline warnings (#177)
* [cc7fee7](https://github.com/hyperledger/fabric-chaincode-node/commit/cc7fee7) [FABCN-319](https://jira.hyperledger.org/browse/FABCN-319) Update dependnency versions (#176)
* [8966eed](https://github.com/hyperledger/fabric-chaincode-node/commit/8966eed) [FABCN-393](https://jira.hyperledger.org/browse/FABCN-393) Fix broken links in documents (#169)

## v2.1.4
Mon 22 Jun 2020 14:51:02 BST

* [81e1123](https://github.com/hyperledger/fabric-chaincode-node/commit/81e1123) Specify exact version of winston dependency

## v2.1.3
Fri 19 Jun 15:26:50 BST 2020

* [cb4afae](https://github.com/hyperledger/fabric-chaincode-node/commit/cb4afae) [FABCN-410](https://jira.hyperledger.org/browse/FABCN-410) Use new lifecycle for fv/e2e tests (#160)
* [e02abf4](https://github.com/hyperledger/fabric-chaincode-node/commit/e02abf4) [FABCN-407](https://jira.hyperledger.org/browse/FABCN-407) Update protos (#154) (#157)
* [f4643f4](https://github.com/hyperledger/fabric-chaincode-node/commit/f4643f4) [FABCN-405](https://jira.hyperledger.org/browse/FABCN-405) Fix tutorial reference (#150) (#152)
* [c1979e3](https://github.com/hyperledger/fabric-chaincode-node/commit/c1979e3) Bump version to 2.1.3 (#149)

## v2.1.2
Mon 18 May 2020 17:06:23 BST

* [3d3264d](https://github.com/hyperledger/fabric-chaincode-node/commit/3d3264d) Fix broken tutorials link (#137) (#138)
* [ac5b009](https://github.com/hyperledger/fabric-chaincode-node/commit/ac5b009) [FABCN-401](https://jira.hyperledger.org/browse/FABCN-401) Correct use of Yargs api (#145)
* [a81935a](https://github.com/hyperledger/fabric-chaincode-node/commit/a81935a) [FABCN-395](https://jira.hyperledger.org/browse/FABCN-395): Use @grpc/grpc-js for Node.js chaincode (#143) (#144)
* [8de8a6e](https://github.com/hyperledger/fabric-chaincode-node/commit/8de8a6e) [FABCN-396](https://jira.hyperledger.org/browse/FABCN-396) Add notes on minimum 1.4 module version for node 12 (#139)
* [00fab0a](https://github.com/hyperledger/fabric-chaincode-node/commit/00fab0a) [FABCN-397](https://jira.hyperledger.org/browse/FABCN-397) State queries limited to 100 results (#141)
* [b1f992d](https://github.com/hyperledger/fabric-chaincode-node/commit/b1f992d) Bump version (#134)

## v2.1.1
Wed 22 Apr 2020 10:31:05 BST

* [3e67b8c](https://github.com/hyperledger/fabric-chaincode-node/commit/3e67b8c) [FABCN-394](https://jira.hyperledger.org/browse/FABCN-394) Update typescript interface file (#128)
* [61c253a](https://github.com/hyperledger/fabric-chaincode-node/commit/61c253a) [FABCN-391](https://jira.hyperledger.org/browse/FABCN-391) fix directory for api doc publish (#125)
* [c753261](https://github.com/hyperledger/fabric-chaincode-node/commit/c753261) [FABCN-391](https://jira.hyperledger.org/browse/FABCN-391) Bump to 2.1.1 and fix docker tag (#122)

## v2.1.0
Wed 1 Apr 2020 16:12:36 BST

* [644213a](https://github.com/hyperledger/fabric-chaincode-node/commit/644213a) [FABCN-391](https://jira.hyperledger.org/browse/FABCN-391) Remove references to 2.0 and 2.0.0 - replace with 2.x
* [de8c29c](https://github.com/hyperledger/fabric-chaincode-node/commit/de8c29c) [FABCN-241](https://jira.hyperledger.org/browse/FABCN-241) Change to.be.ok test calls
* [a3ff93c](https://github.com/hyperledger/fabric-chaincode-node/commit/a3ff93c) Add readme to redirect to site
* [659d36d](https://github.com/hyperledger/fabric-chaincode-node/commit/659d36d) Improve build reliability
* [d62ecae](https://github.com/hyperledger/fabric-chaincode-node/commit/d62ecae) [FABCN-373](https://jira.hyperledger.org/browse/FABCN-373) Compatibility Matrix
* [c09385c](https://github.com/hyperledger/fabric-chaincode-node/commit/c09385c) [FABCN-391](https://jira.hyperledger.org/browse/FABCN-391) Use version 2.1 of fabric docker images
* [78f8cf8](https://github.com/hyperledger/fabric-chaincode-node/commit/78f8cf8) Expand node engine version range
* [c9e9e5b](https://github.com/hyperledger/fabric-chaincode-node/commit/c9e9e5b) Update audit level
* [dd51dfa](https://github.com/hyperledger/fabric-chaincode-node/commit/dd51dfa) [FABCN-381](https://jira.hyperledger.org/browse/FABCN-381) Access localmspid

## v2.0.0
Wed 22 Jan 2020 16:03:50 GMT

* [869f107](https://github.com/hyperledger/fabric-chaincode-node/commit/869f107) [FABCI-482](https://jira.hyperledger.org/browse/FABCI-482) Update Nexus URL's to Artifactory
* [6ef0042](https://github.com/hyperledger/fabric-chaincode-node/commit/6ef0042) [FABCI-482](https://jira.hyperledger.org/browse/FABCI-482) Update Nexus URL's to Artifactory
* [b296d0a](https://github.com/hyperledger/fabric-chaincode-node/commit/b296d0a) [FABCN-241](https://jira.hyperledger.org/browse/FABCN-241) - Remove to.be.ok (#55)
* [b345925](https://github.com/hyperledger/fabric-chaincode-node/commit/b345925) Update maintainers list
* [81eb5a9](https://github.com/hyperledger/fabric-chaincode-node/commit/81eb5a9) Update rush node.js version (#54)
Expand Down
30 changes: 15 additions & 15 deletions COMPATIBILITY.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,16 @@ Github is used for code base management, issues should reported in the [FABCN](h

## 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.
This table shows the summary of the compatibility of the Node modules at versions 1.4 and 2.x, 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.5** | Yes | Yes | Yes | Yes |
| Node modules **v2.1.x** | Yes | No | Yes | Yes |
| | Peer Connectivity v1.4 | NodeJS | Peer Connectivity v2.x |
| ----------------------- | ---------------------- | ------ | ---------------------- |
| Node modules **v1.4.5** | Yes | 8 | Yes |
| Node modules **v2.x.x** | Yes | 12 | 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.
By default a Fabric Peer v1.4 will create a Nodejs v8 runtime, and a Fabric Peer v2.x will create a Nodejs 12 runtime. Whilst this 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=hyperledger/fabric-nodeenv:2.1` will allow the latest Node 12 runtime to be used within a Peer v1.4.
For example `CORE_CHAINCODE_NODE_RUNTIME=hyperledger/fabric-nodeenv:2.1` will allow the use of the latest Node 12 runtime to be used within a Peer v1.4.

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 runtime, if a Nodejs 12 runtime was configured, the node modules at v2.x still function when connecting to the Fabric Peer v1.4.

Expand All @@ -26,30 +26,30 @@ 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:
- 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.
Fabric v1.4.2, and Fabric v2.x 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.
With Fabric v2.x, 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.
v2.x Node modules are supported running in Nodejs 12.16.1, with the x86_64 architecture.

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.
v1.4.x Node modules are supported running Nodejs 8.16.1 with the x86_64 architecture.

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 
When using Fabric 2.x, the default docker image that is used to run the Node chaincode is node:12.16.1-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. 
*Note:* With the default docker image used by Fabric 2.x, 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. 
Subject to a suitable runtime environment, the 1.4.4 Node modules and 2.x Node modules can be used to communicate with a Fabric 2.x or 1.4.4 Peer - with the level of functionality that is implied by the Fabric version in use. 
4 changes: 2 additions & 2 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ The following [Rush categories](https://rushjs.io/pages/maintainer/add_to_repo/)

### Pre-requisites

* node v10.15.2 (npm v6.4.1) => recommend to use [nvm](https://github.com/nvm-sh/nvm)
* node v12.16.1 (npm v6.4.1) => recommend to use [nvm](https://github.com/nvm-sh/nvm)
* rush => `npm install -g @microsoft/rush`

> Note that npm v6 has some bugs that mean adding new dependencies etc are not properly picked up. Longer term we should consider moving to yarn or pnpm. However in practice this isn't a serious problem and has been possible to be worked around by issuing `rm ./common/config/rush/npm-shrinkwrap.json` and then `rush update`
Expand All @@ -33,7 +33,7 @@ They also need to have the `nodeenv` image present - this is build as part of th

## Using the repo

* Clone the repo, and ensure you are using node v10, and have rush installed
* Clone the repo, and ensure you are using node v12, and have rush installed
* `rush update` is needed to ensure everything is correctly linked and updated.
* `rush edge-docker` will pull down and tag the very latest docker images for the peers, orderes etc to test against

Expand Down
8 changes: 4 additions & 4 deletions TUTORIAL.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ The dependencies of `fabric-contract-api` and `fabric-shim` will be required.
"name": "chaincode",
"description": "My first exciting chaincode implemented in node.js",
"engines": {
"node": ">=8.4.0",
"npm": ">=5.3.0"
"node": "^12.13.0",
"npm": "^6.13.4"
},
"scripts": {
"test":"mocha.....
Expand All @@ -28,8 +28,8 @@ The dependencies of `fabric-contract-api` and `fabric-shim` will be required.
"author": "",
"license": "Apache-2.0",
"dependencies": {
"fabric-contract-api": "^1.4.0",
"fabric-shim": "^1.4.0"
"fabric-contract-api": "^2.3.1-unstable",
"fabric-shim": "^2.3.1-unstable"
}
}
Expand Down
6 changes: 3 additions & 3 deletions apis/fabric-contract-api/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@

[![Version](https://badge.fury.io/js/fabric-shim.svg)](http://badge.fury.io/js/fabric-shim)

The `fabric-contract-api` provides the *contract interface* a high level API for application developers to implement [Smart Contracts](https://hyperledger-fabric.readthedocs.io/en/latest/glossary.html#smart-contract). Working with this API provides a high level entry point to writing business logic.
The `fabric-contract-api` provides the *contract interface* a high level API for application developers to implement [Smart Contracts](https://hyperledger-fabric.readthedocs.io/en/release-2.1/glossary.html#smart-contract). Working with this API provides a high level entry point to writing business logic.

Within Hyperledger Fabric, Smart Contracts can also be referred to as [Chaincode](https://hyperledger-fabric.readthedocs.io/en/latest/glossary.html#chaincode). To be more specific, the term chaincode is preferred to be used to refer to the overall container that is hosting the contracts.
Within Hyperledger Fabric, Smart Contracts can also be referred to as [Chaincode](https://hyperledger-fabric.readthedocs.io/en/release-2.1/glossary.html#chaincode). To be more specific, the term chaincode is preferred to be used to refer to the overall container that is hosting the contracts.

The `fabric-shim` provides the *chaincode interface*, a lower level API for implementing "Smart Contracts". It also _currently_ provides the implementation to support communication with Hyperledger Fabric peers for Smart Contracts written using the `fabric-contract-api`. To confirm that this is the same as the `fabric-shim` in previous versions of Hyperledger Fabric.

Expand Down Expand Up @@ -129,7 +129,7 @@ Visit [API Reference](https://hyperledger.github.io/fabric-chaincode-node/master


## Support
Tested with node.js 8.9, and also the v10 LTS release.
Tested with Node v12 LTS release.

## License

Expand Down
8 changes: 4 additions & 4 deletions apis/fabric-contract-api/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "fabric-contract-api",
"version": "3.0.0-unstable",
"version": "2.3.1-unstable",
"tag": "unstable",
"description": "A node.js implementation of Hyperledger Fabric chaincode shim, to allow endorsing peers and user-provided chaincodes to communicate with each other",
"main": "index.js",
Expand Down Expand Up @@ -46,7 +46,7 @@
"lines": 100
},
"dependencies": {
"fabric-shim-api": "3.0.0-unstable",
"fabric-shim-api": "2.3.1-unstable",
"class-transformer": "^0.3.1",
"fast-safe-stringify": "^2.0.7",
"get-params": "^0.1.2",
Expand All @@ -56,10 +56,10 @@
"devDependencies": {
"ajv": "^6.12.2",
"ajv-cli": "^3.2.1",
"chai": "^4.1.1",
"chai": "^4.1.2",
"chai-as-promised": "^7.1.1",
"chai-things": "^0.2.0",
"eslint": "6.6.0",
"eslint": "^6.6.0",
"gulp": "^4.0.0",
"gulp-debug": "~4.0.0",
"gulp-eslint": "~6.0.0",
Expand Down
6 changes: 3 additions & 3 deletions apis/fabric-shim-api/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "fabric-shim-api",
"version": "3.0.0-unstable",
"version": "2.3.1-unstable",
"tag": "unstable",
"description": "A node.js API of Hyperledger Fabric chaincode shim, to allow endorsing peers and user-provided chaincodes to communicate with each other",
"main": "index.js",
Expand All @@ -19,11 +19,11 @@
"engines": {
"node": "^12.13.0",
"npm": "^6.4.1",
"eslint": "6.6.0"
"eslint": "^6.6.0"
},
"types": "./types/index.d.ts",
"license": "Apache-2.0",
"devDependencies": {
"@types/long": "^4.0.1"
}
}
}
Loading

0 comments on commit 5c32dc6

Please sign in to comment.