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 outright swapped `grpc` declarations with `@grpc/grpc-js`.
The rest of the diff is due to the incompatibility of the two mentioned.

Fixes https://github.com/hyperledger/cacti/issues/2562
Fixes https://github.com/hyperledger/cacti/issues/1507

Signed-off-by: Peter Somogyvari <[email protected]>
Signed-off-by: Sandeep Nishad <[email protected]>
Signed-off-by: Peter Somogyvari <[email protected]>
  • Loading branch information
petermetz committed Sep 10, 2023
1 parent 55a1507 commit 73c85ff
Show file tree
Hide file tree
Showing 10 changed files with 47 additions and 200 deletions.
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 packages/cactus-cmd-socketio-server/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,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 @@
"start": "cd ./dist && node common/core/bin/www.js"
},
"dependencies": {
"@grpc/grpc-js": "1.9.0",
"@hyperledger/cactus-cmd-socketio-server": "2.0.0-alpha.1",
"@hyperledger/cactus-common": "2.0.0-alpha.1",
"@types/node": "14.18.54",
"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.1.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 @@ -12,11 +12,11 @@
"dependencies": {
"@types/node": "14.18.54",
"config": "1.31.0",
"socket.io-client": "4.5.4",
"ts-node": "9.1.1",
"fabric-ca-client": "2.2.18",
"fabric-network": "2.2.18",
"shelljs": "0.8.5"
"shelljs": "0.8.5",
"socket.io-client": "4.5.4",
"ts-node": "10.9.1"
},
"devDependencies": {
"typescript": "4.9.5"
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.9.0",
"@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-persistence-fabric/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@
"@types/uuid": "8.3.4",
"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,6 @@
"author": "Hyperledger",
"license": "Apache-2.0",
"dependencies": {
"fabric-ca-client": "1.4.19",
"fabric-network": "1.4.19"
"fabric-network": "2.2.18"
}
}
Loading

0 comments on commit 73c85ff

Please sign in to comment.