hardhat 2.10.1 → 2.11.0-dev.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/README.md +1 -1
- package/builtin-tasks/compile.js +6 -8
- package/builtin-tasks/compile.js.map +1 -1
- package/builtin-tasks/node.js +9 -12
- package/builtin-tasks/node.js.map +1 -1
- package/builtin-tasks/test.js +2 -3
- package/builtin-tasks/test.js.map +1 -1
- package/console.sol +444 -444
- package/internal/artifacts.js +1 -1
- package/internal/artifacts.js.map +1 -1
- package/internal/cli/ArgumentsParser.js +5 -2
- package/internal/cli/ArgumentsParser.js.map +1 -1
- package/internal/cli/analytics.js +2 -2
- package/internal/cli/analytics.js.map +1 -1
- package/internal/cli/autocomplete.js +20 -32
- package/internal/cli/autocomplete.js.map +1 -1
- package/internal/cli/cli.js +1 -1
- package/internal/cli/cli.js.map +1 -1
- package/internal/cli/project-creation.js +14 -4
- package/internal/cli/project-creation.js.map +1 -1
- package/internal/constants.d.ts.map +1 -1
- package/internal/constants.js +2 -0
- package/internal/constants.js.map +1 -1
- package/internal/core/config/config-loading.js +2 -3
- package/internal/core/config/config-loading.js.map +1 -1
- package/internal/core/config/config-resolution.d.ts.map +1 -1
- package/internal/core/config/config-resolution.js +84 -35
- package/internal/core/config/config-resolution.js.map +1 -1
- package/internal/core/config/config-validation.js +38 -20
- package/internal/core/config/config-validation.js.map +1 -1
- package/internal/core/config/default-config.d.ts.map +1 -1
- package/internal/core/config/default-config.js +17 -4
- package/internal/core/config/default-config.js.map +1 -1
- package/internal/core/errors.js +4 -2
- package/internal/core/errors.js.map +1 -1
- package/internal/core/execution-mode.js +2 -2
- package/internal/core/execution-mode.js.map +1 -1
- package/internal/core/flamegraph.d.ts +10 -0
- package/internal/core/flamegraph.d.ts.map +1 -0
- package/internal/core/flamegraph.js +245 -0
- package/internal/core/flamegraph.js.map +1 -0
- package/internal/core/jsonrpc/types/base-types.d.ts +7 -8
- package/internal/core/jsonrpc/types/base-types.d.ts.map +1 -1
- package/internal/core/jsonrpc/types/base-types.js +24 -24
- package/internal/core/jsonrpc/types/base-types.js.map +1 -1
- package/internal/core/jsonrpc/types/input/blockTag.d.ts +15 -10
- package/internal/core/jsonrpc/types/input/blockTag.d.ts.map +1 -1
- package/internal/core/jsonrpc/types/input/blockTag.js +2 -0
- package/internal/core/jsonrpc/types/input/blockTag.js.map +1 -1
- package/internal/core/jsonrpc/types/input/callRequest.d.ts +5 -6
- package/internal/core/jsonrpc/types/input/callRequest.d.ts.map +1 -1
- package/internal/core/jsonrpc/types/input/callRequest.js.map +1 -1
- package/internal/core/jsonrpc/types/input/filterRequest.d.ts +6 -7
- package/internal/core/jsonrpc/types/input/filterRequest.d.ts.map +1 -1
- package/internal/core/jsonrpc/types/input/filterRequest.js.map +1 -1
- package/internal/core/jsonrpc/types/input/transactionRequest.d.ts +7 -8
- package/internal/core/jsonrpc/types/input/transactionRequest.d.ts.map +1 -1
- package/internal/core/jsonrpc/types/input/transactionRequest.js.map +1 -1
- package/internal/core/jsonrpc/types/output/block.d.ts +29 -30
- package/internal/core/jsonrpc/types/output/block.d.ts.map +1 -1
- package/internal/core/jsonrpc/types/output/block.js +8 -2
- package/internal/core/jsonrpc/types/output/block.js.map +1 -1
- package/internal/core/jsonrpc/types/output/log.d.ts +3 -4
- package/internal/core/jsonrpc/types/output/log.d.ts.map +1 -1
- package/internal/core/jsonrpc/types/output/log.js.map +1 -1
- package/internal/core/jsonrpc/types/output/receipt.d.ts +10 -11
- package/internal/core/jsonrpc/types/output/receipt.d.ts.map +1 -1
- package/internal/core/jsonrpc/types/output/receipt.js.map +1 -1
- package/internal/core/jsonrpc/types/output/transaction.d.ts +13 -14
- package/internal/core/jsonrpc/types/output/transaction.d.ts.map +1 -1
- package/internal/core/jsonrpc/types/output/transaction.js.map +1 -1
- package/internal/core/providers/accounts.d.ts.map +1 -1
- package/internal/core/providers/accounts.js +30 -24
- package/internal/core/providers/accounts.js.map +1 -1
- package/internal/core/providers/chainId.js +1 -1
- package/internal/core/providers/chainId.js.map +1 -1
- package/internal/core/providers/construction.d.ts.map +1 -1
- package/internal/core/providers/construction.js +5 -5
- package/internal/core/providers/construction.js.map +1 -1
- package/internal/core/providers/gas-providers.d.ts +4 -4
- package/internal/core/providers/gas-providers.d.ts.map +1 -1
- package/internal/core/providers/gas-providers.js +16 -15
- package/internal/core/providers/gas-providers.js.map +1 -1
- package/internal/core/providers/http.js +7 -2
- package/internal/core/providers/http.js.map +1 -1
- package/internal/core/providers/util.js +5 -8
- package/internal/core/providers/util.js.map +1 -1
- package/internal/core/runtime-environment.js +1 -1
- package/internal/core/runtime-environment.js.map +1 -1
- package/internal/core/task-profiling.d.ts +18 -0
- package/internal/core/task-profiling.d.ts.map +1 -0
- package/internal/core/task-profiling.js +50 -0
- package/internal/core/task-profiling.js.map +1 -0
- package/internal/core/typescript-support.js +3 -3
- package/internal/core/typescript-support.js.map +1 -1
- package/internal/hardhat-network/jsonrpc/client.d.ts +39 -39
- package/internal/hardhat-network/jsonrpc/client.d.ts.map +1 -1
- package/internal/hardhat-network/jsonrpc/client.js +14 -14
- package/internal/hardhat-network/jsonrpc/client.js.map +1 -1
- package/internal/hardhat-network/provider/BlockchainBase.d.ts +13 -10
- package/internal/hardhat-network/provider/BlockchainBase.d.ts.map +1 -1
- package/internal/hardhat-network/provider/BlockchainBase.js +38 -16
- package/internal/hardhat-network/provider/BlockchainBase.js.map +1 -1
- package/internal/hardhat-network/provider/BlockchainData.d.ts +15 -16
- package/internal/hardhat-network/provider/BlockchainData.d.ts.map +1 -1
- package/internal/hardhat-network/provider/BlockchainData.js +33 -29
- package/internal/hardhat-network/provider/BlockchainData.js.map +1 -1
- package/internal/hardhat-network/provider/HardhatBlockchain.d.ts +7 -8
- package/internal/hardhat-network/provider/HardhatBlockchain.d.ts.map +1 -1
- package/internal/hardhat-network/provider/HardhatBlockchain.js +13 -14
- package/internal/hardhat-network/provider/HardhatBlockchain.js.map +1 -1
- package/internal/hardhat-network/provider/PoolState.d.ts +1 -1
- package/internal/hardhat-network/provider/PoolState.d.ts.map +1 -1
- package/internal/hardhat-network/provider/PoolState.js +2 -3
- package/internal/hardhat-network/provider/PoolState.js.map +1 -1
- package/internal/hardhat-network/provider/TransactionQueue.d.ts +2 -3
- package/internal/hardhat-network/provider/TransactionQueue.d.ts.map +1 -1
- package/internal/hardhat-network/provider/TransactionQueue.js +3 -3
- package/internal/hardhat-network/provider/TransactionQueue.js.map +1 -1
- package/internal/hardhat-network/provider/TxPool.d.ts +8 -8
- package/internal/hardhat-network/provider/TxPool.d.ts.map +1 -1
- package/internal/hardhat-network/provider/TxPool.js +66 -68
- package/internal/hardhat-network/provider/TxPool.js.map +1 -1
- package/internal/hardhat-network/provider/ethereumjs-workarounds.js +2 -2
- package/internal/hardhat-network/provider/ethereumjs-workarounds.js.map +1 -1
- package/internal/hardhat-network/provider/filter.d.ts +5 -6
- package/internal/hardhat-network/provider/filter.d.ts.map +1 -1
- package/internal/hardhat-network/provider/filter.js +7 -8
- package/internal/hardhat-network/provider/filter.js.map +1 -1
- package/internal/hardhat-network/provider/fork/ForkBlockchain.d.ts +10 -11
- package/internal/hardhat-network/provider/fork/ForkBlockchain.d.ts.map +1 -1
- package/internal/hardhat-network/provider/fork/ForkBlockchain.js +51 -47
- package/internal/hardhat-network/provider/fork/ForkBlockchain.js.map +1 -1
- package/internal/hardhat-network/provider/fork/ForkStateManager.d.ts +8 -10
- package/internal/hardhat-network/provider/fork/ForkStateManager.d.ts.map +1 -1
- package/internal/hardhat-network/provider/fork/ForkStateManager.js +51 -69
- package/internal/hardhat-network/provider/fork/ForkStateManager.js.map +1 -1
- package/internal/hardhat-network/provider/fork/rpcToBlockData.d.ts +1 -1
- package/internal/hardhat-network/provider/fork/rpcToBlockData.d.ts.map +1 -1
- package/internal/hardhat-network/provider/fork/rpcToBlockData.js +2 -3
- package/internal/hardhat-network/provider/fork/rpcToBlockData.js.map +1 -1
- package/internal/hardhat-network/provider/fork/rpcToTxData.d.ts +2 -2
- package/internal/hardhat-network/provider/fork/rpcToTxData.d.ts.map +1 -1
- package/internal/hardhat-network/provider/fork/rpcToTxData.js +7 -11
- package/internal/hardhat-network/provider/fork/rpcToTxData.js.map +1 -1
- package/internal/hardhat-network/provider/modules/eth.d.ts +2 -1
- package/internal/hardhat-network/provider/modules/eth.d.ts.map +1 -1
- package/internal/hardhat-network/provider/modules/eth.js +92 -68
- package/internal/hardhat-network/provider/modules/eth.js.map +1 -1
- package/internal/hardhat-network/provider/modules/evm.d.ts.map +1 -1
- package/internal/hardhat-network/provider/modules/evm.js +14 -14
- package/internal/hardhat-network/provider/modules/evm.js.map +1 -1
- package/internal/hardhat-network/provider/modules/hardhat.d.ts.map +1 -1
- package/internal/hardhat-network/provider/modules/hardhat.js +13 -13
- package/internal/hardhat-network/provider/modules/hardhat.js.map +1 -1
- package/internal/hardhat-network/provider/modules/logger.d.ts +7 -8
- package/internal/hardhat-network/provider/modules/logger.d.ts.map +1 -1
- package/internal/hardhat-network/provider/modules/logger.js +29 -32
- package/internal/hardhat-network/provider/modules/logger.js.map +1 -1
- package/internal/hardhat-network/provider/modules/net.d.ts +1 -1
- package/internal/hardhat-network/provider/modules/net.d.ts.map +1 -1
- package/internal/hardhat-network/provider/modules/personal.d.ts.map +1 -1
- package/internal/hardhat-network/provider/modules/personal.js +3 -3
- package/internal/hardhat-network/provider/modules/personal.js.map +1 -1
- package/internal/hardhat-network/provider/modules/web3.d.ts.map +1 -1
- package/internal/hardhat-network/provider/modules/web3.js +5 -4
- package/internal/hardhat-network/provider/modules/web3.js.map +1 -1
- package/internal/hardhat-network/provider/node-types.d.ts +30 -29
- package/internal/hardhat-network/provider/node-types.d.ts.map +1 -1
- package/internal/hardhat-network/provider/node.d.ts +47 -42
- package/internal/hardhat-network/provider/node.d.ts.map +1 -1
- package/internal/hardhat-network/provider/node.js +262 -208
- package/internal/hardhat-network/provider/node.js.map +1 -1
- package/internal/hardhat-network/provider/output.d.ts +5 -6
- package/internal/hardhat-network/provider/output.d.ts.map +1 -1
- package/internal/hardhat-network/provider/output.js +39 -36
- package/internal/hardhat-network/provider/output.js.map +1 -1
- package/internal/hardhat-network/provider/provider.d.ts +1 -2
- package/internal/hardhat-network/provider/provider.d.ts.map +1 -1
- package/internal/hardhat-network/provider/provider.js.map +1 -1
- package/internal/hardhat-network/provider/return-data.d.ts +2 -2
- package/internal/hardhat-network/provider/return-data.d.ts.map +1 -1
- package/internal/hardhat-network/provider/return-data.js +4 -1
- package/internal/hardhat-network/provider/return-data.js.map +1 -1
- package/internal/hardhat-network/provider/transactions/FakeSenderAccessListEIP2930Transaction.d.ts +5 -5
- package/internal/hardhat-network/provider/transactions/FakeSenderAccessListEIP2930Transaction.d.ts.map +1 -1
- package/internal/hardhat-network/provider/transactions/FakeSenderAccessListEIP2930Transaction.js +60 -17
- package/internal/hardhat-network/provider/transactions/FakeSenderAccessListEIP2930Transaction.js.map +1 -1
- package/internal/hardhat-network/provider/transactions/FakeSenderEIP1559Transaction.d.ts +4 -4
- package/internal/hardhat-network/provider/transactions/FakeSenderEIP1559Transaction.d.ts.map +1 -1
- package/internal/hardhat-network/provider/transactions/FakeSenderEIP1559Transaction.js +59 -16
- package/internal/hardhat-network/provider/transactions/FakeSenderEIP1559Transaction.js.map +1 -1
- package/internal/hardhat-network/provider/transactions/FakeSenderTransaction.d.ts +3 -3
- package/internal/hardhat-network/provider/transactions/FakeSenderTransaction.d.ts.map +1 -1
- package/internal/hardhat-network/provider/transactions/FakeSenderTransaction.js +41 -9
- package/internal/hardhat-network/provider/transactions/FakeSenderTransaction.js.map +1 -1
- package/internal/hardhat-network/provider/transactions/ReadOnlyValidEIP1559Transaction.d.ts +4 -4
- package/internal/hardhat-network/provider/transactions/ReadOnlyValidEIP1559Transaction.d.ts.map +1 -1
- package/internal/hardhat-network/provider/transactions/ReadOnlyValidEIP1559Transaction.js +7 -23
- package/internal/hardhat-network/provider/transactions/ReadOnlyValidEIP1559Transaction.js.map +1 -1
- package/internal/hardhat-network/provider/transactions/ReadOnlyValidEIP2930Transaction.d.ts +3 -3
- package/internal/hardhat-network/provider/transactions/ReadOnlyValidEIP2930Transaction.d.ts.map +1 -1
- package/internal/hardhat-network/provider/transactions/ReadOnlyValidEIP2930Transaction.js +7 -22
- package/internal/hardhat-network/provider/transactions/ReadOnlyValidEIP2930Transaction.js.map +1 -1
- package/internal/hardhat-network/provider/transactions/ReadOnlyValidTransaction.d.ts +3 -3
- package/internal/hardhat-network/provider/transactions/ReadOnlyValidTransaction.d.ts.map +1 -1
- package/internal/hardhat-network/provider/transactions/ReadOnlyValidTransaction.js +1 -1
- package/internal/hardhat-network/provider/transactions/ReadOnlyValidTransaction.js.map +1 -1
- package/internal/hardhat-network/provider/types/HardhatBlockchainInterface.d.ts +5 -6
- package/internal/hardhat-network/provider/types/HardhatBlockchainInterface.d.ts.map +1 -1
- package/internal/hardhat-network/provider/utils/fork-recomendations-banner.js +2 -3
- package/internal/hardhat-network/provider/utils/fork-recomendations-banner.js.map +1 -1
- package/internal/hardhat-network/provider/utils/getCurrentTimestamp.d.ts +1 -0
- package/internal/hardhat-network/provider/utils/getCurrentTimestamp.d.ts.map +1 -1
- package/internal/hardhat-network/provider/utils/getCurrentTimestamp.js +5 -1
- package/internal/hardhat-network/provider/utils/getCurrentTimestamp.js.map +1 -1
- package/internal/hardhat-network/provider/utils/makeAccount.d.ts +1 -1
- package/internal/hardhat-network/provider/utils/makeAccount.d.ts.map +1 -1
- package/internal/hardhat-network/provider/utils/makeAccount.js +6 -6
- package/internal/hardhat-network/provider/utils/makeAccount.js.map +1 -1
- package/internal/hardhat-network/provider/utils/makeCommon.d.ts +2 -2
- package/internal/hardhat-network/provider/utils/makeCommon.d.ts.map +1 -1
- package/internal/hardhat-network/provider/utils/makeCommon.js +7 -23
- package/internal/hardhat-network/provider/utils/makeCommon.js.map +1 -1
- package/internal/hardhat-network/provider/utils/makeForkClient.d.ts +1 -2
- package/internal/hardhat-network/provider/utils/makeForkClient.d.ts.map +1 -1
- package/internal/hardhat-network/provider/utils/makeForkClient.js +7 -8
- package/internal/hardhat-network/provider/utils/makeForkClient.js.map +1 -1
- package/internal/hardhat-network/provider/utils/makeStateTrie.d.ts +1 -1
- package/internal/hardhat-network/provider/utils/makeStateTrie.d.ts.map +1 -1
- package/internal/hardhat-network/provider/utils/makeStateTrie.js +4 -4
- package/internal/hardhat-network/provider/utils/makeStateTrie.js.map +1 -1
- package/internal/hardhat-network/provider/utils/putGenesisBlock.d.ts +6 -3
- package/internal/hardhat-network/provider/utils/putGenesisBlock.d.ts.map +1 -1
- package/internal/hardhat-network/provider/utils/putGenesisBlock.js +22 -4
- package/internal/hardhat-network/provider/utils/putGenesisBlock.js.map +1 -1
- package/internal/hardhat-network/provider/utils/random.d.ts +15 -0
- package/internal/hardhat-network/provider/utils/random.d.ts.map +1 -0
- package/internal/hardhat-network/provider/utils/random.js +48 -0
- package/internal/hardhat-network/provider/utils/random.js.map +1 -0
- package/internal/hardhat-network/provider/utils/reorganizeTransactionsLists.d.ts +1 -2
- package/internal/hardhat-network/provider/utils/reorganizeTransactionsLists.d.ts.map +1 -1
- package/internal/hardhat-network/provider/utils/reorganizeTransactionsLists.js +5 -4
- package/internal/hardhat-network/provider/utils/reorganizeTransactionsLists.js.map +1 -1
- package/internal/hardhat-network/provider/utils/reorgs-protection.d.ts +2 -2
- package/internal/hardhat-network/provider/utils/reorgs-protection.d.ts.map +1 -1
- package/internal/hardhat-network/provider/utils/reorgs-protection.js +7 -7
- package/internal/hardhat-network/provider/utils/reorgs-protection.js.map +1 -1
- package/internal/hardhat-network/provider/utils/txMapToArray.d.ts +1 -1
- package/internal/hardhat-network/provider/utils/txMapToArray.d.ts.map +1 -1
- package/internal/hardhat-network/stack-traces/compiler-to-model.js +6 -8
- package/internal/hardhat-network/stack-traces/compiler-to-model.js.map +1 -1
- package/internal/hardhat-network/stack-traces/consoleLogger.d.ts.map +1 -1
- package/internal/hardhat-network/stack-traces/consoleLogger.js +51 -47
- package/internal/hardhat-network/stack-traces/consoleLogger.js.map +1 -1
- package/internal/hardhat-network/stack-traces/constants.d.ts +3 -0
- package/internal/hardhat-network/stack-traces/constants.d.ts.map +1 -0
- package/internal/hardhat-network/stack-traces/constants.js +6 -0
- package/internal/hardhat-network/stack-traces/constants.js.map +1 -0
- package/internal/hardhat-network/stack-traces/contracts-identifier.js +2 -2
- package/internal/hardhat-network/stack-traces/contracts-identifier.js.map +1 -1
- package/internal/hardhat-network/stack-traces/debug.js +29 -19
- package/internal/hardhat-network/stack-traces/debug.js.map +1 -1
- package/internal/hardhat-network/stack-traces/error-inferrer.d.ts.map +1 -1
- package/internal/hardhat-network/stack-traces/error-inferrer.js +48 -26
- package/internal/hardhat-network/stack-traces/error-inferrer.js.map +1 -1
- package/internal/hardhat-network/stack-traces/logger.d.ts +223 -2
- package/internal/hardhat-network/stack-traces/logger.d.ts.map +1 -1
- package/internal/hardhat-network/stack-traces/logger.js +445 -224
- package/internal/hardhat-network/stack-traces/logger.js.map +1 -1
- package/internal/hardhat-network/stack-traces/message-trace.d.ts +6 -7
- package/internal/hardhat-network/stack-traces/message-trace.d.ts.map +1 -1
- package/internal/hardhat-network/stack-traces/message-trace.js.map +1 -1
- package/internal/hardhat-network/stack-traces/model.js +6 -6
- package/internal/hardhat-network/stack-traces/model.js.map +1 -1
- package/internal/hardhat-network/stack-traces/panic-errors.d.ts +1 -2
- package/internal/hardhat-network/stack-traces/panic-errors.d.ts.map +1 -1
- package/internal/hardhat-network/stack-traces/panic-errors.js +1 -1
- package/internal/hardhat-network/stack-traces/panic-errors.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 +21 -12
- package/internal/hardhat-network/stack-traces/solidity-errors.js.map +1 -1
- package/internal/hardhat-network/stack-traces/solidity-stack-trace.d.ts +6 -5
- package/internal/hardhat-network/stack-traces/solidity-stack-trace.d.ts.map +1 -1
- package/internal/hardhat-network/stack-traces/solidity-stack-trace.js.map +1 -1
- package/internal/hardhat-network/stack-traces/solidityTracer.d.ts +1 -1
- package/internal/hardhat-network/stack-traces/solidityTracer.d.ts.map +1 -1
- package/internal/hardhat-network/stack-traces/solidityTracer.js +5 -1
- package/internal/hardhat-network/stack-traces/solidityTracer.js.map +1 -1
- package/internal/hardhat-network/stack-traces/vm-debug-tracer.d.ts +2 -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 +79 -78
- package/internal/hardhat-network/stack-traces/vm-debug-tracer.js.map +1 -1
- package/internal/hardhat-network/stack-traces/vm-trace-decoder.js +5 -1
- package/internal/hardhat-network/stack-traces/vm-trace-decoder.js.map +1 -1
- package/internal/hardhat-network/stack-traces/vm-tracer.d.ts +3 -2
- package/internal/hardhat-network/stack-traces/vm-tracer.d.ts.map +1 -1
- package/internal/hardhat-network/stack-traces/vm-tracer.js +15 -16
- package/internal/hardhat-network/stack-traces/vm-tracer.js.map +1 -1
- package/internal/reset.js +1 -1
- package/internal/reset.js.map +1 -1
- package/internal/sentry/anonymizer.js +2 -3
- package/internal/sentry/anonymizer.js.map +1 -1
- package/internal/sentry/subprocess.js +1 -1
- package/internal/sentry/subprocess.js.map +1 -1
- package/internal/sentry/transport.js +3 -4
- package/internal/sentry/transport.js.map +1 -1
- package/internal/solidity/compilation-job.js +2 -4
- package/internal/solidity/compilation-job.js.map +1 -1
- package/internal/solidity/compiler/downloader.d.ts.map +1 -1
- package/internal/solidity/compiler/downloader.js +6 -6
- package/internal/solidity/compiler/downloader.js.map +1 -1
- package/internal/solidity/dependencyGraph.js +3 -5
- package/internal/solidity/dependencyGraph.js.map +1 -1
- package/internal/solidity/parse.js +1 -1
- package/internal/solidity/parse.js.map +1 -1
- package/internal/solidity/resolver.js +4 -1
- package/internal/solidity/resolver.js.map +1 -1
- package/internal/util/abi-helpers.js +1 -1
- package/internal/util/abi-helpers.js.map +1 -1
- package/internal/util/bigint.d.ts +25 -0
- package/internal/util/bigint.d.ts.map +1 -0
- package/internal/util/bigint.js +67 -0
- package/internal/util/bigint.js.map +1 -0
- package/internal/util/download.js +1 -1
- package/internal/util/download.js.map +1 -1
- package/internal/util/fs-utils.d.ts +32 -0
- package/internal/util/fs-utils.d.ts.map +1 -0
- package/internal/util/fs-utils.js +151 -0
- package/internal/util/fs-utils.js.map +1 -0
- package/internal/util/hardforks.d.ts +3 -3
- package/internal/util/hardforks.d.ts.map +1 -1
- package/internal/util/hardforks.js +5 -28
- package/internal/util/hardforks.js.map +1 -1
- package/internal/util/jsonrpc.js +1 -1
- package/internal/util/jsonrpc.js.map +1 -1
- package/internal/util/lazy.js +2 -2
- package/internal/util/lazy.js.map +1 -1
- package/internal/util/packageInfo.js +1 -1
- package/internal/util/packageInfo.js.map +1 -1
- package/internal/util/scripts-runner.js +5 -2
- package/internal/util/scripts-runner.js.map +1 -1
- package/internal/util/wei-values.d.ts +1 -2
- package/internal/util/wei-values.d.ts.map +1 -1
- package/internal/util/wei-values.js +9 -10
- package/internal/util/wei-values.js.map +1 -1
- package/internal/vendor/await-semaphore/index.d.ts +12 -0
- package/internal/vendor/await-semaphore/index.d.ts.map +1 -0
- package/internal/vendor/await-semaphore/index.js +64 -0
- package/internal/vendor/await-semaphore/index.js.map +1 -0
- package/package.json +13 -9
- package/profiling.d.ts +18 -0
- package/profiling.d.ts.map +1 -0
- package/profiling.js +32 -0
- package/profiling.js.map +1 -0
- package/sample-projects/javascript/scripts/deploy.js +3 -1
- package/sample-projects/javascript/test/Lock.js +1 -1
- package/sample-projects/typescript/scripts/deploy.ts +1 -1
- package/sample-projects/typescript/test/Lock.ts +1 -1
- package/src/builtin-tasks/node.ts +4 -6
- package/src/internal/constants.ts +3 -1
- package/src/internal/core/config/config-resolution.ts +30 -7
- package/src/internal/core/config/default-config.ts +12 -4
- package/src/internal/core/jsonrpc/types/base-types.ts +23 -24
- package/src/internal/core/jsonrpc/types/input/blockTag.ts +2 -4
- package/src/internal/core/jsonrpc/types/input/callRequest.ts +0 -4
- package/src/internal/core/jsonrpc/types/input/filterRequest.ts +0 -4
- package/src/internal/core/jsonrpc/types/input/transactionRequest.ts +0 -4
- package/src/internal/core/jsonrpc/types/output/block.ts +0 -4
- package/src/internal/core/jsonrpc/types/output/log.ts +0 -4
- package/src/internal/core/jsonrpc/types/output/receipt.ts +0 -4
- package/src/internal/core/jsonrpc/types/output/transaction.ts +0 -4
- package/src/internal/core/providers/accounts.ts +16 -26
- package/src/internal/core/providers/construction.ts +5 -3
- package/src/internal/core/providers/gas-providers.ts +25 -33
- package/src/internal/core/providers/util.ts +1 -1
- package/src/internal/hardhat-network/jsonrpc/client.ts +22 -22
- package/src/internal/hardhat-network/provider/BlockchainBase.ts +62 -25
- package/src/internal/hardhat-network/provider/BlockchainData.ts +39 -42
- package/src/internal/hardhat-network/provider/HardhatBlockchain.ts +21 -21
- package/src/internal/hardhat-network/provider/PoolState.ts +3 -4
- package/src/internal/hardhat-network/provider/TransactionQueue.ts +11 -8
- package/src/internal/hardhat-network/provider/TxPool.ts +62 -64
- package/src/internal/hardhat-network/provider/ethereumjs-workarounds.ts +3 -3
- package/src/internal/hardhat-network/provider/filter.ts +9 -12
- package/src/internal/hardhat-network/provider/fork/ForkBlockchain.ts +52 -50
- package/src/internal/hardhat-network/provider/fork/ForkStateManager.ts +35 -60
- package/src/internal/hardhat-network/provider/fork/rpcToBlockData.ts +2 -2
- package/src/internal/hardhat-network/provider/fork/rpcToTxData.ts +3 -3
- package/src/internal/hardhat-network/provider/modules/eth.ts +88 -63
- package/src/internal/hardhat-network/provider/modules/evm.ts +19 -22
- package/src/internal/hardhat-network/provider/modules/hardhat.ts +21 -19
- package/src/internal/hardhat-network/provider/modules/logger.ts +33 -40
- package/src/internal/hardhat-network/provider/modules/net.ts +1 -1
- package/src/internal/hardhat-network/provider/modules/personal.ts +2 -1
- package/src/internal/hardhat-network/provider/modules/web3.ts +5 -4
- package/src/internal/hardhat-network/provider/node-types.ts +32 -31
- package/src/internal/hardhat-network/provider/node.ts +379 -343
- package/src/internal/hardhat-network/provider/output.ts +32 -37
- package/src/internal/hardhat-network/provider/provider.ts +5 -6
- package/src/internal/hardhat-network/provider/return-data.ts +6 -3
- package/src/internal/hardhat-network/provider/transactions/FakeSenderAccessListEIP2930Transaction.ts +51 -24
- package/src/internal/hardhat-network/provider/transactions/FakeSenderEIP1559Transaction.ts +50 -23
- package/src/internal/hardhat-network/provider/transactions/FakeSenderTransaction.ts +29 -11
- package/src/internal/hardhat-network/provider/transactions/ReadOnlyValidEIP1559Transaction.ts +12 -24
- package/src/internal/hardhat-network/provider/transactions/ReadOnlyValidEIP2930Transaction.ts +11 -22
- package/src/internal/hardhat-network/provider/transactions/ReadOnlyValidTransaction.ts +3 -3
- package/src/internal/hardhat-network/provider/types/HardhatBlockchainInterface.ts +8 -9
- package/src/internal/hardhat-network/provider/utils/getCurrentTimestamp.ts +4 -0
- package/src/internal/hardhat-network/provider/utils/makeAccount.ts +4 -10
- package/src/internal/hardhat-network/provider/utils/makeCommon.ts +8 -34
- package/src/internal/hardhat-network/provider/utils/makeForkClient.ts +8 -9
- package/src/internal/hardhat-network/provider/utils/makeStateTrie.ts +3 -3
- package/src/internal/hardhat-network/provider/utils/putGenesisBlock.ts +34 -6
- package/src/internal/hardhat-network/provider/utils/random.ts +54 -0
- package/src/internal/hardhat-network/provider/utils/reorganizeTransactionsLists.ts +6 -7
- package/src/internal/hardhat-network/provider/utils/reorgs-protection.ts +8 -8
- package/src/internal/hardhat-network/stack-traces/consoleLogger.ts +16 -6
- package/src/internal/hardhat-network/stack-traces/contracts-identifier.ts +1 -1
- package/src/internal/hardhat-network/stack-traces/debug.ts +1 -1
- package/src/internal/hardhat-network/stack-traces/error-inferrer.ts +11 -7
- package/src/internal/hardhat-network/stack-traces/logger.ts +444 -223
- package/src/internal/hardhat-network/stack-traces/message-trace.ts +6 -7
- package/src/internal/hardhat-network/stack-traces/model.ts +1 -1
- package/src/internal/hardhat-network/stack-traces/panic-errors.ts +3 -5
- package/src/internal/hardhat-network/stack-traces/solidity-errors.ts +16 -1
- package/src/internal/hardhat-network/stack-traces/solidity-stack-trace.ts +6 -6
- package/src/internal/hardhat-network/stack-traces/solidityTracer.ts +6 -1
- package/src/internal/hardhat-network/stack-traces/vm-debug-tracer.ts +106 -103
- package/src/internal/hardhat-network/stack-traces/vm-tracer.ts +23 -18
- package/src/internal/solidity/compiler/downloader.ts +5 -2
- package/src/internal/util/bigint.ts +84 -0
- package/src/internal/util/hardforks.ts +4 -29
- package/src/internal/util/wei-values.ts +11 -13
- package/src/types/config.ts +8 -10
- package/types/config.d.ts +8 -9
- package/types/config.d.ts.map +1 -1
- package/src/internal/hardhat-network/provider/fork/random.ts +0 -33
- package/src/internal/hardhat-network/provider/utils/bnToHex.ts +0 -5
- package/src/internal/hardhat-network/provider/utils/makeForkCommon.ts +0 -15
|
@@ -1,18 +1,13 @@
|
|
|
1
|
-
import { Block } from "@
|
|
2
|
-
import Common from "@
|
|
3
|
-
import {
|
|
4
|
-
Transaction,
|
|
5
|
-
TransactionFactory,
|
|
6
|
-
TypedTransaction,
|
|
7
|
-
} from "@ethereumjs/tx";
|
|
1
|
+
import { Block } from "@ignored/block";
|
|
2
|
+
import { Common } from "@ignored/common";
|
|
3
|
+
import { Transaction, TransactionFactory, TypedTransaction } from "@ignored/tx";
|
|
8
4
|
import {
|
|
9
5
|
Address,
|
|
10
|
-
BN,
|
|
11
6
|
bufferToHex,
|
|
12
7
|
toBuffer,
|
|
13
8
|
toRpcSig,
|
|
14
9
|
zeroAddress,
|
|
15
|
-
} from "
|
|
10
|
+
} from "@ignored/util";
|
|
16
11
|
import * as t from "io-ts";
|
|
17
12
|
import cloneDeep from "lodash/cloneDeep";
|
|
18
13
|
|
|
@@ -86,6 +81,7 @@ import {
|
|
|
86
81
|
|
|
87
82
|
import { assertHardhatNetworkInvariant } from "../utils/assertions";
|
|
88
83
|
import { optional } from "../../../util/io-ts";
|
|
84
|
+
import { BigIntUtils } from "../../../util/bigint";
|
|
89
85
|
import { ModulesLogger } from "./logger";
|
|
90
86
|
|
|
91
87
|
const EIP1559_MIN_HARDFORK = "london";
|
|
@@ -522,7 +518,7 @@ export class EthModule {
|
|
|
522
518
|
}
|
|
523
519
|
|
|
524
520
|
let block: Block | undefined;
|
|
525
|
-
let totalDifficulty:
|
|
521
|
+
let totalDifficulty: bigint | undefined;
|
|
526
522
|
|
|
527
523
|
if (numberOrPending === "pending") {
|
|
528
524
|
[block, totalDifficulty] =
|
|
@@ -607,12 +603,12 @@ export class EthModule {
|
|
|
607
603
|
|
|
608
604
|
// eth_getFilterChanges
|
|
609
605
|
|
|
610
|
-
private _getFilterChangesParams(params: any[]): [
|
|
606
|
+
private _getFilterChangesParams(params: any[]): [bigint] {
|
|
611
607
|
return validateParams(params, rpcQuantity);
|
|
612
608
|
}
|
|
613
609
|
|
|
614
610
|
private async _getFilterChangesAction(
|
|
615
|
-
filterId:
|
|
611
|
+
filterId: bigint
|
|
616
612
|
): Promise<string[] | RpcLogOutput[] | null> {
|
|
617
613
|
const changes = await this._node.getFilterChanges(filterId);
|
|
618
614
|
if (changes === undefined) {
|
|
@@ -624,12 +620,12 @@ export class EthModule {
|
|
|
624
620
|
|
|
625
621
|
// eth_getFilterLogs
|
|
626
622
|
|
|
627
|
-
private _getFilterLogsParams(params: any[]): [
|
|
623
|
+
private _getFilterLogsParams(params: any[]): [bigint] {
|
|
628
624
|
return validateParams(params, rpcQuantity);
|
|
629
625
|
}
|
|
630
626
|
|
|
631
627
|
private async _getFilterLogsAction(
|
|
632
|
-
filterId:
|
|
628
|
+
filterId: bigint
|
|
633
629
|
): Promise<RpcLogOutput[] | null> {
|
|
634
630
|
const changes = await this._node.getFilterLogs(filterId);
|
|
635
631
|
if (changes === undefined) {
|
|
@@ -691,7 +687,7 @@ export class EthModule {
|
|
|
691
687
|
|
|
692
688
|
private _getStorageAtParams(
|
|
693
689
|
params: any[]
|
|
694
|
-
): [Buffer,
|
|
690
|
+
): [Buffer, bigint, OptionalRpcNewBlockTag] {
|
|
695
691
|
return validateParams(
|
|
696
692
|
params,
|
|
697
693
|
rpcAddress,
|
|
@@ -702,7 +698,7 @@ export class EthModule {
|
|
|
702
698
|
|
|
703
699
|
private async _getStorageAtAction(
|
|
704
700
|
address: Buffer,
|
|
705
|
-
slot:
|
|
701
|
+
slot: bigint,
|
|
706
702
|
blockTag: OptionalRpcNewBlockTag
|
|
707
703
|
): Promise<string> {
|
|
708
704
|
const blockNumberOrPending = await this._resolveNewBlockTag(blockTag);
|
|
@@ -720,15 +716,15 @@ export class EthModule {
|
|
|
720
716
|
|
|
721
717
|
private _getTransactionByBlockHashAndIndexParams(
|
|
722
718
|
params: any[]
|
|
723
|
-
): [Buffer,
|
|
719
|
+
): [Buffer, bigint] {
|
|
724
720
|
return validateParams(params, rpcHash, rpcQuantity);
|
|
725
721
|
}
|
|
726
722
|
|
|
727
723
|
private async _getTransactionByBlockHashAndIndexAction(
|
|
728
724
|
hash: Buffer,
|
|
729
|
-
index:
|
|
725
|
+
index: bigint
|
|
730
726
|
): Promise<RpcTransactionOutput | null> {
|
|
731
|
-
const i = index
|
|
727
|
+
const i = Number(index);
|
|
732
728
|
const block = await this._node.getBlockByHash(hash);
|
|
733
729
|
if (block === undefined) {
|
|
734
730
|
return null;
|
|
@@ -751,13 +747,13 @@ export class EthModule {
|
|
|
751
747
|
|
|
752
748
|
private _getTransactionByBlockNumberAndIndexParams(
|
|
753
749
|
params: any[]
|
|
754
|
-
): [RpcOldBlockTag,
|
|
750
|
+
): [RpcOldBlockTag, bigint] {
|
|
755
751
|
return validateParams(params, rpcOldBlockTag, rpcQuantity);
|
|
756
752
|
}
|
|
757
753
|
|
|
758
754
|
private async _getTransactionByBlockNumberAndIndexAction(
|
|
759
755
|
oldBlockTag: RpcOldBlockTag,
|
|
760
|
-
index:
|
|
756
|
+
index: bigint
|
|
761
757
|
): Promise<RpcTransactionOutput | null> {
|
|
762
758
|
const numberOrPending = await this._resolveOldBlockTag(oldBlockTag);
|
|
763
759
|
if (numberOrPending === undefined) {
|
|
@@ -765,7 +761,7 @@ export class EthModule {
|
|
|
765
761
|
}
|
|
766
762
|
|
|
767
763
|
const block = await this._node.getBlockByNumber(numberOrPending);
|
|
768
|
-
const i = index
|
|
764
|
+
const i = Number(index);
|
|
769
765
|
|
|
770
766
|
if (block === undefined) {
|
|
771
767
|
return null;
|
|
@@ -986,7 +982,7 @@ export class EthModule {
|
|
|
986
982
|
}
|
|
987
983
|
|
|
988
984
|
if (error.message.includes("The chain ID does not match")) {
|
|
989
|
-
const chainId = this._common.
|
|
985
|
+
const chainId = this._common.chainId();
|
|
990
986
|
throw new InvalidArgumentsError(
|
|
991
987
|
`Trying to send a raw transaction with an invalid chainId. The expected chainId is ${chainId}`,
|
|
992
988
|
error
|
|
@@ -1017,10 +1013,10 @@ export class EthModule {
|
|
|
1017
1013
|
private async _sendTransactionAction(
|
|
1018
1014
|
transactionRequest: RpcTransactionRequest
|
|
1019
1015
|
): Promise<string> {
|
|
1020
|
-
const expectedChainId = this._common.
|
|
1016
|
+
const expectedChainId = this._common.chainId();
|
|
1021
1017
|
if (
|
|
1022
1018
|
transactionRequest.chainId !== undefined &&
|
|
1023
|
-
|
|
1019
|
+
transactionRequest.chainId !== expectedChainId
|
|
1024
1020
|
) {
|
|
1025
1021
|
throw new InvalidArgumentsError(
|
|
1026
1022
|
`Invalid chainId ${transactionRequest.chainId.toString()} provided, expected ${expectedChainId.toString()} instead.`
|
|
@@ -1143,21 +1139,21 @@ export class EthModule {
|
|
|
1143
1139
|
|
|
1144
1140
|
// eth_uninstallFilter
|
|
1145
1141
|
|
|
1146
|
-
private _uninstallFilterParams(params: any): [
|
|
1142
|
+
private _uninstallFilterParams(params: any): [bigint] {
|
|
1147
1143
|
return validateParams(params, rpcQuantity);
|
|
1148
1144
|
}
|
|
1149
1145
|
|
|
1150
|
-
private async _uninstallFilterAction(filterId:
|
|
1146
|
+
private async _uninstallFilterAction(filterId: bigint): Promise<boolean> {
|
|
1151
1147
|
return this._node.uninstallFilter(filterId, false);
|
|
1152
1148
|
}
|
|
1153
1149
|
|
|
1154
1150
|
// eth_unsubscribe
|
|
1155
1151
|
|
|
1156
|
-
private _unsubscribeParams(params: any[]): [
|
|
1152
|
+
private _unsubscribeParams(params: any[]): [bigint] {
|
|
1157
1153
|
return validateParams(params, rpcQuantity);
|
|
1158
1154
|
}
|
|
1159
1155
|
|
|
1160
|
-
private async _unsubscribeAction(filterId:
|
|
1156
|
+
private async _unsubscribeAction(filterId: bigint): Promise<boolean> {
|
|
1161
1157
|
return this._node.uninstallFilter(filterId, true);
|
|
1162
1158
|
}
|
|
1163
1159
|
|
|
@@ -1165,7 +1161,7 @@ export class EthModule {
|
|
|
1165
1161
|
|
|
1166
1162
|
private _feeHistoryParams(
|
|
1167
1163
|
params: any[]
|
|
1168
|
-
): [
|
|
1164
|
+
): [bigint, RpcNewBlockTag, number[] | undefined] {
|
|
1169
1165
|
const [blockCount, newestBlock, rewardPercentiles] = validateParams(
|
|
1170
1166
|
params,
|
|
1171
1167
|
rpcQuantity,
|
|
@@ -1173,11 +1169,11 @@ export class EthModule {
|
|
|
1173
1169
|
optional(t.array(rpcFloat))
|
|
1174
1170
|
);
|
|
1175
1171
|
|
|
1176
|
-
if (blockCount
|
|
1172
|
+
if (blockCount < 1n) {
|
|
1177
1173
|
throw new InvalidInputError(`blockCount should be at least 1`);
|
|
1178
1174
|
}
|
|
1179
1175
|
|
|
1180
|
-
if (blockCount
|
|
1176
|
+
if (blockCount > 1024n) {
|
|
1181
1177
|
throw new InvalidInputError(`blockCount should be at most 1024`);
|
|
1182
1178
|
}
|
|
1183
1179
|
|
|
@@ -1206,7 +1202,7 @@ export class EthModule {
|
|
|
1206
1202
|
}
|
|
1207
1203
|
|
|
1208
1204
|
private async _feeHistoryAction(
|
|
1209
|
-
blockCount:
|
|
1205
|
+
blockCount: bigint,
|
|
1210
1206
|
newestBlock: RpcNewBlockTag,
|
|
1211
1207
|
rewardPercentiles?: number[]
|
|
1212
1208
|
) {
|
|
@@ -1251,7 +1247,7 @@ export class EthModule {
|
|
|
1251
1247
|
data: rpcCall.data !== undefined ? rpcCall.data : toBuffer([]),
|
|
1252
1248
|
gasLimit:
|
|
1253
1249
|
rpcCall.gas !== undefined ? rpcCall.gas : this._node.getBlockGasLimit(),
|
|
1254
|
-
value: rpcCall.value !== undefined ? rpcCall.value :
|
|
1250
|
+
value: rpcCall.value !== undefined ? rpcCall.value : 0n,
|
|
1255
1251
|
accessList:
|
|
1256
1252
|
rpcCall.accessList !== undefined
|
|
1257
1253
|
? this._rpcAccessListToNodeAccessList(rpcCall.accessList)
|
|
@@ -1270,7 +1266,7 @@ export class EthModule {
|
|
|
1270
1266
|
from: rpcTx.from,
|
|
1271
1267
|
gasLimit:
|
|
1272
1268
|
rpcTx.gas !== undefined ? rpcTx.gas : this._node.getBlockGasLimit(),
|
|
1273
|
-
value: rpcTx.value !== undefined ? rpcTx.value :
|
|
1269
|
+
value: rpcTx.value !== undefined ? rpcTx.value : 0n,
|
|
1274
1270
|
data: rpcTx.data !== undefined ? rpcTx.data : toBuffer([]),
|
|
1275
1271
|
nonce:
|
|
1276
1272
|
rpcTx.nonce !== undefined
|
|
@@ -1298,7 +1294,7 @@ export class EthModule {
|
|
|
1298
1294
|
// than that, we adjust the tip to make the tx valid
|
|
1299
1295
|
if (
|
|
1300
1296
|
rpcTx.maxFeePerGas !== undefined &&
|
|
1301
|
-
rpcTx.maxFeePerGas
|
|
1297
|
+
rpcTx.maxFeePerGas < rpcTx.maxPriorityFeePerGas
|
|
1302
1298
|
) {
|
|
1303
1299
|
rpcTx.maxPriorityFeePerGas = rpcTx.maxFeePerGas;
|
|
1304
1300
|
}
|
|
@@ -1312,9 +1308,7 @@ export class EthModule {
|
|
|
1312
1308
|
"EIP-1559 transactions should only be sent if the next block has baseFeePerGas"
|
|
1313
1309
|
);
|
|
1314
1310
|
|
|
1315
|
-
rpcTx.maxFeePerGas = baseFeePerGas
|
|
1316
|
-
.muln(2)
|
|
1317
|
-
.add(rpcTx.maxPriorityFeePerGas);
|
|
1311
|
+
rpcTx.maxFeePerGas = 2n * baseFeePerGas + rpcTx.maxPriorityFeePerGas;
|
|
1318
1312
|
}
|
|
1319
1313
|
|
|
1320
1314
|
return {
|
|
@@ -1354,7 +1348,7 @@ export class EthModule {
|
|
|
1354
1348
|
|
|
1355
1349
|
private async _resolveOldBlockTag(
|
|
1356
1350
|
oldBlockTag: RpcOldBlockTag
|
|
1357
|
-
): Promise<
|
|
1351
|
+
): Promise<bigint | "pending" | undefined> {
|
|
1358
1352
|
if (oldBlockTag === undefined || oldBlockTag === "latest") {
|
|
1359
1353
|
return this._node.getLatestBlockNumber();
|
|
1360
1354
|
}
|
|
@@ -1364,7 +1358,13 @@ export class EthModule {
|
|
|
1364
1358
|
}
|
|
1365
1359
|
|
|
1366
1360
|
if (oldBlockTag === "earliest") {
|
|
1367
|
-
return
|
|
1361
|
+
return 0n;
|
|
1362
|
+
}
|
|
1363
|
+
|
|
1364
|
+
if (oldBlockTag === "safe" || oldBlockTag === "finalized") {
|
|
1365
|
+
this._checkPostMergeBlockTags(oldBlockTag);
|
|
1366
|
+
|
|
1367
|
+
return this._node.getLatestBlockNumber();
|
|
1368
1368
|
}
|
|
1369
1369
|
|
|
1370
1370
|
const block = await this._node.getBlockByNumber(oldBlockTag);
|
|
@@ -1374,7 +1374,7 @@ export class EthModule {
|
|
|
1374
1374
|
private async _resolveNewBlockTag(
|
|
1375
1375
|
newBlockTag: OptionalRpcNewBlockTag,
|
|
1376
1376
|
defaultValue: RpcNewBlockTag = "latest"
|
|
1377
|
-
): Promise<
|
|
1377
|
+
): Promise<bigint | "pending"> {
|
|
1378
1378
|
if (newBlockTag === undefined) {
|
|
1379
1379
|
newBlockTag = defaultValue;
|
|
1380
1380
|
}
|
|
@@ -1388,23 +1388,31 @@ export class EthModule {
|
|
|
1388
1388
|
}
|
|
1389
1389
|
|
|
1390
1390
|
if (newBlockTag === "earliest") {
|
|
1391
|
-
return
|
|
1391
|
+
return 0n;
|
|
1392
1392
|
}
|
|
1393
1393
|
|
|
1394
|
-
if ("
|
|
1395
|
-
|
|
1396
|
-
|
|
1397
|
-
);
|
|
1394
|
+
if (newBlockTag === "safe" || newBlockTag === "finalized") {
|
|
1395
|
+
this._checkPostMergeBlockTags(newBlockTag);
|
|
1396
|
+
|
|
1397
|
+
return this._node.getLatestBlockNumber();
|
|
1398
1398
|
}
|
|
1399
1399
|
|
|
1400
|
-
if (
|
|
1401
|
-
|
|
1402
|
-
|
|
1403
|
-
|
|
1400
|
+
if (!BigIntUtils.isBigInt(newBlockTag)) {
|
|
1401
|
+
if ("blockNumber" in newBlockTag && "blockHash" in newBlockTag) {
|
|
1402
|
+
throw new InvalidArgumentsError(
|
|
1403
|
+
"Invalid block tag received. Only one of hash or block number can be used."
|
|
1404
|
+
);
|
|
1405
|
+
}
|
|
1406
|
+
|
|
1407
|
+
if ("blockNumber" in newBlockTag && "requireCanonical" in newBlockTag) {
|
|
1408
|
+
throw new InvalidArgumentsError(
|
|
1409
|
+
"Invalid block tag received. requireCanonical only works with hashes."
|
|
1410
|
+
);
|
|
1411
|
+
}
|
|
1404
1412
|
}
|
|
1405
1413
|
|
|
1406
1414
|
let block: Block | undefined;
|
|
1407
|
-
if (
|
|
1415
|
+
if (BigIntUtils.isBigInt(newBlockTag)) {
|
|
1408
1416
|
block = await this._node.getBlockByNumber(newBlockTag);
|
|
1409
1417
|
} else if ("blockNumber" in newBlockTag) {
|
|
1410
1418
|
block = await this._node.getBlockByNumber(newBlockTag.blockNumber);
|
|
@@ -1427,7 +1435,7 @@ export class EthModule {
|
|
|
1427
1435
|
|
|
1428
1436
|
private async _normalizeOldBlockTagForFilterRequest(
|
|
1429
1437
|
blockTag: OptionalRpcOldBlockTag
|
|
1430
|
-
): Promise<
|
|
1438
|
+
): Promise<bigint> {
|
|
1431
1439
|
if (
|
|
1432
1440
|
blockTag === undefined ||
|
|
1433
1441
|
blockTag === "latest" ||
|
|
@@ -1436,8 +1444,14 @@ export class EthModule {
|
|
|
1436
1444
|
return LATEST_BLOCK;
|
|
1437
1445
|
}
|
|
1438
1446
|
|
|
1447
|
+
if (blockTag === "safe" || blockTag === "finalized") {
|
|
1448
|
+
this._checkPostMergeBlockTags(blockTag);
|
|
1449
|
+
|
|
1450
|
+
return LATEST_BLOCK;
|
|
1451
|
+
}
|
|
1452
|
+
|
|
1439
1453
|
if (blockTag === "earliest") {
|
|
1440
|
-
return
|
|
1454
|
+
return 0n;
|
|
1441
1455
|
}
|
|
1442
1456
|
|
|
1443
1457
|
return blockTag;
|
|
@@ -1448,7 +1462,7 @@ export class EthModule {
|
|
|
1448
1462
|
return tag;
|
|
1449
1463
|
}
|
|
1450
1464
|
|
|
1451
|
-
if (
|
|
1465
|
+
if (BigIntUtils.isBigInt(tag)) {
|
|
1452
1466
|
return tag.toString();
|
|
1453
1467
|
}
|
|
1454
1468
|
|
|
@@ -1548,7 +1562,7 @@ export class EthModule {
|
|
|
1548
1562
|
if (singleTransactionMined) {
|
|
1549
1563
|
const block = results[0].block;
|
|
1550
1564
|
const tx = block.transactions[0];
|
|
1551
|
-
const txGasUsed = results[0].blockResult.results[0].
|
|
1565
|
+
const txGasUsed = results[0].blockResult.results[0].totalGasSpent;
|
|
1552
1566
|
const trace = results[0].traces[0];
|
|
1553
1567
|
await this._logSingleTransaction(tx, block, txGasUsed, trace);
|
|
1554
1568
|
|
|
@@ -1570,11 +1584,11 @@ export class EthModule {
|
|
|
1570
1584
|
const blockNumber = sentTxResult.block.header.number;
|
|
1571
1585
|
const code = await this._node.getCodeFromTrace(
|
|
1572
1586
|
sentTxTrace.trace,
|
|
1573
|
-
|
|
1587
|
+
blockNumber
|
|
1574
1588
|
);
|
|
1575
1589
|
|
|
1576
1590
|
const { block, blockResult } = sentTxResult;
|
|
1577
|
-
const gasUsed = blockResult.results[sentTxIndex].
|
|
1591
|
+
const gasUsed = blockResult.results[sentTxIndex].totalGasSpent;
|
|
1578
1592
|
this._logger.logCurrentlySentTransaction(
|
|
1579
1593
|
sentTx,
|
|
1580
1594
|
gasUsed,
|
|
@@ -1591,12 +1605,12 @@ export class EthModule {
|
|
|
1591
1605
|
private async _logSingleTransaction(
|
|
1592
1606
|
tx: TypedTransaction,
|
|
1593
1607
|
block: Block,
|
|
1594
|
-
txGasUsed:
|
|
1608
|
+
txGasUsed: bigint,
|
|
1595
1609
|
txTrace: GatherTracesResult
|
|
1596
1610
|
) {
|
|
1597
1611
|
const code = await this._node.getCodeFromTrace(
|
|
1598
1612
|
txTrace.trace,
|
|
1599
|
-
|
|
1613
|
+
block.header.number
|
|
1600
1614
|
);
|
|
1601
1615
|
this._logger.logSingleTransaction(tx, block, txGasUsed, txTrace, code);
|
|
1602
1616
|
|
|
@@ -1610,7 +1624,7 @@ export class EthModule {
|
|
|
1610
1624
|
for (const txTrace of traces) {
|
|
1611
1625
|
const code = await this._node.getCodeFromTrace(
|
|
1612
1626
|
txTrace.trace,
|
|
1613
|
-
|
|
1627
|
+
block.header.number
|
|
1614
1628
|
);
|
|
1615
1629
|
|
|
1616
1630
|
codes.push(code);
|
|
@@ -1702,7 +1716,7 @@ You can use them by running Hardhat Network with 'hardfork' ${ACCESS_LIST_MIN_HA
|
|
|
1702
1716
|
if (
|
|
1703
1717
|
rpcRequest.maxFeePerGas !== undefined &&
|
|
1704
1718
|
rpcRequest.maxPriorityFeePerGas !== undefined &&
|
|
1705
|
-
rpcRequest.maxPriorityFeePerGas
|
|
1719
|
+
rpcRequest.maxPriorityFeePerGas > rpcRequest.maxFeePerGas
|
|
1706
1720
|
) {
|
|
1707
1721
|
throw new InvalidInputError(
|
|
1708
1722
|
`maxPriorityFeePerGas (${rpcRequest.maxPriorityFeePerGas.toString()}) is bigger than maxFeePerGas (${rpcRequest.maxFeePerGas.toString()})`
|
|
@@ -1713,7 +1727,7 @@ You can use them by running Hardhat Network with 'hardfork' ${ACCESS_LIST_MIN_HA
|
|
|
1713
1727
|
// TODO: Find a better place for this
|
|
1714
1728
|
private _validateEip155HardforkRequirement(tx: Transaction) {
|
|
1715
1729
|
// 27 and 28 are only valid for non-EIP-155 legacy txs
|
|
1716
|
-
if (tx.v
|
|
1730
|
+
if (tx.v === 27n || tx.v === 28n) {
|
|
1717
1731
|
return;
|
|
1718
1732
|
}
|
|
1719
1733
|
|
|
@@ -1747,4 +1761,15 @@ You can use them by running Hardhat Network with 'hardfork' ${EIP1559_MIN_HARDFO
|
|
|
1747
1761
|
);
|
|
1748
1762
|
}
|
|
1749
1763
|
}
|
|
1764
|
+
|
|
1765
|
+
private _checkPostMergeBlockTags(blockTag: "safe" | "finalized") {
|
|
1766
|
+
const isPostMerge = this._node.isPostMergeHardfork();
|
|
1767
|
+
const hardfork = this._node.hardfork;
|
|
1768
|
+
|
|
1769
|
+
if (!isPostMerge) {
|
|
1770
|
+
throw new InvalidArgumentsError(
|
|
1771
|
+
`The '${blockTag}' block tag is not allowed in pre-merge hardforks. You are using the '${hardfork}' hardfork.`
|
|
1772
|
+
);
|
|
1773
|
+
}
|
|
1774
|
+
}
|
|
1750
1775
|
}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { BN } from "ethereumjs-util";
|
|
2
1
|
import * as t from "io-ts";
|
|
3
2
|
|
|
4
3
|
import { BoundExperimentalHardhatNetworkMessageTraceHook } from "../../../../types";
|
|
@@ -85,16 +84,15 @@ export class EvmModule {
|
|
|
85
84
|
timestamp: RpcQuantityOrNumber
|
|
86
85
|
): Promise<string> {
|
|
87
86
|
const latestBlock = await this._node.getLatestBlock();
|
|
88
|
-
const increment =
|
|
89
|
-
|
|
90
|
-
)
|
|
91
|
-
if (increment.lte(new BN(0))) {
|
|
87
|
+
const increment = BigInt(timestamp) - latestBlock.header.timestamp;
|
|
88
|
+
|
|
89
|
+
if (increment <= 0n) {
|
|
92
90
|
throw new InvalidInputError(
|
|
93
91
|
`Timestamp ${timestamp.toString()} is lower than or equal to previous block's timestamp` +
|
|
94
|
-
` ${
|
|
92
|
+
` ${latestBlock.header.timestamp}`
|
|
95
93
|
);
|
|
96
94
|
}
|
|
97
|
-
this._node.setNextBlockTimestamp(
|
|
95
|
+
this._node.setNextBlockTimestamp(BigInt(timestamp));
|
|
98
96
|
return timestamp.toString();
|
|
99
97
|
}
|
|
100
98
|
|
|
@@ -107,7 +105,7 @@ export class EvmModule {
|
|
|
107
105
|
private async _increaseTimeAction(
|
|
108
106
|
increment: RpcQuantityOrNumber
|
|
109
107
|
): Promise<string> {
|
|
110
|
-
this._node.increaseTime(
|
|
108
|
+
this._node.increaseTime(BigInt(increment));
|
|
111
109
|
const totalIncrement = this._node.getTimeIncrement();
|
|
112
110
|
// This RPC call is an exception: it returns a number in decimal
|
|
113
111
|
return totalIncrement.toString();
|
|
@@ -123,21 +121,20 @@ export class EvmModule {
|
|
|
123
121
|
}
|
|
124
122
|
|
|
125
123
|
private async _mineAction(timestamp: RpcQuantityOrNumber): Promise<string> {
|
|
124
|
+
timestamp = BigInt(timestamp);
|
|
126
125
|
// if timestamp is specified, make sure it is bigger than previous
|
|
127
126
|
// block's timestamp
|
|
128
|
-
if (timestamp !==
|
|
127
|
+
if (timestamp !== 0n) {
|
|
129
128
|
const latestBlock = await this._node.getLatestBlock();
|
|
130
|
-
const increment =
|
|
131
|
-
|
|
132
|
-
);
|
|
133
|
-
if (increment.lte(new BN(0))) {
|
|
129
|
+
const increment = timestamp - latestBlock.header.timestamp;
|
|
130
|
+
if (increment <= 0n) {
|
|
134
131
|
throw new InvalidInputError(
|
|
135
132
|
`Timestamp ${timestamp.toString()} is lower than previous block's timestamp` +
|
|
136
|
-
` ${
|
|
133
|
+
` ${latestBlock.header.timestamp}`
|
|
137
134
|
);
|
|
138
135
|
}
|
|
139
136
|
}
|
|
140
|
-
const result = await this._node.mineBlock(
|
|
137
|
+
const result = await this._node.mineBlock(timestamp);
|
|
141
138
|
|
|
142
139
|
await this._logBlock(result);
|
|
143
140
|
|
|
@@ -146,12 +143,12 @@ export class EvmModule {
|
|
|
146
143
|
|
|
147
144
|
// evm_revert
|
|
148
145
|
|
|
149
|
-
private _revertParams(params: any[]): [
|
|
146
|
+
private _revertParams(params: any[]): [bigint] {
|
|
150
147
|
return validateParams(params, rpcQuantity);
|
|
151
148
|
}
|
|
152
149
|
|
|
153
|
-
private async _revertAction(snapshotId:
|
|
154
|
-
return this._node.revertToSnapshot(snapshotId
|
|
150
|
+
private async _revertAction(snapshotId: bigint): Promise<boolean> {
|
|
151
|
+
return this._node.revertToSnapshot(Number(snapshotId));
|
|
155
152
|
}
|
|
156
153
|
|
|
157
154
|
// evm_snapshot
|
|
@@ -192,12 +189,12 @@ export class EvmModule {
|
|
|
192
189
|
|
|
193
190
|
// evm_setBlockGasLimit
|
|
194
191
|
|
|
195
|
-
private _setBlockGasLimitParams(params: any[]): [
|
|
192
|
+
private _setBlockGasLimitParams(params: any[]): [bigint] {
|
|
196
193
|
return validateParams(params, rpcQuantity);
|
|
197
194
|
}
|
|
198
195
|
|
|
199
|
-
private async _setBlockGasLimitAction(blockGasLimit:
|
|
200
|
-
if (blockGasLimit
|
|
196
|
+
private async _setBlockGasLimitAction(blockGasLimit: bigint): Promise<true> {
|
|
197
|
+
if (blockGasLimit <= 0n) {
|
|
201
198
|
throw new InvalidInputError("Block gas limit must be greater than 0");
|
|
202
199
|
}
|
|
203
200
|
|
|
@@ -212,7 +209,7 @@ export class EvmModule {
|
|
|
212
209
|
for (const txTrace of traces) {
|
|
213
210
|
const code = await this._node.getCodeFromTrace(
|
|
214
211
|
txTrace.trace,
|
|
215
|
-
|
|
212
|
+
block.header.number
|
|
216
213
|
);
|
|
217
214
|
|
|
218
215
|
codes.push(code);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Address
|
|
1
|
+
import { Address } from "@ignored/util";
|
|
2
2
|
import * as t from "io-ts";
|
|
3
3
|
|
|
4
4
|
import {
|
|
@@ -173,7 +173,7 @@ export class HardhatModule {
|
|
|
173
173
|
|
|
174
174
|
private async _intervalMineAction(): Promise<boolean> {
|
|
175
175
|
const result = await this._node.mineBlock();
|
|
176
|
-
const blockNumber = result.block.header.number
|
|
176
|
+
const blockNumber = result.block.header.number;
|
|
177
177
|
|
|
178
178
|
const isEmpty = result.block.transactions.length === 0;
|
|
179
179
|
if (isEmpty) {
|
|
@@ -238,12 +238,12 @@ export class HardhatModule {
|
|
|
238
238
|
|
|
239
239
|
// hardhat_setMinGasPrice
|
|
240
240
|
|
|
241
|
-
private _setMinGasPriceParams(params: any[]): [
|
|
241
|
+
private _setMinGasPriceParams(params: any[]): [bigint] {
|
|
242
242
|
return validateParams(params, rpcQuantity);
|
|
243
243
|
}
|
|
244
244
|
|
|
245
|
-
private async _setMinGasPriceAction(minGasPrice:
|
|
246
|
-
if (minGasPrice
|
|
245
|
+
private async _setMinGasPriceAction(minGasPrice: bigint): Promise<true> {
|
|
246
|
+
if (minGasPrice < 0n) {
|
|
247
247
|
throw new InvalidInputError("Minimum gas price cannot be negative");
|
|
248
248
|
}
|
|
249
249
|
|
|
@@ -269,11 +269,11 @@ export class HardhatModule {
|
|
|
269
269
|
|
|
270
270
|
// hardhat_setBalance
|
|
271
271
|
|
|
272
|
-
private _setBalanceParams(params: any[]): [Buffer,
|
|
272
|
+
private _setBalanceParams(params: any[]): [Buffer, bigint] {
|
|
273
273
|
return validateParams(params, rpcAddress, rpcQuantity);
|
|
274
274
|
}
|
|
275
275
|
|
|
276
|
-
private async _setBalanceAction(address: Buffer, newBalance:
|
|
276
|
+
private async _setBalanceAction(address: Buffer, newBalance: bigint) {
|
|
277
277
|
await this._node.setAccountBalance(new Address(address), newBalance);
|
|
278
278
|
return true;
|
|
279
279
|
}
|
|
@@ -291,18 +291,18 @@ export class HardhatModule {
|
|
|
291
291
|
|
|
292
292
|
// hardhat_setNonce
|
|
293
293
|
|
|
294
|
-
private _setNonceParams(params: any[]): [Buffer,
|
|
294
|
+
private _setNonceParams(params: any[]): [Buffer, bigint] {
|
|
295
295
|
return validateParams(params, rpcAddress, rpcQuantity);
|
|
296
296
|
}
|
|
297
297
|
|
|
298
|
-
private async _setNonceAction(address: Buffer, newNonce:
|
|
298
|
+
private async _setNonceAction(address: Buffer, newNonce: bigint) {
|
|
299
299
|
await this._node.setNextConfirmedNonce(new Address(address), newNonce);
|
|
300
300
|
return true;
|
|
301
301
|
}
|
|
302
302
|
|
|
303
303
|
// hardhat_setStorageAt
|
|
304
304
|
|
|
305
|
-
private _setStorageAtParams(params: any[]): [Buffer,
|
|
305
|
+
private _setStorageAtParams(params: any[]): [Buffer, bigint, Buffer] {
|
|
306
306
|
const [address, positionIndex, value] = validateParams(
|
|
307
307
|
params,
|
|
308
308
|
rpcAddress,
|
|
@@ -310,8 +310,8 @@ export class HardhatModule {
|
|
|
310
310
|
rpcData
|
|
311
311
|
);
|
|
312
312
|
|
|
313
|
-
const MAX_WORD_VALUE =
|
|
314
|
-
if (positionIndex
|
|
313
|
+
const MAX_WORD_VALUE = 2n ** 256n;
|
|
314
|
+
if (positionIndex >= MAX_WORD_VALUE) {
|
|
315
315
|
throw new InvalidInputError(
|
|
316
316
|
`Storage key must not be greater than or equal to 2^256. Received ${positionIndex.toString()}.`
|
|
317
317
|
);
|
|
@@ -330,7 +330,7 @@ export class HardhatModule {
|
|
|
330
330
|
|
|
331
331
|
private async _setStorageAtAction(
|
|
332
332
|
address: Buffer,
|
|
333
|
-
positionIndex:
|
|
333
|
+
positionIndex: bigint,
|
|
334
334
|
value: Buffer
|
|
335
335
|
) {
|
|
336
336
|
await this._node.setStorageAt(new Address(address), positionIndex, value);
|
|
@@ -338,11 +338,11 @@ export class HardhatModule {
|
|
|
338
338
|
}
|
|
339
339
|
|
|
340
340
|
// hardhat_setNextBlockBaseFeePerGas
|
|
341
|
-
private _setNextBlockBaseFeePerGasParams(params: any[]): [
|
|
341
|
+
private _setNextBlockBaseFeePerGasParams(params: any[]): [bigint] {
|
|
342
342
|
return validateParams(params, rpcQuantity);
|
|
343
343
|
}
|
|
344
344
|
|
|
345
|
-
private _setNextBlockBaseFeePerGasAction(baseFeePerGas:
|
|
345
|
+
private _setNextBlockBaseFeePerGasAction(baseFeePerGas: bigint) {
|
|
346
346
|
if (!this._node.isEip1559Active()) {
|
|
347
347
|
throw new InvalidInputError(
|
|
348
348
|
"hardhat_setNextBlockBaseFeePerGas is disabled because EIP-1559 is not active"
|
|
@@ -365,7 +365,7 @@ export class HardhatModule {
|
|
|
365
365
|
}
|
|
366
366
|
|
|
367
367
|
// hardhat_mine
|
|
368
|
-
private async _hardhatMineAction(blockCount?:
|
|
368
|
+
private async _hardhatMineAction(blockCount?: bigint, interval?: bigint) {
|
|
369
369
|
const mineBlockResults = await this._node.mineBlocks(blockCount, interval);
|
|
370
370
|
|
|
371
371
|
for (const [i, result] of mineBlockResults.entries()) {
|
|
@@ -381,7 +381,9 @@ export class HardhatModule {
|
|
|
381
381
|
|
|
382
382
|
return true;
|
|
383
383
|
}
|
|
384
|
-
private _hardhatMineParams(
|
|
384
|
+
private _hardhatMineParams(
|
|
385
|
+
params: any[]
|
|
386
|
+
): [bigint | undefined, bigint | undefined] {
|
|
385
387
|
return validateParams(params, optional(rpcQuantity), optional(rpcQuantity));
|
|
386
388
|
}
|
|
387
389
|
|
|
@@ -395,7 +397,7 @@ export class HardhatModule {
|
|
|
395
397
|
for (const txTrace of traces) {
|
|
396
398
|
const code = await this._node.getCodeFromTrace(
|
|
397
399
|
txTrace.trace,
|
|
398
|
-
|
|
400
|
+
block.header.number
|
|
399
401
|
);
|
|
400
402
|
|
|
401
403
|
codes.push(code);
|
|
@@ -427,7 +429,7 @@ export class HardhatModule {
|
|
|
427
429
|
|
|
428
430
|
private async _logHardhatMinedBlock(result: MineBlockResult) {
|
|
429
431
|
const isEmpty = result.block.transactions.length === 0;
|
|
430
|
-
const blockNumber = result.block.header.number
|
|
432
|
+
const blockNumber = result.block.header.number;
|
|
431
433
|
|
|
432
434
|
if (isEmpty) {
|
|
433
435
|
this._logger.logEmptyHardhatMinedBlock(
|