rtang03 / fabric-es

Hyperledger Fabric => event-store
https://fabric-es.readthedocs.io/en/latest/index.html
MIT License
11 stars 3 forks source link

replace fabric-client v1.4.x #151

Closed rtang03 closed 3 years ago

rtang03 commented 3 years ago

During the version upgrade from fabric-network from v2.1.x to v2.2.3. There is an error below:

2020-12-04T16:47:09.076Z [error]: fail to enroll admin-org1.net, {"message":"Failed to generate key for enrollment due to error [TypeError: this.keyValueStore.setValue is not a function]: TypeError: this.keyValueStore.setValue is not a function\n    at CryptoKeyStore.setValue (/Users/tangross/dev/2020/fabric-es/node_modules/fabric-common/lib/impl/CryptoKeyStore.js:51:28)\n    at CryptoKeyStore.putKey (/Users/tangross/dev/2020/fabric-es/node_modules/fabric-common/lib/impl/CryptoKeyStore.js:81:14)\n    at CryptoSuite_ECDSA_AES.generateKey (/Users/tangross/dev/2020/fabric-es/node_modules/fabric-common/lib/impl/CryptoSuite_ECDSA_AES.js:105:30)\n    at FabricCAServices.enroll (/Users/tangross/dev/2020/fabric-es/node_modules/fabric-client/node_modules/fabric-ca-client/lib/FabricCAServices.js:203:47)\n    at CertificateAuthority.enroll (/Users/tangross/dev/2020/fabric-es/node_modules/fabric-client/lib/CertificateAuthority.js:146:32)\n    at Object.<anonymous>.exports.enrollAdmin (/Users/tangross/dev/2020/fabric-es/packages/operator/src/enrollAdmin.ts:38:8)\n    at Object.<anonymous> (/Users/tangross/dev/2020/fabric-es/packages/operator/src/__tests__/unit.test.ts:32:3)","stack":"Error: Failed to generate key for enrollment due to error [TypeError: this.keyValueStore.setValue is not a function]: TypeError: this.keyValueStore.setValue is not a function\n    at CryptoKeyStore.setValue (/Users/tangross/dev/2020/fabric-es/node_modules/fabric-common/lib/impl/CryptoKeyStore.js:51:28)\n    at CryptoKeyStore.putKey (/Users/tangross/dev/2020/fabric-es/node_modules/fabric-common/lib/impl/CryptoKeyStore.js:81:14)\n    at CryptoSuite_ECDSA_AES.generateKey (/Users/tangross/dev/2020/fabric-es/node_modules/fabric-common/lib/impl/CryptoSuite_ECDSA_AES.js:105:30)\n    at FabricCAServices.enroll (/Users/tangross/dev/2020/fabric-es/node_modules/fabric-client/node_modules/fabric-ca-client/lib/FabricCAServices.js:203:47)\n    at CertificateAuthority.enroll (/Users/tangross/dev/2020/fabric-es/node_modules/fabric-client/lib/CertificateAuthority.js:146:32)\n    at Object.<anonymous>.exports.enrollAdmin (/Users/tangross/dev/2020/fabric-es/packages/operator/src/enrollAdmin.ts:38:8)\n    at Object.<anonymous> (/Users/tangross/dev/2020/fabric-es/packages/operator/src/__tests__/unit.test.ts:32:3)\n    at FabricCAServices.enroll (/Users/tangross/dev/2020/fabric-es/node_modules/fabric-client/node_modules/fabric-ca-client/lib/FabricCAServices.js:210:11)"} ([operator] enrollAdmin.js)`

Currently, enrollAdmin is using fabric-client v1.4.x. By Fabric documentation below, it recommends a migration.

https://hyperledger.github.io/fabric-sdk-node/release-2.2/tutorial-migration.html

Sooner or later, the use fabric-client v1.4.x should be replaced. It mainly impacts the enrollAdmin under packages/operator.

This is high priority item, it blocks, simply because the enrollAdmin cannot run properly when fabric-network 's version is bumped.

rtang03 commented 3 years ago

example code:

https://github.com/hyperledger/fabric-samples/blob/master/fabcar/typescript/src/enrollAdmin.ts

rtang03 commented 3 years ago

This is a more difficult task than imagined. That is not only impacting enrollAdmin. It affects everything in package/operator, because all admin task rely on this low-level api "fabric-client". Unsure if "fabric-client" can be totally removed.

rtang03 commented 3 years ago

I find that "fabric-network" v2.2.3 is in conflict with installed "fabric-client" v1.4.x And, therefore, I need to drop "fabric-client" entirely.

Unfortunately, there is negative impact, which getQueries function in "packages/operator" will be dropped as well.

That is not an impact. By Hyperledger official direction, the SDK will no longer add / perform administrative function. The dropped administrative API, can be fulfilled by Hyperledger Explorer.

The administrative API inside "packages/operator" will thereafter focus on Fabric CA server admin functions.