From d6b829c43002cdcf09328e2c25339b05a03a6905 Mon Sep 17 00:00:00 2001 From: Franco Victorio Date: Fri, 21 Jul 2023 11:24:49 +0200 Subject: [PATCH 1/4] Upgrade typescript --- package.json | 2 +- packages/hardhat-chai-matchers/package.json | 2 +- packages/hardhat-core/package.json | 2 +- packages/hardhat-ethers/package.json | 2 +- packages/hardhat-foundry/package.json | 2 +- packages/hardhat-ledger/package.json | 2 +- packages/hardhat-network-helpers/package.json | 2 +- packages/hardhat-shorthand/package.json | 2 +- packages/hardhat-solhint/package.json | 2 +- packages/hardhat-solpp/package.json | 2 +- packages/hardhat-toolbox/package.json | 2 +- packages/hardhat-truffle4/package.json | 2 +- packages/hardhat-truffle5/package.json | 2 +- packages/hardhat-verify/package.json | 2 +- packages/hardhat-vyper/package.json | 2 +- packages/hardhat-web3-legacy/package.json | 2 +- packages/hardhat-web3/package.json | 2 +- yarn.lock | 8 ++++---- 18 files changed, 21 insertions(+), 21 deletions(-) diff --git a/package.json b/package.json index 3f4ed1ccbf..1d16011f7f 100644 --- a/package.json +++ b/package.json @@ -19,7 +19,7 @@ "@changesets/cli": "^2.16.0", "prettier": "2.4.1", "shelljs": "^0.8.5", - "typescript": "~4.7.4", + "typescript": "~5.0.0", "wsrun": "^5.2.2" }, "scripts": { diff --git a/packages/hardhat-chai-matchers/package.json b/packages/hardhat-chai-matchers/package.json index d8b2d7d7ba..389ff22abf 100644 --- a/packages/hardhat-chai-matchers/package.json +++ b/packages/hardhat-chai-matchers/package.json @@ -59,7 +59,7 @@ "prettier": "2.4.1", "rimraf": "^3.0.2", "ts-node": "^10.8.0", - "typescript": "~4.7.4" + "typescript": "~5.0.0" }, "peerDependencies": { "@nomicfoundation/hardhat-ethers": "^3.0.0", diff --git a/packages/hardhat-core/package.json b/packages/hardhat-core/package.json index cb1ee4da74..15fd3bff77 100644 --- a/packages/hardhat-core/package.json +++ b/packages/hardhat-core/package.json @@ -92,7 +92,7 @@ "sinon": "^9.0.0", "time-require": "^0.1.2", "ts-node": "^10.8.0", - "typescript": "~4.7.4" + "typescript": "~5.0.0" }, "dependencies": { "@ethersproject/abi": "^5.1.2", diff --git a/packages/hardhat-ethers/package.json b/packages/hardhat-ethers/package.json index b23a6d80af..42f27d3206 100644 --- a/packages/hardhat-ethers/package.json +++ b/packages/hardhat-ethers/package.json @@ -65,7 +65,7 @@ "rimraf": "^3.0.2", "sinon": "^9.0.0", "ts-node": "^10.8.0", - "typescript": "~4.7.4" + "typescript": "~5.0.0" }, "peerDependencies": { "ethers": "^6.1.0", diff --git a/packages/hardhat-foundry/package.json b/packages/hardhat-foundry/package.json index ad9e626d45..0e788f4982 100644 --- a/packages/hardhat-foundry/package.json +++ b/packages/hardhat-foundry/package.json @@ -50,7 +50,7 @@ "prettier": "2.4.1", "rimraf": "^3.0.2", "ts-node": "^10.8.0", - "typescript": "~4.7.4" + "typescript": "~5.0.0" }, "peerDependencies": { "hardhat": "^2.12.6" diff --git a/packages/hardhat-ledger/package.json b/packages/hardhat-ledger/package.json index 83ee441d9d..d458a97c36 100644 --- a/packages/hardhat-ledger/package.json +++ b/packages/hardhat-ledger/package.json @@ -65,7 +65,7 @@ "prettier": "2.4.1", "ts-node": "^10.8.0", "sinon": "^9.0.0", - "typescript": "~4.7.4" + "typescript": "~5.0.0" }, "peerDependencies": { "hardhat": "^2.16.0" diff --git a/packages/hardhat-network-helpers/package.json b/packages/hardhat-network-helpers/package.json index 9f15e47208..a33a59f965 100644 --- a/packages/hardhat-network-helpers/package.json +++ b/packages/hardhat-network-helpers/package.json @@ -58,7 +58,7 @@ "prettier": "2.4.1", "rimraf": "^3.0.2", "ts-node": "^10.8.0", - "typescript": "~4.7.4" + "typescript": "~5.0.0" }, "peerDependencies": { "hardhat": "^2.9.5" diff --git a/packages/hardhat-shorthand/package.json b/packages/hardhat-shorthand/package.json index 2a93e2218a..22921aeef6 100644 --- a/packages/hardhat-shorthand/package.json +++ b/packages/hardhat-shorthand/package.json @@ -50,7 +50,7 @@ "prettier": "2.4.1", "rimraf": "^3.0.2", "ts-node": "^10.8.0", - "typescript": "~4.7.4" + "typescript": "~5.0.0" }, "dependencies": { "@fvictorio/tabtab": "^0.0.3", diff --git a/packages/hardhat-solhint/package.json b/packages/hardhat-solhint/package.json index 23ec0831e1..0735ac0cb7 100644 --- a/packages/hardhat-solhint/package.json +++ b/packages/hardhat-solhint/package.json @@ -56,7 +56,7 @@ "rimraf": "^3.0.2", "sinon": "^9.0.0", "ts-node": "^10.8.0", - "typescript": "~4.7.4" + "typescript": "~5.0.0" }, "peerDependencies": { "hardhat": "^2.0.0" diff --git a/packages/hardhat-solpp/package.json b/packages/hardhat-solpp/package.json index 5298c1b00d..67adb101e1 100644 --- a/packages/hardhat-solpp/package.json +++ b/packages/hardhat-solpp/package.json @@ -55,7 +55,7 @@ "prettier": "2.4.1", "rimraf": "^3.0.2", "ts-node": "^10.8.0", - "typescript": "~4.7.4" + "typescript": "~5.0.0" }, "peerDependencies": { "hardhat": "^2.0.0" diff --git a/packages/hardhat-toolbox/package.json b/packages/hardhat-toolbox/package.json index b0b7babc6f..7655770537 100644 --- a/packages/hardhat-toolbox/package.json +++ b/packages/hardhat-toolbox/package.json @@ -64,7 +64,7 @@ "solidity-coverage": "^0.8.1", "ts-node": "^10.8.0", "typechain": "^8.2.0", - "typescript": "~4.7.4" + "typescript": "~5.0.0" }, "peerDependencies": { "@nomicfoundation/hardhat-network-helpers": "^1.0.0", diff --git a/packages/hardhat-truffle4/package.json b/packages/hardhat-truffle4/package.json index 0ea1b34935..f67c29e83c 100644 --- a/packages/hardhat-truffle4/package.json +++ b/packages/hardhat-truffle4/package.json @@ -58,7 +58,7 @@ "prettier": "2.4.1", "rimraf": "^3.0.2", "ts-node": "^10.8.0", - "typescript": "~4.7.4", + "typescript": "~5.0.0", "web3": "^0.20.0" }, "peerDependencies": { diff --git a/packages/hardhat-truffle5/package.json b/packages/hardhat-truffle5/package.json index fc61de9cc9..bf88d11ffd 100644 --- a/packages/hardhat-truffle5/package.json +++ b/packages/hardhat-truffle5/package.json @@ -58,7 +58,7 @@ "prettier": "2.4.1", "rimraf": "^3.0.2", "ts-node": "^10.8.0", - "typescript": "~4.7.4", + "typescript": "~5.0.0", "web3": "^1.0.0-beta.36" }, "peerDependencies": { diff --git a/packages/hardhat-verify/package.json b/packages/hardhat-verify/package.json index 90f87450ca..ba75fd89ed 100644 --- a/packages/hardhat-verify/package.json +++ b/packages/hardhat-verify/package.json @@ -71,7 +71,7 @@ "sinon": "^9.0.0", "sinon-chai": "^3.7.0", "ts-node": "^10.8.0", - "typescript": "~4.7.4" + "typescript": "~5.0.0" }, "peerDependencies": { "hardhat": "^2.0.4" diff --git a/packages/hardhat-vyper/package.json b/packages/hardhat-vyper/package.json index 83ca5a28b3..5afb0e4d8c 100644 --- a/packages/hardhat-vyper/package.json +++ b/packages/hardhat-vyper/package.json @@ -58,7 +58,7 @@ "prettier": "2.4.1", "rimraf": "^3.0.2", "ts-node": "^10.8.0", - "typescript": "~4.7.4" + "typescript": "~5.0.0" }, "peerDependencies": { "hardhat": "^2.8.3" diff --git a/packages/hardhat-web3-legacy/package.json b/packages/hardhat-web3-legacy/package.json index ce8b9f4c13..d79b700fe4 100644 --- a/packages/hardhat-web3-legacy/package.json +++ b/packages/hardhat-web3-legacy/package.json @@ -49,7 +49,7 @@ "prettier": "2.4.1", "rimraf": "^3.0.2", "ts-node": "^10.8.0", - "typescript": "~4.7.4", + "typescript": "~5.0.0", "web3": "^0.20.0" }, "peerDependencies": { diff --git a/packages/hardhat-web3/package.json b/packages/hardhat-web3/package.json index 4076a6861c..b010e3bdb1 100644 --- a/packages/hardhat-web3/package.json +++ b/packages/hardhat-web3/package.json @@ -49,7 +49,7 @@ "prettier": "2.4.1", "rimraf": "^3.0.2", "ts-node": "^10.8.0", - "typescript": "~4.7.4", + "typescript": "~5.0.0", "web3": "^1.0.0-beta.36" }, "peerDependencies": { diff --git a/yarn.lock b/yarn.lock index 6c7db8128b..f2874631a8 100644 --- a/yarn.lock +++ b/yarn.lock @@ -9529,10 +9529,10 @@ typedarray@^0.0.6: resolved "https://registry.yarnpkg.com/typedarray/-/typedarray-0.0.6.tgz#867ac74e3864187b1d3d47d996a78ec5c8830777" integrity sha512-/aCDEGatGvZ2BIk+HmLf4ifCJFwvKFNb9/JeZPMulfgFracn9QFcAf5GO8B/mweUjSoblS5In0cWhqpfs/5PQA== -typescript@~4.7.4: - version "4.7.4" - resolved "https://registry.yarnpkg.com/typescript/-/typescript-4.7.4.tgz#1a88596d1cf47d59507a1bcdfb5b9dfe4d488235" - integrity sha512-C0WQT0gezHuw6AdY1M2jxUO83Rjf0HP7Sk1DtXj6j1EwkQNZrHAg2XPWlq62oqEhYvONq5pkC2Y9oPljWToLmQ== +typescript@~5.0.0: + version "5.0.4" + resolved "https://registry.yarnpkg.com/typescript/-/typescript-5.0.4.tgz#b217fd20119bd61a94d4011274e0ab369058da3b" + integrity sha512-cW9T5W9xY37cc+jfEnaUvX91foxtHkza3Nw3wkoF4sSlKn0MONdkdEndig/qPBWXNkmplh3NzayQzCiHM4/hqw== typical@^4.0.0: version "4.0.0" From 999c5ea64f15b2873650676c8279e2807721c037 Mon Sep 17 00:00:00 2001 From: Franco Victorio Date: Fri, 21 Jul 2023 11:27:30 +0200 Subject: [PATCH 2/4] Fix compilation errors in hardhat-core --- .../hardhat-network/provider/fork/rpcToTxData.ts | 11 ++++++++++- packages/hardhat-core/src/internal/util/unsafe.ts | 2 +- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/packages/hardhat-core/src/internal/hardhat-network/provider/fork/rpcToTxData.ts b/packages/hardhat-core/src/internal/hardhat-network/provider/fork/rpcToTxData.ts index 09782ac180..93d8c2fce9 100644 --- a/packages/hardhat-core/src/internal/hardhat-network/provider/fork/rpcToTxData.ts +++ b/packages/hardhat-core/src/internal/hardhat-network/provider/fork/rpcToTxData.ts @@ -1,11 +1,20 @@ +import type { BigIntLike } from "@nomicfoundation/ethereumjs-util"; + import { AccessListEIP2930TxData, TxData, } from "@nomicfoundation/ethereumjs-tx"; -import { FeeMarketEIP1559TxData } from "@nomicfoundation/ethereumjs-tx/dist/types"; import { RpcTransaction } from "../../../core/jsonrpc/types/output/transaction"; +// the FeeMarketEIP1559TxData interface from ethereum js also has a +// `gasPrice?: never | null` property, which causes a compilation +// error in the latest version of typescript +interface FeeMarketEIP1559TxData extends AccessListEIP2930TxData { + maxPriorityFeePerGas?: BigIntLike; + maxFeePerGas?: BigIntLike; +} + export function rpcToTxData( rpcTransaction: RpcTransaction ): TxData | AccessListEIP2930TxData | FeeMarketEIP1559TxData { diff --git a/packages/hardhat-core/src/internal/util/unsafe.ts b/packages/hardhat-core/src/internal/util/unsafe.ts index abb8b3910a..417a23059c 100644 --- a/packages/hardhat-core/src/internal/util/unsafe.ts +++ b/packages/hardhat-core/src/internal/util/unsafe.ts @@ -10,6 +10,6 @@ export const unsafeObjectKeys = Object.keys as ( * This function is a typed version of `Object.entries`. Note that it's type * unsafe. You have to be sure that `o` has exactly the same keys as `T`. */ -export function unsafeObjectEntries(o: T) { +export function unsafeObjectEntries(o: T) { return Object.entries(o) as Array<[keyof T, T[keyof T]]>; } From 28447133f655129ce1ee47a86b291677fb7c114d Mon Sep 17 00:00:00 2001 From: Franco Victorio Date: Fri, 21 Jul 2023 11:41:21 +0200 Subject: [PATCH 3/4] Add workflow to compile the project with typescript v4 --- .../workflows/compile-with-typescript-v4.yml | 22 +++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 .github/workflows/compile-with-typescript-v4.yml diff --git a/.github/workflows/compile-with-typescript-v4.yml b/.github/workflows/compile-with-typescript-v4.yml new file mode 100644 index 0000000000..84435f1a87 --- /dev/null +++ b/.github/workflows/compile-with-typescript-v4.yml @@ -0,0 +1,22 @@ +name: Compile with typescript v4 + +on: + push: + branches: main + pull_request: + branches: + - "**" + +jobs: + compile_with_typescript_v4: + name: Compile with typescript v4 + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - uses: actions/setup-node@v2 + with: + node-version: 16 + - name: Install typescript v4 in all packages + run: sed -i 's/"typescript": "~5.0.0"/"typescript": "^4.0.0"/' package.json packages/*/package.json && yarn + - name: Build + run: yarn build From 79f3941fa0d799eee8a7e7e209589f1f0fde133d Mon Sep 17 00:00:00 2001 From: Franco Victorio Date: Fri, 21 Jul 2023 11:43:09 +0200 Subject: [PATCH 4/4] Update compile-with-typescript-v4.yml --- .github/workflows/compile-with-typescript-v4.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/compile-with-typescript-v4.yml b/.github/workflows/compile-with-typescript-v4.yml index 84435f1a87..4be5edf28f 100644 --- a/.github/workflows/compile-with-typescript-v4.yml +++ b/.github/workflows/compile-with-typescript-v4.yml @@ -17,6 +17,7 @@ jobs: with: node-version: 16 - name: Install typescript v4 in all packages - run: sed -i 's/"typescript": "~5.0.0"/"typescript": "^4.0.0"/' package.json packages/*/package.json && yarn + run: | + sed -i 's/"typescript": "~5.0.0"/"typescript": "^4.0.0"/' package.json packages/*/package.json && yarn - name: Build run: yarn build