From d325ea63d095fbea341cee9122c52b5d8b4ab21d Mon Sep 17 00:00:00 2001 From: Franco Victorio Date: Fri, 27 Sep 2024 09:53:29 +0200 Subject: [PATCH 1/6] Upgrade hardhat --- hardhat-tests/package.json | 2 +- pnpm-lock.yaml | 85 +++++++++++++++++++++++++++++++++++++- 2 files changed, 84 insertions(+), 3 deletions(-) diff --git a/hardhat-tests/package.json b/hardhat-tests/package.json index 381681a81..201e12d8a 100644 --- a/hardhat-tests/package.json +++ b/hardhat-tests/package.json @@ -38,7 +38,7 @@ "ethereumjs-abi": "^0.6.8", "ethers": "^6.1.0", "fs-extra": "^7.0.1", - "hardhat": "2.22.10", + "hardhat": "2.22.12", "mocha": "^10.0.0", "prettier": "^3.2.5", "rimraf": "^3.0.2", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index f7504486a..0e5d2718d 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -246,8 +246,8 @@ importers: specifier: ^7.0.1 version: 7.0.1 hardhat: - specifier: 2.22.10 - version: 2.22.10(ts-node@10.9.2(@types/node@20.16.1)(typescript@5.0.4))(typescript@5.0.4) + specifier: 2.22.12 + version: 2.22.12(ts-node@10.9.2(@types/node@20.16.1)(typescript@5.0.4))(typescript@5.0.4) mocha: specifier: ^10.0.0 version: 10.3.0 @@ -1286,6 +1286,10 @@ packages: resolution: {integrity: sha512-7VT13fmjotKpGipCW9JEQAusEPE+Ei8nl6/g4FBAmIm0GOOLMua9NDDo/DWp0ZAxCr3cPq5ZpBqmPAQgDda2Pw==} engines: {node: '>= 8.10.0'} + chokidar@4.0.1: + resolution: {integrity: sha512-n8enUVCED/KVRQlab1hr3MVpcVMvxtZjmEa956u+4YijlmQED223XMSYj2tLuKvr4jcCTzNNMpQDUer72MMmzA==} + engines: {node: '>= 14.16.0'} + ci-info@2.0.0: resolution: {integrity: sha512-5tK7EtrZ0N+OLFMthtqOj4fI2Jeb88C4CAZPu25LDVUgXJ0A3Js4PMGqrn0JU1W0Mh1/Z8wZzYPxqUrXeBboCQ==} @@ -1879,6 +1883,18 @@ packages: typescript: optional: true + hardhat@2.22.12: + resolution: {integrity: sha512-yok65M+LsOeTBHQsjg//QreGCyrsaNmeLVzhTFqlOvZ4ZE5y69N0wRxH1b2BC9dGK8S8OPUJMNiL9X0RAvbm8w==} + hasBin: true + peerDependencies: + ts-node: '*' + typescript: '*' + peerDependenciesMeta: + ts-node: + optional: true + typescript: + optional: true + has-bigints@1.0.2: resolution: {integrity: sha512-tSvCKtBr9lkF0Ex0aQiP9N+OpV4zi2r/Nee5VkRDbaqv35RLYMzbwQfFSZZH0kR+Rd6302UJZ2p/bJCEoR3VoQ==} @@ -2572,6 +2588,10 @@ packages: resolution: {integrity: sha512-hOS089on8RduqdbhvQ5Z37A0ESjsqz6qnRcffsMU3495FuTdqSm+7bhJ29JvIOsBDEEnan5DPu9t3To9VRlMzA==} engines: {node: '>=8.10.0'} + readdirp@4.0.1: + resolution: {integrity: sha512-GkMg9uOTpIWWKbSsgwb5fA4EavTR+SG/PMPoAY8hkhHfEEY0/vqljY+XHqtDf2cr2IJtoNRDbrrEpZUiZCkYRw==} + engines: {node: '>= 14.16.0'} + redent@3.0.0: resolution: {integrity: sha512-6tDA8g98We0zd0GvVeMT9arEOnTw9qM03L9cJXaCjrip1OO764RDBLBfrB4cwzNGDj5OA5ioymC9GkizgWJDUg==} engines: {node: '>=8'} @@ -4427,6 +4447,10 @@ snapshots: optionalDependencies: fsevents: 2.3.3 + chokidar@4.0.1: + dependencies: + readdirp: 4.0.1 + ci-info@2.0.0: {} ci-info@3.9.0: {} @@ -5248,6 +5272,61 @@ snapshots: - supports-color - utf-8-validate + hardhat@2.22.12(ts-node@10.9.2(@types/node@20.16.1)(typescript@5.0.4))(typescript@5.0.4): + dependencies: + '@ethersproject/abi': 5.7.0 + '@metamask/eth-sig-util': 4.0.1 + '@nomicfoundation/edr': link:crates/edr_napi + '@nomicfoundation/ethereumjs-common': 4.0.4 + '@nomicfoundation/ethereumjs-tx': 5.0.4 + '@nomicfoundation/ethereumjs-util': 9.0.4 + '@nomicfoundation/solidity-analyzer': 0.1.1 + '@sentry/node': 5.30.0 + '@types/bn.js': 5.1.5 + '@types/lru-cache': 5.1.1 + adm-zip: 0.4.16 + aggregate-error: 3.1.0 + ansi-escapes: 4.3.2 + boxen: 5.1.2 + chalk: 2.4.2 + chokidar: 4.0.1 + ci-info: 2.0.0 + debug: 4.3.4(supports-color@8.1.1) + enquirer: 2.4.1 + env-paths: 2.2.1 + ethereum-cryptography: 1.2.0 + ethereumjs-abi: 0.6.8 + find-up: 2.1.0 + fp-ts: 1.19.3 + fs-extra: 7.0.1 + glob: 7.2.0 + immutable: 4.3.5 + io-ts: 1.10.4 + json-stream-stringify: 3.1.4 + keccak: 3.0.4 + lodash: 4.17.21 + mnemonist: 0.38.5 + mocha: 10.3.0 + p-map: 4.0.0 + raw-body: 2.5.2 + resolve: 1.17.0 + semver: 6.3.1 + solc: 0.8.26(debug@4.3.4) + source-map-support: 0.5.21 + stacktrace-parser: 0.1.10 + tsort: 0.0.1 + undici: 5.28.3 + uuid: 8.3.2 + ws: 7.5.9 + optionalDependencies: + ts-node: 10.9.2(@types/node@20.16.1)(typescript@5.0.4) + typescript: 5.0.4 + transitivePeerDependencies: + - bufferutil + - c-kzg + - supports-color + - utf-8-validate + has-bigints@1.0.2: {} has-flag@3.0.0: {} @@ -5917,6 +5996,8 @@ snapshots: dependencies: picomatch: 2.3.1 + readdirp@4.0.1: {} + redent@3.0.0: dependencies: indent-string: 4.0.0 From e959befe965f12f4ff313783a27636c58ed1578b Mon Sep 17 00:00:00 2001 From: Franco Victorio Date: Fri, 27 Sep 2024 09:53:37 +0200 Subject: [PATCH 2/6] Remove old patch --- patches/hardhat@2.22.9.patch | 13 ------------- 1 file changed, 13 deletions(-) delete mode 100644 patches/hardhat@2.22.9.patch diff --git a/patches/hardhat@2.22.9.patch b/patches/hardhat@2.22.9.patch deleted file mode 100644 index cd9da39fb..000000000 --- a/patches/hardhat@2.22.9.patch +++ /dev/null @@ -1,13 +0,0 @@ -diff --git a/internal/hardhat-network/provider/provider.js b/internal/hardhat-network/provider/provider.js -index 5538259ab7fcbf99b7fa82e26922510da6444613..8d230d2421d977efc22f0dfdde676c6559420e88 100644 ---- a/internal/hardhat-network/provider/provider.js -+++ b/internal/hardhat-network/provider/provider.js -@@ -415,7 +415,7 @@ async function createHardhatNetworkProvider(hardhatNetworkProviderConfig, logger - log("Making tracing config"); - const tracingConfig = await makeTracingConfig(artifacts); - log("Creating EDR provider"); -- const provider = EdrProviderWrapper.create(hardhatNetworkProviderConfig, loggerConfig, tracingConfig); -+ const provider = await EdrProviderWrapper.create(hardhatNetworkProviderConfig, loggerConfig, tracingConfig); - log("EDR provider created"); - return provider; - } From b4b8bf4e2d9bb8d87d31b324bd25cbef47609ba0 Mon Sep 17 00:00:00 2001 From: Franco Victorio Date: Fri, 27 Sep 2024 10:13:58 +0200 Subject: [PATCH 3/6] Sync hardhat-tests with hardhat repo --- hardhat-tests/package.json | 1 + .../stack-traces/compilers-list.ts | 46 ++++++++++++++++-- .../hardhat-network/stack-traces/execution.ts | 2 +- .../hardhat-network/stack-traces/test.ts | 47 +++++++++---------- pnpm-lock.yaml | 3 ++ 5 files changed, 69 insertions(+), 30 deletions(-) diff --git a/hardhat-tests/package.json b/hardhat-tests/package.json index 201e12d8a..b7b41a84f 100644 --- a/hardhat-tests/package.json +++ b/hardhat-tests/package.json @@ -4,6 +4,7 @@ "author": "Nomic Foundation", "devDependencies": { "@metamask/eth-sig-util": "^4.0.0", + "@nomicfoundation/edr": "workspace:*", "@nomicfoundation/ethereumjs-block": "5.0.4", "@nomicfoundation/ethereumjs-common": "^4.0.4", "@nomicfoundation/ethereumjs-tx": "^5.0.4", diff --git a/hardhat-tests/test/internal/hardhat-network/stack-traces/compilers-list.ts b/hardhat-tests/test/internal/hardhat-network/stack-traces/compilers-list.ts index d53377c77..71c925f81 100644 --- a/hardhat-tests/test/internal/hardhat-network/stack-traces/compilers-list.ts +++ b/hardhat-tests/test/internal/hardhat-network/stack-traces/compilers-list.ts @@ -220,7 +220,6 @@ export const solidityCompilers: SolidityCompiler[] = [ { solidityVersion: "0.8.22", compilerPath: "soljson-v0.8.22+commit.4fc1097e.js", - latestSolcVersion: true, }, { solidityVersion: "0.8.22", @@ -229,12 +228,10 @@ export const solidityCompilers: SolidityCompiler[] = [ runs: 200, viaIR: true, }, - latestSolcVersion: true, }, { solidityVersion: "0.8.23", compilerPath: "soljson-v0.8.23+commit.f704f362.js", - latestSolcVersion: true, }, { solidityVersion: "0.8.23", @@ -243,12 +240,10 @@ export const solidityCompilers: SolidityCompiler[] = [ runs: 200, viaIR: true, }, - latestSolcVersion: true, }, { solidityVersion: "0.8.24", compilerPath: "soljson-v0.8.24+commit.e11b9ed9.js", - latestSolcVersion: true, }, { solidityVersion: "0.8.24", @@ -257,6 +252,47 @@ export const solidityCompilers: SolidityCompiler[] = [ runs: 200, viaIR: true, }, + }, + { + solidityVersion: "0.8.25", + compilerPath: "soljson-v0.8.25+commit.b61c2a91.js", + latestSolcVersion: true, + }, + { + solidityVersion: "0.8.25", + compilerPath: "soljson-v0.8.25+commit.b61c2a91.js", + optimizer: { + runs: 200, + viaIR: true, + }, + latestSolcVersion: true, + }, + { + solidityVersion: "0.8.26", + compilerPath: "soljson-v0.8.26+commit.8a97fa7a.js", + latestSolcVersion: true, + }, + { + solidityVersion: "0.8.26", + compilerPath: "soljson-v0.8.26+commit.8a97fa7a.js", + optimizer: { + runs: 200, + viaIR: true, + }, + latestSolcVersion: true, + }, + { + solidityVersion: "0.8.27", + compilerPath: "soljson-v0.8.27+commit.40a35a09.js", + latestSolcVersion: true, + }, + { + solidityVersion: "0.8.27", + compilerPath: "soljson-v0.8.27+commit.40a35a09.js", + optimizer: { + runs: 200, + viaIR: true, + }, latestSolcVersion: true, }, ]; diff --git a/hardhat-tests/test/internal/hardhat-network/stack-traces/execution.ts b/hardhat-tests/test/internal/hardhat-network/stack-traces/execution.ts index 551f60c03..8a0652242 100644 --- a/hardhat-tests/test/internal/hardhat-network/stack-traces/execution.ts +++ b/hardhat-tests/test/internal/hardhat-network/stack-traces/execution.ts @@ -31,7 +31,7 @@ export async function instantiateProvider( tracingConfig: TracingConfig ): Promise { const config = { - hardfork: "shanghai", + hardfork: "cancun", chainId: 1, networkId: 1, blockGasLimit: 10_000_000, diff --git a/hardhat-tests/test/internal/hardhat-network/stack-traces/test.ts b/hardhat-tests/test/internal/hardhat-network/stack-traces/test.ts index 5e8f31b08..96f9ec4ee 100644 --- a/hardhat-tests/test/internal/hardhat-network/stack-traces/test.ts +++ b/hardhat-tests/test/internal/hardhat-network/stack-traces/test.ts @@ -1,3 +1,4 @@ +import { stackTraceEntryTypeToString } from "@nomicfoundation/edr"; import { toBytes } from "@nomicfoundation/ethereumjs-util"; import { assert } from "chai"; import { BUILD_INFO_FORMAT_VERSION } from "hardhat/internal/constants"; @@ -23,7 +24,7 @@ import { StackTraceEntryType, } from "hardhat/internal/hardhat-network/stack-traces/solidity-stack-trace"; import { SolidityTracer } from "hardhat/internal/hardhat-network/stack-traces/solidityTracer"; -import { VmTraceDecoder } from "hardhat/internal/hardhat-network/stack-traces/vm-trace-decoder"; +import { VmTraceDecoderT } from "hardhat/internal/hardhat-network/stack-traces/vm-trace-decoder"; import { SUPPORTED_SOLIDITY_VERSION_RANGE } from "hardhat/internal/hardhat-network/stack-traces/constants"; import { BuildInfo, @@ -303,7 +304,7 @@ function compareStackTraces( const actual = trace[i]; const expected = description[i]; - const actualErrorType = StackTraceEntryType[actual.type]; + const actualErrorType = stackTraceEntryTypeToString(actual.type); const expectedErrorType = expected.type; if ( @@ -324,17 +325,15 @@ function compareStackTraces( const actualMessage = "message" in actual ? actual.message : undefined; - // actual.message is a ReturnData in revert errors, but a string - // in custom errors - let decodedMessage = ""; - if (typeof actualMessage === "string") { - decodedMessage = actualMessage; - } else if ( - actualMessage instanceof ReturnData && - actualMessage.isErrorReturnData() - ) { - decodedMessage = actualMessage.decodeError(); - } + // actual.message is a ReturnData in revert errors but in custom errors + // we need to decode it + const decodedMessage = + "message" in actual + ? actual.message + : "returnData" in actual && + new ReturnData(actual.returnData).isErrorReturnData() + ? new ReturnData(actual.returnData).decodeError() + : ""; if (expected.message !== undefined) { assert.equal( @@ -482,6 +481,7 @@ async function runTest( }; const logger = new FakeModulesLogger(); + const solidityTracer = new SolidityTracer(); const provider = await instantiateProvider( { enabled: false, @@ -529,17 +529,15 @@ async function runTest( ); } - compareConsoleLogs(logger.lines, tx.consoleLogs); - // eslint-disable-next-line @typescript-eslint/dot-notation - const vmTraceDecoder = provider["_vmTraceDecoder"] as VmTraceDecoder; + const vmTraceDecoder = provider["_vmTraceDecoder"] as VmTraceDecoderT; const decodedTrace = vmTraceDecoder.tryToDecodeMessageTrace(trace); try { if (tx.stackTrace === undefined) { assert.isFalse( trace.exit.isError(), - `Transaction ${txIndex} shouldn't have failed` + `Transaction ${txIndex} shouldn't have failed (${trace.exit.getReason()})` ); } else { assert.isDefined( @@ -554,7 +552,6 @@ async function runTest( } if (trace.exit.isError()) { - const solidityTracer = new SolidityTracer(); const stackTrace = solidityTracer.getStackTrace(decodedTrace); try { @@ -575,6 +572,8 @@ async function runTest( throw err; } } + + compareConsoleLogs(logger.lines, tx.consoleLogs); } } @@ -721,13 +720,13 @@ const onlyLatestSolcVersions = const filterSolcVersionBy = (versionRange: string) => - ({ solidityVersion, latestSolcVersion }: SolidityCompiler) => { - if (onlyLatestSolcVersions && latestSolcVersion !== true) { - return false; - } + ({ solidityVersion, latestSolcVersion }: SolidityCompiler) => { + if (onlyLatestSolcVersions && latestSolcVersion !== true) { + return false; + } - return semver.satisfies(solidityVersion, versionRange); - }; + return semver.satisfies(solidityVersion, versionRange); + }; const solidity05Compilers = solidityCompilers.filter( filterSolcVersionBy("^0.5.0") diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 0e5d2718d..6e4de6af4 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -143,6 +143,9 @@ importers: '@metamask/eth-sig-util': specifier: ^4.0.0 version: 4.0.1 + '@nomicfoundation/edr': + specifier: workspace:* + version: link:../crates/edr_napi '@nomicfoundation/ethereumjs-block': specifier: 5.0.4 version: 5.0.4 From 22cf7ae2269cfeeb95a09a96184ac50d43ca1c33 Mon Sep 17 00:00:00 2001 From: Franco Victorio Date: Fri, 27 Sep 2024 10:14:09 +0200 Subject: [PATCH 4/6] Update hardhat in other packages --- crates/tools/js/benchmark/package.json | 2 +- hardhat-tests/integration/smock/package.json | 2 +- pnpm-lock.yaml | 104 ++----------------- 3 files changed, 13 insertions(+), 95 deletions(-) diff --git a/crates/tools/js/benchmark/package.json b/crates/tools/js/benchmark/package.json index 8ee1282f4..cf825bf55 100644 --- a/crates/tools/js/benchmark/package.json +++ b/crates/tools/js/benchmark/package.json @@ -17,7 +17,7 @@ "eslint-plugin-import": "2.27.5", "eslint-plugin-mocha": "10.4.1", "eslint-plugin-prettier": "5.2.1", - "hardhat": "2.22.10", + "hardhat": "2.22.12", "lodash": "^4.17.11", "mocha": "^10.0.0", "prettier": "^3.2.5", diff --git a/hardhat-tests/integration/smock/package.json b/hardhat-tests/integration/smock/package.json index f0d601d07..b3bcbe25c 100644 --- a/hardhat-tests/integration/smock/package.json +++ b/hardhat-tests/integration/smock/package.json @@ -9,7 +9,7 @@ "@types/node": "^20.0.0", "chai": "^4.3.6", "ethers": "5.7.2", - "hardhat": "2.22.10", + "hardhat": "2.22.12", "mocha": "^10.0.0" }, "keywords": [], diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 6e4de6af4..76dd23260 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -123,8 +123,8 @@ importers: specifier: 5.2.1 version: 5.2.1(eslint-config-prettier@9.1.0(eslint@8.57.0))(eslint@8.57.0)(prettier@3.2.5) hardhat: - specifier: 2.22.10 - version: 2.22.10(ts-node@10.9.2(@types/node@20.16.1)(typescript@5.0.4))(typescript@5.0.4) + specifier: 2.22.12 + version: 2.22.12(ts-node@10.9.2(@types/node@20.16.1)(typescript@5.0.4))(typescript@5.0.4) lodash: specifier: ^4.17.11 version: 4.17.21 @@ -280,10 +280,10 @@ importers: devDependencies: '@defi-wonderland/smock': specifier: ^2.4.0 - version: 2.4.0(@ethersproject/abi@5.7.0)(@ethersproject/abstract-provider@5.7.0)(@ethersproject/abstract-signer@5.7.0)(@nomiclabs/hardhat-ethers@2.2.3(ethers@5.7.2)(hardhat@2.22.10(ts-node@10.9.2(@types/node@20.16.1)(typescript@5.0.4))(typescript@5.0.4)))(ethers@5.7.2)(hardhat@2.22.10(ts-node@10.9.2(@types/node@20.16.1)(typescript@5.0.4))(typescript@5.0.4)) + version: 2.4.0(@ethersproject/abi@5.7.0)(@ethersproject/abstract-provider@5.7.0)(@ethersproject/abstract-signer@5.7.0)(@nomiclabs/hardhat-ethers@2.2.3(ethers@5.7.2)(hardhat@2.22.12(ts-node@10.9.2(@types/node@20.16.1)(typescript@5.0.4))(typescript@5.0.4)))(ethers@5.7.2)(hardhat@2.22.12(ts-node@10.9.2(@types/node@20.16.1)(typescript@5.0.4))(typescript@5.0.4)) '@nomiclabs/hardhat-ethers': specifier: ^2.2.3 - version: 2.2.3(ethers@5.7.2)(hardhat@2.22.10(ts-node@10.9.2(@types/node@20.16.1)(typescript@5.0.4))(typescript@5.0.4)) + version: 2.2.3(ethers@5.7.2)(hardhat@2.22.12(ts-node@10.9.2(@types/node@20.16.1)(typescript@5.0.4))(typescript@5.0.4)) '@types/node': specifier: ^20.0.0 version: 20.16.1 @@ -294,8 +294,8 @@ importers: specifier: 5.7.2 version: 5.7.2 hardhat: - specifier: 2.22.10 - version: 2.22.10(ts-node@10.9.2(@types/node@20.16.1)(typescript@5.0.4))(typescript@5.0.4) + specifier: 2.22.12 + version: 2.22.12(ts-node@10.9.2(@types/node@20.16.1)(typescript@5.0.4))(typescript@5.0.4) mocha: specifier: ^10.0.0 version: 10.3.0 @@ -1285,10 +1285,6 @@ packages: resolution: {integrity: sha512-Dr3sfKRP6oTcjf2JmUmFJfeVMvXBdegxB0iVQ5eb2V10uFJUCAS8OByZdVAyVb8xXNz3GjjTgj9kLWsZTqE6kw==} engines: {node: '>= 8.10.0'} - chokidar@3.6.0: - resolution: {integrity: sha512-7VT13fmjotKpGipCW9JEQAusEPE+Ei8nl6/g4FBAmIm0GOOLMua9NDDo/DWp0ZAxCr3cPq5ZpBqmPAQgDda2Pw==} - engines: {node: '>= 8.10.0'} - chokidar@4.0.1: resolution: {integrity: sha512-n8enUVCED/KVRQlab1hr3MVpcVMvxtZjmEa956u+4YijlmQED223XMSYj2tLuKvr4jcCTzNNMpQDUer72MMmzA==} engines: {node: '>= 14.16.0'} @@ -1874,18 +1870,6 @@ packages: resolution: {integrity: sha512-VIZB+ibDhx7ObhAe7OVtoEbuP4h/MuOTHJ+J8h/eBXotJYl0fBgR72xDFCKgIh22OJZIOVNxBMWuhAr10r8HdA==} engines: {node: '>=6'} - hardhat@2.22.10: - resolution: {integrity: sha512-JRUDdiystjniAvBGFmJRsiIZSOP2/6s++8xRDe3TzLeQXlWWHsXBrd9wd3JWFyKXvgMqMeLL5Sz/oNxXKYw9vg==} - hasBin: true - peerDependencies: - ts-node: '*' - typescript: '*' - peerDependenciesMeta: - ts-node: - optional: true - typescript: - optional: true - hardhat@2.22.12: resolution: {integrity: sha512-yok65M+LsOeTBHQsjg//QreGCyrsaNmeLVzhTFqlOvZ4ZE5y69N0wRxH1b2BC9dGK8S8OPUJMNiL9X0RAvbm8w==} hasBin: true @@ -3367,16 +3351,16 @@ snapshots: dependencies: '@jridgewell/trace-mapping': 0.3.9 - '@defi-wonderland/smock@2.4.0(@ethersproject/abi@5.7.0)(@ethersproject/abstract-provider@5.7.0)(@ethersproject/abstract-signer@5.7.0)(@nomiclabs/hardhat-ethers@2.2.3(ethers@5.7.2)(hardhat@2.22.10(ts-node@10.9.2(@types/node@20.16.1)(typescript@5.0.4))(typescript@5.0.4)))(ethers@5.7.2)(hardhat@2.22.10(ts-node@10.9.2(@types/node@20.16.1)(typescript@5.0.4))(typescript@5.0.4))': + '@defi-wonderland/smock@2.4.0(@ethersproject/abi@5.7.0)(@ethersproject/abstract-provider@5.7.0)(@ethersproject/abstract-signer@5.7.0)(@nomiclabs/hardhat-ethers@2.2.3(ethers@5.7.2)(hardhat@2.22.12(ts-node@10.9.2(@types/node@20.16.1)(typescript@5.0.4))(typescript@5.0.4)))(ethers@5.7.2)(hardhat@2.22.12(ts-node@10.9.2(@types/node@20.16.1)(typescript@5.0.4))(typescript@5.0.4))': dependencies: '@ethersproject/abi': 5.7.0 '@ethersproject/abstract-provider': 5.7.0 '@ethersproject/abstract-signer': 5.7.0 '@nomicfoundation/ethereumjs-util': 9.0.4 - '@nomiclabs/hardhat-ethers': 2.2.3(ethers@5.7.2)(hardhat@2.22.10(ts-node@10.9.2(@types/node@20.16.1)(typescript@5.0.4))(typescript@5.0.4)) + '@nomiclabs/hardhat-ethers': 2.2.3(ethers@5.7.2)(hardhat@2.22.12(ts-node@10.9.2(@types/node@20.16.1)(typescript@5.0.4))(typescript@5.0.4)) diff: 5.0.0 ethers: 5.7.2 - hardhat: 2.22.10(ts-node@10.9.2(@types/node@20.16.1)(typescript@5.0.4))(typescript@5.0.4) + hardhat: 2.22.12(ts-node@10.9.2(@types/node@20.16.1)(typescript@5.0.4))(typescript@5.0.4) lodash.isequal: 4.5.0 lodash.isequalwith: 4.4.0 rxjs: 7.8.1 @@ -3892,10 +3876,10 @@ snapshots: '@nomicfoundation/solidity-analyzer-win32-ia32-msvc': 0.1.1 '@nomicfoundation/solidity-analyzer-win32-x64-msvc': 0.1.1 - '@nomiclabs/hardhat-ethers@2.2.3(ethers@5.7.2)(hardhat@2.22.10(ts-node@10.9.2(@types/node@20.16.1)(typescript@5.0.4))(typescript@5.0.4))': + '@nomiclabs/hardhat-ethers@2.2.3(ethers@5.7.2)(hardhat@2.22.12(ts-node@10.9.2(@types/node@20.16.1)(typescript@5.0.4))(typescript@5.0.4))': dependencies: ethers: 5.7.2 - hardhat: 2.22.10(ts-node@10.9.2(@types/node@20.16.1)(typescript@5.0.4))(typescript@5.0.4) + hardhat: 2.22.12(ts-node@10.9.2(@types/node@20.16.1)(typescript@5.0.4))(typescript@5.0.4) '@pkgr/core@0.1.1': {} @@ -4438,18 +4422,6 @@ snapshots: optionalDependencies: fsevents: 2.3.3 - chokidar@3.6.0: - dependencies: - anymatch: 3.1.3 - braces: 3.0.2 - glob-parent: 5.1.2 - is-binary-path: 2.1.0 - is-glob: 4.0.3 - normalize-path: 3.0.0 - readdirp: 3.6.0 - optionalDependencies: - fsevents: 2.3.3 - chokidar@4.0.1: dependencies: readdirp: 4.0.1 @@ -5221,60 +5193,6 @@ snapshots: hard-rejection@2.1.0: {} - hardhat@2.22.10(ts-node@10.9.2(@types/node@20.16.1)(typescript@5.0.4))(typescript@5.0.4): - dependencies: - '@ethersproject/abi': 5.7.0 - '@metamask/eth-sig-util': 4.0.1 - '@nomicfoundation/edr': link:crates/edr_napi - '@nomicfoundation/ethereumjs-common': 4.0.4 - '@nomicfoundation/ethereumjs-tx': 5.0.4 - '@nomicfoundation/ethereumjs-util': 9.0.4 - '@nomicfoundation/solidity-analyzer': 0.1.1 - '@sentry/node': 5.30.0 - '@types/bn.js': 5.1.5 - '@types/lru-cache': 5.1.1 - adm-zip: 0.4.16 - aggregate-error: 3.1.0 - ansi-escapes: 4.3.2 - boxen: 5.1.2 - chalk: 2.4.2 - chokidar: 3.6.0 - ci-info: 2.0.0 - debug: 4.3.4(supports-color@8.1.1) - enquirer: 2.4.1 - env-paths: 2.2.1 - ethereum-cryptography: 1.2.0 - ethereumjs-abi: 0.6.8 - find-up: 2.1.0 - fp-ts: 1.19.3 - fs-extra: 7.0.1 - glob: 7.2.0 - immutable: 4.3.5 - io-ts: 1.10.4 - keccak: 3.0.4 - lodash: 4.17.21 - mnemonist: 0.38.5 - mocha: 10.3.0 - p-map: 4.0.0 - raw-body: 2.5.2 - resolve: 1.17.0 - semver: 6.3.1 - solc: 0.8.26(debug@4.3.4) - source-map-support: 0.5.21 - stacktrace-parser: 0.1.10 - tsort: 0.0.1 - undici: 5.28.3 - uuid: 8.3.2 - ws: 7.5.9 - optionalDependencies: - ts-node: 10.9.2(@types/node@20.16.1)(typescript@5.0.4) - typescript: 5.0.4 - transitivePeerDependencies: - - bufferutil - - c-kzg - - supports-color - - utf-8-validate - hardhat@2.22.12(ts-node@10.9.2(@types/node@20.16.1)(typescript@5.0.4))(typescript@5.0.4): dependencies: '@ethersproject/abi': 5.7.0 From 4f0f2cf257090c67edd39a59ba8d0a750a85b492 Mon Sep 17 00:00:00 2001 From: Franco Victorio Date: Fri, 27 Sep 2024 10:21:09 +0200 Subject: [PATCH 5/6] Lint fixes --- .syncpackrc.js | 5 +++++ .../hardhat-network/stack-traces/test.ts | 16 +++++++--------- 2 files changed, 12 insertions(+), 9 deletions(-) diff --git a/.syncpackrc.js b/.syncpackrc.js index a6fddf44b..989587996 100644 --- a/.syncpackrc.js +++ b/.syncpackrc.js @@ -10,6 +10,11 @@ const config = { // latest ethers v5 version pinVersion: "5.7.2", }, + { + packages: ["**"], + dependencies: ["@nomicfoundation/edr"], + dependencyTypes: ["local"], + }, ], semverGroups: [ { diff --git a/hardhat-tests/test/internal/hardhat-network/stack-traces/test.ts b/hardhat-tests/test/internal/hardhat-network/stack-traces/test.ts index 96f9ec4ee..feb735949 100644 --- a/hardhat-tests/test/internal/hardhat-network/stack-traces/test.ts +++ b/hardhat-tests/test/internal/hardhat-network/stack-traces/test.ts @@ -323,15 +323,13 @@ function compareStackTraces( `Stack trace of tx ${txIndex} entry ${i} type is incorrect: expected ${expectedErrorType}, got ${actualErrorType}` ); - const actualMessage = "message" in actual ? actual.message : undefined; - // actual.message is a ReturnData in revert errors but in custom errors // we need to decode it const decodedMessage = "message" in actual ? actual.message : "returnData" in actual && - new ReturnData(actual.returnData).isErrorReturnData() + new ReturnData(actual.returnData).isErrorReturnData() ? new ReturnData(actual.returnData).decodeError() : ""; @@ -720,13 +718,13 @@ const onlyLatestSolcVersions = const filterSolcVersionBy = (versionRange: string) => - ({ solidityVersion, latestSolcVersion }: SolidityCompiler) => { - if (onlyLatestSolcVersions && latestSolcVersion !== true) { - return false; - } + ({ solidityVersion, latestSolcVersion }: SolidityCompiler) => { + if (onlyLatestSolcVersions && latestSolcVersion !== true) { + return false; + } - return semver.satisfies(solidityVersion, versionRange); - }; + return semver.satisfies(solidityVersion, versionRange); + }; const solidity05Compilers = solidityCompilers.filter( filterSolcVersionBy("^0.5.0") From bbe8ff66214b5d5f6c7e082e9b25f0f012b92392 Mon Sep 17 00:00:00 2001 From: Franco Victorio Date: Fri, 27 Sep 2024 10:22:51 +0200 Subject: [PATCH 6/6] Replace HARDHAT_ with EDR_ in env vars --- .../internal/hardhat-network/stack-traces/README.md | 4 ++-- .../hardhat-network/stack-traces/compilation.ts | 2 +- .../internal/hardhat-network/stack-traces/test.ts | 12 ++++++------ 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/hardhat-tests/test/internal/hardhat-network/stack-traces/README.md b/hardhat-tests/test/internal/hardhat-network/stack-traces/README.md index fcb92d12e..fc166793c 100644 --- a/hardhat-tests/test/internal/hardhat-network/stack-traces/README.md +++ b/hardhat-tests/test/internal/hardhat-network/stack-traces/README.md @@ -62,6 +62,6 @@ These compilers are grouped by minor version (that is, a group with all the 0.5. The solidity files in each test directory are compiled (unless a cached compilation output exists) and then the `test.json` description is then executed. -## The `HARDHAT_TESTS_SOLC_PATH` environment variable +## The `EDR_TESTS_SOLC_PATH` environment variable -If this variable is set, the only compiler used will be the one that is available in that path. For example, if you want to test a nightly version, you would set the envvars `HARDHAT_TESTS_SOLC_PATH=/path/to/solc-nightly-0.8.21 HARDHAT_TESTS_SOLC_VERSION=0.8.21` and then run the tests. This would only run the test files under `test-files/0_8` and `test-files/version-independent`. +If this variable is set, the only compiler used will be the one that is available in that path. For example, if you want to test a nightly version, you would set the envvars `EDR_TESTS_SOLC_PATH=/path/to/solc-nightly-0.8.21 EDR_TESTS_SOLC_VERSION=0.8.21` and then run the tests. This would only run the test files under `test-files/0_8` and `test-files/version-independent`. diff --git a/hardhat-tests/test/internal/hardhat-network/stack-traces/compilation.ts b/hardhat-tests/test/internal/hardhat-network/stack-traces/compilation.ts index 3424dbdb1..0a40614c5 100644 --- a/hardhat-tests/test/internal/hardhat-network/stack-traces/compilation.ts +++ b/hardhat-tests/test/internal/hardhat-network/stack-traces/compilation.ts @@ -132,7 +132,7 @@ export async function compileFiles( if (path.isAbsolute(compilerOptions.compilerPath)) { compiler = { compilerPath: compilerOptions.compilerPath, - isSolcJs: process.env.HARDHAT_TESTS_SOLC_NATIVE !== "true", + isSolcJs: process.env.EDR_TESTS_SOLC_NATIVE !== "true", version: compilerOptions.solidityVersion, longVersion: compilerOptions.solidityVersion, }; diff --git a/hardhat-tests/test/internal/hardhat-network/stack-traces/test.ts b/hardhat-tests/test/internal/hardhat-network/stack-traces/test.ts index feb735949..f422393f9 100644 --- a/hardhat-tests/test/internal/hardhat-network/stack-traces/test.ts +++ b/hardhat-tests/test/internal/hardhat-network/stack-traces/test.ts @@ -249,7 +249,7 @@ async function compileIfNecessary( fs.statSync(inputPath).ctimeMs > maxSourceCtime && fs.statSync(outputPath).ctimeMs > maxSourceCtime; - const usingCustomSolc = process.env.HARDHAT_TESTS_SOLC_PATH !== undefined; + const usingCustomSolc = process.env.EDR_TESTS_SOLC_PATH !== undefined; if (!usingCustomSolc && isCached) { const inputJson = fs.readFileSync(inputPath, "utf8"); @@ -714,7 +714,7 @@ async function runCallTransactionTest( } const onlyLatestSolcVersions = - process.env.HARDHAT_TESTS_ALL_SOLC_VERSIONS === undefined; + process.env.EDR_TESTS_ALL_SOLC_VERSIONS === undefined; const filterSolcVersionBy = (versionRange: string) => @@ -744,19 +744,19 @@ describe("Stack traces", function () { // if a path to a solc file was specified, we only run these tests and use // that compiler - const customSolcPath = process.env.HARDHAT_TESTS_SOLC_PATH; + const customSolcPath = process.env.EDR_TESTS_SOLC_PATH; if (customSolcPath !== undefined) { - const customSolcVersion = process.env.HARDHAT_TESTS_SOLC_VERSION; + const customSolcVersion = process.env.EDR_TESTS_SOLC_VERSION; if (customSolcVersion === undefined) { console.error( - "HARDHAT_TESTS_SOLC_VERSION has to be set when using HARDHAT_TESTS_SOLC_PATH" + "EDR_TESTS_SOLC_VERSION has to be set when using EDR_TESTS_SOLC_PATH" ); process.exit(1); } if (!path.isAbsolute(customSolcPath)) { - console.error("HARDHAT_TESTS_SOLC_PATH has to be an absolute path"); + console.error("EDR_TESTS_SOLC_PATH has to be an absolute path"); process.exit(1); }