Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: lockfile #48

Merged
merged 3 commits into from
Mar 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
node-version: ${{ matrix.node-version }}

- name: Install dependencies
run: yarn install
run: yarn install --frozen-lockfile --non-interactive

- name: Compile contracts
run: npx hardhat compile
Expand Down
1 change: 0 additions & 1 deletion hardhat.config.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import * as dotenv from "dotenv";

import type { HardhatUserConfig } from "hardhat/config";
import "hardhat-preprocessor";
import "@nomicfoundation/hardhat-toolbox";
Expand Down
8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,11 @@
"@types/chai": "^4.2.0",
"@types/mocha": ">=9.1.0",
"@types/node": ">=16.0.0",
"@typescript-eslint/eslint-plugin": "^6.7.4",
"@typescript-eslint/parser": "^6.7.4",
"@typescript-eslint/eslint-plugin": "^7.3.1",
"@typescript-eslint/parser": "^7.3.1",
"chai": "^4.2.0",
"chain": "^0.4.0",
"eslint": "^8.50.0",
"eslint": "^8.57.0",
"eslint-config-prettier": "^9.0.0",
"eslint-plugin-prettier": "^5.0.1",
"ethers": "^6.7.1",
Expand All @@ -55,7 +55,7 @@
"ts-node": ">=8.0.0",
"tslint-config-prettier": "^1.18.0",
"typechain": "^8.1.0",
"typescript": ">=4.5.0"
"typescript": "5.3.3"
},
"dependencies": {
"dotenv": "^16.4.1"
Expand Down
2 changes: 1 addition & 1 deletion scripts/migrations/01_deployCoreContracts.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { ethers } from "hardhat";
import type { DeployFunction } from "hardhat-deploy/dist/types";
import type { HardhatRuntimeEnvironment } from "hardhat/types";
import type { DeployFunction } from "hardhat-deploy/dist/types";

import { generateAccessControlFuncSignatures, verifyContract } from "../utils";

Expand Down
3 changes: 2 additions & 1 deletion scripts/migrations/02_deployHandlers.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import type { DeployFunction } from "hardhat-deploy/dist/types";
import type { HardhatRuntimeEnvironment } from "hardhat/types";
import type { DeployFunction } from "hardhat-deploy/dist/types";

import { verifyContract } from "../utils";

const deployFunc: DeployFunction = async function ({
Expand Down
3 changes: 2 additions & 1 deletion scripts/utils.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import fs from "fs";
import { resolve } from "path";
import { deployments, run } from "hardhat";

import { keccak256, ContractFactory } from "ethers";
import type { InterfaceAbi, Fragment } from "ethers";
import { deployments, run } from "hardhat";
import type { DeployResult } from "hardhat-deploy/dist/types";

export function generateAccessControlFuncSignatures(contracts: Array<string>): {
Expand Down
15 changes: 8 additions & 7 deletions test/contractBridge/admin.test.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,10 @@
// The Licensed Work is (c) 2022 Sygma
// SPDX-License-Identifier: LGPL-3.0-only

import { ethers } from "hardhat";
import { assert, expect } from "chai";
import type { HardhatEthersSigner } from "@nomicfoundation/hardhat-ethers/signers";
import {
deployBridgeContracts,
createResourceID,
createERCWithdrawData,
} from "../helpers";
import { assert, expect } from "chai";
import { ethers } from "hardhat";

import type {
Bridge,
Router,
Expand All @@ -18,6 +14,11 @@ import type {
ERC20PresetMinterPauser__factory,
Executor,
} from "../../typechain-types";
import {
deployBridgeContracts,
createResourceID,
createERCWithdrawData,
} from "../helpers";

// This test does NOT include all getter methods, just
// getters that should work with only the constructor called
Expand Down
2 changes: 1 addition & 1 deletion test/contractBridge/constructor.test.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
// The Licensed Work is (c) 2022 Sygma
// SPDX-License-Identifier: LGPL-3.0-only

import { ethers } from "hardhat";
import { expect } from "chai";
import { ethers } from "hardhat";

describe("Bridge/Router/Executor - [constructor]", () => {
const domainID = 1;
Expand Down
5 changes: 3 additions & 2 deletions test/contractBridge/depositERC20.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,10 @@
import type { HardhatEthersSigner } from "@nomicfoundation/hardhat-ethers/signers";
import { assert, expect } from "chai";
import { ethers } from "hardhat";

import type {
Bridge,
Depositor,
Router,
ERC20Handler,
ERC20PresetMinterPauser,
ERC20Safe__factory,
Expand All @@ -31,7 +32,7 @@ describe("Bridge - [deposit - ERC20]", () => {
const routerAddress = "0x1a60efB48c61A79515B170CA61C84DD6dCA80418";

let bridgeInstance: Bridge;
let routerInstance: Depositor;
let routerInstance: Router;
let executorInstance: Executor;
let ERC20MintableInstance1: ERC20PresetMinterPauser;
let ERC20MintableInstance2: ERC20PresetMinterPauser;
Expand Down
9 changes: 4 additions & 5 deletions test/contractBridge/executeProposalERC20.test.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,9 @@
// The Licensed Work is (c) 2022 Sygma
// SPDX-License-Identifier: LGPL-3.0-only

import { ethers } from "hardhat";
import { assert, expect } from "chai";
import type { HardhatEthersSigner } from "@nomicfoundation/hardhat-ethers/signers";
import { deployBridgeContracts, createERCDepositData } from "../helpers";

import { accountProof1, storageProof1 } from "../testingProofs";
import { assert, expect } from "chai";
import { ethers } from "hardhat";

import type {
Bridge,
Expand All @@ -17,6 +14,8 @@ import type {
StateRootStorage,
MerkleTrie__factory,
} from "../../typechain-types";
import { deployBridgeContracts, createERCDepositData } from "../helpers";
import { accountProof1, storageProof1 } from "../testingProofs";

describe("Bridge - [execute proposal - ERC20]", () => {
const originDomainID = 1;
Expand Down
11 changes: 7 additions & 4 deletions test/contractBridge/executeProposals.test.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
// The Licensed Work is (c) 2022 Sygma
// SPDX-License-Identifier: LGPL-3.0-only

import { ethers } from "hardhat";
import { assert, expect } from "chai";
import type { HardhatEthersSigner } from "@nomicfoundation/hardhat-ethers/signers";
import { deployBridgeContracts, createERCDepositData } from "../helpers";
import { accountProof1, storageProof1 } from "../testingProofs";
import { assert, expect } from "chai";
import { ethers } from "hardhat";

import type {
Bridge,
Expand All @@ -15,6 +13,8 @@ import type {
ERC20PresetMinterPauser,
StateRootStorage,
} from "../../typechain-types";
import { deployBridgeContracts, createERCDepositData } from "../helpers";
import { accountProof1, storageProof1 } from "../testingProofs";

describe("Bridge - [execute proposals]", () => {
const originDomainID = 1;
Expand Down Expand Up @@ -145,6 +145,7 @@ describe("Bridge - [execute proposals]", () => {
await expect(executeTx).not.to.be.reverted;

// check that deposit nonces had been marked as used in bitmap
// eslint-disable-next-line @typescript-eslint/no-floating-promises
expectedDepositNonces.map(async (_, index) => {
assert.isTrue(
await executorInstance.isProposalExecuted(
Expand Down Expand Up @@ -184,6 +185,7 @@ describe("Bridge - [execute proposals]", () => {
await expect(executeTx).not.to.be.reverted;

// check that deposit nonces had been marked as used in bitmap
// eslint-disable-next-line @typescript-eslint/no-floating-promises
expectedDepositNonces.map(async (_, index) => {
assert.isTrue(
await executorInstance.isProposalExecuted(
Expand Down Expand Up @@ -252,6 +254,7 @@ describe("Bridge - [execute proposals]", () => {
);

// check that deposit nonces had been marked as used in bitmap
// eslint-disable-next-line @typescript-eslint/no-floating-promises
expectedDepositNonces.map(async (_, index) => {
assert.isTrue(
await executorInstance.isProposalExecuted(
Expand Down
22 changes: 11 additions & 11 deletions test/e2e/erc20/decimals/bothChainsNot18Decimals.test.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,18 @@
// The Licensed Work is (c) 2022 Sygma
// SPDX-License-Identifier: LGPL-3.0-only

import { ethers } from "hardhat";
import { assert, expect } from "chai";
import type { HardhatEthersSigner } from "@nomicfoundation/hardhat-ethers/signers";
import { assert, expect } from "chai";
import { ethers } from "hardhat";

import type {
StateRootStorage,
Bridge,
ERC20Handler,
ERC20PresetMinterPauser,
Executor,
Router,
} from "../../../../typechain-types";
import {
deployBridgeContracts,
createERCDepositData,
Expand All @@ -16,15 +25,6 @@ import {
storageProof4,
} from "../../../testingProofs";

import type {
StateRootStorage,
Bridge,
ERC20Handler,
ERC20PresetMinterPauser,
Executor,
Router,
} from "../../../../typechain-types";

describe("E2E ERC20 - Two EVM Chains both with decimal places != 18", () => {
const originDomainID = 1;
const destinationDomainID = 2;
Expand Down
21 changes: 10 additions & 11 deletions test/e2e/erc20/decimals/oneChainNot18Decimals.test.ts
Original file line number Diff line number Diff line change
@@ -1,31 +1,30 @@
// The Licensed Work is (c) 2022 Sygma
// SPDX-License-Identifier: LGPL-3.0-only

import type { HardhatEthersSigner } from "@nomicfoundation/hardhat-ethers/signers";
import { expect, assert } from "chai";
import { ethers } from "hardhat";
import type { HardhatEthersSigner } from "@nomicfoundation/hardhat-ethers/signers";

import type {
StateRootStorage,
Bridge,
ERC20Handler,
ERC20PresetMinterPauser,
Executor,
Router,
} from "../../../../typechain-types";
import {
deployBridgeContracts,
createERCDepositData,
getDepositEventData,
} from "../../../helpers";

import {
accountProof3,
storageProof3,
accountProof4,
storageProof4,
} from "../../../testingProofs";

import type {
StateRootStorage,
Bridge,
ERC20Handler,
ERC20PresetMinterPauser,
Executor,
Router,
} from "../../../../typechain-types";

describe("E2E ERC20 - Two EVM Chains, one with decimal places == 18, other with != 18", () => {
const originDomainID = 1;
const destinationDomainID = 2;
Expand Down
23 changes: 11 additions & 12 deletions test/e2e/erc20/decimals/oneChainWith0Decimals.test.ts
Original file line number Diff line number Diff line change
@@ -1,31 +1,30 @@
// The Licensed Work is (c) 2022 Sygma
// SPDX-License-Identifier: LGPL-3.0-only

import { ethers } from "hardhat";
import { assert, expect } from "chai";
import type { HardhatEthersSigner } from "@nomicfoundation/hardhat-ethers/signers";
import { assert, expect } from "chai";
import { ethers } from "hardhat";

import type {
Bridge,
ERC20Handler,
ERC20PresetMinterPauser,
Executor,
Router,
StateRootStorage,
} from "../../../../typechain-types";
import {
deployBridgeContracts,
createERCDepositData,
getDepositEventData,
} from "../../../helpers";

import {
accountProof5,
storageProof5,
accountProof6,
storageProof6,
} from "../../../testingProofs";

import type {
Bridge,
ERC20Handler,
ERC20PresetMinterPauser,
Executor,
Router,
StateRootStorage,
} from "../../../../typechain-types";

describe("E2E ERC20 - Two EVM Chains, one with decimal places == 18, other with == 0", () => {
const originDomainID = 1;
const destinationDomainID = 2;
Expand Down
23 changes: 11 additions & 12 deletions test/e2e/erc20/decimals/roundingLoss.test.ts
Original file line number Diff line number Diff line change
@@ -1,32 +1,31 @@
// The Licensed Work is (c) 2022 Sygma
// SPDX-License-Identifier: LGPL-3.0-only

import { ethers } from "hardhat";
import { assert, expect } from "chai";
import type { HardhatEthersSigner } from "@nomicfoundation/hardhat-ethers/signers";
import { assert, expect } from "chai";
import { ethers } from "hardhat";

import type {
Bridge,
ERC20Handler,
ERC20PresetMinterPauser,
Router,
Executor,
StateRootStorage,
} from "../../../../typechain-types";
import {
deployBridgeContracts,
createERCDepositData,
toHex,
getDepositEventData,
} from "../../../helpers";

import {
accountProof7,
storageProof7,
accountProof8,
storageProof8,
} from "../../../testingProofs";

import type {
Bridge,
ERC20Handler,
ERC20PresetMinterPauser,
Router,
Executor,
StateRootStorage,
} from "../../../../typechain-types";

describe("E2E ERC20 - Two EVM Chains both with decimal places != 18 with rounding loss", () => {
const originDomainID = 1;
const destinationDomainID = 2;
Expand Down
19 changes: 9 additions & 10 deletions test/e2e/erc20/differentChainsMock.test.ts
Original file line number Diff line number Diff line change
@@ -1,17 +1,9 @@
// The Licensed Work is (c) 2022 Sygma
// SPDX-License-Identifier: LGPL-3.0-only

import { ethers } from "hardhat";
import { assert, expect } from "chai";
import type { HardhatEthersSigner } from "@nomicfoundation/hardhat-ethers/signers";
import { deployBridgeContracts, createERCDepositData } from "../../helpers";

import {
accountProof1,
storageProof1,
accountProof2,
storageProof2,
} from "../../testingProofs";
import { assert, expect } from "chai";
import { ethers } from "hardhat";

import type {
Bridge,
Expand All @@ -21,6 +13,13 @@ import type {
ERC20PresetMinterPauser,
StateRootStorage,
} from "../../../typechain-types";
import { deployBridgeContracts, createERCDepositData } from "../../helpers";
import {
accountProof1,
storageProof1,
accountProof2,
storageProof2,
} from "../../testingProofs";

describe("E2E ERC20 - Two EVM Chains", () => {
const originDomainID = 1;
Expand Down
Loading
Loading