Skip to content

Commit

Permalink
build(deps): upgrade to [email protected], [email protected]
Browse files Browse the repository at this point in the history
Also upgraded the ESLint related packages such as the typescript parser
plugin and all the other plugins or configuration management packages
related to ESLint in general.

The reason why it's important that we keep up to date with ESLint is
because newer versions of Typescript are not getting backported to older
versions of ESLint fast enough (if at all) so to be able to reliably
lint our newer Typescript code, we need to keep up to date with ESLint
as well.

In addition to the dependency upgrades we are also applying the automatic
formatter's changes that it started making after the upgrade.

To-do for later: Consolidate the ESLint versions used among the different
components of the project because right now we still have a few packages
that declare much older versions of ESLint such as 3.x and 4.x.

Depends on #3052 because that pull request also applies some of the
automatic formatting changes that were forgotten in an earlier pull request.

Signed-off-by: Peter Somogyvari <[email protected]>
  • Loading branch information
petermetz committed Mar 4, 2024
1 parent 631ed83 commit 9c565e2
Show file tree
Hide file tree
Showing 11 changed files with 870 additions and 241 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,12 @@ import {
} from "../besu-helper";
import AssetReferenceContractJson from "../../../../solidity/asset-reference-contract/AssetReferenceContract.json";
import CBDCcontractJson from "../../../../solidity/cbdc-erc-20/CBDCcontract.json";
import { getEthAddress, getPrvKey, assertEqual, assertStringContains } from "./common";
import {
getEthAddress,
getPrvKey,
assertEqual,
assertStringContains,
} from "./common";

const BESU_CONTRACT_CBDC_ERC20_NAME = CBDCcontractJson.contractName;
const BESU_CONTRACT_ASSET_REF_NAME = AssetReferenceContractJson.contractName;
Expand Down Expand Up @@ -156,7 +161,8 @@ Then(
getPrvKey(user),
assetRefID,
).catch((err) => {
assertStringContains(err.response.data.error,
assertStringContains(
err.response.data.error,
`Transaction has been reverted by the EVM`,
);
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,11 +70,7 @@ Then(
Then(
"{string} fails to initiate bridge back of {int} CBDC referenced by id {string}",
{ timeout: 60 * 1000 },
async function (
user: string,
amount: number,
assetRefID: string,
) {
async function (user: string, amount: number, assetRefID: string) {
const address = getEthAddress(user);
const fabricID = getFabricId(user);

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,13 @@
import { When, Then } from "cucumber";
import axios from "axios";
import CryptoMaterial from "../../../../crypto-material/crypto-material.json";
import { getUserFromPseudonim, getFabricId, getEthAddress, assertEqual, assertStringContains } from "./common";
import {
getUserFromPseudonim,
getFabricId,
getEthAddress,
assertEqual,
assertStringContains,
} from "./common";

const MAX_RETRIES = 5;
const MAX_TIMEOUT = 5000;
Expand Down Expand Up @@ -87,7 +93,7 @@ When(
recipientLedgerAssetID: "FABRIC_ASSET_ID",
},
);

assertEqual(response.status, 200);
},
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,7 @@ export function getPrvKey(user: string): string {
}
}

export function assertEqual(
value_1: unknown,
value_2: unknown,
) {
export function assertEqual(value_1: unknown, value_2: unknown) {
if (value_1 !== value_2) {
throw Error(`Expected ${value_1} to be equal to ${value_2}`);
}
Expand All @@ -66,7 +63,7 @@ export function assertStringContains(
subString: string,
): void {
if (!mainString.includes(subString)) {
throw new Error(`String "${mainString}" does not contain "${subString}"`);
throw new Error(`String "${mainString}" does not contain "${subString}"`);
}
}

Expand All @@ -76,4 +73,4 @@ export function assertNonNullish<TValue>(
if (value === null || value === undefined) {
throw Error(`${value} was expected to be non-null`);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import {
getUserFromPseudonim,
assertEqual,
assertNonNullish,
assertStringContains
assertStringContains,
} from "./common";
import {
deleteFabricAssetReference,
Expand Down Expand Up @@ -94,7 +94,7 @@ When(

When(
"bob refunds {int} CBDC to {string} in the source chain",
{ timeout: 10 * 1000 },
{ timeout: 10 * 1000 },
async function (amount: number, userTo: string) {
const finalUserFabricID = getFabricId(userTo);
const finalUserEthAddress = getEthAddress(userTo);
Expand Down Expand Up @@ -123,14 +123,17 @@ Then(
},
)
.catch((err) => {
assertStringContains(err.response.data.error, `client is not authorized to perform the operation`);
assertStringContains(
err.response.data.error,
`client is not authorized to perform the operation`,
);
});
},
);

Then(
"{string} fails to transfer {int} CBDC to {string}",
{ timeout: 10 * 1000 },
{ timeout: 10 * 1000 },
async function (userFrom: string, amount: number, userTo: string) {
const recipient = getFabricId(userTo);

Expand All @@ -157,32 +160,32 @@ Then(

Then(
"{string} has {int} CBDC available in the source chain",
{ timeout: 10 * 1000 },
{ timeout: 10 * 1000 },
async function (user: string, amount: number) {
assertEqual((await getFabricBalance(getFabricId(user))), amount)
assertEqual(await getFabricBalance(getFabricId(user)), amount);
},
);

Then(
"the asset reference chaincode has an asset reference with id {string}",
{ timeout: 10 * 1000 },
{ timeout: 10 * 1000 },
async function (assetRefID: string) {
assertNonNullish((await readFabricAssetReference(assetRefID)));
assertNonNullish(await readFabricAssetReference(assetRefID));
},
);

Then(
"the asset reference with id {string} is locked in the source chain",
{ timeout: 10 * 1000 },
{ timeout: 10 * 1000 },
async function (assetRefID: string) {
assertEqual((await readFabricAssetReference(assetRefID)).isLocked, true)
assertEqual((await readFabricAssetReference(assetRefID)).isLocked, true);
},
);

Then(
"the asset reference chaincode has no asset reference with id {string}",
{ timeout: 10 * 1000 },
{ timeout: 10 * 1000 },
async function (assetRefID: string) {
assertEqual(await fabricAssetReferenceExists(assetRefID), "false")
assertEqual(await fabricAssetReferenceExists(assetRefID), "false");
},
);
18 changes: 9 additions & 9 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -125,8 +125,8 @@
"@types/tape-promise": "4.0.1",
"@types/uuid": "9.0.8",
"@types/yargs": "17.0.24",
"@typescript-eslint/eslint-plugin": "6.4.0",
"@typescript-eslint/parser": "6.4.0",
"@typescript-eslint/eslint-plugin": "7.1.0",
"@typescript-eslint/parser": "7.1.0",
"adm-zip": "0.5.10",
"benchmark": "2.1.4",
"buffer": "6.0.3",
Expand All @@ -138,13 +138,13 @@
"del-cli": "4.0.1",
"depcheck": "1.4.7",
"es-main": "1.2.0",
"eslint": "7.32.0",
"eslint-config-prettier": "8.10.0",
"eslint-config-standard": "16.0.3",
"eslint-plugin-import": "2.28.1",
"eslint": "8.57.0",
"eslint-config-prettier": "9.1.0",
"eslint-config-standard": "17.1.0",
"eslint-plugin-import": "2.29.1",
"eslint-plugin-node": "11.1.0",
"eslint-plugin-prettier": "5.0.0",
"eslint-plugin-promise": "5.2.0",
"eslint-plugin-prettier": "5.1.3",
"eslint-plugin-promise": "6.1.1",
"eslint-plugin-standard": "5.0.0",
"fast-safe-stringify": "2.1.1",
"fs-extra": "10.1.0",
Expand All @@ -164,7 +164,7 @@
"npm-run-all": "4.1.5",
"npm-watch": "0.11.0",
"openapi-types": "12.1.3",
"prettier": "3.0.3",
"prettier": "3.2.5",
"protoc-gen-ts": "0.8.7",
"run-time-error": "1.4.0",
"run-time-error-cjs": "1.4.0",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,8 @@ try {
delete data["services"]["peer0.org3.example.com"];

// l.33: container port
data["services"][orgName][
"environment"
][1] = `CORE_LEDGER_STATE_COUCHDBCONFIG_COUCHDBADDRESS=couchdb4:${containerPort}`;
data["services"][orgName]["environment"][1] =
`CORE_LEDGER_STATE_COUCHDBCONFIG_COUCHDBADDRESS=couchdb4:${containerPort}`;

//console.log("After modification");
//console.log(util.inspect(data, true, 10, true));
Expand Down Expand Up @@ -95,58 +94,48 @@ try {
data["services"][orgName]["environment"][8] = `CORE_PEER_ID=${orgName}`;

// CORE_PEER_ADDRESS=peer0.org3.example.com:11051
data["services"][orgName][
"environment"
][9] = `CORE_PEER_ADDRESS=${orgName}:${hostPort}`;
data["services"][orgName]["environment"][9] =
`CORE_PEER_ADDRESS=${orgName}:${hostPort}`;

// CORE_PEER_LISTENADDRESS=0.0.0.0:11051
data["services"][orgName][
"environment"
][10] = `CORE_PEER_LISTENADDRESS=0.0.0.0:${hostPort}`;
data["services"][orgName]["environment"][10] =
`CORE_PEER_LISTENADDRESS=0.0.0.0:${hostPort}`;

// - CORE_PEER_CHAINCODEADDRESS=peer0.org3.example.com:11052
const chaincodePort = parseInt(hostPort) + 1;
data["services"][orgName][
"environment"
][11] = `CORE_PEER_CHAINCODEADDRESS=${orgName}:${chaincodePort}`;
data["services"][orgName]["environment"][11] =
`CORE_PEER_CHAINCODEADDRESS=${orgName}:${chaincodePort}`;

// CORE_PEER_CHAINCODELISTENADDRESS=0.0.0.0:11052
data["services"][orgName][
"environment"
][12] = `CORE_PEER_CHAINCODELISTENADDRESS=0.0.0.0:${chaincodePort}`;
data["services"][orgName]["environment"][12] =
`CORE_PEER_CHAINCODELISTENADDRESS=0.0.0.0:${chaincodePort}`;

// - CORE_PEER_GOSSIP_BOOTSTRAP=peer0.org3.example.com:11051
data["services"][orgName][
"environment"
][13] = `CORE_PEER_GOSSIP_BOOTSTRAP=${orgName}:${hostPort}`;
data["services"][orgName]["environment"][13] =
`CORE_PEER_GOSSIP_BOOTSTRAP=${orgName}:${hostPort}`;

// - - CORE_PEER_GOSSIP_EXTERNALENDPOINT=peer0.org3.example.com:11051

data["services"][orgName][
"environment"
][14] = `CORE_PEER_GOSSIP_EXTERNALENDPOINT=${orgName}:${hostPort}`;
data["services"][orgName]["environment"][14] =
`CORE_PEER_GOSSIP_EXTERNALENDPOINT=${orgName}:${hostPort}`;

// - CORE_PEER_LOCALMSPID=Org3MSP

data["services"][orgName][
"environment"
][15] = `CORE_PEER_LOCALMSPID=${mspId}`;
data["services"][orgName]["environment"][15] =
`CORE_PEER_LOCALMSPID=${mspId}`;

/// Volumes
// - ../../organizations/peerOrganizations/org3.example.com/peers/peer0.org3.example.com/msp:/etc/hyperledger/fabric/msp
data["services"][orgName][
"volumes"
][1] = `../../organizations/peerOrganizations/${orgName}/peers/${orgName}/msp:/etc/hyperledger/fabric/msp`;
data["services"][orgName]["volumes"][1] =
`../../organizations/peerOrganizations/${orgName}/peers/${orgName}/msp:/etc/hyperledger/fabric/msp`;

// - ../../organizations/peerOrganizations/org3.example.com/peers/peer0.org3.example.com/tls:/etc/hyperledger/fabric/tls
data["services"][orgName][
"volumes"
][2] = `../../organizations/peerOrganizations/${orgName}/peers/${orgName}/tls:/etc/hyperledger/fabric/tls`;
data["services"][orgName]["volumes"][2] =
`../../organizations/peerOrganizations/${orgName}/peers/${orgName}/tls:/etc/hyperledger/fabric/tls`;

// - peer0.org3.example.com:/var/hyperledger/production
data["services"][orgName][
"volumes"
][3] = `${orgName}:/var/hyperledger/production`;
data["services"][orgName]["volumes"][3] =
`${orgName}:/var/hyperledger/production`;

data["services"][orgName]["ports"] = `${hostPort}:${hostPort}`;

Expand Down Expand Up @@ -177,21 +166,18 @@ try {
delete data["services"]["ca_org3"];

// - FABRIC_CA_SERVER_CA_NAME=ca-org3
data["services"][caName][
"environment"
][1] = `FABRIC_CA_SERVER_CA_NAME=${caName}`;
data["services"][caName]["environment"][1] =
`FABRIC_CA_SERVER_CA_NAME=${caName}`;

// - FABRIC_CA_SERVER_PORT=11054
data["services"][caName][
"environment"
][3] = `FABRIC_CA_SERVER_PORT=${hostPort}`;
data["services"][caName]["environment"][3] =
`FABRIC_CA_SERVER_PORT=${hostPort}`;

// - "11054:11054"
data["services"][caName]["ports"] = `${hostPort}:${hostPort}`;

data["services"][caName][
"volumes"
] = `../fabric-ca/${orgName}:/etc/hyperledger/fabric-ca-server`;
data["services"][caName]["volumes"] =
`../fabric-ca/${orgName}:/etc/hyperledger/fabric-ca-server`;

data["services"][caName]["container_name"] = caName;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -264,15 +264,15 @@ export class IrohaV2TestEnv {

if (this.socketioServer) {
this.log.info("Stop the SocketIO server connector...");
await new Promise<void>(
(resolve) => this.socketioServer?.close(() => resolve()),
await new Promise<void>((resolve) =>
this.socketioServer?.close(() => resolve()),
);
}

if (this.connectorServer) {
this.log.info("Stop the iroha2 connector...");
await new Promise<void>(
(resolve) => this.connectorServer?.close(() => resolve()),
await new Promise<void>((resolve) =>
this.connectorServer?.close(() => resolve()),
);
}

Expand Down
Loading

0 comments on commit 9c565e2

Please sign in to comment.