hardhat 2.9.3 → 2.9.4
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 +18 -10
- package/builtin-tasks/compile.js.map +1 -1
- package/internal/artifacts.d.ts.map +1 -1
- package/internal/artifacts.js +2 -1
- package/internal/artifacts.js.map +1 -1
- package/internal/cli/HelpPrinter.js +6 -6
- package/internal/cli/HelpPrinter.js.map +1 -1
- package/internal/cli/analytics.d.ts.map +1 -1
- package/internal/cli/analytics.js +2 -2
- package/internal/cli/analytics.js.map +1 -1
- package/internal/cli/cli.js +5 -5
- package/internal/cli/cli.js.map +1 -1
- package/internal/cli/project-creation.js +1 -1
- package/internal/core/errors-list.d.ts +7 -0
- package/internal/core/errors-list.d.ts.map +1 -1
- package/internal/core/errors-list.js +10 -3
- package/internal/core/errors-list.js.map +1 -1
- package/internal/core/providers/http.d.ts +1 -1
- package/internal/core/providers/http.d.ts.map +1 -1
- package/internal/core/providers/http.js +3 -3
- package/internal/core/providers/http.js.map +1 -1
- package/internal/hardhat-network/jsonrpc/handler.js +12 -3
- package/internal/hardhat-network/jsonrpc/handler.js.map +1 -1
- package/internal/hardhat-network/jsonrpc/server.d.ts.map +1 -1
- package/internal/hardhat-network/jsonrpc/server.js +2 -2
- package/internal/hardhat-network/jsonrpc/server.js.map +1 -1
- package/internal/hardhat-network/provider/BlockchainBase.d.ts +1 -1
- package/internal/hardhat-network/provider/BlockchainBase.d.ts.map +1 -1
- package/internal/hardhat-network/provider/BlockchainBase.js +2 -2
- package/internal/hardhat-network/provider/BlockchainBase.js.map +1 -1
- package/internal/hardhat-network/provider/BlockchainData.d.ts +2 -1
- package/internal/hardhat-network/provider/BlockchainData.d.ts.map +1 -1
- package/internal/hardhat-network/provider/BlockchainData.js +4 -2
- package/internal/hardhat-network/provider/BlockchainData.js.map +1 -1
- package/internal/hardhat-network/provider/HardhatBlockchain.d.ts +1 -1
- package/internal/hardhat-network/provider/HardhatBlockchain.d.ts.map +1 -1
- package/internal/hardhat-network/provider/HardhatBlockchain.js +2 -2
- package/internal/hardhat-network/provider/HardhatBlockchain.js.map +1 -1
- package/internal/hardhat-network/provider/TransactionQueue.d.ts.map +1 -1
- package/internal/hardhat-network/provider/TransactionQueue.js.map +1 -1
- package/internal/hardhat-network/provider/TxPool.js +3 -3
- package/internal/hardhat-network/provider/TxPool.js.map +1 -1
- package/internal/hardhat-network/provider/fork/ForkBlockchain.d.ts +1 -1
- package/internal/hardhat-network/provider/fork/ForkBlockchain.d.ts.map +1 -1
- package/internal/hardhat-network/provider/fork/ForkBlockchain.js +3 -3
- package/internal/hardhat-network/provider/fork/ForkBlockchain.js.map +1 -1
- package/internal/hardhat-network/provider/modules/eth.d.ts +3 -0
- package/internal/hardhat-network/provider/modules/eth.d.ts.map +1 -1
- package/internal/hardhat-network/provider/modules/eth.js +20 -17
- package/internal/hardhat-network/provider/modules/eth.js.map +1 -1
- package/internal/hardhat-network/provider/modules/evm.js +2 -2
- package/internal/hardhat-network/provider/modules/evm.js.map +1 -1
- package/internal/hardhat-network/provider/modules/logger.d.ts.map +1 -1
- package/internal/hardhat-network/provider/modules/logger.js +10 -4
- package/internal/hardhat-network/provider/modules/logger.js.map +1 -1
- package/internal/hardhat-network/provider/node.d.ts.map +1 -1
- package/internal/hardhat-network/provider/node.js +8 -8
- package/internal/hardhat-network/provider/node.js.map +1 -1
- package/internal/hardhat-network/provider/output.js +1 -1
- package/internal/hardhat-network/provider/output.js.map +1 -1
- package/internal/hardhat-network/provider/types/HardhatBlockchainInterface.d.ts +1 -1
- package/internal/hardhat-network/provider/types/HardhatBlockchainInterface.d.ts.map +1 -1
- package/internal/hardhat-network/stack-traces/vm-debug-tracer.d.ts.map +1 -1
- package/internal/hardhat-network/stack-traces/vm-debug-tracer.js +1 -10
- package/internal/hardhat-network/stack-traces/vm-debug-tracer.js.map +1 -1
- package/internal/solidity/compilation-job.d.ts.map +1 -1
- package/internal/solidity/compilation-job.js.map +1 -1
- package/internal/util/download.js +1 -1
- package/internal/util/download.js.map +1 -1
- package/internal/util/lazy.d.ts.map +1 -1
- package/internal/util/lazy.js +6 -4
- package/internal/util/lazy.js.map +1 -1
- package/internal/util/wei-values.js +1 -1
- package/internal/util/wei-values.js.map +1 -1
- package/package.json +14 -8
- package/src/builtin-tasks/compile.ts +30 -14
- package/src/common/bigInt.ts +106 -0
- package/src/common/index.ts +2 -0
- package/src/internal/artifacts.ts +3 -2
- package/src/internal/cli/HelpPrinter.ts +6 -6
- package/src/internal/cli/analytics.ts +4 -1
- package/src/internal/cli/cli.ts +6 -6
- package/src/internal/cli/project-creation.ts +1 -1
- package/src/internal/core/errors-list.ts +11 -3
- package/src/internal/core/providers/http.ts +6 -2
- package/src/internal/hardhat-network/jsonrpc/handler.ts +15 -3
- package/src/internal/hardhat-network/jsonrpc/server.ts +2 -1
- package/src/internal/hardhat-network/provider/BlockchainBase.ts +4 -2
- package/src/internal/hardhat-network/provider/BlockchainData.ts +6 -2
- package/src/internal/hardhat-network/provider/HardhatBlockchain.ts +4 -2
- package/src/internal/hardhat-network/provider/TransactionQueue.ts +3 -1
- package/src/internal/hardhat-network/provider/TxPool.ts +3 -3
- package/src/internal/hardhat-network/provider/fork/ForkBlockchain.ts +7 -3
- package/src/internal/hardhat-network/provider/modules/eth.ts +22 -17
- package/src/internal/hardhat-network/provider/modules/evm.ts +2 -2
- package/src/internal/hardhat-network/provider/modules/logger.ts +10 -4
- package/src/internal/hardhat-network/provider/node.ts +9 -8
- package/src/internal/hardhat-network/provider/output.ts +1 -1
- package/src/internal/hardhat-network/provider/types/HardhatBlockchainInterface.ts +2 -1
- package/src/internal/hardhat-network/stack-traces/vm-debug-tracer.ts +1 -11
- package/src/internal/solidity/compilation-job.ts +3 -1
- package/src/internal/util/download.ts +1 -1
- package/src/internal/util/lazy.ts +21 -5
- package/src/internal/util/wei-values.ts +1 -1
- package/src/tsconfig.json +0 -10
|
@@ -235,10 +235,16 @@ const _readWsRequest = (msg: string): JsonRpcRequest => {
|
|
|
235
235
|
};
|
|
236
236
|
|
|
237
237
|
const _handleError = (error: any): JsonRpcResponse => {
|
|
238
|
+
// extract the relevant fields from the error before wrapping it
|
|
238
239
|
let txHash: string | undefined;
|
|
240
|
+
let returnData: string | undefined;
|
|
241
|
+
|
|
239
242
|
if (error.transactionHash !== undefined) {
|
|
240
243
|
txHash = error.transactionHash;
|
|
241
244
|
}
|
|
245
|
+
if (error.data !== undefined) {
|
|
246
|
+
returnData = error.data;
|
|
247
|
+
}
|
|
242
248
|
|
|
243
249
|
// In case of non-hardhat error, treat it as internal and associate the appropriate error code.
|
|
244
250
|
if (!ProviderError.isProviderError(error)) {
|
|
@@ -254,10 +260,16 @@ const _handleError = (error: any): JsonRpcResponse => {
|
|
|
254
260
|
},
|
|
255
261
|
};
|
|
256
262
|
|
|
263
|
+
response.error.data = {
|
|
264
|
+
message: error.message,
|
|
265
|
+
};
|
|
266
|
+
|
|
257
267
|
if (txHash !== undefined) {
|
|
258
|
-
response.error.data =
|
|
259
|
-
|
|
260
|
-
|
|
268
|
+
response.error.data.txHash = txHash;
|
|
269
|
+
}
|
|
270
|
+
|
|
271
|
+
if (returnData !== undefined) {
|
|
272
|
+
response.error.data.data = returnData;
|
|
261
273
|
}
|
|
262
274
|
|
|
263
275
|
return response;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
+
import type { Client as ClientT } from "undici";
|
|
1
2
|
import type WsT from "ws";
|
|
2
3
|
|
|
3
4
|
import debug from "debug";
|
|
4
5
|
import http, { Server } from "http";
|
|
5
6
|
import { AddressInfo } from "net";
|
|
6
|
-
import { Client } from "undici";
|
|
7
7
|
|
|
8
8
|
import {
|
|
9
9
|
EIP1193Provider,
|
|
@@ -44,6 +44,7 @@ export class JsonRpcServer implements IJsonRpcServer {
|
|
|
44
44
|
}
|
|
45
45
|
|
|
46
46
|
public getProvider = (name = "json-rpc"): EIP1193Provider => {
|
|
47
|
+
const { Client } = require("undici") as { Client: typeof ClientT };
|
|
47
48
|
const { address, port } = this._httpServer.address() as AddressInfo;
|
|
48
49
|
|
|
49
50
|
const dispatcher = new Client(`http://${address}:${port}/`, {
|
|
@@ -86,14 +86,16 @@ export abstract class BlockchainBase {
|
|
|
86
86
|
count: BN,
|
|
87
87
|
interval: BN,
|
|
88
88
|
previousBlockStateRoot: Buffer,
|
|
89
|
-
previousBlockTotalDifficulty: BN
|
|
89
|
+
previousBlockTotalDifficulty: BN,
|
|
90
|
+
previousBlockBaseFeePerGas: BN | undefined
|
|
90
91
|
) {
|
|
91
92
|
this._data.reserveBlocks(
|
|
92
93
|
this.getLatestBlockNumber().addn(1),
|
|
93
94
|
count,
|
|
94
95
|
interval,
|
|
95
96
|
previousBlockStateRoot,
|
|
96
|
-
previousBlockTotalDifficulty
|
|
97
|
+
previousBlockTotalDifficulty,
|
|
98
|
+
previousBlockBaseFeePerGas
|
|
97
99
|
);
|
|
98
100
|
}
|
|
99
101
|
|
|
@@ -15,6 +15,7 @@ interface Reservation {
|
|
|
15
15
|
interval: BN;
|
|
16
16
|
previousBlockStateRoot: Buffer;
|
|
17
17
|
previousBlockTotalDifficulty: BN;
|
|
18
|
+
previousBlockBaseFeePerGas: BN | undefined;
|
|
18
19
|
}
|
|
19
20
|
|
|
20
21
|
export class BlockchainData {
|
|
@@ -33,7 +34,8 @@ export class BlockchainData {
|
|
|
33
34
|
count: BN,
|
|
34
35
|
interval: BN,
|
|
35
36
|
previousBlockStateRoot: Buffer,
|
|
36
|
-
previousBlockTotalDifficulty: BN
|
|
37
|
+
previousBlockTotalDifficulty: BN,
|
|
38
|
+
previousBlockBaseFeePerGas: BN | undefined
|
|
37
39
|
) {
|
|
38
40
|
const reservation: Reservation = {
|
|
39
41
|
first,
|
|
@@ -41,6 +43,7 @@ export class BlockchainData {
|
|
|
41
43
|
interval,
|
|
42
44
|
previousBlockStateRoot,
|
|
43
45
|
previousBlockTotalDifficulty,
|
|
46
|
+
previousBlockBaseFeePerGas,
|
|
44
47
|
};
|
|
45
48
|
this._blockReservations.push(reservation);
|
|
46
49
|
}
|
|
@@ -188,7 +191,7 @@ export class BlockchainData {
|
|
|
188
191
|
const reservationIndex = this._findBlockReservation(blockNumber);
|
|
189
192
|
assertHardhatInvariant(
|
|
190
193
|
reservationIndex !== -1,
|
|
191
|
-
`No reservation to fill for block number ${blockNumber}`
|
|
194
|
+
`No reservation to fill for block number ${blockNumber.toString()}`
|
|
192
195
|
);
|
|
193
196
|
|
|
194
197
|
// capture the timestamp before removing the reservation:
|
|
@@ -217,6 +220,7 @@ export class BlockchainData {
|
|
|
217
220
|
header: {
|
|
218
221
|
number: blockNumber,
|
|
219
222
|
stateRoot: oldReservation.previousBlockStateRoot,
|
|
223
|
+
baseFeePerGas: oldReservation.previousBlockBaseFeePerGas,
|
|
220
224
|
timestamp,
|
|
221
225
|
},
|
|
222
226
|
},
|
|
@@ -36,13 +36,15 @@ export class HardhatBlockchain
|
|
|
36
36
|
count: BN,
|
|
37
37
|
interval: BN,
|
|
38
38
|
previousBlockStateRoot: Buffer,
|
|
39
|
-
previousBlockTotalDifficulty: BN
|
|
39
|
+
previousBlockTotalDifficulty: BN,
|
|
40
|
+
previousBlockBaseFeePerGas: BN | undefined
|
|
40
41
|
) {
|
|
41
42
|
super.reserveBlocks(
|
|
42
43
|
count,
|
|
43
44
|
interval,
|
|
44
45
|
previousBlockStateRoot,
|
|
45
|
-
previousBlockTotalDifficulty
|
|
46
|
+
previousBlockTotalDifficulty,
|
|
47
|
+
previousBlockBaseFeePerGas
|
|
46
48
|
);
|
|
47
49
|
this._length = this._length + count.toNumber();
|
|
48
50
|
}
|
|
@@ -62,7 +62,9 @@ function getOrderedTransactionHeap(
|
|
|
62
62
|
);
|
|
63
63
|
default:
|
|
64
64
|
// eslint-disable-next-line @nomiclabs/hardhat-internal-rules/only-hardhat-error
|
|
65
|
-
throw new InvalidInputError(
|
|
65
|
+
throw new InvalidInputError(
|
|
66
|
+
`Invalid mempool order: ${mempoolOrder as any}`
|
|
67
|
+
);
|
|
66
68
|
}
|
|
67
69
|
}
|
|
68
70
|
|
|
@@ -445,7 +445,7 @@ export class TxPool {
|
|
|
445
445
|
|
|
446
446
|
if (txMaxUpfrontCost.gt(senderBalance)) {
|
|
447
447
|
throw new InvalidInputError(
|
|
448
|
-
`sender doesn't have enough funds to send tx. The max upfront cost is: ${txMaxUpfrontCost}` +
|
|
448
|
+
`sender doesn't have enough funds to send tx. The max upfront cost is: ${txMaxUpfrontCost.toString()}` +
|
|
449
449
|
` and the sender's account only has: ${senderBalance.toString()}`
|
|
450
450
|
);
|
|
451
451
|
}
|
|
@@ -461,7 +461,7 @@ export class TxPool {
|
|
|
461
461
|
|
|
462
462
|
if (gasLimit.lt(baseFee)) {
|
|
463
463
|
throw new InvalidInputError(
|
|
464
|
-
`Transaction requires at least ${baseFee} gas but got ${gasLimit}`
|
|
464
|
+
`Transaction requires at least ${baseFee.toString()} gas but got ${gasLimit.toString()}`
|
|
465
465
|
);
|
|
466
466
|
}
|
|
467
467
|
|
|
@@ -469,7 +469,7 @@ export class TxPool {
|
|
|
469
469
|
|
|
470
470
|
if (gasLimit.gt(blockGasLimit)) {
|
|
471
471
|
throw new InvalidInputError(
|
|
472
|
-
`Transaction gas limit is ${gasLimit} and exceeds block gas limit of ${blockGasLimit}`
|
|
472
|
+
`Transaction gas limit is ${gasLimit.toString()} and exceeds block gas limit of ${blockGasLimit.toString()}`
|
|
473
473
|
);
|
|
474
474
|
}
|
|
475
475
|
}
|
|
@@ -97,13 +97,15 @@ export class ForkBlockchain
|
|
|
97
97
|
count: BN,
|
|
98
98
|
interval: BN,
|
|
99
99
|
previousBlockStateRoot: Buffer,
|
|
100
|
-
previousBlockTotalDifficulty: BN
|
|
100
|
+
previousBlockTotalDifficulty: BN,
|
|
101
|
+
previousBlockBaseFeePerGas: BN | undefined
|
|
101
102
|
) {
|
|
102
103
|
super.reserveBlocks(
|
|
103
104
|
count,
|
|
104
105
|
interval,
|
|
105
106
|
previousBlockStateRoot,
|
|
106
|
-
previousBlockTotalDifficulty
|
|
107
|
+
previousBlockTotalDifficulty,
|
|
108
|
+
previousBlockBaseFeePerGas
|
|
107
109
|
);
|
|
108
110
|
this._latestBlockNumber = this._latestBlockNumber.add(count);
|
|
109
111
|
}
|
|
@@ -293,7 +295,9 @@ export class ForkBlockchain
|
|
|
293
295
|
rpcToTxData(transaction) as FeeMarketEIP1559TxData
|
|
294
296
|
);
|
|
295
297
|
} else {
|
|
296
|
-
throw new InternalError(
|
|
298
|
+
throw new InternalError(
|
|
299
|
+
`Unknown transaction type ${transaction.type.toString()}`
|
|
300
|
+
);
|
|
297
301
|
}
|
|
298
302
|
|
|
299
303
|
block.transactions.push(tx);
|
|
@@ -365,6 +365,9 @@ export class EthModule {
|
|
|
365
365
|
await this._runHardhatNetworkMessageTraceHooks(trace, true);
|
|
366
366
|
|
|
367
367
|
if (error !== undefined && this._throwOnCallFailures) {
|
|
368
|
+
const callReturnData = trace?.returnData.toString("hex") ?? "";
|
|
369
|
+
(error as any).data = `0x${callReturnData}`;
|
|
370
|
+
|
|
368
371
|
throw error;
|
|
369
372
|
}
|
|
370
373
|
|
|
@@ -438,6 +441,9 @@ export class EthModule {
|
|
|
438
441
|
error
|
|
439
442
|
);
|
|
440
443
|
|
|
444
|
+
const callReturnData = trace?.returnData.toString("hex") ?? "";
|
|
445
|
+
(error as any).data = `0x${callReturnData}`;
|
|
446
|
+
|
|
441
447
|
throw error;
|
|
442
448
|
}
|
|
443
449
|
|
|
@@ -979,8 +985,9 @@ export class EthModule {
|
|
|
979
985
|
}
|
|
980
986
|
|
|
981
987
|
if (error.message.includes("The chain ID does not match")) {
|
|
988
|
+
const chainId = this._common.chainIdBN().toString();
|
|
982
989
|
throw new InvalidArgumentsError(
|
|
983
|
-
`Trying to send a raw transaction with an invalid chainId. The expected chainId is ${
|
|
990
|
+
`Trying to send a raw transaction with an invalid chainId. The expected chainId is ${chainId}`,
|
|
984
991
|
error
|
|
985
992
|
);
|
|
986
993
|
}
|
|
@@ -1015,7 +1022,7 @@ export class EthModule {
|
|
|
1015
1022
|
!transactionRequest.chainId.eq(expectedChainId)
|
|
1016
1023
|
) {
|
|
1017
1024
|
throw new InvalidArgumentsError(
|
|
1018
|
-
`Invalid chainId ${transactionRequest.chainId.toString()} provided, expected ${expectedChainId} instead.`
|
|
1025
|
+
`Invalid chainId ${transactionRequest.chainId.toString()} provided, expected ${expectedChainId.toString()} instead.`
|
|
1019
1026
|
);
|
|
1020
1027
|
}
|
|
1021
1028
|
|
|
@@ -1512,12 +1519,13 @@ export class EthModule {
|
|
|
1512
1519
|
result = [result];
|
|
1513
1520
|
}
|
|
1514
1521
|
|
|
1515
|
-
|
|
1516
|
-
|
|
1517
|
-
|
|
1518
|
-
|
|
1519
|
-
|
|
1520
|
-
|
|
1522
|
+
const trace = await this._handleMineBlockResults(result, tx);
|
|
1523
|
+
|
|
1524
|
+
if (trace.error !== undefined && this._throwOnTransactionFailures) {
|
|
1525
|
+
const e = trace.error;
|
|
1526
|
+
|
|
1527
|
+
const returnData = trace.trace?.returnData.toString("hex") ?? "";
|
|
1528
|
+
(e as any).data = `0x${returnData}`;
|
|
1521
1529
|
(e as any).transactionHash = bufferToRpcData(tx.hash());
|
|
1522
1530
|
|
|
1523
1531
|
throw e;
|
|
@@ -1526,10 +1534,13 @@ export class EthModule {
|
|
|
1526
1534
|
return bufferToRpcData(tx.hash());
|
|
1527
1535
|
}
|
|
1528
1536
|
|
|
1537
|
+
/**
|
|
1538
|
+
* Returns the trace of the sent tx
|
|
1539
|
+
*/
|
|
1529
1540
|
private async _handleMineBlockResults(
|
|
1530
1541
|
results: MineBlockResult[],
|
|
1531
1542
|
sentTx: TypedTransaction
|
|
1532
|
-
) {
|
|
1543
|
+
): Promise<GatherTracesResult> {
|
|
1533
1544
|
const singleTransactionMined =
|
|
1534
1545
|
results.length === 1 && results[0].block.transactions.length === 1;
|
|
1535
1546
|
|
|
@@ -1540,10 +1551,7 @@ export class EthModule {
|
|
|
1540
1551
|
const trace = results[0].traces[0];
|
|
1541
1552
|
await this._logSingleTransaction(tx, block, txGasUsed, trace);
|
|
1542
1553
|
|
|
1543
|
-
|
|
1544
|
-
if (txError !== undefined && this._throwOnTransactionFailures) {
|
|
1545
|
-
throw txError;
|
|
1546
|
-
}
|
|
1554
|
+
return trace;
|
|
1547
1555
|
} else {
|
|
1548
1556
|
// this happens when automine is enabled, a tx is sent, and there are
|
|
1549
1557
|
// pending txs in the mempool
|
|
@@ -1575,10 +1583,7 @@ export class EthModule {
|
|
|
1575
1583
|
);
|
|
1576
1584
|
}
|
|
1577
1585
|
|
|
1578
|
-
|
|
1579
|
-
if (sentTxError !== undefined && this._throwOnTransactionFailures) {
|
|
1580
|
-
throw sentTxError;
|
|
1581
|
-
}
|
|
1586
|
+
return sentTxTrace;
|
|
1582
1587
|
}
|
|
1583
1588
|
}
|
|
1584
1589
|
|
|
@@ -90,7 +90,7 @@ export class EvmModule {
|
|
|
90
90
|
);
|
|
91
91
|
if (increment.lte(new BN(0))) {
|
|
92
92
|
throw new InvalidInputError(
|
|
93
|
-
`Timestamp ${timestamp} is lower than or equal to previous block's timestamp` +
|
|
93
|
+
`Timestamp ${timestamp.toString()} is lower than or equal to previous block's timestamp` +
|
|
94
94
|
` ${new BN(latestBlock.header.timestamp).toNumber()}`
|
|
95
95
|
);
|
|
96
96
|
}
|
|
@@ -132,7 +132,7 @@ export class EvmModule {
|
|
|
132
132
|
);
|
|
133
133
|
if (increment.lte(new BN(0))) {
|
|
134
134
|
throw new InvalidInputError(
|
|
135
|
-
`Timestamp ${timestamp} is lower than previous block's timestamp` +
|
|
135
|
+
`Timestamp ${timestamp.toString()} is lower than previous block's timestamp` +
|
|
136
136
|
` ${new BN(latestBlock.header.timestamp).toNumber()}`
|
|
137
137
|
);
|
|
138
138
|
}
|
|
@@ -331,7 +331,9 @@ export class ModulesLogger {
|
|
|
331
331
|
if (isEmpty) {
|
|
332
332
|
this._log(
|
|
333
333
|
`Mined empty block #${blockNumber}${
|
|
334
|
-
baseFeePerGas !== undefined
|
|
334
|
+
baseFeePerGas !== undefined
|
|
335
|
+
? ` with base fee ${baseFeePerGas.toString()}`
|
|
336
|
+
: ""
|
|
335
337
|
}`
|
|
336
338
|
);
|
|
337
339
|
|
|
@@ -365,7 +367,7 @@ export class ModulesLogger {
|
|
|
365
367
|
|
|
366
368
|
private _logBaseFeePerGas(block: Block) {
|
|
367
369
|
if (block.header.baseFeePerGas !== undefined) {
|
|
368
|
-
this._log(`Base fee: ${block.header.baseFeePerGas}`);
|
|
370
|
+
this._log(`Base fee: ${block.header.baseFeePerGas.toString()}`);
|
|
369
371
|
}
|
|
370
372
|
}
|
|
371
373
|
|
|
@@ -413,7 +415,9 @@ export class ModulesLogger {
|
|
|
413
415
|
if (isEmpty) {
|
|
414
416
|
this._print(
|
|
415
417
|
`Mined empty block #${blockNumber}${
|
|
416
|
-
baseFeePerGas !== undefined
|
|
418
|
+
baseFeePerGas !== undefined
|
|
419
|
+
? ` with base fee ${baseFeePerGas.toString()}`
|
|
420
|
+
: ""
|
|
417
421
|
}`,
|
|
418
422
|
{
|
|
419
423
|
collapseIntervalMinedBlock: true,
|
|
@@ -441,7 +445,9 @@ export class ModulesLogger {
|
|
|
441
445
|
|
|
442
446
|
this._log(
|
|
443
447
|
`Mined empty block #${blockNumber}${
|
|
444
|
-
baseFeePerGas !== undefined
|
|
448
|
+
baseFeePerGas !== undefined
|
|
449
|
+
? ` with base fee ${baseFeePerGas.toString()}`
|
|
450
|
+
: ""
|
|
445
451
|
}`,
|
|
446
452
|
{
|
|
447
453
|
collapseHardhatMinedBlock: true,
|
|
@@ -563,7 +563,8 @@ Hardhat Network's forking functionality only works with blocks from at least spu
|
|
|
563
563
|
remainingBlockCount.subn(1),
|
|
564
564
|
interval,
|
|
565
565
|
await this._stateManager.getStateRoot(),
|
|
566
|
-
await this.getBlockTotalDifficulty(latestBlock)
|
|
566
|
+
await this.getBlockTotalDifficulty(latestBlock),
|
|
567
|
+
(await this.getLatestBlock()).header.baseFeePerGas
|
|
567
568
|
);
|
|
568
569
|
|
|
569
570
|
await mineBlock();
|
|
@@ -1031,7 +1032,7 @@ Hardhat Network's forking functionality only works with blocks from at least spu
|
|
|
1031
1032
|
this.setNextBlockTimestamp(snapshot.nextBlockTimestamp);
|
|
1032
1033
|
this._txPool.revert(snapshot.txPoolSnapshotId);
|
|
1033
1034
|
|
|
1034
|
-
if (snapshot.userProvidedNextBlockBaseFeePerGas) {
|
|
1035
|
+
if (snapshot.userProvidedNextBlockBaseFeePerGas !== undefined) {
|
|
1035
1036
|
this.setUserProvidedNextBlockBaseFeePerGas(
|
|
1036
1037
|
snapshot.userProvidedNextBlockBaseFeePerGas
|
|
1037
1038
|
);
|
|
@@ -1675,7 +1676,7 @@ Hardhat Network's forking functionality only works with blocks from at least spu
|
|
|
1675
1676
|
const nextPendingNonce = await this._txPool.getNextPendingNonce(sender);
|
|
1676
1677
|
const txNonce = new BN(tx.nonce);
|
|
1677
1678
|
|
|
1678
|
-
const expectedNonceMsg = `Expected nonce to be ${nextPendingNonce} but got ${txNonce}.`;
|
|
1679
|
+
const expectedNonceMsg = `Expected nonce to be ${nextPendingNonce.toString()} but got ${txNonce.toString()}.`;
|
|
1679
1680
|
if (txNonce.gt(nextPendingNonce)) {
|
|
1680
1681
|
throw new InvalidInputError(
|
|
1681
1682
|
`Nonce too high. ${expectedNonceMsg} Note that transactions can't be queued when automining.`
|
|
@@ -1691,7 +1692,7 @@ Hardhat Network's forking functionality only works with blocks from at least spu
|
|
|
1691
1692
|
);
|
|
1692
1693
|
if (txPriorityFee.lt(this._minGasPrice)) {
|
|
1693
1694
|
throw new InvalidInputError(
|
|
1694
|
-
`Transaction gas price is ${txPriorityFee}, which is below the minimum of ${this._minGasPrice}`
|
|
1695
|
+
`Transaction gas price is ${txPriorityFee.toString()}, which is below the minimum of ${this._minGasPrice.toString()}`
|
|
1695
1696
|
);
|
|
1696
1697
|
}
|
|
1697
1698
|
|
|
@@ -1701,13 +1702,13 @@ Hardhat Network's forking functionality only works with blocks from at least spu
|
|
|
1701
1702
|
if ("maxFeePerGas" in tx) {
|
|
1702
1703
|
if (nextBlockGasFee.gt(tx.maxFeePerGas)) {
|
|
1703
1704
|
throw new InvalidInputError(
|
|
1704
|
-
`Transaction maxFeePerGas (${tx.maxFeePerGas}) is too low for the next block, which has a baseFeePerGas of ${nextBlockGasFee}`
|
|
1705
|
+
`Transaction maxFeePerGas (${tx.maxFeePerGas.toString()}) is too low for the next block, which has a baseFeePerGas of ${nextBlockGasFee.toString()}`
|
|
1705
1706
|
);
|
|
1706
1707
|
}
|
|
1707
1708
|
} else {
|
|
1708
1709
|
if (nextBlockGasFee.gt(tx.gasPrice)) {
|
|
1709
1710
|
throw new InvalidInputError(
|
|
1710
|
-
`Transaction gasPrice (${tx.gasPrice}) is too low for the next block, which has a baseFeePerGas of ${nextBlockGasFee}`
|
|
1711
|
+
`Transaction gasPrice (${tx.gasPrice.toString()}) is too low for the next block, which has a baseFeePerGas of ${nextBlockGasFee.toString()}`
|
|
1711
1712
|
);
|
|
1712
1713
|
}
|
|
1713
1714
|
}
|
|
@@ -2125,7 +2126,7 @@ Hardhat Network's forking functionality only works with blocks from at least spu
|
|
|
2125
2126
|
if (block === undefined) {
|
|
2126
2127
|
// TODO handle this better
|
|
2127
2128
|
throw new Error(
|
|
2128
|
-
`Block with number ${blockNumberOrPending} doesn't exist. This should never happen.`
|
|
2129
|
+
`Block with number ${blockNumberOrPending.toString()} doesn't exist. This should never happen.`
|
|
2129
2130
|
);
|
|
2130
2131
|
}
|
|
2131
2132
|
|
|
@@ -2545,7 +2546,7 @@ Hardhat Network's forking functionality only works with blocks from at least spu
|
|
|
2545
2546
|
);
|
|
2546
2547
|
if (hardfork === undefined || blockNumber.ltn(activationBlock)) {
|
|
2547
2548
|
throw new InternalError(
|
|
2548
|
-
`Could not find a hardfork to run for block ${blockNumber}, after having looked for one in the HardhatNode's hardfork activation history, which was: ${JSON.stringify(
|
|
2549
|
+
`Could not find a hardfork to run for block ${blockNumber.toString()}, after having looked for one in the HardhatNode's hardfork activation history, which was: ${JSON.stringify(
|
|
2549
2550
|
hardforkHistory
|
|
2550
2551
|
)}. For more information, see https://hardhat.org/hardhat-network/reference/#config`
|
|
2551
2552
|
);
|
|
@@ -186,7 +186,7 @@ export function getRpcBlock(
|
|
|
186
186
|
uncles: block.uncleHeaders.map((uh: any) => bufferToRpcData(uh.hash())),
|
|
187
187
|
};
|
|
188
188
|
|
|
189
|
-
if (block.header.baseFeePerGas) {
|
|
189
|
+
if (block.header.baseFeePerGas !== undefined) {
|
|
190
190
|
output.baseFeePerGas = numberToRpcQuantity(block.header.baseFeePerGas);
|
|
191
191
|
}
|
|
192
192
|
|
|
@@ -11,7 +11,8 @@ export interface HardhatBlockchainInterface extends BlockchainInterface {
|
|
|
11
11
|
count: BN,
|
|
12
12
|
interval: BN,
|
|
13
13
|
previousBlockStateRoot: Buffer,
|
|
14
|
-
previousBlockTotalDifficulty: BN
|
|
14
|
+
previousBlockTotalDifficulty: BN,
|
|
15
|
+
previousBlockBaseFeePerGas: BN | undefined
|
|
15
16
|
): void;
|
|
16
17
|
deleteLaterBlocks(block: Block): void;
|
|
17
18
|
getBlockByTransactionHash(transactionHash: Buffer): Promise<Block | null>;
|
|
@@ -223,16 +223,6 @@ export class VMDebugTracer {
|
|
|
223
223
|
...structLog.storage,
|
|
224
224
|
};
|
|
225
225
|
|
|
226
|
-
// sometimes the memSize has the correct value
|
|
227
|
-
// for the memory length, in those cases we increase
|
|
228
|
-
// the memory to reflect this
|
|
229
|
-
if (structLog.memSize > structLog.memory.length) {
|
|
230
|
-
const wordsToAdd = structLog.memSize - structLog.memory.length;
|
|
231
|
-
for (let k = 0; k < wordsToAdd; k++) {
|
|
232
|
-
structLog.memory.push(EMPTY_MEMORY_WORD);
|
|
233
|
-
}
|
|
234
|
-
}
|
|
235
|
-
|
|
236
226
|
if (i === 0) {
|
|
237
227
|
continue;
|
|
238
228
|
}
|
|
@@ -411,7 +401,7 @@ export class VMDebugTracer {
|
|
|
411
401
|
gasCost = constantGas + dynamicGas;
|
|
412
402
|
} else if (step.opcode.name === "CALLCODE") {
|
|
413
403
|
// finding an existing tx that uses CALLCODE or compiling a contract
|
|
414
|
-
// so that it uses
|
|
404
|
+
// so that it uses this opcode is hard,
|
|
415
405
|
// so we just throw
|
|
416
406
|
throw new InvalidInputError(
|
|
417
407
|
"Transactions that use CALLCODE are not supported by Hardhat's debug_traceTransaction"
|
|
@@ -153,7 +153,9 @@ export async function createCompilationJobsFromConnectedComponent(
|
|
|
153
153
|
|
|
154
154
|
if (isCompilationJobCreationError(compilationJobOrError)) {
|
|
155
155
|
log(
|
|
156
|
-
`'${file.absolutePath}' couldn't be compiled. Reason: '${
|
|
156
|
+
`'${file.absolutePath}' couldn't be compiled. Reason: '${
|
|
157
|
+
compilationJobOrError as any
|
|
158
|
+
}'`
|
|
157
159
|
);
|
|
158
160
|
errors.push(compilationJobOrError);
|
|
159
161
|
continue;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import util from "util";
|
|
1
|
+
import util, { InspectOptions } from "util";
|
|
2
2
|
|
|
3
3
|
import { HardhatError } from "../core/errors";
|
|
4
4
|
import { ERRORS } from "../core/errors-list";
|
|
@@ -36,9 +36,17 @@ export function lazyObject<T extends object>(objectCreator: () => T): T {
|
|
|
36
36
|
return createLazyProxy(
|
|
37
37
|
objectCreator,
|
|
38
38
|
(getRealTarget) => ({
|
|
39
|
-
[inspect](
|
|
39
|
+
[inspect](
|
|
40
|
+
depth: number,
|
|
41
|
+
options: InspectOptions,
|
|
42
|
+
inspectFn: (
|
|
43
|
+
object: any,
|
|
44
|
+
options: InspectOptions
|
|
45
|
+
) => string = util.inspect
|
|
46
|
+
) {
|
|
40
47
|
const realTarget = getRealTarget();
|
|
41
|
-
|
|
48
|
+
const newOptions = { ...options, depth };
|
|
49
|
+
return inspectFn(realTarget, newOptions);
|
|
42
50
|
},
|
|
43
51
|
}),
|
|
44
52
|
(object) => {
|
|
@@ -64,9 +72,17 @@ export function lazyFunction<T extends Function>(functionCreator: () => T): T {
|
|
|
64
72
|
(getRealTarget) => {
|
|
65
73
|
function dummyTarget() {}
|
|
66
74
|
|
|
67
|
-
(dummyTarget as any)[inspect] = function (
|
|
75
|
+
(dummyTarget as any)[inspect] = function (
|
|
76
|
+
depth: number,
|
|
77
|
+
options: InspectOptions,
|
|
78
|
+
inspectFn: (
|
|
79
|
+
object: any,
|
|
80
|
+
options: InspectOptions
|
|
81
|
+
) => string = util.inspect
|
|
82
|
+
) {
|
|
68
83
|
const realTarget = getRealTarget();
|
|
69
|
-
|
|
84
|
+
const newOptions = { ...options, depth };
|
|
85
|
+
return inspectFn(realTarget, newOptions);
|
|
70
86
|
};
|
|
71
87
|
|
|
72
88
|
return dummyTarget;
|