hardhat 3.1.11 → 3.2.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 +31 -0
- package/dist/src/internal/builtin-plugins/coverage/helpers.d.ts +5 -0
- package/dist/src/internal/builtin-plugins/coverage/helpers.d.ts.map +1 -1
- package/dist/src/internal/builtin-plugins/coverage/helpers.js +12 -0
- package/dist/src/internal/builtin-plugins/coverage/helpers.js.map +1 -1
- package/dist/src/internal/builtin-plugins/coverage/hook-handlers/hre.d.ts.map +1 -1
- package/dist/src/internal/builtin-plugins/coverage/hook-handlers/hre.js +2 -5
- package/dist/src/internal/builtin-plugins/coverage/hook-handlers/hre.js.map +1 -1
- package/dist/src/internal/builtin-plugins/coverage/hook-handlers/solidity.d.ts.map +1 -1
- package/dist/src/internal/builtin-plugins/coverage/hook-handlers/solidity.js +3 -5
- package/dist/src/internal/builtin-plugins/coverage/hook-handlers/solidity.js.map +1 -1
- package/dist/src/internal/builtin-plugins/coverage/hook-handlers/test.d.ts.map +1 -1
- package/dist/src/internal/builtin-plugins/coverage/hook-handlers/test.js +4 -15
- package/dist/src/internal/builtin-plugins/coverage/hook-handlers/test.js.map +1 -1
- package/dist/src/internal/builtin-plugins/gas-analytics/function-gas-snapshots.d.ts +53 -0
- package/dist/src/internal/builtin-plugins/gas-analytics/function-gas-snapshots.d.ts.map +1 -0
- package/dist/src/internal/builtin-plugins/gas-analytics/function-gas-snapshots.js +288 -0
- package/dist/src/internal/builtin-plugins/gas-analytics/function-gas-snapshots.js.map +1 -0
- package/dist/src/internal/builtin-plugins/gas-analytics/gas-analytics-manager.d.ts +11 -11
- package/dist/src/internal/builtin-plugins/gas-analytics/gas-analytics-manager.d.ts.map +1 -1
- package/dist/src/internal/builtin-plugins/gas-analytics/gas-analytics-manager.js +82 -27
- package/dist/src/internal/builtin-plugins/gas-analytics/gas-analytics-manager.js.map +1 -1
- package/dist/src/internal/builtin-plugins/gas-analytics/helpers.d.ts +10 -0
- package/dist/src/internal/builtin-plugins/gas-analytics/helpers.d.ts.map +1 -1
- package/dist/src/internal/builtin-plugins/gas-analytics/helpers.js +27 -0
- package/dist/src/internal/builtin-plugins/gas-analytics/helpers.js.map +1 -1
- package/dist/src/internal/builtin-plugins/gas-analytics/hook-handlers/hre.d.ts.map +1 -1
- package/dist/src/internal/builtin-plugins/gas-analytics/hook-handlers/hre.js +4 -5
- package/dist/src/internal/builtin-plugins/gas-analytics/hook-handlers/hre.js.map +1 -1
- package/dist/src/internal/builtin-plugins/gas-analytics/hook-handlers/test.d.ts.map +1 -1
- package/dist/src/internal/builtin-plugins/gas-analytics/hook-handlers/test.js +13 -17
- package/dist/src/internal/builtin-plugins/gas-analytics/hook-handlers/test.js.map +1 -1
- package/dist/src/internal/builtin-plugins/gas-analytics/index.d.ts.map +1 -1
- package/dist/src/internal/builtin-plugins/gas-analytics/index.js +42 -2
- package/dist/src/internal/builtin-plugins/gas-analytics/index.js.map +1 -1
- package/dist/src/internal/builtin-plugins/gas-analytics/snapshot-cheatcodes.d.ts +45 -0
- package/dist/src/internal/builtin-plugins/gas-analytics/snapshot-cheatcodes.d.ts.map +1 -0
- package/dist/src/internal/builtin-plugins/gas-analytics/snapshot-cheatcodes.js +276 -0
- package/dist/src/internal/builtin-plugins/gas-analytics/snapshot-cheatcodes.js.map +1 -0
- package/dist/src/internal/builtin-plugins/gas-analytics/tasks/solidity-test/task-action.d.ts +22 -0
- package/dist/src/internal/builtin-plugins/gas-analytics/tasks/solidity-test/task-action.d.ts.map +1 -0
- package/dist/src/internal/builtin-plugins/gas-analytics/tasks/solidity-test/task-action.js +88 -0
- package/dist/src/internal/builtin-plugins/gas-analytics/tasks/solidity-test/task-action.js.map +1 -0
- package/dist/src/internal/builtin-plugins/gas-analytics/type-extensions.d.ts +1 -0
- package/dist/src/internal/builtin-plugins/gas-analytics/type-extensions.d.ts.map +1 -1
- package/dist/src/internal/builtin-plugins/gas-analytics/types.d.ts +33 -0
- package/dist/src/internal/builtin-plugins/gas-analytics/types.d.ts.map +1 -1
- package/dist/src/internal/builtin-plugins/index.js +1 -1
- package/dist/src/internal/builtin-plugins/network-manager/network-manager.d.ts +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 +15 -1
- package/dist/src/internal/builtin-plugins/network-manager/network-manager.js.map +1 -1
- package/dist/src/internal/builtin-plugins/node/json-rpc/handler.js +7 -2
- package/dist/src/internal/builtin-plugins/node/json-rpc/handler.js.map +1 -1
- package/dist/src/internal/builtin-plugins/solidity/build-system/compiler/downloader.d.ts.map +1 -1
- package/dist/src/internal/builtin-plugins/solidity/build-system/compiler/downloader.js +0 -1
- package/dist/src/internal/builtin-plugins/solidity/build-system/compiler/downloader.js.map +1 -1
- package/dist/src/internal/builtin-plugins/solidity/build-system/compiler/index.d.ts +10 -0
- package/dist/src/internal/builtin-plugins/solidity/build-system/compiler/index.d.ts.map +1 -1
- package/dist/src/internal/builtin-plugins/solidity/build-system/compiler/index.js +29 -6
- package/dist/src/internal/builtin-plugins/solidity/build-system/compiler/index.js.map +1 -1
- package/dist/src/internal/builtin-plugins/solidity/build-system/solc-info.d.ts +6 -0
- package/dist/src/internal/builtin-plugins/solidity/build-system/solc-info.d.ts.map +1 -1
- package/dist/src/internal/builtin-plugins/solidity/build-system/solc-info.js +11 -0
- package/dist/src/internal/builtin-plugins/solidity/build-system/solc-info.js.map +1 -1
- package/dist/src/internal/builtin-plugins/solidity/config.d.ts.map +1 -1
- package/dist/src/internal/builtin-plugins/solidity/config.js +13 -7
- package/dist/src/internal/builtin-plugins/solidity/config.js.map +1 -1
- package/dist/src/internal/builtin-plugins/solidity-test/config.d.ts +3 -1
- package/dist/src/internal/builtin-plugins/solidity-test/config.d.ts.map +1 -1
- package/dist/src/internal/builtin-plugins/solidity-test/config.js +9 -0
- package/dist/src/internal/builtin-plugins/solidity-test/config.js.map +1 -1
- package/dist/src/internal/builtin-plugins/solidity-test/helpers.d.ts.map +1 -1
- package/dist/src/internal/builtin-plugins/solidity-test/helpers.js +4 -10
- package/dist/src/internal/builtin-plugins/solidity-test/helpers.js.map +1 -1
- package/dist/src/internal/builtin-plugins/solidity-test/index.d.ts.map +1 -1
- package/dist/src/internal/builtin-plugins/solidity-test/index.js +0 -1
- package/dist/src/internal/builtin-plugins/solidity-test/index.js.map +1 -1
- package/dist/src/internal/builtin-plugins/solidity-test/runner.d.ts +1 -1
- package/dist/src/internal/builtin-plugins/solidity-test/runner.d.ts.map +1 -1
- package/dist/src/internal/builtin-plugins/solidity-test/runner.js +2 -2
- package/dist/src/internal/builtin-plugins/solidity-test/runner.js.map +1 -1
- package/dist/src/internal/builtin-plugins/solidity-test/task-action.d.ts +5 -0
- 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 +19 -11
- package/dist/src/internal/builtin-plugins/solidity-test/task-action.js.map +1 -1
- package/dist/src/internal/builtin-plugins/solidity-test/type-extensions.d.ts +15 -10
- package/dist/src/internal/builtin-plugins/solidity-test/type-extensions.d.ts.map +1 -1
- package/dist/src/internal/builtin-plugins/test/task-action.d.ts.map +1 -1
- package/dist/src/internal/builtin-plugins/test/task-action.js +60 -21
- package/dist/src/internal/builtin-plugins/test/task-action.js.map +1 -1
- package/dist/src/types/network.d.ts +1 -1
- package/dist/src/types/network.d.ts.map +1 -1
- package/dist/src/types/test.d.ts +7 -0
- package/dist/src/types/test.d.ts.map +1 -1
- package/package.json +5 -5
- package/src/internal/builtin-plugins/coverage/helpers.ts +31 -0
- package/src/internal/builtin-plugins/coverage/hook-handlers/hre.ts +2 -10
- package/src/internal/builtin-plugins/coverage/hook-handlers/solidity.ts +3 -12
- package/src/internal/builtin-plugins/coverage/hook-handlers/test.ts +4 -25
- package/src/internal/builtin-plugins/gas-analytics/function-gas-snapshots.ts +473 -0
- package/src/internal/builtin-plugins/gas-analytics/gas-analytics-manager.ts +121 -35
- package/src/internal/builtin-plugins/gas-analytics/helpers.ts +60 -0
- package/src/internal/builtin-plugins/gas-analytics/hook-handlers/hre.ts +6 -10
- package/src/internal/builtin-plugins/gas-analytics/hook-handlers/test.ts +18 -26
- package/src/internal/builtin-plugins/gas-analytics/index.ts +44 -2
- package/src/internal/builtin-plugins/gas-analytics/snapshot-cheatcodes.ts +454 -0
- package/src/internal/builtin-plugins/gas-analytics/tasks/solidity-test/task-action.ts +172 -0
- package/src/internal/builtin-plugins/gas-analytics/type-extensions.ts +1 -0
- package/src/internal/builtin-plugins/gas-analytics/types.ts +37 -0
- package/src/internal/builtin-plugins/index.ts +1 -1
- package/src/internal/builtin-plugins/network-manager/network-manager.ts +29 -2
- package/src/internal/builtin-plugins/node/json-rpc/handler.ts +8 -2
- package/src/internal/builtin-plugins/solidity/build-system/compiler/downloader.ts +0 -5
- package/src/internal/builtin-plugins/solidity/build-system/compiler/index.ts +44 -9
- package/src/internal/builtin-plugins/solidity/build-system/solc-info.ts +15 -0
- package/src/internal/builtin-plugins/solidity/config.ts +13 -6
- package/src/internal/builtin-plugins/solidity-test/config.ts +15 -0
- package/src/internal/builtin-plugins/solidity-test/helpers.ts +6 -14
- package/src/internal/builtin-plugins/solidity-test/index.ts +0 -1
- package/src/internal/builtin-plugins/solidity-test/runner.ts +2 -2
- package/src/internal/builtin-plugins/solidity-test/task-action.ts +27 -21
- package/src/internal/builtin-plugins/solidity-test/type-extensions.ts +17 -10
- package/src/internal/builtin-plugins/test/task-action.ts +74 -36
- package/src/types/network.ts +2 -2
- package/src/types/test.ts +8 -0
- package/templates/hardhat-3/01-node-test-runner-viem/package.json +5 -5
- package/templates/hardhat-3/02-mocha-ethers/package.json +6 -6
- package/templates/hardhat-3/03-minimal/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,36 @@
|
|
|
1
1
|
# hardhat
|
|
2
2
|
|
|
3
|
+
## 3.2.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [#8064](https://github.com/NomicFoundation/hardhat/pull/8064) [`392fc38`](https://github.com/NomicFoundation/hardhat/commit/392fc388556e9ec3ca1309db0ffb2ded24439ee2) Thanks [@schaable](https://github.com/schaable)! - Add `--gas-stats-json <path>` global option to write gas usage statistics to a JSON file ([#7990](https://github.com/NomicFoundation/hardhat/issues/7990)).
|
|
8
|
+
|
|
9
|
+
### Patch Changes
|
|
10
|
+
|
|
11
|
+
- [#8061](https://github.com/NomicFoundation/hardhat/pull/8061) [`c03f647`](https://github.com/NomicFoundation/hardhat/commit/c03f6476cc62ae31e745e0e1a72371d3cba8e9dc) Thanks [@ChristopherDedominici](https://github.com/ChristopherDedominici)! - Fixed bug to preserve revert data in JSON-RPC responses for non-ProviderErrors ([8061](https://github.com/NomicFoundation/hardhat/pull/8061)).
|
|
12
|
+
|
|
13
|
+
- [#8060](https://github.com/NomicFoundation/hardhat/pull/8060) [`4461d1e`](https://github.com/NomicFoundation/hardhat/commit/4461d1e760c42e186c4b64e4332ca2c6333b86bf) Thanks [@kanej](https://github.com/kanej)! - Updated `network.createServer` signature to type non-generic chainTypes
|
|
14
|
+
|
|
15
|
+
- [#8038](https://github.com/NomicFoundation/hardhat/pull/8038) [`465d00d`](https://github.com/NomicFoundation/hardhat/commit/465d00d6f67b72752ffa54a88ee90027667f0030) Thanks [@schaable](https://github.com/schaable)! - Aggregate deployment gas statistics (min, avg, median, max, count) instead of showing only the last deployment cost and size ([#8037](https://github.com/NomicFoundation/hardhat/issues/8037))
|
|
16
|
+
|
|
17
|
+
- [#8060](https://github.com/NomicFoundation/hardhat/pull/8060) [`0e8abcf`](https://github.com/NomicFoundation/hardhat/commit/0e8abcf376b7b3618261512c98ae5dcfef716216) Thanks [@kanej](https://github.com/kanej)! - Added guard against `http` network configs in `network.createServer(...)`
|
|
18
|
+
|
|
19
|
+
- [#8036](https://github.com/NomicFoundation/hardhat/pull/8036) [`954825a`](https://github.com/NomicFoundation/hardhat/commit/954825a35f5813625c4a72d8e887895d7a71e78b) Thanks [@schaable](https://github.com/schaable)! - Aggregate `--gas-stats` output when using multiple test runners, printing a single consolidated table at the end instead of separate tables per runner ([#7500](https://github.com/NomicFoundation/hardhat/issues/7500)).
|
|
20
|
+
|
|
21
|
+
- [#8062](https://github.com/NomicFoundation/hardhat/pull/8062) [`45963d4`](https://github.com/NomicFoundation/hardhat/commit/45963d4ef98f505e7f1e40414ead94baaa566d79) Thanks [@ChristopherDedominici](https://github.com/ChristopherDedominici)! - Fixed compiler download for old versions in ARM64 ([8062](https://github.com/NomicFoundation/hardhat/pull/8062)).
|
|
22
|
+
|
|
23
|
+
- Updated dependencies:
|
|
24
|
+
- @nomicfoundation/hardhat-errors@3.0.9
|
|
25
|
+
|
|
26
|
+
## 3.1.12
|
|
27
|
+
|
|
28
|
+
### Patch Changes
|
|
29
|
+
|
|
30
|
+
- 01b41ee: Added support for function gas snapshots and snapshot cheatcodes in Solidity tests with `--snapshot` and `--snapshot-check` flags ([#7769](https://github.com/NomicFoundation/hardhat/issues/7769))
|
|
31
|
+
- e37f96c: Add `TestRunResult` type that wraps `TestSummary`, allowing plugins to extend test results with additional data
|
|
32
|
+
- bda5a0a: Bumped EDR version to [`0.12.0-next.28`](https://github.com/NomicFoundation/edr/releases/tag/%40nomicfoundation%2Fedr%400.12.0-next.28)
|
|
33
|
+
|
|
3
34
|
## 3.1.11
|
|
4
35
|
|
|
5
36
|
### Patch Changes
|
|
@@ -1,4 +1,9 @@
|
|
|
1
|
+
import type { CoverageManager } from "./types.js";
|
|
2
|
+
import type { HookContext } from "../../../types/hooks.js";
|
|
3
|
+
import type { HardhatRuntimeEnvironment } from "../../../types/hre.js";
|
|
1
4
|
export declare function getCoveragePath(rootPath: string): string;
|
|
5
|
+
export declare function getCoverageManager(hookContextOrHre: HookContext | HardhatRuntimeEnvironment): CoverageManager;
|
|
6
|
+
export declare function setCoverageManager(hre: HardhatRuntimeEnvironment, coverageManager: CoverageManager): void;
|
|
2
7
|
/**
|
|
3
8
|
* The following helpers are kept for backward compatibility with older versions
|
|
4
9
|
* of test runner plugins (hardhat-mocha, hardhat-node-test-runner) that import
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"helpers.d.ts","sourceRoot":"","sources":["../../../../../src/internal/builtin-plugins/coverage/helpers.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"helpers.d.ts","sourceRoot":"","sources":["../../../../../src/internal/builtin-plugins/coverage/helpers.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAClD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAC3D,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,uBAAuB,CAAC;AAevE,wBAAgB,eAAe,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CAExD;AAED,wBAAgB,kBAAkB,CAChC,gBAAgB,EAAE,WAAW,GAAG,yBAAyB,GACxD,eAAe,CAOjB;AAED,wBAAgB,kBAAkB,CAChC,GAAG,EAAE,yBAAyB,EAC9B,eAAe,EAAE,eAAe,GAC/B,IAAI,CAMN;AAED;;;;GAIG;AAEH,wBAAsB,gBAAgB,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAGhE;AAED,wBAAsB,kBAAkB,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAGlE;AAED,wBAAsB,eAAe,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAG/D"}
|
|
@@ -1,8 +1,20 @@
|
|
|
1
1
|
import path from "node:path";
|
|
2
|
+
import { assertHardhatInvariant } from "@nomicfoundation/hardhat-errors";
|
|
3
|
+
import { HardhatRuntimeEnvironmentImplementation } from "../../core/hre.js";
|
|
4
|
+
import { CoverageManagerImplementation } from "./coverage-manager.js";
|
|
2
5
|
import { testRunDone, testRunStart, testWorkerDone, } from "./hook-handlers/test.js";
|
|
3
6
|
export function getCoveragePath(rootPath) {
|
|
4
7
|
return path.join(rootPath, "coverage");
|
|
5
8
|
}
|
|
9
|
+
export function getCoverageManager(hookContextOrHre) {
|
|
10
|
+
assertHardhatInvariant("_coverage" in hookContextOrHre &&
|
|
11
|
+
hookContextOrHre._coverage instanceof CoverageManagerImplementation, "Expected _coverage to be an instance of CoverageManagerImplementation");
|
|
12
|
+
return hookContextOrHre._coverage;
|
|
13
|
+
}
|
|
14
|
+
export function setCoverageManager(hre, coverageManager) {
|
|
15
|
+
assertHardhatInvariant(hre instanceof HardhatRuntimeEnvironmentImplementation, "Expected HRE to be an instance of HardhatRuntimeEnvironmentImplementation");
|
|
16
|
+
hre._coverage = coverageManager;
|
|
17
|
+
}
|
|
6
18
|
/**
|
|
7
19
|
* The following helpers are kept for backward compatibility with older versions
|
|
8
20
|
* of test runner plugins (hardhat-mocha, hardhat-node-test-runner) that import
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"helpers.js","sourceRoot":"","sources":["../../../../../src/internal/builtin-plugins/coverage/helpers.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"helpers.js","sourceRoot":"","sources":["../../../../../src/internal/builtin-plugins/coverage/helpers.ts"],"names":[],"mappings":"AAIA,OAAO,IAAI,MAAM,WAAW,CAAC;AAE7B,OAAO,EAAE,sBAAsB,EAAE,MAAM,iCAAiC,CAAC;AAEzE,OAAO,EAAE,uCAAuC,EAAE,MAAM,mBAAmB,CAAC;AAE5E,OAAO,EAAE,6BAA6B,EAAE,MAAM,uBAAuB,CAAC;AACtE,OAAO,EACL,WAAW,EACX,YAAY,EACZ,cAAc,GACf,MAAM,yBAAyB,CAAC;AAEjC,MAAM,UAAU,eAAe,CAAC,QAAgB;IAC9C,OAAO,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE,UAAU,CAAC,CAAC;AACzC,CAAC;AAED,MAAM,UAAU,kBAAkB,CAChC,gBAAyD;IAEzD,sBAAsB,CACpB,WAAW,IAAI,gBAAgB;QAC7B,gBAAgB,CAAC,SAAS,YAAY,6BAA6B,EACrE,uEAAuE,CACxE,CAAC;IACF,OAAO,gBAAgB,CAAC,SAAS,CAAC;AACpC,CAAC;AAED,MAAM,UAAU,kBAAkB,CAChC,GAA8B,EAC9B,eAAgC;IAEhC,sBAAsB,CACpB,GAAG,YAAY,uCAAuC,EACtD,2EAA2E,CAC5E,CAAC;IACF,GAAG,CAAC,SAAS,GAAG,eAAe,CAAC;AAClC,CAAC;AAED;;;;GAIG;AAEH,MAAM,CAAC,KAAK,UAAU,gBAAgB,CAAC,EAAU;IAC/C,MAAM,EAAE,OAAO,EAAE,GAAG,EAAE,GAAG,MAAM,MAAM,CAAC,mBAAmB,CAAC,CAAC;IAC3D,MAAM,YAAY,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC;AAC9B,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,kBAAkB,CAAC,EAAU;IACjD,MAAM,EAAE,OAAO,EAAE,GAAG,EAAE,GAAG,MAAM,MAAM,CAAC,mBAAmB,CAAC,CAAC;IAC3D,MAAM,cAAc,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC;AAChC,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,eAAe,CAAC,EAAU;IAC9C,MAAM,EAAE,OAAO,EAAE,GAAG,EAAE,GAAG,MAAM,MAAM,CAAC,mBAAmB,CAAC,CAAC;IAC3D,MAAM,WAAW,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC;AAC7B,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hre.d.ts","sourceRoot":"","sources":["../../../../../../src/internal/builtin-plugins/coverage/hook-handlers/hre.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,8BAA8B,EAAE,MAAM,4BAA4B,CAAC;
|
|
1
|
+
{"version":3,"file":"hre.d.ts","sourceRoot":"","sources":["../../../../../../src/internal/builtin-plugins/coverage/hook-handlers/hre.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,8BAA8B,EAAE,MAAM,4BAA4B,CAAC;8BAKxD,OAAO,CAAC,OAAO,CAAC,8BAA8B,CAAC,CAAC;AAAzE,wBAoBG"}
|
|
@@ -1,14 +1,11 @@
|
|
|
1
|
-
import { assertHardhatInvariant } from "@nomicfoundation/hardhat-errors";
|
|
2
|
-
import { HardhatRuntimeEnvironmentImplementation } from "../../../core/hre.js";
|
|
3
1
|
import { CoverageManagerImplementation } from "../coverage-manager.js";
|
|
4
|
-
import { getCoveragePath } from "../helpers.js";
|
|
2
|
+
import { getCoveragePath, setCoverageManager } from "../helpers.js";
|
|
5
3
|
export default async () => ({
|
|
6
4
|
created: async (context, hre) => {
|
|
7
5
|
if (context.globalOptions.coverage) {
|
|
8
6
|
const coveragePath = getCoveragePath(hre.config.paths.root);
|
|
9
7
|
const coverageManager = new CoverageManagerImplementation(coveragePath);
|
|
10
|
-
|
|
11
|
-
hre._coverage = coverageManager;
|
|
8
|
+
setCoverageManager(hre, coverageManager);
|
|
12
9
|
// NOTE: We register this hook dynamically because we use the information about
|
|
13
10
|
// the existence of onCoverageData hook handlers to determine whether coverage
|
|
14
11
|
// is enabled or not.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hre.js","sourceRoot":"","sources":["../../../../../../src/internal/builtin-plugins/coverage/hook-handlers/hre.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"hre.js","sourceRoot":"","sources":["../../../../../../src/internal/builtin-plugins/coverage/hook-handlers/hre.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,6BAA6B,EAAE,MAAM,wBAAwB,CAAC;AACvE,OAAO,EAAE,eAAe,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAC;AAEpE,eAAe,KAAK,IAAsD,EAAE,CAAC,CAAC;IAC5E,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,GAAG,EAAE,EAAE;QAC9B,IAAI,OAAO,CAAC,aAAa,CAAC,QAAQ,EAAE,CAAC;YACnC,MAAM,YAAY,GAAG,eAAe,CAAC,GAAG,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;YAC5D,MAAM,eAAe,GAAG,IAAI,6BAA6B,CAAC,YAAY,CAAC,CAAC;YAExE,kBAAkB,CAAC,GAAG,EAAE,eAAe,CAAC,CAAC;YAEzC,+EAA+E;YAC/E,8EAA8E;YAC9E,qBAAqB;YACrB,GAAG,CAAC,KAAK,CAAC,gBAAgB,CAAC,SAAS,EAAE;gBACpC,cAAc,EAAE,KAAK,EAAE,QAAQ,EAAE,YAAY,EAAE,EAAE;oBAC/C,MAAM,eAAe,CAAC,OAAO,CAAC,YAAY,CAAC,CAAC;oBAE5C,OAAO;gBACT,CAAC;aACF,CAAC,CAAC;QACL,CAAC;IACH,CAAC;CACF,CAAC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"solidity.d.ts","sourceRoot":"","sources":["../../../../../../src/internal/builtin-plugins/coverage/hook-handlers/solidity.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;
|
|
1
|
+
{"version":3,"file":"solidity.d.ts","sourceRoot":"","sources":["../../../../../../src/internal/builtin-plugins/coverage/hook-handlers/solidity.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;8BAmBvC,OAAO,CAAC,OAAO,CAAC,aAAa,CAAC,CAAC;AAAxD,wBA0GG"}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import path from "node:path";
|
|
2
|
-
import {
|
|
2
|
+
import { HardhatError } from "@nomicfoundation/hardhat-errors";
|
|
3
3
|
import { ensureError } from "@nomicfoundation/hardhat-utils/error";
|
|
4
4
|
import { readUtf8File } from "@nomicfoundation/hardhat-utils/fs";
|
|
5
5
|
import { findClosestPackageRoot } from "@nomicfoundation/hardhat-utils/package";
|
|
6
6
|
import debug from "debug";
|
|
7
|
-
import {
|
|
7
|
+
import { getCoverageManager } from "../helpers.js";
|
|
8
8
|
import { instrumentSolidityFileForCompilationJob } from "../instrumentation.js";
|
|
9
9
|
const log = debug("hardhat:core:coverage:hook-handlers:solidity");
|
|
10
10
|
const COVERAGE_LIBRARY_PATH = "__hardhat_coverage_library_a3e9cfe2-41b4-4a1f-ad9e-ac62dd82979e.sol";
|
|
@@ -52,9 +52,7 @@ export default async () => ({
|
|
|
52
52
|
break;
|
|
53
53
|
}
|
|
54
54
|
}
|
|
55
|
-
|
|
56
|
-
context._coverage instanceof CoverageManagerImplementation, "Expected _coverage to be defined in the HookContext, as it's should be defined in the HRE");
|
|
57
|
-
await context._coverage.addMetadata(coverageMetadata);
|
|
55
|
+
await getCoverageManager(context).addMetadata(coverageMetadata);
|
|
58
56
|
return await next(context, sourceName, fsPath, source, solcVersion);
|
|
59
57
|
}
|
|
60
58
|
catch (e) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"solidity.js","sourceRoot":"","sources":["../../../../../../src/internal/builtin-plugins/coverage/hook-handlers/solidity.ts"],"names":[],"mappings":"AAGA,OAAO,IAAI,MAAM,WAAW,CAAC;AAE7B,OAAO,
|
|
1
|
+
{"version":3,"file":"solidity.js","sourceRoot":"","sources":["../../../../../../src/internal/builtin-plugins/coverage/hook-handlers/solidity.ts"],"names":[],"mappings":"AAGA,OAAO,IAAI,MAAM,WAAW,CAAC;AAE7B,OAAO,EAAE,YAAY,EAAE,MAAM,iCAAiC,CAAC;AAC/D,OAAO,EAAE,WAAW,EAAE,MAAM,sCAAsC,CAAC;AACnE,OAAO,EAAE,YAAY,EAAE,MAAM,mCAAmC,CAAC;AACjE,OAAO,EAAE,sBAAsB,EAAE,MAAM,wCAAwC,CAAC;AAChF,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAE,kBAAkB,EAAE,MAAM,eAAe,C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AC,OAAO,CAAC,qBAAqB,CAAC,KAAK,SAAS,EAAE,CAAC;gBAC3D,MAAM,IAAI,YAAY,CACpB,YAAY,CAAC,MAAM,CAAC,IAAI,CAAC,QAAQ,CAAC,2BAA2B,EAC7D;oBACE,UAAU,EAAE,qBAAqB;iBAClC,CACF,CAAC;YACJ,CAAC;YAED,4EAA4E;YAC5E,0EAA0E;YAC1E,2CAA2C;YAC3C,MAAM,WAAW,GAAG,MAAM,sBAAsB,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;YAClE,MAAM,eAAe,GAAG,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE,cAAc,CAAC,CAAC;YAE/D,MAAM,OAAO,GAAG,MAAM,YAAY,CAAC,eAAe,CAAC,CAAC;YACpD,SAAS,CAAC,OAAO,CAAC,qBAAqB,CAAC,GAAG,EAAE,OAAO,EAAE,CAAC;QACzD,CAAC;QAED,OAAO,IAAI,CAAC,OAAO,EAAE,SAAS,CAAC,CAAC;IAClC,CAAC;CACF,CAAC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"test.d.ts","sourceRoot":"","sources":["../../../../../../src/internal/builtin-plugins/coverage/hook-handlers/test.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,4BAA4B,CAAC;
|
|
1
|
+
{"version":3,"file":"test.d.ts","sourceRoot":"","sources":["../../../../../../src/internal/builtin-plugins/coverage/hook-handlers/test.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,4BAA4B,CAAC;8BAIhD,OAAO,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;AAApD,wBAeG;AAEH,wBAAsB,YAAY,CAChC,OAAO,EAAE,WAAW,EACpB,EAAE,EAAE,MAAM,GACT,OAAO,CAAC,IAAI,CAAC,CAIf;AAED,wBAAsB,cAAc,CAClC,OAAO,EAAE,WAAW,EACpB,EAAE,EAAE,MAAM,GACT,OAAO,CAAC,IAAI,CAAC,CAIf;AAED,wBAAsB,WAAW,CAC/B,OAAO,EAAE,WAAW,EACpB,EAAE,EAAE,MAAM,GACT,OAAO,CAAC,IAAI,CAAC,CAIf"}
|
|
@@ -1,6 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { isObject } from "@nomicfoundation/hardhat-utils/lang";
|
|
3
|
-
import { CoverageManagerImplementation } from "../coverage-manager.js";
|
|
1
|
+
import { getCoverageManager } from "../helpers.js";
|
|
4
2
|
export default async () => ({
|
|
5
3
|
onTestRunStart: async (context, id, next) => {
|
|
6
4
|
await next(context, id);
|
|
@@ -17,26 +15,17 @@ export default async () => ({
|
|
|
17
15
|
});
|
|
18
16
|
export async function testRunStart(context, id) {
|
|
19
17
|
if (context.globalOptions.coverage === true) {
|
|
20
|
-
|
|
21
|
-
isObject(context._coverage) &&
|
|
22
|
-
context._coverage instanceof CoverageManagerImplementation, "Expected HookContext#_coverage to be an instance of CoverageManagerImplementation");
|
|
23
|
-
await context._coverage.clearData(id);
|
|
18
|
+
await getCoverageManager(context).clearData(id);
|
|
24
19
|
}
|
|
25
20
|
}
|
|
26
21
|
export async function testWorkerDone(context, id) {
|
|
27
22
|
if (context.globalOptions.coverage === true) {
|
|
28
|
-
|
|
29
|
-
isObject(context._coverage) &&
|
|
30
|
-
context._coverage instanceof CoverageManagerImplementation, "Expected HookContext#_coverage to be an instance of CoverageManagerImplementation");
|
|
31
|
-
await context._coverage.saveData(id);
|
|
23
|
+
await getCoverageManager(context).saveData(id);
|
|
32
24
|
}
|
|
33
25
|
}
|
|
34
26
|
export async function testRunDone(context, id) {
|
|
35
27
|
if (context.globalOptions.coverage === true) {
|
|
36
|
-
|
|
37
|
-
isObject(context._coverage) &&
|
|
38
|
-
context._coverage instanceof CoverageManagerImplementation, "Expected HookContext#_coverage to be an instance of CoverageManagerImplementation");
|
|
39
|
-
await context._coverage.report(id);
|
|
28
|
+
await getCoverageManager(context).report(id);
|
|
40
29
|
}
|
|
41
30
|
}
|
|
42
31
|
//# sourceMappingURL=test.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"test.js","sourceRoot":"","sources":["../../../../../../src/internal/builtin-plugins/coverage/hook-handlers/test.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"test.js","sourceRoot":"","sources":["../../../../../../src/internal/builtin-plugins/coverage/hook-handlers/test.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAC;AAEnD,eAAe,KAAK,IAAiC,EAAE,CAAC,CAAC;IACvD,cAAc,EAAE,KAAK,EAAE,OAAO,EAAE,EAAE,EAAE,IAAI,EAAE,EAAE;QAC1C,MAAM,IAAI,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC;QACxB,MAAM,YAAY,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC;IAClC,CAAC;IAED,gBAAgB,EAAE,KAAK,EAAE,OAAO,EAAE,EAAE,EAAE,IAAI,EAAE,EAAE;QAC5C,MAAM,IAAI,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC;QACxB,MAAM,cAAc,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC;IACpC,CAAC;IAED,aAAa,EAAE,KAAK,EAAE,OAAO,EAAE,EAAE,EAAE,IAAI,EAAE,EAAE;QACzC,MAAM,IAAI,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC;QACxB,MAAM,WAAW,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC;IACjC,CAAC;CACF,CAAC,CAAC;AAEH,MAAM,CAAC,KAAK,UAAU,YAAY,CAChC,OAAoB,EACpB,EAAU;IAEV,IAAI,OAAO,CAAC,aAAa,CAAC,QAAQ,KAAK,IAAI,EAAE,CAAC;QAC5C,MAAM,kBAAkB,CAAC,OAAO,CAAC,CAAC,SAAS,CAAC,EAAE,CAAC,CAAC;IAClD,CAAC;AACH,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,cAAc,CAClC,OAAoB,EACpB,EAAU;IAEV,IAAI,OAAO,CAAC,aAAa,CAAC,QAAQ,KAAK,IAAI,EAAE,CAAC;QAC5C,MAAM,kBAAkB,CAAC,OAAO,CAAC,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC;IACjD,CAAC;AACH,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,WAAW,CAC/B,OAAoB,EACpB,EAAU;IAEV,IAAI,OAAO,CAAC,aAAa,CAAC,QAAQ,KAAK,IAAI,EAAE,CAAC;QAC5C,MAAM,kBAAkB,CAAC,OAAO,CAAC,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC;IAC/C,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import type { SuiteResult } from "@nomicfoundation/edr";
|
|
2
|
+
export declare const FUNCTION_GAS_SNAPSHOTS_FILE = ".gas-snapshot";
|
|
3
|
+
export interface FunctionGasSnapshot {
|
|
4
|
+
contractNameOrFqn: string;
|
|
5
|
+
functionSig: string;
|
|
6
|
+
gasUsage: StandardTestKindGasUsage | FuzzTestKindGasUsage;
|
|
7
|
+
}
|
|
8
|
+
export interface FunctionGasSnapshotWithMetadata extends FunctionGasSnapshot {
|
|
9
|
+
metadata: {
|
|
10
|
+
source: string;
|
|
11
|
+
};
|
|
12
|
+
}
|
|
13
|
+
export interface StandardTestKindGasUsage {
|
|
14
|
+
kind: "standard";
|
|
15
|
+
gas: bigint;
|
|
16
|
+
}
|
|
17
|
+
export interface FuzzTestKindGasUsage {
|
|
18
|
+
kind: "fuzz";
|
|
19
|
+
runs: bigint;
|
|
20
|
+
meanGas: bigint;
|
|
21
|
+
medianGas: bigint;
|
|
22
|
+
}
|
|
23
|
+
export interface FunctionGasSnapshotComparison {
|
|
24
|
+
added: FunctionGasSnapshot[];
|
|
25
|
+
removed: FunctionGasSnapshot[];
|
|
26
|
+
changed: FunctionGasSnapshotChange[];
|
|
27
|
+
}
|
|
28
|
+
export interface FunctionGasSnapshotChange {
|
|
29
|
+
source: string;
|
|
30
|
+
contractNameOrFqn: string;
|
|
31
|
+
functionSig: string;
|
|
32
|
+
kind: "standard" | "fuzz";
|
|
33
|
+
expected: number;
|
|
34
|
+
actual: number;
|
|
35
|
+
runs?: number;
|
|
36
|
+
}
|
|
37
|
+
export interface FunctionGasSnapshotCheckResult {
|
|
38
|
+
passed: boolean;
|
|
39
|
+
comparison: FunctionGasSnapshotComparison;
|
|
40
|
+
written: boolean;
|
|
41
|
+
}
|
|
42
|
+
export declare function getFunctionGasSnapshotsPath(basePath: string): string;
|
|
43
|
+
export declare function extractFunctionGasSnapshots(suiteResults: SuiteResult[]): FunctionGasSnapshotWithMetadata[];
|
|
44
|
+
export declare function writeFunctionGasSnapshots(basePath: string, snapshots: FunctionGasSnapshot[]): Promise<void>;
|
|
45
|
+
export declare function readFunctionGasSnapshots(basePath: string): Promise<FunctionGasSnapshot[]>;
|
|
46
|
+
export declare function stringifyFunctionGasSnapshots(snapshots: FunctionGasSnapshot[]): string;
|
|
47
|
+
export declare function parseFunctionGasSnapshots(stringifiedSnapshots: string): FunctionGasSnapshot[];
|
|
48
|
+
export declare function compareFunctionGasSnapshots(previousSnapshots: FunctionGasSnapshot[], currentSnapshots: FunctionGasSnapshotWithMetadata[]): FunctionGasSnapshotComparison;
|
|
49
|
+
export declare function hasGasUsageChanged(previous: StandardTestKindGasUsage | FuzzTestKindGasUsage, current: StandardTestKindGasUsage | FuzzTestKindGasUsage): boolean;
|
|
50
|
+
export declare function checkFunctionGasSnapshots(basePath: string, suiteResults: SuiteResult[]): Promise<FunctionGasSnapshotCheckResult>;
|
|
51
|
+
export declare function logFunctionGasSnapshotsSection(result: FunctionGasSnapshotCheckResult, logger?: typeof console.log): void;
|
|
52
|
+
export declare function printFunctionGasSnapshotChanges(changes: FunctionGasSnapshotChange[], logger?: typeof console.log): void;
|
|
53
|
+
//# sourceMappingURL=function-gas-snapshots.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"function-gas-snapshots.d.ts","sourceRoot":"","sources":["../../../../../src/internal/builtin-plugins/gas-analytics/function-gas-snapshots.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAsBxD,eAAO,MAAM,2BAA2B,kBAAkB,CAAC;AAE3D,MAAM,WAAW,mBAAmB;IAClC,iBAAiB,EAAE,MAAM,CAAC;IAC1B,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,EAAE,wBAAwB,GAAG,oBAAoB,CAAC;CAC3D;AAED,MAAM,WAAW,+BAAgC,SAAQ,mBAAmB;IAC1E,QAAQ,EAAE;QACR,MAAM,EAAE,MAAM,CAAC;KAChB,CAAC;CACH;AAED,MAAM,WAAW,wBAAwB;IACvC,IAAI,EAAE,UAAU,CAAC;IACjB,GAAG,EAAE,MAAM,CAAC;CACb;AAED,MAAM,WAAW,oBAAoB;IACnC,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,6BAA6B;IAC5C,KAAK,EAAE,mBAAmB,EAAE,CAAC;IAC7B,OAAO,EAAE,mBAAmB,EAAE,CAAC;IAC/B,OAAO,EAAE,yBAAyB,EAAE,CAAC;CACtC;AAED,MAAM,WAAW,yBAAyB;IACxC,MAAM,EAAE,MAAM,CAAC;IACf,iBAAiB,EAAE,MAAM,CAAC;IAC1B,WAAW,EAAE,MAAM,CAAC;IACpB,IAAI,EAAE,UAAU,GAAG,MAAM,CAAC;IAC1B,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,8BAA8B;IAC7C,MAAM,EAAE,OAAO,CAAC;IAChB,UAAU,EAAE,6BAA6B,CA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errors";
|
|
3
|
+
import { ensureError } from "@nomicfoundation/hardhat-utils/error";
|
|
4
|
+
import { FileNotFoundError, readUtf8File, writeUtf8File, } from "@nomicfoundation/hardhat-utils/fs";
|
|
5
|
+
import { findDuplicates } from "@nomicfoundation/hardhat-utils/lang";
|
|
6
|
+
import chalk from "chalk";
|
|
7
|
+
import { getFullyQualifiedName, parseFullyQualifiedName, } from "../../../utils/contract-names.js";
|
|
8
|
+
import { getUserFqn } from "./gas-analytics-manager.js";
|
|
9
|
+
import { formatSectionHeader } from "./helpers.js";
|
|
10
|
+
export const FUNCTION_GAS_SNAPSHOTS_FILE = ".gas-snapshot";
|
|
11
|
+
export function getFunctionGasSnapshotsPath(basePath) {
|
|
12
|
+
return path.join(basePath, FUNCTION_GAS_SNAPSHOTS_FILE);
|
|
13
|
+
}
|
|
14
|
+
export function extractFunctionGasSnapshots(suiteResults) {
|
|
15
|
+
const duplicateContractNames = findDuplicates(suiteResults.map(({ id }) => id.name));
|
|
16
|
+
const snapshots = [];
|
|
17
|
+
for (const { id: suiteId, testResults } of suiteResults) {
|
|
18
|
+
for (const { name: functionSig, kind: testKind } of testResults) {
|
|
19
|
+
if ("calls" in testKind) {
|
|
20
|
+
continue;
|
|
21
|
+
}
|
|
22
|
+
const userFqn = getUserFqn(getFullyQualifiedName(suiteId.source, suiteId.name));
|
|
23
|
+
const contractNameOrFqn = duplicateContractNames.has(suiteId.name)
|
|
24
|
+
? userFqn
|
|
25
|
+
: suiteId.name;
|
|
26
|
+
const gasUsage = "consumedGas" in testKind
|
|
27
|
+
? {
|
|
28
|
+
kind: "standard",
|
|
29
|
+
gas: testKind.consumedGas,
|
|
30
|
+
}
|
|
31
|
+
: {
|
|
32
|
+
kind: "fuzz",
|
|
33
|
+
runs: testKind.runs,
|
|
34
|
+
meanGas: testKind.meanGas,
|
|
35
|
+
medianGas: testKind.medianGas,
|
|
36
|
+
};
|
|
37
|
+
snapshots.push({
|
|
38
|
+
contractNameOrFqn,
|
|
39
|
+
functionSig,
|
|
40
|
+
gasUsage,
|
|
41
|
+
metadata: {
|
|
42
|
+
source: parseFullyQualifiedName(userFqn).sourceName,
|
|
43
|
+
},
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
return snapshots;
|
|
48
|
+
}
|
|
49
|
+
export async function writeFunctionGasSnapshots(basePath, snapshots) {
|
|
50
|
+
const snapshotsPath = getFunctionGasSnapshotsPath(basePath);
|
|
51
|
+
try {
|
|
52
|
+
await writeUtf8File(snapshotsPath, stringifyFunctionGasSnapshots(snapshots));
|
|
53
|
+
}
|
|
54
|
+
catch (error) {
|
|
55
|
+
ensureError(error);
|
|
56
|
+
throw new HardhatError(HardhatError.ERRORS.CORE.SOLIDITY_TESTS.SNAPSHOT_WRITE_ERROR, { snapshotsPath, error: error.message }, error);
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
export async function readFunctionGasSnapshots(basePath) {
|
|
60
|
+
const snapshotsPath = getFunctionGasSnapshotsPath(basePath);
|
|
61
|
+
let stringifiedSnapshots;
|
|
62
|
+
try {
|
|
63
|
+
stringifiedSnapshots = await readUtf8File(snapshotsPath);
|
|
64
|
+
}
|
|
65
|
+
catch (error) {
|
|
66
|
+
ensureError(error);
|
|
67
|
+
// Re-throw as-is to allow the caller to handle this case specifically
|
|
68
|
+
if (error instanceof FileNotFoundError) {
|
|
69
|
+
throw error;
|
|
70
|
+
}
|
|
71
|
+
throw new HardhatError(HardhatError.ERRORS.CORE.SOLIDITY_TESTS.SNAPSHOT_READ_ERROR, { snapshotsPath, error: error.message }, error);
|
|
72
|
+
}
|
|
73
|
+
return parseFunctionGasSnapshots(stringifiedSnapshots);
|
|
74
|
+
}
|
|
75
|
+
export function stringifyFunctionGasSnapshots(snapshots) {
|
|
76
|
+
const lines = [];
|
|
77
|
+
for (const { contractNameOrFqn, functionSig, gasUsage } of snapshots) {
|
|
78
|
+
const gasDetails = gasUsage.kind === "standard"
|
|
79
|
+
? `gas: ${gasUsage.gas}`
|
|
80
|
+
: `runs: ${gasUsage.runs}, μ: ${gasUsage.meanGas}, ~: ${gasUsage.medianGas}`;
|
|
81
|
+
lines.push(`${contractNameOrFqn}#${functionSig} (${gasDetails})`);
|
|
82
|
+
}
|
|
83
|
+
return lines.sort((a, b) => a.localeCompare(b)).join("\n");
|
|
84
|
+
}
|
|
85
|
+
export function parseFunctionGasSnapshots(stringifiedSnapshots) {
|
|
86
|
+
if (stringifiedSnapshots.trim() === "") {
|
|
87
|
+
return [];
|
|
88
|
+
}
|
|
89
|
+
const lines = stringifiedSnapshots.split("\n");
|
|
90
|
+
const snapshots = [];
|
|
91
|
+
const standardTestRegex = /^(.+)#(.+) \(gas: (\d+)\)$/;
|
|
92
|
+
const fuzzTestRegex = /^(.+)#(.+) \(runs: (\d+), μ: (\d+), ~: (\d+)\)$/;
|
|
93
|
+
for (const line of lines) {
|
|
94
|
+
if (line.trim() === "") {
|
|
95
|
+
continue;
|
|
96
|
+
}
|
|
97
|
+
const standardMatch = standardTestRegex.exec(line);
|
|
98
|
+
if (standardMatch !== null) {
|
|
99
|
+
const [, contractNameOrFqn, functionSig, gasValue] = standardMatch;
|
|
100
|
+
snapshots.push({
|
|
101
|
+
contractNameOrFqn,
|
|
102
|
+
functionSig,
|
|
103
|
+
gasUsage: { kind: "standard", gas: BigInt(gasValue) },
|
|
104
|
+
});
|
|
105
|
+
continue;
|
|
106
|
+
}
|
|
107
|
+
const fuzzMatch = fuzzTestRegex.exec(line);
|
|
108
|
+
if (fuzzMatch !== null) {
|
|
109
|
+
const [, contractNameOrFqn, functionSig, runs, meanGas, medianGas] = fuzzMatch;
|
|
110
|
+
snapshots.push({
|
|
111
|
+
contractNameOrFqn,
|
|
112
|
+
functionSig,
|
|
113
|
+
gasUsage: {
|
|
114
|
+
kind: "fuzz",
|
|
115
|
+
runs: BigInt(runs),
|
|
116
|
+
meanGas: BigInt(meanGas),
|
|
117
|
+
medianGas: BigInt(medianGas),
|
|
118
|
+
},
|
|
119
|
+
});
|
|
120
|
+
continue;
|
|
121
|
+
}
|
|
122
|
+
throw new HardhatError(HardhatError.ERRORS.CORE.SOLIDITY_TESTS.INVALID_SNAPSHOT_FORMAT, {
|
|
123
|
+
file: FUNCTION_GAS_SNAPSHOTS_FILE,
|
|
124
|
+
line,
|
|
125
|
+
expectedFormat: "'ContractName#functionName (gas: value)' for standard tests or 'ContractName#functionName (runs: value, μ: value, ~: value)' for fuzz tests",
|
|
126
|
+
});
|
|
127
|
+
}
|
|
128
|
+
return snapshots;
|
|
129
|
+
}
|
|
130
|
+
export function compareFunctionGasSnapshots(previousSnapshots, currentSnapshots) {
|
|
131
|
+
const previousSnapshotsMap = new Map(previousSnapshots.map((s) => [
|
|
132
|
+
`${s.contractNameOrFqn}#${s.functionSig}`,
|
|
133
|
+
s,
|
|
134
|
+
]));
|
|
135
|
+
const added = [];
|
|
136
|
+
const changed = [];
|
|
137
|
+
for (const current of currentSnapshots) {
|
|
138
|
+
const key = `${current.contractNameOrFqn}#${current.functionSig}`;
|
|
139
|
+
const previous = previousSnapshotsMap.get(key);
|
|
140
|
+
const currentKind = current.gasUsage.kind;
|
|
141
|
+
const previousKind = previous?.gasUsage.kind;
|
|
142
|
+
if (previous === undefined ||
|
|
143
|
+
// If the kind doesn't match, we treat it as an addition + removal
|
|
144
|
+
previousKind !== currentKind) {
|
|
145
|
+
added.push(current);
|
|
146
|
+
continue;
|
|
147
|
+
}
|
|
148
|
+
if (hasGasUsageChanged(previous.gasUsage, current.gasUsage)) {
|
|
149
|
+
const expectedValue = previousKind === "standard"
|
|
150
|
+
? previous.gasUsage.gas
|
|
151
|
+
: previous.gasUsage.medianGas;
|
|
152
|
+
const actualValue = currentKind === "standard"
|
|
153
|
+
? current.gasUsage.gas
|
|
154
|
+
: current.gasUsage.medianGas;
|
|
155
|
+
changed.push({
|
|
156
|
+
contractNameOrFqn: current.contractNameOrFqn,
|
|
157
|
+
functionSig: current.functionSig,
|
|
158
|
+
kind: currentKind,
|
|
159
|
+
expected: Number(expectedValue),
|
|
160
|
+
actual: Number(actualValue),
|
|
161
|
+
runs: currentKind === "fuzz" ? Number(current.gasUsage.runs) : undefined,
|
|
162
|
+
source: current.metadata.source,
|
|
163
|
+
});
|
|
164
|
+
}
|
|
165
|
+
previousSnapshotsMap.delete(key);
|
|
166
|
+
}
|
|
167
|
+
const removed = Array.from(previousSnapshotsMap.values());
|
|
168
|
+
return { added, removed, changed };
|
|
169
|
+
}
|
|
170
|
+
export function hasGasUsageChanged(previous, current) {
|
|
171
|
+
if (previous.kind === "standard" && current.kind === "standard") {
|
|
172
|
+
return previous.gas !== current.gas;
|
|
173
|
+
}
|
|
174
|
+
if (previous.kind === "fuzz" && current.kind === "fuzz") {
|
|
175
|
+
return previous.medianGas !== current.medianGas;
|
|
176
|
+
}
|
|
177
|
+
return false;
|
|
178
|
+
}
|
|
179
|
+
export async function checkFunctionGasSnapshots(basePath, suiteResults) {
|
|
180
|
+
const functionGasSnapshots = extractFunctionGasSnapshots(suiteResults);
|
|
181
|
+
let previousFunctionGasSnapshots;
|
|
182
|
+
try {
|
|
183
|
+
previousFunctionGasSnapshots = await readFunctionGasSnapshots(basePath);
|
|
184
|
+
}
|
|
185
|
+
catch (error) {
|
|
186
|
+
if (error instanceof FileNotFoundError) {
|
|
187
|
+
await writeFunctionGasSnapshots(basePath, functionGasSnapshots);
|
|
188
|
+
return {
|
|
189
|
+
passed: true,
|
|
190
|
+
comparison: {
|
|
191
|
+
added: [],
|
|
192
|
+
removed: [],
|
|
193
|
+
changed: [],
|
|
194
|
+
},
|
|
195
|
+
written: true,
|
|
196
|
+
};
|
|
197
|
+
}
|
|
198
|
+
throw error;
|
|
199
|
+
}
|
|
200
|
+
const comparison = compareFunctionGasSnapshots(previousFunctionGasSnapshots, functionGasSnapshots);
|
|
201
|
+
// Update snapshots when functions are added or removed (but not changed)
|
|
202
|
+
const hasAddedOrRemoved = comparison.added.length > 0 || comparison.removed.length > 0;
|
|
203
|
+
if (comparison.changed.length === 0 && hasAddedOrRemoved) {
|
|
204
|
+
await writeFunctionGasSnapshots(basePath, functionGasSnapshots);
|
|
205
|
+
}
|
|
206
|
+
return {
|
|
207
|
+
passed: comparison.changed.length === 0,
|
|
208
|
+
comparison,
|
|
209
|
+
written: hasAddedOrRemoved,
|
|
210
|
+
};
|
|
211
|
+
}
|
|
212
|
+
export function logFunctionGasSnapshotsSection(result, logger = console.log) {
|
|
213
|
+
const { comparison, written } = result;
|
|
214
|
+
const changedLength = comparison.changed.length;
|
|
215
|
+
const addedLength = comparison.added.length;
|
|
216
|
+
const removedLength = comparison.removed.length;
|
|
217
|
+
const hasChanges = changedLength > 0;
|
|
218
|
+
const hasAdded = addedLength > 0;
|
|
219
|
+
const hasRemoved = removedLength > 0;
|
|
220
|
+
const hasAnyDifferences = hasChanges || hasAdded || hasRemoved;
|
|
221
|
+
const isFirstTimeWrite = written && !hasAnyDifferences;
|
|
222
|
+
// Nothing to report
|
|
223
|
+
if (!isFirstTimeWrite && !hasAnyDifferences) {
|
|
224
|
+
return;
|
|
225
|
+
}
|
|
226
|
+
logger(formatSectionHeader("Function gas snapshots", {
|
|
227
|
+
changedLength,
|
|
228
|
+
addedLength,
|
|
229
|
+
removedLength,
|
|
230
|
+
}));
|
|
231
|
+
if (isFirstTimeWrite) {
|
|
232
|
+
logger();
|
|
233
|
+
logger(chalk.green(" No existing snapshots found. Function gas snapshots written successfully"));
|
|
234
|
+
logger();
|
|
235
|
+
return;
|
|
236
|
+
}
|
|
237
|
+
if (hasChanges) {
|
|
238
|
+
logger();
|
|
239
|
+
printFunctionGasSnapshotChanges(comparison.changed, logger);
|
|
240
|
+
}
|
|
241
|
+
if (hasAdded) {
|
|
242
|
+
logger();
|
|
243
|
+
logger(` Added ${comparison.added.length} function(s):`);
|
|
244
|
+
const addedLines = stringifyFunctionGasSnapshots(comparison.added).split("\n");
|
|
245
|
+
for (const line of addedLines) {
|
|
246
|
+
logger(chalk.green(` + ${line}`));
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
if (hasRemoved) {
|
|
250
|
+
logger();
|
|
251
|
+
logger(` Removed ${comparison.removed.length} function(s):`);
|
|
252
|
+
const removedLines = stringifyFunctionGasSnapshots(comparison.removed).split("\n");
|
|
253
|
+
for (const line of removedLines) {
|
|
254
|
+
logger(chalk.red(` - ${line}`));
|
|
255
|
+
}
|
|
256
|
+
}
|
|
257
|
+
logger();
|
|
258
|
+
}
|
|
259
|
+
export function printFunctionGasSnapshotChanges(changes, logger = console.log) {
|
|
260
|
+
for (let i = 0; i < changes.length; i++) {
|
|
261
|
+
const change = changes[i];
|
|
262
|
+
const isLast = i === changes.length - 1;
|
|
263
|
+
logger(` ${change.contractNameOrFqn}#${change.functionSig}`);
|
|
264
|
+
logger(chalk.grey(` (in ${change.source})`));
|
|
265
|
+
if (change.kind === "fuzz") {
|
|
266
|
+
logger(chalk.grey(` Runs: ${change.runs}`));
|
|
267
|
+
}
|
|
268
|
+
const diff = change.actual - change.expected;
|
|
269
|
+
const formattedDiff = diff > 0 ? `Δ+${diff}` : `Δ${diff}`;
|
|
270
|
+
let gasChange = `${formattedDiff}`;
|
|
271
|
+
if (change.expected > 0) {
|
|
272
|
+
const percent = (diff / change.expected) * 100;
|
|
273
|
+
const formattedPercent = percent >= 0 ? `+${percent.toFixed(2)}%` : `${percent.toFixed(2)}%`;
|
|
274
|
+
gasChange = `${formattedPercent}, ${formattedDiff}`;
|
|
275
|
+
}
|
|
276
|
+
// Color: green for decrease (improvement), red for increase (regression)
|
|
277
|
+
const formattedGasChange = diff < 0 ? chalk.green(gasChange) : chalk.red(gasChange);
|
|
278
|
+
const label = change.kind === "fuzz" ? "~" : "gas";
|
|
279
|
+
logger(chalk.grey(` Expected (${label}): ${change.expected}`));
|
|
280
|
+
logger(chalk.grey(` Actual (${label}): ${change.actual} (`) +
|
|
281
|
+
formattedGasChange +
|
|
282
|
+
chalk.grey(")"));
|
|
283
|
+
if (!isLast) {
|
|
284
|
+
logger();
|
|
285
|
+
}
|
|
286
|
+
}
|
|
287
|
+
}
|
|
288
|
+
//# sourceMappingURL=function-gas-snapshots.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"function-gas-snapshots.js","sourceRoot":"","sources":["../../../../../src/internal/builtin-plugins/gas-analytics/function-gas-snapshots.ts"],"names":[],"mappings":"AAEA,OAAO,IAAI,MAAM,WAAW,CAAC;AAE7B,OAAO,EAAE,YAAY,EAAE,MAAM,iCAAiC,CAAC;AAC/D,OAAO,EAAE,WAAW,EAAE,MAAM,sCAAsC,CAAC;AACnE,OAAO,EACL,iBAAiB,EACjB,YAAY,EACZ,aAAa,GACd,MAAM,mCAAmC,CAAC;AAC3C,OAAO,EAAE,cAAc,EAAE,MAAM,qCAAqC,CAAC;AACrE,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EACL,qBAAqB,EACrB,uBAAuB,GACxB,MAAM,kCAAkC,CAAC;AAE1C,OAAO,EAAE,UAAU,EAAE,MAAM,4BAA4B,CAAC;AACxD,OAAO,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAC;AAEnD,MAAM,CAAC,MAAM,2BAA2B,GAAG,eAAe,CAAC;AAgD3D,MAAM,UAAU,2BAA2B,CAAC,QAAgB;IAC1D,OAAO,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE,2BAA2B,CAAC,CAAC;AAC1D,CAAC;AAED,MAAM,UAAU,2BAA2B,CACzC,YAA2B;IAE3B,MAAM,sBAAsB,GAAG,cAAc,CAC3C,YAAY,CAAC,GAAG,CAAC,CAAC,EAAE,EAAE,EAAE,EAAE,EAAE,CAAC,EAAE,CAAC,IAAI,CAAC,CACtC,CAAC;IAEF,MAAM,SAAS,GAAsC,EAAE,CAAC;IACxD,KAAK,MAAM,EAAE,EAAE,EAAE,OAAO,EAAE,WAAW,EAAE,IAAI,YAAY,EAAE,CAAC;QACxD,KAAK,MAAM,EAAE,IAAI,EAAE,WAAW,EAAE,IAAI,EAAE,QAAQ,E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