hardhat 2.12.4 → 2.12.5
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/builtin-tasks/compile.js +1 -1
- package/builtin-tasks/compile.js.map +1 -1
- package/builtin-tasks/flatten.js +9 -3
- package/builtin-tasks/flatten.js.map +1 -1
- package/internal/artifacts.d.ts.map +1 -1
- package/internal/artifacts.js +6 -10
- package/internal/artifacts.js.map +1 -1
- package/internal/cli/cli.js +3 -1
- package/internal/cli/cli.js.map +1 -1
- package/internal/cli/project-creation.js +1 -1
- package/internal/core/config/config-resolution.d.ts.map +1 -1
- package/internal/core/config/config-resolution.js +2 -1
- package/internal/core/config/config-resolution.js.map +1 -1
- package/internal/core/errors-list.js +75 -75
- package/internal/core/flamegraph.js +10 -10
- package/internal/core/providers/backwards-compatibility.d.ts.map +1 -1
- package/internal/core/providers/backwards-compatibility.js +3 -0
- package/internal/core/providers/backwards-compatibility.js.map +1 -1
- package/internal/core/providers/gas-providers.d.ts +1 -1
- package/internal/core/providers/gas-providers.d.ts.map +1 -1
- package/internal/core/providers/gas-providers.js +1 -1
- package/internal/core/providers/gas-providers.js.map +1 -1
- package/internal/hardhat-network/jsonrpc/client.d.ts.map +1 -1
- package/internal/hardhat-network/jsonrpc/client.js +5 -3
- package/internal/hardhat-network/jsonrpc/client.js.map +1 -1
- package/internal/hardhat-network/provider/modules/eth.js +4 -4
- package/internal/hardhat-network/stack-traces/error-inferrer.d.ts.map +1 -1
- package/internal/hardhat-network/stack-traces/error-inferrer.js +2 -5
- package/internal/hardhat-network/stack-traces/error-inferrer.js.map +1 -1
- package/internal/hardhat-network/stack-traces/solidity-errors.d.ts.map +1 -1
- package/internal/hardhat-network/stack-traces/solidity-errors.js +2 -1
- package/internal/hardhat-network/stack-traces/solidity-errors.js.map +1 -1
- package/internal/solidity/dependencyGraph.d.ts.map +1 -1
- package/internal/solidity/dependencyGraph.js +2 -0
- package/internal/solidity/dependencyGraph.js.map +1 -1
- package/internal/util/console.d.ts.map +1 -1
- package/internal/util/console.js +1 -1
- package/internal/util/console.js.map +1 -1
- package/internal/util/download.d.ts +3 -1
- package/internal/util/download.d.ts.map +1 -1
- package/internal/util/download.js +2 -1
- package/internal/util/download.js.map +1 -1
- package/package.json +1 -1
- package/src/builtin-tasks/compile.ts +2 -4
- package/src/builtin-tasks/flatten.ts +14 -3
- package/src/internal/artifacts.ts +6 -15
- package/src/internal/cli/cli.ts +5 -1
- package/src/internal/cli/project-creation.ts +1 -1
- package/src/internal/core/config/config-resolution.ts +4 -3
- package/src/internal/core/errors-list.ts +75 -75
- package/src/internal/core/flamegraph.ts +10 -10
- package/src/internal/core/jsonrpc/types/output/metadata.ts +3 -3
- package/src/internal/core/providers/backwards-compatibility.ts +3 -0
- package/src/internal/core/providers/gas-providers.ts +1 -1
- package/src/internal/hardhat-network/jsonrpc/client.ts +7 -4
- package/src/internal/hardhat-network/provider/modules/eth.ts +4 -4
- package/src/internal/hardhat-network/stack-traces/compiler-to-model.ts +2 -2
- package/src/internal/hardhat-network/stack-traces/error-inferrer.ts +2 -6
- package/src/internal/hardhat-network/stack-traces/solidity-errors.ts +3 -1
- package/src/internal/solidity/compiler/downloader.ts +1 -1
- package/src/internal/solidity/dependencyGraph.ts +2 -0
- package/src/internal/util/console.ts +4 -2
- package/src/internal/util/download.ts +3 -1
|
@@ -143,7 +143,7 @@ export class AutomaticGasPriceProvider extends ProviderWrapper {
|
|
|
143
143
|
3n;
|
|
144
144
|
|
|
145
145
|
// See eth_feeHistory for an explanation of what this means
|
|
146
|
-
public static readonly EIP1559_REWARD_PERCENTILE
|
|
146
|
+
public static readonly EIP1559_REWARD_PERCENTILE = 50;
|
|
147
147
|
|
|
148
148
|
private _nodeHasFeeHistory?: boolean;
|
|
149
149
|
private _nodeSupportsEIP1559?: boolean;
|
|
@@ -359,7 +359,8 @@ export class JsonRpcClient {
|
|
|
359
359
|
}
|
|
360
360
|
|
|
361
361
|
// This is a workaround for this TurboGeth bug: https://github.com/ledgerwatch/turbo-geth/issues/1645
|
|
362
|
-
|
|
362
|
+
const errMessage: string = err.message;
|
|
363
|
+
if (err.code === -32000 && errMessage.includes("not found")) {
|
|
363
364
|
return null;
|
|
364
365
|
}
|
|
365
366
|
|
|
@@ -383,10 +384,12 @@ export class JsonRpcClient {
|
|
|
383
384
|
}
|
|
384
385
|
}
|
|
385
386
|
|
|
386
|
-
private _shouldRetry(isRetryCall: boolean, err: any) {
|
|
387
|
+
private _shouldRetry(isRetryCall: boolean, err: any): boolean {
|
|
388
|
+
const errMessage: string = err.message;
|
|
389
|
+
|
|
387
390
|
const isRetriableError =
|
|
388
|
-
|
|
389
|
-
|
|
391
|
+
errMessage.includes("header not found") ||
|
|
392
|
+
errMessage.includes("connect ETIMEDOUT");
|
|
390
393
|
|
|
391
394
|
const isServiceUrl =
|
|
392
395
|
this._httpProvider.url.includes("infura") ||
|
|
@@ -1683,7 +1683,7 @@ export class EthModule {
|
|
|
1683
1683
|
rpcRequest.maxPriorityFeePerGas !== undefined) &&
|
|
1684
1684
|
!this._common.gteHardfork(EIP1559_MIN_HARDFORK)
|
|
1685
1685
|
) {
|
|
1686
|
-
throw new InvalidArgumentsError(`EIP-1559 style fee params (maxFeePerGas or maxPriorityFeePerGas) received but they are not supported by the current hardfork.
|
|
1686
|
+
throw new InvalidArgumentsError(`EIP-1559 style fee params (maxFeePerGas or maxPriorityFeePerGas) received but they are not supported by the current hardfork.
|
|
1687
1687
|
|
|
1688
1688
|
You can use them by running Hardhat Network with 'hardfork' ${EIP1559_MIN_HARDFORK} or later.`);
|
|
1689
1689
|
}
|
|
@@ -1694,8 +1694,8 @@ You can use them by running Hardhat Network with 'hardfork' ${EIP1559_MIN_HARDFO
|
|
|
1694
1694
|
rpcRequest.accessList !== undefined &&
|
|
1695
1695
|
!this._common.gteHardfork(ACCESS_LIST_MIN_HARDFORK)
|
|
1696
1696
|
) {
|
|
1697
|
-
throw new InvalidArgumentsError(`Access list received but is not supported by the current hardfork.
|
|
1698
|
-
|
|
1697
|
+
throw new InvalidArgumentsError(`Access list received but is not supported by the current hardfork.
|
|
1698
|
+
|
|
1699
1699
|
You can use them by running Hardhat Network with 'hardfork' ${ACCESS_LIST_MIN_HARDFORK} or later.`);
|
|
1700
1700
|
}
|
|
1701
1701
|
|
|
@@ -1736,7 +1736,7 @@ You can use them by running Hardhat Network with 'hardfork' ${ACCESS_LIST_MIN_HA
|
|
|
1736
1736
|
}
|
|
1737
1737
|
|
|
1738
1738
|
if (!this._common.gteHardfork(EIP155_MIN_HARDFORK)) {
|
|
1739
|
-
throw new InvalidArgumentsError(`Trying to send an EIP-155 transaction, but they are not supported by the current hardfork.
|
|
1739
|
+
throw new InvalidArgumentsError(`Trying to send an EIP-155 transaction, but they are not supported by the current hardfork.
|
|
1740
1740
|
|
|
1741
1741
|
You can use them by running Hardhat Network with 'hardfork' ${EIP155_MIN_HARDFORK} or later.`);
|
|
1742
1742
|
}
|
|
@@ -539,7 +539,7 @@ function astFunctionDefinitionToSelector(functionDefinition: any): Buffer {
|
|
|
539
539
|
return abi.methodID(functionDefinition.name, paramTypes);
|
|
540
540
|
}
|
|
541
541
|
|
|
542
|
-
function isContractType(param: any) {
|
|
542
|
+
function isContractType(param: any): boolean {
|
|
543
543
|
return (
|
|
544
544
|
(param.typeName?.nodeType === "UserDefinedTypeName" ||
|
|
545
545
|
param?.nodeType === "UserDefinedTypeName") &&
|
|
@@ -548,7 +548,7 @@ function isContractType(param: any) {
|
|
|
548
548
|
);
|
|
549
549
|
}
|
|
550
550
|
|
|
551
|
-
function isEnumType(param: any) {
|
|
551
|
+
function isEnumType(param: any): boolean {
|
|
552
552
|
return (
|
|
553
553
|
(param.typeName?.nodeType === "UserDefinedTypeName" ||
|
|
554
554
|
param?.nodeType === "UserDefinedTypeName") &&
|
|
@@ -519,12 +519,8 @@ export class ErrorInferrer {
|
|
|
519
519
|
return;
|
|
520
520
|
}
|
|
521
521
|
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
const selector = returnData.getSelector();
|
|
525
|
-
if (selector !== undefined) {
|
|
526
|
-
errorMessage += ` with selector ${selector}`;
|
|
527
|
-
}
|
|
522
|
+
const rawReturnData = returnData.value.toString("hex");
|
|
523
|
+
let errorMessage = `reverted with an unrecognized custom error (return data: 0x${rawReturnData})`;
|
|
528
524
|
|
|
529
525
|
for (const customError of trace.bytecode.contract.customErrors) {
|
|
530
526
|
if (returnData.matchesSelector(customError.selector)) {
|
|
@@ -271,7 +271,9 @@ function getMessageFromLastStackTraceEntry(
|
|
|
271
271
|
}
|
|
272
272
|
|
|
273
273
|
if (!stackTraceEntry.message.isEmpty()) {
|
|
274
|
-
|
|
274
|
+
const returnData = stackTraceEntry.message.value.toString("hex");
|
|
275
|
+
|
|
276
|
+
return `VM Exception while processing transaction: reverted with an unrecognized custom error (return data: 0x${returnData})`;
|
|
275
277
|
}
|
|
276
278
|
|
|
277
279
|
if (stackTraceEntry.isInvalidOpcodeError) {
|
|
@@ -347,7 +347,7 @@ export class CompilerDownloader implements ICompilerDownloader {
|
|
|
347
347
|
await fsExtra.createFile(this._getCompilerDoesntWorkFile(build));
|
|
348
348
|
}
|
|
349
349
|
|
|
350
|
-
private async _checkNativeSolc(build: CompilerBuild) {
|
|
350
|
+
private async _checkNativeSolc(build: CompilerBuild): Promise<boolean> {
|
|
351
351
|
const solcPath = this._getCompilerBinaryPathFromBuild(build);
|
|
352
352
|
const execFileP = promisify(execFile);
|
|
353
353
|
|
|
@@ -9,6 +9,7 @@ export class DependencyGraph implements taskTypes.DependencyGraph {
|
|
|
9
9
|
): Promise<DependencyGraph> {
|
|
10
10
|
const graph = new DependencyGraph();
|
|
11
11
|
|
|
12
|
+
// TODO refactor this to make the results deterministic
|
|
12
13
|
await Promise.all(
|
|
13
14
|
resolvedFiles.map((resolvedFile) =>
|
|
14
15
|
graph._addDependenciesFrom(resolver, resolvedFile)
|
|
@@ -169,6 +170,7 @@ export class DependencyGraph implements taskTypes.DependencyGraph {
|
|
|
169
170
|
this._resolvedFiles.set(file.sourceName, file);
|
|
170
171
|
this._dependenciesPerFile.set(file.sourceName, dependencies);
|
|
171
172
|
|
|
173
|
+
// TODO refactor this to make the results deterministic
|
|
172
174
|
await Promise.all(
|
|
173
175
|
file.content.imports.map(async (imp) => {
|
|
174
176
|
const dependency = await resolver.resolveImport(file, imp);
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import type ReplT from "repl";
|
|
2
|
+
|
|
1
3
|
export function isNodeCalledWithoutAScript() {
|
|
2
4
|
const script = process.argv[1];
|
|
3
5
|
return script === undefined || script.trim() === "";
|
|
@@ -9,9 +11,9 @@ export function isNodeCalledWithoutAScript() {
|
|
|
9
11
|
* so we disable it in hardhat/register.
|
|
10
12
|
*/
|
|
11
13
|
export function disableReplWriterShowProxy() {
|
|
12
|
-
const repl = require("repl");
|
|
14
|
+
const repl = require("repl") as typeof ReplT;
|
|
13
15
|
|
|
14
|
-
if (repl.writer.options) {
|
|
16
|
+
if (repl.writer.options !== undefined) {
|
|
15
17
|
Object.defineProperty(repl.writer.options, "showProxy", {
|
|
16
18
|
value: false,
|
|
17
19
|
writable: false,
|
|
@@ -20,7 +20,8 @@ function resolveTempFileName(filePath: string): string {
|
|
|
20
20
|
export async function download(
|
|
21
21
|
url: string,
|
|
22
22
|
filePath: string,
|
|
23
|
-
timeoutMillis = 10000
|
|
23
|
+
timeoutMillis = 10000,
|
|
24
|
+
extraHeaders: { [name: string]: string } = {}
|
|
24
25
|
) {
|
|
25
26
|
const { pipeline } = await import("stream");
|
|
26
27
|
const { getGlobalDispatcher, ProxyAgent, request } = await import("undici");
|
|
@@ -47,6 +48,7 @@ export async function download(
|
|
|
47
48
|
maxRedirections: 10,
|
|
48
49
|
method: "GET",
|
|
49
50
|
headers: {
|
|
51
|
+
...extraHeaders,
|
|
50
52
|
"User-Agent": `hardhat ${hardhatVersion ?? "(unknown version)"}`,
|
|
51
53
|
},
|
|
52
54
|
});
|