hardhat 3.4.5 → 3.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +44 -0
- package/dist/src/config.d.ts +0 -1
- package/dist/src/config.d.ts.map +1 -1
- package/dist/src/config.js.map +1 -1
- package/dist/src/hre.d.ts +0 -1
- package/dist/src/hre.d.ts.map +1 -1
- package/dist/src/hre.js.map +1 -1
- package/dist/src/index.d.ts +0 -1
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js.map +1 -1
- package/dist/src/internal/builtin-global-options.d.ts.map +1 -1
- package/dist/src/internal/builtin-global-options.js +1 -1
- package/dist/src/internal/builtin-global-options.js.map +1 -1
- package/dist/src/internal/builtin-plugins/gas-analytics/snapshot-cheatcodes.d.ts +21 -0
- package/dist/src/internal/builtin-plugins/gas-analytics/snapshot-cheatcodes.d.ts.map +1 -1
- package/dist/src/internal/builtin-plugins/gas-analytics/snapshot-cheatcodes.js +49 -1
- package/dist/src/internal/builtin-plugins/gas-analytics/snapshot-cheatcodes.js.map +1 -1
- package/dist/src/internal/builtin-plugins/gas-analytics/tasks/solidity-test/task-action.d.ts +2 -1
- package/dist/src/internal/builtin-plugins/gas-analytics/tasks/solidity-test/task-action.d.ts.map +1 -1
- package/dist/src/internal/builtin-plugins/gas-analytics/tasks/solidity-test/task-action.js +12 -2
- package/dist/src/internal/builtin-plugins/gas-analytics/tasks/solidity-test/task-action.js.map +1 -1
- package/dist/src/internal/builtin-plugins/network-manager/config-resolution.d.ts.map +1 -1
- package/dist/src/internal/builtin-plugins/network-manager/config-resolution.js +9 -2
- package/dist/src/internal/builtin-plugins/network-manager/config-resolution.js.map +1 -1
- package/dist/src/internal/builtin-plugins/network-manager/edr/edr-constants.d.ts +1 -0
- package/dist/src/internal/builtin-plugins/network-manager/edr/edr-constants.d.ts.map +1 -1
- package/dist/src/internal/builtin-plugins/network-manager/edr/edr-constants.js +1 -0
- package/dist/src/internal/builtin-plugins/network-manager/edr/edr-constants.js.map +1 -1
- package/dist/src/internal/builtin-plugins/network-manager/edr/edr-provider.d.ts.map +1 -1
- package/dist/src/internal/builtin-plugins/network-manager/edr/edr-provider.js +25 -5
- package/dist/src/internal/builtin-plugins/network-manager/edr/edr-provider.js.map +1 -1
- package/dist/src/internal/builtin-plugins/network-manager/edr/utils/convert-to-edr.d.ts +16 -0
- package/dist/src/internal/builtin-plugins/network-manager/edr/utils/convert-to-edr.d.ts.map +1 -1
- package/dist/src/internal/builtin-plugins/network-manager/edr/utils/convert-to-edr.js +28 -1
- package/dist/src/internal/builtin-plugins/network-manager/edr/utils/convert-to-edr.js.map +1 -1
- package/dist/src/internal/builtin-plugins/network-manager/network-manager.d.ts.map +1 -1
- package/dist/src/internal/builtin-plugins/network-manager/network-manager.js +2 -6
- package/dist/src/internal/builtin-plugins/network-manager/network-manager.js.map +1 -1
- package/dist/src/internal/builtin-plugins/network-manager/type-extensions/config.d.ts +5 -3
- package/dist/src/internal/builtin-plugins/network-manager/type-extensions/config.d.ts.map +1 -1
- package/dist/src/internal/builtin-plugins/network-manager/type-validation.d.ts.map +1 -1
- package/dist/src/internal/builtin-plugins/network-manager/type-validation.js +3 -1
- package/dist/src/internal/builtin-plugins/network-manager/type-validation.js.map +1 -1
- package/dist/src/internal/builtin-plugins/network-manager/utils/apply-coverage-network-overrides.d.ts +18 -0
- package/dist/src/internal/builtin-plugins/network-manager/utils/apply-coverage-network-overrides.d.ts.map +1 -0
- package/dist/src/internal/builtin-plugins/network-manager/utils/apply-coverage-network-overrides.js +27 -0
- package/dist/src/internal/builtin-plugins/network-manager/utils/apply-coverage-network-overrides.js.map +1 -0
- package/dist/src/internal/builtin-plugins/node/json-rpc/handler.js +6 -5
- package/dist/src/internal/builtin-plugins/node/json-rpc/handler.js.map +1 -1
- package/dist/src/internal/builtin-plugins/solidity/build-system/resolver/remapped-npm-packages-graph.d.ts.map +1 -1
- package/dist/src/internal/builtin-plugins/solidity/build-system/resolver/remapped-npm-packages-graph.js +1 -1
- package/dist/src/internal/builtin-plugins/solidity/build-system/resolver/remapped-npm-packages-graph.js.map +1 -1
- package/dist/src/internal/builtin-plugins/solidity/constants.d.ts +10 -0
- package/dist/src/internal/builtin-plugins/solidity/constants.d.ts.map +1 -1
- package/dist/src/internal/builtin-plugins/solidity/constants.js +10 -0
- package/dist/src/internal/builtin-plugins/solidity/constants.js.map +1 -1
- package/dist/src/internal/builtin-plugins/solidity/index.d.ts.map +1 -1
- package/dist/src/internal/builtin-plugins/solidity/index.js +1 -0
- package/dist/src/internal/builtin-plugins/solidity/index.js.map +1 -1
- package/dist/src/internal/builtin-plugins/solidity/tasks/compile.d.ts +9 -0
- package/dist/src/internal/builtin-plugins/solidity/tasks/compile.d.ts.map +1 -0
- package/dist/src/internal/builtin-plugins/solidity/tasks/compile.js +10 -0
- package/dist/src/internal/builtin-plugins/solidity/tasks/compile.js.map +1 -0
- package/dist/src/internal/builtin-plugins/solidity-test/config.d.ts +4 -3
- package/dist/src/internal/builtin-plugins/solidity-test/config.d.ts.map +1 -1
- package/dist/src/internal/builtin-plugins/solidity-test/config.js +55 -8
- package/dist/src/internal/builtin-plugins/solidity-test/config.js.map +1 -1
- package/dist/src/internal/builtin-plugins/solidity-test/eip712/ast-walker.d.ts +58 -0
- package/dist/src/internal/builtin-plugins/solidity-test/eip712/ast-walker.d.ts.map +1 -0
- package/dist/src/internal/builtin-plugins/solidity-test/eip712/ast-walker.js +226 -0
- package/dist/src/internal/builtin-plugins/solidity-test/eip712/ast-walker.js.map +1 -0
- package/dist/src/internal/builtin-plugins/solidity-test/eip712/canonicalize.d.ts +29 -0
- package/dist/src/internal/builtin-plugins/solidity-test/eip712/canonicalize.d.ts.map +1 -0
- package/dist/src/internal/builtin-plugins/solidity-test/eip712/canonicalize.js +244 -0
- package/dist/src/internal/builtin-plugins/solidity-test/eip712/canonicalize.js.map +1 -0
- package/dist/src/internal/builtin-plugins/solidity-test/eip712/glob.d.ts +7 -0
- package/dist/src/internal/builtin-plugins/solidity-test/eip712/glob.d.ts.map +1 -0
- package/dist/src/internal/builtin-plugins/solidity-test/eip712/glob.js +204 -0
- package/dist/src/internal/builtin-plugins/solidity-test/eip712/glob.js.map +1 -0
- package/dist/src/internal/builtin-plugins/solidity-test/eip712/index.d.ts +21 -0
- package/dist/src/internal/builtin-plugins/solidity-test/eip712/index.d.ts.map +1 -0
- package/dist/src/internal/builtin-plugins/solidity-test/eip712/index.js +77 -0
- package/dist/src/internal/builtin-plugins/solidity-test/eip712/index.js.map +1 -0
- package/dist/src/internal/builtin-plugins/solidity-test/helpers.d.ts +4 -3
- package/dist/src/internal/builtin-plugins/solidity-test/helpers.d.ts.map +1 -1
- package/dist/src/internal/builtin-plugins/solidity-test/helpers.js +20 -3
- package/dist/src/internal/builtin-plugins/solidity-test/helpers.js.map +1 -1
- package/dist/src/internal/builtin-plugins/solidity-test/task-action.d.ts.map +1 -1
- package/dist/src/internal/builtin-plugins/solidity-test/task-action.js +5 -1
- package/dist/src/internal/builtin-plugins/solidity-test/task-action.js.map +1 -1
- package/dist/src/internal/builtin-plugins/solidity-test/test-profiles.d.ts +2 -0
- package/dist/src/internal/builtin-plugins/solidity-test/test-profiles.d.ts.map +1 -0
- package/dist/src/internal/builtin-plugins/solidity-test/test-profiles.js +2 -0
- package/dist/src/internal/builtin-plugins/solidity-test/test-profiles.js.map +1 -0
- package/dist/src/internal/builtin-plugins/solidity-test/type-extensions.d.ts +91 -32
- package/dist/src/internal/builtin-plugins/solidity-test/type-extensions.d.ts.map +1 -1
- package/dist/src/internal/cli/init/init.d.ts +31 -6
- package/dist/src/internal/cli/init/init.d.ts.map +1 -1
- package/dist/src/internal/cli/init/init.js +121 -10
- package/dist/src/internal/cli/init/init.js.map +1 -1
- package/dist/src/internal/cli/main.d.ts.map +1 -1
- package/dist/src/internal/cli/main.js +41 -1
- package/dist/src/internal/cli/main.js.map +1 -1
- package/dist/src/types/arguments.d.ts +1 -0
- package/dist/src/types/arguments.d.ts.map +1 -1
- package/dist/src/types/arguments.js +1 -0
- package/dist/src/types/arguments.js.map +1 -1
- package/dist/src/types/artifacts.d.ts +1 -0
- package/dist/src/types/artifacts.d.ts.map +1 -1
- package/dist/src/types/artifacts.js +1 -1
- package/dist/src/types/artifacts.js.map +1 -1
- package/dist/src/types/builtin-plugin-type-extensions.d.ts +2 -0
- package/dist/src/types/builtin-plugin-type-extensions.d.ts.map +1 -0
- package/dist/src/types/builtin-plugin-type-extensions.js +2 -0
- package/dist/src/types/builtin-plugin-type-extensions.js.map +1 -0
- package/dist/src/types/config.d.ts +1 -0
- package/dist/src/types/config.d.ts.map +1 -1
- package/dist/src/types/config.js +1 -1
- package/dist/src/types/config.js.map +1 -1
- package/dist/src/types/global-options.d.ts +1 -0
- package/dist/src/types/global-options.d.ts.map +1 -1
- package/dist/src/types/global-options.js +1 -1
- package/dist/src/types/global-options.js.map +1 -1
- package/dist/src/types/hooks.d.ts +1 -0
- package/dist/src/types/hooks.d.ts.map +1 -1
- package/dist/src/types/hooks.js +1 -1
- package/dist/src/types/hooks.js.map +1 -1
- package/dist/src/types/hre.d.ts +1 -0
- package/dist/src/types/hre.d.ts.map +1 -1
- package/dist/src/types/hre.js +1 -1
- package/dist/src/types/hre.js.map +1 -1
- package/dist/src/types/index.d.ts +1 -0
- package/dist/src/types/index.d.ts.map +1 -1
- package/dist/src/types/index.js +1 -0
- package/dist/src/types/index.js.map +1 -1
- package/dist/src/types/network.d.ts +1 -0
- package/dist/src/types/network.d.ts.map +1 -1
- package/dist/src/types/network.js +1 -1
- package/dist/src/types/network.js.map +1 -1
- package/dist/src/types/plugins.d.ts +1 -1
- package/dist/src/types/plugins.d.ts.map +1 -1
- package/dist/src/types/plugins.js +1 -1
- package/dist/src/types/plugins.js.map +1 -1
- package/dist/src/types/providers.d.ts +1 -0
- package/dist/src/types/providers.d.ts.map +1 -1
- package/dist/src/types/providers.js +1 -1
- package/dist/src/types/providers.js.map +1 -1
- package/dist/src/types/solidity.d.ts +1 -0
- package/dist/src/types/solidity.d.ts.map +1 -1
- package/dist/src/types/solidity.js +1 -0
- package/dist/src/types/solidity.js.map +1 -1
- package/dist/src/types/tasks.d.ts +1 -0
- package/dist/src/types/tasks.d.ts.map +1 -1
- package/dist/src/types/tasks.js +1 -0
- package/dist/src/types/tasks.js.map +1 -1
- package/dist/src/types/test.d.ts +1 -0
- package/dist/src/types/test.d.ts.map +1 -1
- package/dist/src/types/test.js +1 -1
- package/dist/src/types/test.js.map +1 -1
- package/dist/src/types/user-interruptions.d.ts +1 -0
- package/dist/src/types/user-interruptions.d.ts.map +1 -1
- package/dist/src/types/user-interruptions.js +1 -1
- package/dist/src/types/user-interruptions.js.map +1 -1
- package/package.json +12 -11
- package/src/config.ts +0 -2
- package/src/hre.ts +0 -3
- package/src/index.ts +0 -3
- package/src/internal/builtin-global-options.ts +2 -1
- package/src/internal/builtin-plugins/gas-analytics/snapshot-cheatcodes.ts +90 -1
- package/src/internal/builtin-plugins/gas-analytics/tasks/solidity-test/task-action.ts +24 -2
- package/src/internal/builtin-plugins/network-manager/config-resolution.ts +11 -3
- package/src/internal/builtin-plugins/network-manager/edr/edr-constants.ts +2 -0
- package/src/internal/builtin-plugins/network-manager/edr/edr-provider.ts +38 -8
- package/src/internal/builtin-plugins/network-manager/edr/utils/convert-to-edr.ts +43 -1
- package/src/internal/builtin-plugins/network-manager/network-manager.ts +5 -6
- package/src/internal/builtin-plugins/network-manager/type-extensions/config.ts +5 -3
- package/src/internal/builtin-plugins/network-manager/type-validation.ts +7 -1
- package/src/internal/builtin-plugins/network-manager/utils/apply-coverage-network-overrides.ts +32 -0
- package/src/internal/builtin-plugins/node/json-rpc/handler.ts +7 -5
- package/src/internal/builtin-plugins/solidity/build-system/resolver/remapped-npm-packages-graph.ts +1 -2
- package/src/internal/builtin-plugins/solidity/constants.ts +11 -0
- package/src/internal/builtin-plugins/solidity/index.ts +1 -0
- package/src/internal/builtin-plugins/solidity/tasks/compile.ts +12 -0
- package/src/internal/builtin-plugins/solidity-test/config.ts +85 -12
- package/src/internal/builtin-plugins/solidity-test/eip712/ast-walker.ts +324 -0
- package/src/internal/builtin-plugins/solidity-test/eip712/canonicalize.ts +317 -0
- package/src/internal/builtin-plugins/solidity-test/eip712/glob.ts +225 -0
- package/src/internal/builtin-plugins/solidity-test/eip712/index.ts +120 -0
- package/src/internal/builtin-plugins/solidity-test/helpers.ts +28 -4
- package/src/internal/builtin-plugins/solidity-test/task-action.ts +12 -1
- package/src/internal/builtin-plugins/solidity-test/test-profiles.ts +1 -0
- package/src/internal/builtin-plugins/solidity-test/type-extensions.ts +100 -33
- package/src/internal/cli/init/init.ts +198 -16
- package/src/internal/cli/main.ts +64 -1
- package/src/types/arguments.ts +2 -0
- package/src/types/artifacts.ts +2 -0
- package/src/types/builtin-plugin-type-extensions.ts +15 -0
- package/src/types/config.ts +2 -0
- package/src/types/global-options.ts +2 -0
- package/src/types/hooks.ts +2 -0
- package/src/types/hre.ts +2 -0
- package/src/types/index.ts +2 -0
- package/src/types/network.ts +2 -0
- package/src/types/plugins.ts +1 -2
- package/src/types/providers.ts +2 -0
- package/src/types/solidity.ts +2 -0
- package/src/types/tasks.ts +2 -0
- package/src/types/test.ts +2 -0
- package/src/types/user-interruptions.ts +2 -0
- package/templates/hardhat-3/01-node-test-runner-viem/package.json +11 -11
- package/templates/hardhat-3/01-node-test-runner-viem/tsconfig.json +4 -7
- package/templates/hardhat-3/02-mocha-ethers/package.json +13 -13
- package/templates/hardhat-3/02-mocha-ethers/tsconfig.json +4 -7
- package/templates/hardhat-3/03-minimal/package.json +2 -2
- package/templates/hardhat-3/03-minimal/tsconfig.json +4 -7
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "hardhat",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.5.0",
|
|
4
4
|
"description": "Hardhat is an extensible developer tool that helps smart contract developers increase productivity by reliably bringing together the tools they want.",
|
|
5
5
|
"homepage": "https://hardhat.org",
|
|
6
6
|
"repository": {
|
|
@@ -44,7 +44,8 @@
|
|
|
44
44
|
"./utils/result": "./dist/src/utils/result.js",
|
|
45
45
|
"./types/runtime": "./dist/src/internal/deprecated-module-imported-from-hardhat2-plugin.js",
|
|
46
46
|
"./builtin-tasks/task-names": "./dist/src/internal/deprecated-module-imported-from-hardhat2-plugin.js",
|
|
47
|
-
"./internal/artifacts": "./dist/src/internal/deprecated-module-imported-from-hardhat2-plugin.js"
|
|
47
|
+
"./internal/artifacts": "./dist/src/internal/deprecated-module-imported-from-hardhat2-plugin.js",
|
|
48
|
+
"./package.json": "./package.json"
|
|
48
49
|
},
|
|
49
50
|
"keywords": [
|
|
50
51
|
"ethereum",
|
|
@@ -61,7 +62,7 @@
|
|
|
61
62
|
"README.md"
|
|
62
63
|
],
|
|
63
64
|
"devDependencies": {
|
|
64
|
-
"@nomicfoundation/hardhat-node-test-reporter": "^3.0.
|
|
65
|
+
"@nomicfoundation/hardhat-node-test-reporter": "^3.0.7",
|
|
65
66
|
"@types/adm-zip": "^0.5.5",
|
|
66
67
|
"@types/node": "^22.0.0",
|
|
67
68
|
"@types/semver": "^7.5.8",
|
|
@@ -71,15 +72,15 @@
|
|
|
71
72
|
"expect-type": "^1.2.1",
|
|
72
73
|
"prettier": "3.2.5",
|
|
73
74
|
"rimraf": "^5.0.5",
|
|
74
|
-
"typescript": "~
|
|
75
|
+
"typescript": "~6.0.3",
|
|
75
76
|
"@nomicfoundation/hardhat-test-utils": "^2.0.3"
|
|
76
77
|
},
|
|
77
78
|
"dependencies": {
|
|
78
|
-
"@nomicfoundation/edr": "0.12.0-next.
|
|
79
|
-
"@nomicfoundation/hardhat-errors": "^3.0.
|
|
80
|
-
"@nomicfoundation/hardhat-utils": "^4.1.
|
|
81
|
-
"@nomicfoundation/hardhat-vendored": "^3.0.
|
|
82
|
-
"@nomicfoundation/hardhat-zod-utils": "^3.0.
|
|
79
|
+
"@nomicfoundation/edr": "0.12.0-next.33",
|
|
80
|
+
"@nomicfoundation/hardhat-errors": "^3.0.13",
|
|
81
|
+
"@nomicfoundation/hardhat-utils": "^4.1.2",
|
|
82
|
+
"@nomicfoundation/hardhat-vendored": "^3.0.4",
|
|
83
|
+
"@nomicfoundation/hardhat-zod-utils": "^3.0.5",
|
|
83
84
|
"@nomicfoundation/solidity-analyzer": "^0.1.1",
|
|
84
85
|
"@sentry/core": "^9.4.0",
|
|
85
86
|
"adm-zip": "^0.4.16",
|
|
@@ -95,8 +96,8 @@
|
|
|
95
96
|
"zod": "^3.23.8"
|
|
96
97
|
},
|
|
97
98
|
"scripts": {
|
|
98
|
-
"lint": "pnpm
|
|
99
|
-
"lint:fix": "pnpm
|
|
99
|
+
"lint": "pnpm eslint && pnpm prettier --check",
|
|
100
|
+
"lint:fix": "pnpm eslint --fix && pnpm prettier --write",
|
|
100
101
|
"eslint": "eslint \"src/**/*.ts\" \"test/**/*.ts\"",
|
|
101
102
|
"postlint": "eslint \"templates/**/*.ts\"",
|
|
102
103
|
"postlint:fix": "eslint --fix \"templates/**/*.ts\"",
|
package/src/config.ts
CHANGED
|
@@ -3,8 +3,6 @@ export * from "./internal/core/config.js";
|
|
|
3
3
|
|
|
4
4
|
export type { HardhatUserConfig } from "./types/config.js";
|
|
5
5
|
|
|
6
|
-
// NOTE: We export the built-in plugin types to load their type extensions
|
|
7
|
-
export type * from "./internal/builtin-plugins/index.js";
|
|
8
6
|
import type { HardhatUserConfig } from "./types/config.js";
|
|
9
7
|
|
|
10
8
|
import { throwUsingHardhat2PluginError } from "./internal/using-hardhat2-plugin-errors.js";
|
package/src/hre.ts
CHANGED
|
@@ -1,6 +1,3 @@
|
|
|
1
|
-
// NOTE: We export the built-in plugin types to load their type extensions
|
|
2
|
-
export type * from "./internal/builtin-plugins/index.js";
|
|
3
|
-
|
|
4
1
|
export { importUserConfig } from "./internal/config-loading.js";
|
|
5
2
|
export { resolveHardhatConfigPath } from "./internal/config-loading.js";
|
|
6
3
|
export { createHardhatRuntimeEnvironment } from "./internal/hre-initialization.js";
|
package/src/index.ts
CHANGED
|
@@ -10,9 +10,6 @@ import type { UserInterruptionManager } from "./types/user-interruptions.js";
|
|
|
10
10
|
|
|
11
11
|
import { getOrCreateGlobalHardhatRuntimeEnvironment } from "./internal/hre-initialization.js";
|
|
12
12
|
|
|
13
|
-
// NOTE: We export the built-in plugin types to load their type extensions
|
|
14
|
-
export type * from "./internal/builtin-plugins/index.js";
|
|
15
|
-
|
|
16
13
|
const hre: HardhatRuntimeEnvironment =
|
|
17
14
|
// eslint-disable-next-line no-restricted-syntax -- Allow top-level await here
|
|
18
15
|
await getOrCreateGlobalHardhatRuntimeEnvironment();
|
|
@@ -37,7 +37,8 @@ export const BUILTIN_GLOBAL_OPTIONS_DEFINITIONS: GlobalOptionDefinitions =
|
|
|
37
37
|
pluginId: "builtin",
|
|
38
38
|
option: globalFlag({
|
|
39
39
|
name: "init",
|
|
40
|
-
description:
|
|
40
|
+
description:
|
|
41
|
+
"Initializes a Hardhat project. Supports `--template <name>` and `--templates`.",
|
|
41
42
|
}),
|
|
42
43
|
},
|
|
43
44
|
],
|
|
@@ -13,6 +13,7 @@ import {
|
|
|
13
13
|
remove,
|
|
14
14
|
writeJsonFile,
|
|
15
15
|
} from "@nomicfoundation/hardhat-utils/fs";
|
|
16
|
+
import { sanitizeFilename } from "@nomicfoundation/hardhat-utils/path";
|
|
16
17
|
|
|
17
18
|
import {
|
|
18
19
|
getFullyQualifiedName,
|
|
@@ -23,6 +24,16 @@ import { formatSectionHeader, getUserFqn } from "./helpers/utils.js";
|
|
|
23
24
|
|
|
24
25
|
export const SNAPSHOT_CHEATCODES_DIR = "snapshots";
|
|
25
26
|
|
|
27
|
+
export interface RenamedSnapshotGroup {
|
|
28
|
+
original: string;
|
|
29
|
+
sanitized: string;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
export interface SanitizedSnapshotCheatcodes {
|
|
33
|
+
snapshotCheatcodes: SnapshotCheatcodesWithMetadataMap;
|
|
34
|
+
renamedGroups: RenamedSnapshotGroup[];
|
|
35
|
+
}
|
|
36
|
+
|
|
26
37
|
export type SnapshotCheatcodesMap = Map<
|
|
27
38
|
string, // group
|
|
28
39
|
Record<
|
|
@@ -68,6 +79,7 @@ export interface SnapshotCheatcodesCheckResult {
|
|
|
68
79
|
passed: boolean;
|
|
69
80
|
comparison: SnapshotCheatcodesComparison;
|
|
70
81
|
written: boolean;
|
|
82
|
+
renamedGroups: RenamedSnapshotGroup[];
|
|
71
83
|
}
|
|
72
84
|
|
|
73
85
|
export function getSnapshotCheatcodesPath(
|
|
@@ -77,6 +89,53 @@ export function getSnapshotCheatcodesPath(
|
|
|
77
89
|
return path.join(basePath, SNAPSHOT_CHEATCODES_DIR, filename);
|
|
78
90
|
}
|
|
79
91
|
|
|
92
|
+
/**
|
|
93
|
+
* Rekeys {@link snapshotCheatcodes} so each group name is safe to use as a
|
|
94
|
+
* filename component, returning the rekeyed map alongside the list of names
|
|
95
|
+
* that were actually changed by sanitization.
|
|
96
|
+
*
|
|
97
|
+
* @throws `SOLIDITY_TESTS.SNAPSHOT_GROUP_NAME_COLLISION` if two distinct
|
|
98
|
+
* original names sanitize to the same on-disk filename. Originals are
|
|
99
|
+
* sorted by codepoint in the error message so the same input always
|
|
100
|
+
* produces the same error text.
|
|
101
|
+
*/
|
|
102
|
+
export function sanitizeSnapshotCheatcodes(
|
|
103
|
+
snapshotCheatcodes: SnapshotCheatcodesWithMetadataMap,
|
|
104
|
+
): SanitizedSnapshotCheatcodes {
|
|
105
|
+
const sanitizedSnapshotCheatcodes: SnapshotCheatcodesWithMetadataMap =
|
|
106
|
+
new Map();
|
|
107
|
+
const originalBySanitized = new Map<string, string>();
|
|
108
|
+
const renamedGroups: RenamedSnapshotGroup[] = [];
|
|
109
|
+
|
|
110
|
+
for (const [original, entries] of snapshotCheatcodes) {
|
|
111
|
+
const sanitizedName = sanitizeFilename(original);
|
|
112
|
+
|
|
113
|
+
const previousOriginal = originalBySanitized.get(sanitizedName);
|
|
114
|
+
if (previousOriginal !== undefined) {
|
|
115
|
+
const [nameA, nameB] =
|
|
116
|
+
previousOriginal < original
|
|
117
|
+
? [previousOriginal, original]
|
|
118
|
+
: [original, previousOriginal];
|
|
119
|
+
throw new HardhatError(
|
|
120
|
+
HardhatError.ERRORS.CORE.SOLIDITY_TESTS.SNAPSHOT_GROUP_NAME_COLLISION,
|
|
121
|
+
{ nameA, nameB, sanitized: sanitizedName },
|
|
122
|
+
);
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
originalBySanitized.set(sanitizedName, original);
|
|
126
|
+
sanitizedSnapshotCheatcodes.set(sanitizedName, entries);
|
|
127
|
+
|
|
128
|
+
if (sanitizedName !== original) {
|
|
129
|
+
renamedGroups.push({ original, sanitized: sanitizedName });
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
return {
|
|
134
|
+
snapshotCheatcodes: sanitizedSnapshotCheatcodes,
|
|
135
|
+
renamedGroups,
|
|
136
|
+
};
|
|
137
|
+
}
|
|
138
|
+
|
|
80
139
|
export function extractSnapshotCheatcodes(
|
|
81
140
|
suiteResults: SuiteResult[],
|
|
82
141
|
): SnapshotCheatcodesWithMetadataMap {
|
|
@@ -295,7 +354,9 @@ export async function checkSnapshotCheatcodes(
|
|
|
295
354
|
basePath: string,
|
|
296
355
|
suiteResults: SuiteResult[],
|
|
297
356
|
): Promise<SnapshotCheatcodesCheckResult> {
|
|
298
|
-
const snapshotCheatcodes =
|
|
357
|
+
const { snapshotCheatcodes, renamedGroups } = sanitizeSnapshotCheatcodes(
|
|
358
|
+
extractSnapshotCheatcodes(suiteResults),
|
|
359
|
+
);
|
|
299
360
|
|
|
300
361
|
let previousSnapshotCheatcodes;
|
|
301
362
|
try {
|
|
@@ -316,6 +377,7 @@ export async function checkSnapshotCheatcodes(
|
|
|
316
377
|
changed: [],
|
|
317
378
|
},
|
|
318
379
|
written,
|
|
380
|
+
renamedGroups,
|
|
319
381
|
};
|
|
320
382
|
}
|
|
321
383
|
|
|
@@ -338,6 +400,7 @@ export async function checkSnapshotCheatcodes(
|
|
|
338
400
|
passed: comparison.changed.length === 0,
|
|
339
401
|
comparison,
|
|
340
402
|
written: hasAddedOrRemoved,
|
|
403
|
+
renamedGroups,
|
|
341
404
|
};
|
|
342
405
|
}
|
|
343
406
|
|
|
@@ -448,3 +511,29 @@ export function printSnapshotCheatcodeChanges(
|
|
|
448
511
|
}
|
|
449
512
|
}
|
|
450
513
|
}
|
|
514
|
+
|
|
515
|
+
export function logSnapshotRenameWarnings(
|
|
516
|
+
renamedGroups: RenamedSnapshotGroup[],
|
|
517
|
+
logger: typeof console.log = console.log,
|
|
518
|
+
): void {
|
|
519
|
+
if (renamedGroups.length === 0) {
|
|
520
|
+
return;
|
|
521
|
+
}
|
|
522
|
+
|
|
523
|
+
logger(
|
|
524
|
+
styleText(
|
|
525
|
+
"yellow",
|
|
526
|
+
`Renamed ${renamedGroups.length} snapshot group name(s) for safe filesystem use:`,
|
|
527
|
+
),
|
|
528
|
+
);
|
|
529
|
+
for (const { original, sanitized } of renamedGroups) {
|
|
530
|
+
logger(styleText("yellow", ` "${original}" → "${sanitized}"`));
|
|
531
|
+
}
|
|
532
|
+
logger(
|
|
533
|
+
styleText(
|
|
534
|
+
"yellow",
|
|
535
|
+
"If you'd like the on-disk filename(s) to match exactly, consider renaming the group(s) in Solidity.",
|
|
536
|
+
),
|
|
537
|
+
);
|
|
538
|
+
logger();
|
|
539
|
+
}
|
|
@@ -2,7 +2,10 @@ import type { TaskOverrideActionFunction } from "../../../../../types/tasks.js";
|
|
|
2
2
|
import type { Result } from "../../../../../types/utils.js";
|
|
3
3
|
import type { SolidityTestRunResult } from "../../../solidity-test/task-action.js";
|
|
4
4
|
import type { FunctionGasSnapshotCheckResult } from "../../function-gas-snapshots.js";
|
|
5
|
-
import type {
|
|
5
|
+
import type {
|
|
6
|
+
SnapshotCheatcodesCheckResult,
|
|
7
|
+
RenamedSnapshotGroup,
|
|
8
|
+
} from "../../snapshot-cheatcodes.js";
|
|
6
9
|
import type { SuiteResult } from "@nomicfoundation/edr";
|
|
7
10
|
|
|
8
11
|
import { styleText } from "node:util";
|
|
@@ -20,6 +23,8 @@ import {
|
|
|
20
23
|
checkSnapshotCheatcodes,
|
|
21
24
|
extractSnapshotCheatcodes,
|
|
22
25
|
logSnapshotCheatcodesSection,
|
|
26
|
+
logSnapshotRenameWarnings,
|
|
27
|
+
sanitizeSnapshotCheatcodes,
|
|
23
28
|
writeSnapshotCheatcodes,
|
|
24
29
|
} from "../../snapshot-cheatcodes.js";
|
|
25
30
|
|
|
@@ -30,6 +35,7 @@ interface GasAnalyticsTestActionArguments {
|
|
|
30
35
|
|
|
31
36
|
export interface SnapshotResult {
|
|
32
37
|
functionGasSnapshotsWritten: boolean;
|
|
38
|
+
renamedGroups: RenamedSnapshotGroup[];
|
|
33
39
|
}
|
|
34
40
|
|
|
35
41
|
export interface SnapshotCheckResult {
|
|
@@ -91,11 +97,14 @@ export async function handleSnapshot(
|
|
|
91
97
|
await writeFunctionGasSnapshots(basePath, functionGasSnapshots);
|
|
92
98
|
}
|
|
93
99
|
|
|
94
|
-
const snapshotCheatcodes =
|
|
100
|
+
const { snapshotCheatcodes, renamedGroups } = sanitizeSnapshotCheatcodes(
|
|
101
|
+
extractSnapshotCheatcodes(suiteResults),
|
|
102
|
+
);
|
|
95
103
|
await writeSnapshotCheatcodes(basePath, snapshotCheatcodes);
|
|
96
104
|
|
|
97
105
|
return {
|
|
98
106
|
functionGasSnapshotsWritten: testsPassed,
|
|
107
|
+
renamedGroups,
|
|
99
108
|
};
|
|
100
109
|
}
|
|
101
110
|
|
|
@@ -107,6 +116,7 @@ export function logSnapshotResult(
|
|
|
107
116
|
logger(styleText("green", "Function gas snapshots written successfully"));
|
|
108
117
|
logger();
|
|
109
118
|
}
|
|
119
|
+
logSnapshotRenameWarnings(result.renamedGroups, logger);
|
|
110
120
|
}
|
|
111
121
|
|
|
112
122
|
export async function handleSnapshotCheck(
|
|
@@ -164,6 +174,18 @@ export function logSnapshotCheckResult(
|
|
|
164
174
|
|
|
165
175
|
logSnapshotCheatcodesSection(snapshotCheatcodesCheck, logger);
|
|
166
176
|
|
|
177
|
+
// Add an extra newline if only the rename warnings have output
|
|
178
|
+
// (logSnapshotCheatcodesSection adds one if it has output)
|
|
179
|
+
if (
|
|
180
|
+
!functionGasHasOutput &&
|
|
181
|
+
!snapshotCheatcodesHasOutput &&
|
|
182
|
+
snapshotCheatcodesCheck.renamedGroups.length > 0
|
|
183
|
+
) {
|
|
184
|
+
logger();
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
logSnapshotRenameWarnings(snapshotCheatcodesCheck.renamedGroups, logger);
|
|
188
|
+
|
|
167
189
|
if (!functionGasSnapshotsCheck.passed || !snapshotCheatcodesCheck.passed) {
|
|
168
190
|
logger(
|
|
169
191
|
styleText(
|
|
@@ -83,9 +83,12 @@ export function resolveEdrNetwork(
|
|
|
83
83
|
|
|
84
84
|
allowBlocksWithSameTimestamp:
|
|
85
85
|
networkConfig.allowBlocksWithSameTimestamp ?? false,
|
|
86
|
-
allowUnlimitedContractSize:
|
|
87
|
-
|
|
88
|
-
|
|
86
|
+
allowUnlimitedContractSize: networkConfig.allowUnlimitedContractSize,
|
|
87
|
+
blockGasLimit:
|
|
88
|
+
typeof networkConfig.blockGasLimit === "number" ||
|
|
89
|
+
typeof networkConfig.blockGasLimit === "bigint"
|
|
90
|
+
? toBigInt(networkConfig.blockGasLimit)
|
|
91
|
+
: networkConfig.blockGasLimit,
|
|
89
92
|
coinbase: resolveCoinbase(networkConfig.coinbase),
|
|
90
93
|
|
|
91
94
|
forking: resolveForkingConfig(
|
|
@@ -108,6 +111,11 @@ export function resolveEdrNetwork(
|
|
|
108
111
|
throwOnCallFailures: networkConfig.throwOnCallFailures ?? true,
|
|
109
112
|
throwOnTransactionFailures:
|
|
110
113
|
networkConfig.throwOnTransactionFailures ?? true,
|
|
114
|
+
transactionGasCap:
|
|
115
|
+
typeof networkConfig.transactionGasCap === "number" ||
|
|
116
|
+
typeof networkConfig.transactionGasCap === "bigint"
|
|
117
|
+
? toBigInt(networkConfig.transactionGasCap)
|
|
118
|
+
: networkConfig.transactionGasCap,
|
|
111
119
|
};
|
|
112
120
|
}
|
|
113
121
|
|
|
@@ -8,6 +8,8 @@ import { DEFAULT_HD_ACCOUNTS_CONFIG_PARAMS } from "../accounts/constants.js";
|
|
|
8
8
|
export const EDR_NETWORK_DEFAULT_COINBASE =
|
|
9
9
|
"0xc014ba5ec014ba5ec014ba5ec014ba5ec014ba5e";
|
|
10
10
|
|
|
11
|
+
export const DEFAULT_EDR_NETWORK_BLOCK_GAS_LIMIT = 60_000_000n;
|
|
12
|
+
|
|
11
13
|
interface EdrNetworkDefaultHDAccountsConfigParams
|
|
12
14
|
extends DefaultHDAccountsConfigParams {
|
|
13
15
|
mnemonic: string;
|
|
@@ -45,6 +45,7 @@ import {
|
|
|
45
45
|
UnknownError,
|
|
46
46
|
} from "../provider-errors.js";
|
|
47
47
|
|
|
48
|
+
import { DEFAULT_EDR_NETWORK_BLOCK_GAS_LIMIT } from "./edr-constants.js";
|
|
48
49
|
import { getGenesisStateAndOwnedAccounts } from "./genesis-state.js";
|
|
49
50
|
import { EdrProviderStackTraceGenerationError } from "./stack-traces/stack-trace-generation-errors.js";
|
|
50
51
|
import { createSolidityErrorWithStackTrace } from "./stack-traces/stack-trace-solidity-errors.js";
|
|
@@ -56,6 +57,7 @@ import {
|
|
|
56
57
|
hardhatMempoolOrderToEdrMineOrdering,
|
|
57
58
|
hardhatHardforkToEdrSpecId,
|
|
58
59
|
hardhatForkingConfigToEdrForkConfig,
|
|
60
|
+
resolveDefaultTransactionGasLimit,
|
|
59
61
|
} from "./utils/convert-to-edr.js";
|
|
60
62
|
import { printLine, replaceLastLine } from "./utils/logger.js";
|
|
61
63
|
|
|
@@ -457,6 +459,15 @@ export async function getProviderConfig(
|
|
|
457
459
|
networkConfig.chainType,
|
|
458
460
|
);
|
|
459
461
|
|
|
462
|
+
const genesisBlockGasLimit =
|
|
463
|
+
typeof networkConfig.blockGasLimit === "bigint"
|
|
464
|
+
? networkConfig.blockGasLimit
|
|
465
|
+
: DEFAULT_EDR_NETWORK_BLOCK_GAS_LIMIT;
|
|
466
|
+
|
|
467
|
+
// EDR's mining block gas limit can be disabled in user config explicitly
|
|
468
|
+
const miningBlockGasLimit =
|
|
469
|
+
networkConfig.blockGasLimit === false ? undefined : genesisBlockGasLimit;
|
|
470
|
+
|
|
460
471
|
const { genesisState, ownedAccounts } = await getGenesisStateAndOwnedAccounts(
|
|
461
472
|
networkConfig.accounts,
|
|
462
473
|
networkConfig.forking,
|
|
@@ -464,26 +475,43 @@ export async function getProviderConfig(
|
|
|
464
475
|
specId,
|
|
465
476
|
);
|
|
466
477
|
|
|
478
|
+
const forkConfig = await hardhatForkingConfigToEdrForkConfig(
|
|
479
|
+
networkConfig.forking,
|
|
480
|
+
chainDescriptors,
|
|
481
|
+
networkConfig.chainType,
|
|
482
|
+
);
|
|
483
|
+
|
|
484
|
+
const network =
|
|
485
|
+
forkConfig !== undefined
|
|
486
|
+
? forkConfig
|
|
487
|
+
: {
|
|
488
|
+
genesisBlockGasLimit,
|
|
489
|
+
genesisBlockTime: BigInt(toSeconds(networkConfig.initialDate)),
|
|
490
|
+
};
|
|
491
|
+
|
|
492
|
+
const defaultTransactionGasLimit = resolveDefaultTransactionGasLimit({
|
|
493
|
+
chainType: networkConfig.chainType,
|
|
494
|
+
hardfork: networkConfig.hardfork,
|
|
495
|
+
blockGasLimit: genesisBlockGasLimit,
|
|
496
|
+
transactionGasCap: networkConfig.transactionGasCap,
|
|
497
|
+
});
|
|
498
|
+
|
|
467
499
|
return {
|
|
468
500
|
allowBlocksWithSameTimestamp: networkConfig.allowBlocksWithSameTimestamp,
|
|
469
|
-
allowUnlimitedContractSize:
|
|
501
|
+
allowUnlimitedContractSize:
|
|
502
|
+
networkConfig.allowUnlimitedContractSize ?? false,
|
|
470
503
|
bailOnCallFailure: networkConfig.throwOnCallFailures,
|
|
471
504
|
bailOnTransactionFailure: networkConfig.throwOnTransactionFailures,
|
|
472
|
-
blockGasLimit: networkConfig.blockGasLimit,
|
|
473
505
|
chainId: BigInt(networkConfig.chainId),
|
|
474
506
|
coinbase: networkConfig.coinbase,
|
|
475
|
-
|
|
476
|
-
networkConfig.forking,
|
|
477
|
-
chainDescriptors,
|
|
478
|
-
networkConfig.chainType,
|
|
479
|
-
),
|
|
507
|
+
defaultTransactionGasLimit,
|
|
480
508
|
genesisState: Array.from(genesisState.values()),
|
|
481
509
|
hardfork: specId,
|
|
482
510
|
initialBaseFeePerGas: networkConfig.initialBaseFeePerGas,
|
|
483
|
-
initialDate: BigInt(toSeconds(networkConfig.initialDate)),
|
|
484
511
|
minGasPrice: networkConfig.minGasPrice,
|
|
485
512
|
mining: {
|
|
486
513
|
autoMine: networkConfig.mining.auto,
|
|
514
|
+
blockGasLimit: miningBlockGasLimit,
|
|
487
515
|
interval: hardhatMiningIntervalToEdrMiningInterval(
|
|
488
516
|
networkConfig.mining.interval,
|
|
489
517
|
),
|
|
@@ -493,6 +521,7 @@ export async function getProviderConfig(
|
|
|
493
521
|
),
|
|
494
522
|
},
|
|
495
523
|
},
|
|
524
|
+
network,
|
|
496
525
|
networkId: BigInt(networkConfig.networkId),
|
|
497
526
|
observability: {
|
|
498
527
|
codeCoverage: coverageConfig,
|
|
@@ -501,5 +530,6 @@ export async function getProviderConfig(
|
|
|
501
530
|
},
|
|
502
531
|
ownedAccounts: ownedAccounts.map((account) => account.secretKey),
|
|
503
532
|
precompileOverrides: [],
|
|
533
|
+
transactionGasCap: networkConfig.transactionGasCap,
|
|
504
534
|
};
|
|
505
535
|
}
|
|
@@ -62,7 +62,11 @@ import {
|
|
|
62
62
|
EDR_NETWORK_DEFAULT_PRIVATE_KEYS,
|
|
63
63
|
isDefaultEdrNetworkHDAccountsConfig,
|
|
64
64
|
} from "../edr-constants.js";
|
|
65
|
-
import {
|
|
65
|
+
import {
|
|
66
|
+
hardforkGte,
|
|
67
|
+
L1HardforkName,
|
|
68
|
+
OpHardforkName,
|
|
69
|
+
} from "../types/hardfork.js";
|
|
66
70
|
|
|
67
71
|
import { getL1HardforkName, getOpHardforkName } from "./hardfork.js";
|
|
68
72
|
|
|
@@ -382,6 +386,44 @@ export async function hardhatForkingConfigToEdrForkConfig(
|
|
|
382
386
|
return fork;
|
|
383
387
|
}
|
|
384
388
|
|
|
389
|
+
/**
|
|
390
|
+
* Resolves the default transaction gas limit used by RPC call and
|
|
391
|
+
* transaction requests that omit a `gas` field.
|
|
392
|
+
*
|
|
393
|
+
* When `transactionGasCap` is a bigint, that value wins. When it is
|
|
394
|
+
* `false`, the per-transaction cap is disabled and the block gas limit is
|
|
395
|
+
* used. When it is undefined, the hardfork-specific default applies:
|
|
396
|
+
* from L1's Osaka hardfork onwards, the EIP-7825 transaction gas cap of
|
|
397
|
+
* 16,777,216; otherwise the block gas limit.
|
|
398
|
+
*/
|
|
399
|
+
export function resolveDefaultTransactionGasLimit(params: {
|
|
400
|
+
chainType: ChainType;
|
|
401
|
+
hardfork: string;
|
|
402
|
+
blockGasLimit: bigint;
|
|
403
|
+
transactionGasCap: bigint | false | undefined;
|
|
404
|
+
}): bigint {
|
|
405
|
+
const { chainType, hardfork, blockGasLimit, transactionGasCap } = params;
|
|
406
|
+
|
|
407
|
+
if (typeof transactionGasCap === "bigint") {
|
|
408
|
+
return transactionGasCap;
|
|
409
|
+
}
|
|
410
|
+
|
|
411
|
+
if (transactionGasCap === false) {
|
|
412
|
+
return blockGasLimit;
|
|
413
|
+
}
|
|
414
|
+
|
|
415
|
+
// TODO: OP UPGRADE 19 - update OP to also set a default transaction gas once enabled
|
|
416
|
+
if (chainType === OPTIMISM_CHAIN_TYPE) {
|
|
417
|
+
return blockGasLimit;
|
|
418
|
+
}
|
|
419
|
+
|
|
420
|
+
if (hardforkGte(hardfork, L1HardforkName.OSAKA, chainType)) {
|
|
421
|
+
return 16_777_216n; // EIP-7825 transaction gas cap
|
|
422
|
+
}
|
|
423
|
+
|
|
424
|
+
return blockGasLimit;
|
|
425
|
+
}
|
|
426
|
+
|
|
385
427
|
/**
|
|
386
428
|
* Converts EDR's nested GasReport structure into a flat array of gas entries.
|
|
387
429
|
* Filters out reverted transactions.
|
|
@@ -42,6 +42,7 @@ import { edrGasReportToHardhatGasMeasurements } from "./edr/utils/convert-to-edr
|
|
|
42
42
|
import { verbosityToIncludeTraces } from "./edr/utils/trace-formatters.js";
|
|
43
43
|
import { HttpProvider } from "./http-provider.js";
|
|
44
44
|
import { NetworkConnectionImplementation } from "./network-connection.js";
|
|
45
|
+
import { applyCoverageNetworkOverrides } from "./utils/apply-coverage-network-overrides.js";
|
|
45
46
|
|
|
46
47
|
export type JsonRpcRequestWrapperFunction = (
|
|
47
48
|
request: JsonRpcRequest,
|
|
@@ -360,12 +361,10 @@ export class NetworkManagerImplementation implements NetworkManager {
|
|
|
360
361
|
// The resolvedNetworkConfig can have its chainType set to `undefined`
|
|
361
362
|
// so we default to the default chain type here.
|
|
362
363
|
networkConfig: {
|
|
363
|
-
...
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
? true
|
|
368
|
-
: resolvedNetworkConfig.allowUnlimitedContractSize,
|
|
364
|
+
...applyCoverageNetworkOverrides(
|
|
365
|
+
resolvedNetworkConfig,
|
|
366
|
+
shouldEnableCoverage,
|
|
367
|
+
),
|
|
369
368
|
chainType: resolvedChainType,
|
|
370
369
|
},
|
|
371
370
|
jsonRpcRequestWrapper,
|
|
@@ -111,7 +111,7 @@ declare module "../../../../types/config.js" {
|
|
|
111
111
|
// EDR network specific
|
|
112
112
|
allowBlocksWithSameTimestamp?: boolean;
|
|
113
113
|
allowUnlimitedContractSize?: boolean;
|
|
114
|
-
blockGasLimit?: number | bigint;
|
|
114
|
+
blockGasLimit?: number | bigint | false;
|
|
115
115
|
coinbase?: string;
|
|
116
116
|
forking?: EdrNetworkForkingUserConfig;
|
|
117
117
|
hardfork?: string;
|
|
@@ -123,6 +123,7 @@ declare module "../../../../types/config.js" {
|
|
|
123
123
|
networkId?: number;
|
|
124
124
|
throwOnCallFailures?: boolean;
|
|
125
125
|
throwOnTransactionFailures?: boolean;
|
|
126
|
+
transactionGasCap?: number | bigint | false;
|
|
126
127
|
}
|
|
127
128
|
|
|
128
129
|
export type EdrNetworkAccountsUserConfig =
|
|
@@ -255,8 +256,8 @@ declare module "../../../../types/config.js" {
|
|
|
255
256
|
|
|
256
257
|
// EDR network specific
|
|
257
258
|
allowBlocksWithSameTimestamp: boolean;
|
|
258
|
-
allowUnlimitedContractSize
|
|
259
|
-
blockGasLimit
|
|
259
|
+
allowUnlimitedContractSize?: boolean;
|
|
260
|
+
blockGasLimit?: bigint | false;
|
|
260
261
|
coinbase: Uint8Array;
|
|
261
262
|
forking?: EdrNetworkForkingConfig;
|
|
262
263
|
hardfork: string;
|
|
@@ -268,6 +269,7 @@ declare module "../../../../types/config.js" {
|
|
|
268
269
|
networkId: number;
|
|
269
270
|
throwOnCallFailures: boolean;
|
|
270
271
|
throwOnTransactionFailures: boolean;
|
|
272
|
+
transactionGasCap?: bigint | false;
|
|
271
273
|
}
|
|
272
274
|
|
|
273
275
|
export type EdrNetworkAccountsConfig =
|
|
@@ -220,6 +220,11 @@ const gasUnitUserConfigSchema = unionType(
|
|
|
220
220
|
"Expected a positive safe int or a positive bigint",
|
|
221
221
|
);
|
|
222
222
|
|
|
223
|
+
const gasLimitWithDisableUserConfigSchema = unionType(
|
|
224
|
+
[gasUnitUserConfigSchema, z.literal(false)],
|
|
225
|
+
"Expected `false`, a positive safe int, or a positive bigint",
|
|
226
|
+
);
|
|
227
|
+
|
|
223
228
|
const gasUserConfigSchema = unionType(
|
|
224
229
|
[z.literal("auto"), gasUnitUserConfigSchema],
|
|
225
230
|
"Expected 'auto', a positive safe int, or positive bigint",
|
|
@@ -311,7 +316,7 @@ const edrNetworkUserConfigSchema = z.object({
|
|
|
311
316
|
// EDR network specific
|
|
312
317
|
allowBlocksWithSameTimestamp: z.optional(z.boolean()),
|
|
313
318
|
allowUnlimitedContractSize: z.optional(z.boolean()),
|
|
314
|
-
blockGasLimit: z.optional(
|
|
319
|
+
blockGasLimit: z.optional(gasLimitWithDisableUserConfigSchema),
|
|
315
320
|
coinbase: z.optional(z.string()),
|
|
316
321
|
forking: z.optional(edrNetworkForkingUserConfigSchema),
|
|
317
322
|
hardfork: z.optional(z.string()),
|
|
@@ -325,6 +330,7 @@ const edrNetworkUserConfigSchema = z.object({
|
|
|
325
330
|
networkId: z.optional(chainIdSchema),
|
|
326
331
|
throwOnCallFailures: z.optional(z.boolean()),
|
|
327
332
|
throwOnTransactionFailures: z.optional(z.boolean()),
|
|
333
|
+
transactionGasCap: z.optional(gasLimitWithDisableUserConfigSchema),
|
|
328
334
|
});
|
|
329
335
|
|
|
330
336
|
const networkUserConfigSchema = z.discriminatedUnion("type", [
|
package/src/internal/builtin-plugins/network-manager/utils/apply-coverage-network-overrides.ts
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import type { EdrNetworkConfig } from "../../../../types/config.js";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Returns a copy of the resolved EDR network config with coverage-specific
|
|
5
|
+
* overrides applied. When coverage is enabled and the user has not set the
|
|
6
|
+
* field explicitly:
|
|
7
|
+
*
|
|
8
|
+
* - `allowUnlimitedContractSize` defaults to `true`, because coverage
|
|
9
|
+
* instrumentation can push the contract size over the limit.
|
|
10
|
+
* - `blockGasLimit` and `transactionGasCap` default to `false` (disabled),
|
|
11
|
+
* so the added gas of coverage instrumentation does not push tests over
|
|
12
|
+
* the per-block or EIP-7825 transaction caps.
|
|
13
|
+
*
|
|
14
|
+
* Explicit user values are preserved in all three cases.
|
|
15
|
+
*
|
|
16
|
+
* When coverage is disabled, the config is returned unchanged.
|
|
17
|
+
*/
|
|
18
|
+
export function applyCoverageNetworkOverrides(
|
|
19
|
+
config: EdrNetworkConfig,
|
|
20
|
+
shouldEnableCoverage: boolean,
|
|
21
|
+
): EdrNetworkConfig {
|
|
22
|
+
if (!shouldEnableCoverage) {
|
|
23
|
+
return config;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
return {
|
|
27
|
+
...config,
|
|
28
|
+
allowUnlimitedContractSize: config.allowUnlimitedContractSize ?? true,
|
|
29
|
+
blockGasLimit: config.blockGasLimit ?? false,
|
|
30
|
+
transactionGasCap: config.transactionGasCap ?? false,
|
|
31
|
+
};
|
|
32
|
+
}
|
|
@@ -269,6 +269,12 @@ const _handleError = (error: Error): JsonRpcResponse => {
|
|
|
269
269
|
error = new InternalError(undefined, error);
|
|
270
270
|
}
|
|
271
271
|
|
|
272
|
+
// Revert errors (code 3): return raw hex to match the geth/anvil convention
|
|
273
|
+
// that viem/ethers/web3.js rely on. Other errors keep the wrapper for diagnostics.
|
|
274
|
+
const data: unknown = isRevertError
|
|
275
|
+
? returnData
|
|
276
|
+
: { message: error.message, txHash, data: returnData };
|
|
277
|
+
|
|
272
278
|
const response: FailedJsonRpcResponse = {
|
|
273
279
|
jsonrpc: "2.0",
|
|
274
280
|
id: null,
|
|
@@ -278,11 +284,7 @@ const _handleError = (error: Error): JsonRpcResponse => {
|
|
|
278
284
|
? error.code
|
|
279
285
|
: InternalError.CODE,
|
|
280
286
|
message: error.message,
|
|
281
|
-
data
|
|
282
|
-
message: error.message,
|
|
283
|
-
txHash,
|
|
284
|
-
data: returnData,
|
|
285
|
-
},
|
|
287
|
+
data,
|
|
286
288
|
},
|
|
287
289
|
};
|
|
288
290
|
|
package/src/internal/builtin-plugins/solidity/build-system/resolver/remapped-npm-packages-graph.ts
CHANGED
|
@@ -29,14 +29,13 @@ import {
|
|
|
29
29
|
} from "@nomicfoundation/hardhat-utils/package";
|
|
30
30
|
|
|
31
31
|
import { UserRemappingErrorType } from "../../../../../types/solidity.js";
|
|
32
|
+
import { HARDHAT_PROJECT_INPUT_SOURCE_NAME_ROOT } from "../../constants.js";
|
|
32
33
|
|
|
33
34
|
import { getNpmPackageName } from "./npm-module-parsing.js";
|
|
34
35
|
import { parseRemappingString, selectBestRemapping } from "./remappings.js";
|
|
35
36
|
import { sourceNamePathJoin } from "./source-name-utils.js";
|
|
36
37
|
import { UserRemappingType } from "./types.js";
|
|
37
38
|
|
|
38
|
-
const HARDHAT_PROJECT_INPUT_SOURCE_NAME_ROOT = "project";
|
|
39
|
-
|
|
40
39
|
/**
|
|
41
40
|
* Returns a normalized version of the path if it refers to a node_modules in
|
|
42
41
|
* the root directory (i.e. node_modules/...), or a `node_modules` directory
|