Skip to content

Commit

Permalink
build(deps): fix npm (grpc) build on NodeJS v20.4.0
Browse files Browse the repository at this point in the history
WORK IN PROGRESS
--------------

1. Eliminates all uses of the old `grpc` dependency from the codebase.
1.1. Upgraded all outdated fabirc-network, fabric-client and fabric-ca-client
dependencies to the latest stable 2.2.x version which is 2.2.18 at the time.
1.2. Also outrighted swapped `grpc` declarations with `@grpc/grpc-js`.
The rest of the diff is due to the incompatibility of the two mentioned.

Fixes hyperledger-cacti#2562
Fixes hyperledger-cacti#1507

Signed-off-by: Peter Somogyvari <peter.somogyvari@accenture.com>
Signed-off-by: Sandeep Nishad <sandeep.nishad1@ibm.com>
  • Loading branch information
petermetz authored and sandeepnRES committed Aug 9, 2023
1 parent 1b643df commit 4973ca9
Show file tree
Hide file tree
Showing 25 changed files with 131 additions and 345 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@
"@openzeppelin/contracts": "4.9.2",
"@openzeppelin/contracts-upgradeable": "4.9.2",
"async-exit-hook": "2.0.1",
"fabric-network": "2.2.10",
"fabric-network": "2.2.18",
"fs-extra": "10.0.0",
"openapi-types": "9.1.0",
"typescript-optional": "2.0.1",
Expand Down
4 changes: 1 addition & 3 deletions examples/cactus-example-discounted-asset-trade/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,7 @@
"ethereumjs-common": "1.5.2",
"ethereumjs-tx": "2.1.2",
"express": "4.16.4",
"fabric-ca-client": "1.4.19",
"fabric-client": "1.4.19",
"fabric-network": "1.4.19",
"fabric-network": "2.2.18",
"http-errors": "1.6.3",
"jsonwebtoken": "9.0.0",
"jsrsasign": "10.5.25",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import { ISocketApiClient } from "@hyperledger/cactus-core-api";
import { Verifier } from "@hyperledger/cactus-verifier-client";
import { signProposal } from "./sign-utils";

import { FileSystemWallet } from "fabric-network";
import { Wallets } from "fabric-network";

const config: any = ConfigUtil.getConfig();
import { getLogger } from "log4js";
Expand Down Expand Up @@ -50,14 +50,13 @@ export function makeSignedProposal<T extends ISocketApiClient<unknown>>(
let certPem = undefined;
let privateKeyPem = undefined;
const submitter = config.assetTradeInfo.fabric.submitter.name;
const wallet = new FileSystemWallet(
const wallet = await Wallets.newFileSystemWallet(
config.assetTradeInfo.fabric.keystore,
);
logger.debug(`Wallet path: ${config.assetTradeInfo.fabric.keystore}`);

const submitterExists = await wallet.exists(submitter);
if (submitterExists) {
const submitterIdentity = await wallet.export(submitter);
const submitterIdentity = await wallet.get(submitter);
if (submitterIdentity) {
certPem = (submitterIdentity as any).certificate;
privateKeyPem = (submitterIdentity as any).privateKey;
}
Expand Down
3 changes: 1 addition & 2 deletions examples/cactus-example-electricity-trade/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,7 @@
"ethereumjs-common": "1.5.2",
"ethereumjs-tx": "2.1.2",
"express": "4.16.4",
"fabric-ca-client": "2.2.10",
"fabric-network": "2.2.10",
"fabric-network": "2.2.18",
"http-errors": "1.6.3",
"js-yaml": "3.14.1",
"jsonwebtoken": "9.0.0",
Expand Down
2 changes: 1 addition & 1 deletion examples/cactus-example-supply-chain-backend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@
"dotenv": "16.0.0",
"express": "4.17.3",
"express-jwt": "8.4.1",
"fabric-network": "2.2.10",
"fabric-network": "2.2.18",
"jose": "4.9.2",
"openapi-types": "9.1.0",
"solc": "0.8.6",
Expand Down
3 changes: 1 addition & 2 deletions examples/cactus-example-tcs-huawei/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,7 @@
"ethereumjs-common": "1.5.2",
"ethereumjs-tx": "2.1.2",
"express": "4.16.4",
"fabric-ca-client": "2.2.10",
"fabric-network": "2.2.10",
"fabric-network": "2.2.18",
"http-errors": "1.6.3",
"js-yaml": "3.14.1",
"jsonwebtoken": "8.5.1",
Expand Down
4 changes: 2 additions & 2 deletions examples/test-run-transaction/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@
"ethereumjs-common": "1.5.2",
"ethereumjs-tx": "2.1.2",
"express": "4.16.4",
"fabric-ca-client": "2.2.10",
"fabric-network": "2.2.10",
"fabric-network": "2.2.18",
"fabric-network": "2.2.18",
"http-errors": "1.6.3",
"jsonwebtoken": "8.5.1",
"log4js": "6.4.0",
Expand Down
3 changes: 1 addition & 2 deletions packages/cactus-cmd-socketio-server/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,7 @@
"ethereumjs-common": "1.5.2",
"ethereumjs-tx": "2.1.2",
"express": "4.16.4",
"fabric-ca-client": "1.4.19",
"fabric-network": "1.4.19",
"fabric-network": "2.2.18",
"http-errors": "1.6.3",
"js-yaml": "3.14.1",
"jsonwebtoken": "9.0.0",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,18 +14,17 @@
"prepare-docker-build": "cp -af ../../yarn.lock ./dist/yarn.lock"
},
"dependencies": {
"@grpc/grpc-js": "1.8.18",
"@hyperledger/cactus-cmd-socketio-server": "2.0.0-alpha.1",
"@hyperledger/cactus-common": "2.0.0-alpha.1",
"@types/node": "14.17.32",
"body-parser": "1.17.2",
"cookie-parser": "1.4.6",
"debug": "3.1.0",
"express": "4.17.3",
"fabric-ca-client": "1.4.19",
"fabric-client": "1.4.19",
"fabric-network": "1.4.19",
"fabric-ca-client": "2.2.18",
"fabric-network": "2.2.18",
"fs-extra": "10.0.0",
"grpc": "1.24.11",
"js-yaml": "3.14.1",
"jsonwebtoken": "9.0.0",
"lodash": "4.17.21",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@
"config": "1.31.0",
"socket.io-client": "4.5.4",
"ts-node": "9.1.1",
"fabric-ca-client": "2.2.10",
"fabric-network": "2.2.10",
"fabric-network": "2.2.18",
"fabric-network": "2.2.18",
"shelljs": "0.8.5"
},
"devDependencies": {
Expand Down
2 changes: 1 addition & 1 deletion packages/cactus-plugin-ledger-connector-iroha/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -55,14 +55,14 @@
"webpack:dev:web": "webpack --env=dev --target=web --config ../../webpack.config.js"
},
"dependencies": {
"@grpc/grpc-js": "1.8.18",
"@hyperledger/cactus-common": "2.0.0-alpha.1",
"@hyperledger/cactus-core": "2.0.0-alpha.1",
"@hyperledger/cactus-core-api": "2.0.0-alpha.1",
"@types/google-protobuf": "3.15.5",
"axios": "0.21.4",
"express": "4.17.1",
"fast-safe-stringify": "2.1.1",
"grpc": "1.24.11",
"iroha-helpers": "1.5.0",
"key-encoder": "2.0.3",
"openapi-types": "7.0.1",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import {
} from "./generated/openapi/typescript-axios";

import { RuntimeError } from "run-time-error";
import * as grpc from "grpc";
import * as grpc from "@grpc/grpc-js";

import {
GrantablePermission,
Expand Down
2 changes: 1 addition & 1 deletion packages/cactus-plugin-odap-hermes/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@
"@types/express": "4.17.8",
"@types/tape": "4.13.0",
"crypto-js": "4.0.0",
"fabric-network": "2.2.10",
"fabric-network": "2.2.18",
"ipfs-http-client": "51.0.1",
"typescript": "4.3.2"
},
Expand Down
2 changes: 1 addition & 1 deletion packages/cactus-plugin-persistence-fabric/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@
"@types/uuid": "8.3.1",
"body-parser": "1.19.0",
"express": "4.17.1",
"fabric-network": "1.4.19",
"fabric-network": "2.2.18",
"uuid": "8.3.2"
},
"engines": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"author": "Hyperledger",
"license": "Apache-2.0",
"dependencies": {
"fabric-ca-client": "1.4.19",
"fabric-network": "1.4.19"
"fabric-network": "2.2.18",
"fabric-network": "2.2.18"
}
}
3 changes: 1 addition & 2 deletions weaver/common/protos-js/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,9 @@
"js"
],
"dependencies": {
"@grpc/grpc-js": "^1.1.3",
"@grpc/grpc-js": "1.9.0",
"@grpc/proto-loader": "^0.5.5",
"google-protobuf": "^3.21.2",
"grpc": "^1.24.3",
"grpc-tools": "^1.9.1"
},
"devDependencies": {
Expand Down
6 changes: 3 additions & 3 deletions weaver/core/drivers/fabric-driver/package-local.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,14 @@
"@hyperledger/cacti-weaver-protos-js": "file:./protos-js",
"@hyperledger/cacti-weaver-sdk-fabric": "file:./cacti-weaver-sdk-fabric",
"@fidm/x509": "^1.2.1",
"@grpc/grpc-js": "^1.1.1",
"@grpc/grpc-js": "1.9.0",
"@typescript-eslint/eslint-plugin": "^4.29.1",
"@typescript-eslint/parser": "^4.29.1",
"dotenv": "^8.2.0",
"eslint-config-prettier": "^8.3.0",
"eslint-plugin-prettier": "^3.4.0",
"fabric-ca-client": "^2.2.8",
"fabric-network": "^2.2.8",
"fabric-ca-client": "2.2.18",
"fabric-network": "2.2.18",
"level": "^8.0.0",
"winston": "^3.3.3"
},
Expand Down
6 changes: 3 additions & 3 deletions weaver/core/drivers/fabric-driver/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,16 +20,16 @@
"license": "Apache-2.0",
"dependencies": {
"@fidm/x509": "^1.2.1",
"@grpc/grpc-js": "^1.1.1",
"@grpc/grpc-js": "1.9.0",
"@hyperledger/cacti-weaver-protos-js": "2.0.0-alpha.1",
"@hyperledger/cacti-weaver-sdk-fabric": "2.0.0-alpha.1",
"@typescript-eslint/eslint-plugin": "^4.29.1",
"@typescript-eslint/parser": "^4.29.1",
"dotenv": "^8.2.0",
"eslint-config-prettier": "^8.3.0",
"eslint-plugin-prettier": "^3.4.0",
"fabric-ca-client": "^2.2.8",
"fabric-network": "^2.2.8",
"fabric-ca-client": "2.2.18",
"fabric-network": "2.2.18",
"level": "^8.0.0",
"winston": "^3.3.3"
},
Expand Down
8 changes: 4 additions & 4 deletions weaver/core/identity-management/iin-agent/package-local.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,15 @@
"@hyperledger/cacti-weaver-protos-js": "file:./protos-js",
"@hyperledger/cacti-weaver-sdk-fabric": "file:./cacti-weaver-sdk-fabric",
"@fidm/x509": "^1.2.1",
"@grpc/grpc-js": "^1.1.1",
"@grpc/grpc-js": "1.9.0",
"@typescript-eslint/eslint-plugin": "^3.5.0",
"@typescript-eslint/parser": "^3.5.0",
"dotenv": "^8.2.0",
"eslint-config-prettier": "^6.11.0",
"eslint-plugin-prettier": "^3.1.4",
"fabric-ca-client": "^2.2.8",
"fabric-network": "^2.2.8",
"fabric-common": "^2.2.8"
"fabric-ca-client": "2.2.18",
"fabric-common": "2.2.18",
"fabric-network": "2.2.18"
},
"devDependencies": {
"patch-package": "^6.2.2",
Expand Down
8 changes: 4 additions & 4 deletions weaver/core/identity-management/iin-agent/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,17 +20,17 @@
"license": "Apache-2.0",
"dependencies": {
"@fidm/x509": "^1.2.1",
"@grpc/grpc-js": "^1.1.1",
"@grpc/grpc-js": "1.9.0",
"@hyperledger/cacti-weaver-protos-js": "2.0.0-alpha.1",
"@hyperledger/cacti-weaver-sdk-fabric": "2.0.0-alpha.1",
"@typescript-eslint/eslint-plugin": "^3.5.0",
"@typescript-eslint/parser": "^3.5.0",
"dotenv": "^8.2.0",
"eslint-config-prettier": "^6.11.0",
"eslint-plugin-prettier": "^3.1.4",
"fabric-ca-client": "^2.2.8",
"fabric-common": "^2.2.8",
"fabric-network": "^2.2.8"
"fabric-ca-client": "2.2.18",
"fabric-common": "2.2.18",
"fabric-network": "2.2.18"
},
"devDependencies": {
"@types/node": "^14.0.14",
Expand Down
6 changes: 3 additions & 3 deletions weaver/samples/fabric/fabric-cli/package-local.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@
"crypto": "^1.0.1",
"dotenv": "^8.2.0",
"elliptic": "^6.5.4",
"fabric-ca-client": "^2.2.8",
"fabric-network": "^2.2.8",
"fabric-ca-client": "2.2.18",
"fabric-network": "2.2.18",
"express": "^4.18.1",
"body-parser": "^1.20.0",
"gluegun": "latest",
Expand All @@ -51,7 +51,7 @@
"y18n": "^4.0.1"
},
"devDependencies": {
"@grpc/grpc-js": "^1.1.1",
"@grpc/grpc-js": "1.9.0",
"@grpc/proto-loader": "^0.5.4",
"@types/express": "^4.17.13",
"@types/jest": "^24.0.18",
Expand Down
6 changes: 3 additions & 3 deletions weaver/samples/fabric/fabric-cli/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@
"dotenv": "^8.2.0",
"elliptic": "^6.5.4",
"express": "^4.18.1",
"fabric-ca-client": "^2.2.8",
"fabric-network": "^2.2.8",
"fabric-ca-client": "2.2.18",
"fabric-network": "2.2.18",
"gluegun": "latest",
"grpc-tools": "1.9.1",
"ini": "^1.3.6",
Expand All @@ -51,7 +51,7 @@
"y18n": "^4.0.1"
},
"devDependencies": {
"@grpc/grpc-js": "^1.1.1",
"@grpc/grpc-js": "1.9.0",
"@grpc/proto-loader": "^0.5.4",
"@types/express": "^4.17.13",
"@types/jest": "^24.0.18",
Expand Down
8 changes: 4 additions & 4 deletions weaver/sdks/fabric/interoperation-node-sdk/package-local.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,12 @@
},
"dependencies": {
"@hyperledger/cacti-weaver-protos-js": "file:./protos-js",
"@grpc/grpc-js": "^1.1.3",
"@grpc/grpc-js": "1.9.0",
"@grpc/proto-loader": "^0.6.13",
"elliptic": "^6.2.3",
"fabric-common": "^2.2.8",
"fabric-network": "^2.2.8",
"fabric-protos": "^2.2.8",
"fabric-common": "2.2.18",
"fabric-network": "2.2.18",
"fabric-protos": "2.2.18",
"js-sha3": "^0.7.0",
"jsrsasign": "^10.5.25",
"log4js": "^6.3.0",
Expand Down
8 changes: 4 additions & 4 deletions weaver/sdks/fabric/interoperation-node-sdk/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,13 @@
"npm": ">=6.0.0 <=8.15.0"
},
"dependencies": {
"@grpc/grpc-js": "^1.1.3",
"@grpc/grpc-js": "1.9.0",
"@grpc/proto-loader": "^0.6.13",
"@hyperledger/cacti-weaver-protos-js": "2.0.0-alpha.1",
"elliptic": "^6.2.3",
"fabric-common": "^2.2.8",
"fabric-network": "^2.2.8",
"fabric-protos": "^2.2.8",
"fabric-common": "2.2.18",
"fabric-network": "2.2.18",
"fabric-protos": "2.2.18",
"js-sha3": "^0.7.0",
"jsrsasign": "^10.5.25",
"log4js": "^6.3.0",
Expand Down
Loading

0 comments on commit 4973ca9

Please sign in to comment.