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,9 +1,10 @@
|
|
|
1
|
-
import { Block } from "@
|
|
2
|
-
import Common from "@
|
|
3
|
-
import { TypedTransaction } from "@
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
1
|
+
import { Block } from "@ignored/block";
|
|
2
|
+
import { Common } from "@ignored/common";
|
|
3
|
+
import { TypedTransaction } from "@ignored/tx";
|
|
4
|
+
import { bufferToHex } from "@ignored/util";
|
|
5
|
+
import { RunBlockResult } from "@ignored/vm";
|
|
6
6
|
|
|
7
|
+
import { BigIntUtils } from "../../util/bigint";
|
|
7
8
|
import { assertHardhatInvariant } from "../../core/errors";
|
|
8
9
|
import {
|
|
9
10
|
bufferToRpcData,
|
|
@@ -150,7 +151,7 @@ export interface RpcDebugTraceOutput {
|
|
|
150
151
|
|
|
151
152
|
export function getRpcBlock(
|
|
152
153
|
block: Block,
|
|
153
|
-
totalDifficulty:
|
|
154
|
+
totalDifficulty: bigint,
|
|
154
155
|
showTransactionType: boolean,
|
|
155
156
|
includeTransactions = true,
|
|
156
157
|
pending = false
|
|
@@ -162,7 +163,7 @@ export function getRpcBlock(
|
|
|
162
163
|
: block.transactions.map((tx) => bufferToRpcData(tx.hash()));
|
|
163
164
|
|
|
164
165
|
const output: RpcBlockOutput = {
|
|
165
|
-
number: pending ? null : numberToRpcQuantity(
|
|
166
|
+
number: pending ? null : numberToRpcQuantity(block.header.number),
|
|
166
167
|
hash: pending ? null : bufferToRpcData(block.hash()),
|
|
167
168
|
parentHash: bufferToRpcData(block.header.parentHash),
|
|
168
169
|
// We pad this to 8 bytes because of a limitation in The Graph
|
|
@@ -170,18 +171,18 @@ export function getRpcBlock(
|
|
|
170
171
|
nonce: pending ? null : bufferToRpcData(block.header.nonce, 8),
|
|
171
172
|
mixHash: pending ? null : bufferToRpcData(block.header.mixHash, 32),
|
|
172
173
|
sha3Uncles: bufferToRpcData(block.header.uncleHash),
|
|
173
|
-
logsBloom: pending ? null : bufferToRpcData(block.header.
|
|
174
|
+
logsBloom: pending ? null : bufferToRpcData(block.header.logsBloom),
|
|
174
175
|
transactionsRoot: bufferToRpcData(block.header.transactionsTrie),
|
|
175
176
|
stateRoot: bufferToRpcData(block.header.stateRoot),
|
|
176
177
|
receiptsRoot: bufferToRpcData(block.header.receiptTrie),
|
|
177
178
|
miner: bufferToRpcData(block.header.coinbase.toBuffer()),
|
|
178
|
-
difficulty: numberToRpcQuantity(
|
|
179
|
+
difficulty: numberToRpcQuantity(block.header.difficulty),
|
|
179
180
|
totalDifficulty: numberToRpcQuantity(totalDifficulty),
|
|
180
181
|
extraData: bufferToRpcData(block.header.extraData),
|
|
181
182
|
size: numberToRpcQuantity(block.serialize().length),
|
|
182
|
-
gasLimit: numberToRpcQuantity(
|
|
183
|
-
gasUsed: numberToRpcQuantity(
|
|
184
|
-
timestamp: numberToRpcQuantity(
|
|
183
|
+
gasLimit: numberToRpcQuantity(block.header.gasLimit),
|
|
184
|
+
gasUsed: numberToRpcQuantity(block.header.gasUsed),
|
|
185
|
+
timestamp: numberToRpcQuantity(block.header.timestamp),
|
|
185
186
|
transactions,
|
|
186
187
|
uncles: block.uncleHeaders.map((uh: any) => bufferToRpcData(uh.hash())),
|
|
187
188
|
};
|
|
@@ -223,23 +224,21 @@ export function getRpcTransaction(
|
|
|
223
224
|
const baseOutput = {
|
|
224
225
|
blockHash: block === "pending" ? null : bufferToRpcData(block.hash()),
|
|
225
226
|
blockNumber:
|
|
226
|
-
block === "pending"
|
|
227
|
-
? null
|
|
228
|
-
: numberToRpcQuantity(new BN(block.header.number)),
|
|
227
|
+
block === "pending" ? null : numberToRpcQuantity(block.header.number),
|
|
229
228
|
from: bufferToRpcData(tx.getSenderAddress().toBuffer()),
|
|
230
|
-
gas: numberToRpcQuantity(
|
|
229
|
+
gas: numberToRpcQuantity(tx.gasLimit),
|
|
231
230
|
hash: bufferToRpcData(tx.hash()),
|
|
232
231
|
input: bufferToRpcData(tx.data),
|
|
233
|
-
nonce: numberToRpcQuantity(
|
|
232
|
+
nonce: numberToRpcQuantity(tx.nonce),
|
|
234
233
|
to: tx.to === undefined ? null : bufferToRpcData(tx.to.toBuffer()),
|
|
235
234
|
transactionIndex: index !== undefined ? numberToRpcQuantity(index) : null,
|
|
236
|
-
value: numberToRpcQuantity(
|
|
237
|
-
v: numberToRpcQuantity(
|
|
238
|
-
r: numberToRpcQuantity(
|
|
239
|
-
s: numberToRpcQuantity(
|
|
235
|
+
value: numberToRpcQuantity(tx.value),
|
|
236
|
+
v: numberToRpcQuantity(tx.v),
|
|
237
|
+
r: numberToRpcQuantity(tx.r),
|
|
238
|
+
s: numberToRpcQuantity(tx.s),
|
|
240
239
|
type:
|
|
241
240
|
showTransactionType || isTypedTransaction
|
|
242
|
-
? numberToRpcQuantity(tx.
|
|
241
|
+
? numberToRpcQuantity(tx.type)
|
|
243
242
|
: undefined,
|
|
244
243
|
accessList:
|
|
245
244
|
"accessList" in tx
|
|
@@ -274,14 +273,14 @@ export function getRpcTransaction(
|
|
|
274
273
|
};
|
|
275
274
|
}
|
|
276
275
|
|
|
277
|
-
function getEffectiveGasPrice(tx: TypedTransaction, baseFeePerGas:
|
|
276
|
+
function getEffectiveGasPrice(tx: TypedTransaction, baseFeePerGas: bigint) {
|
|
278
277
|
const maxFeePerGas = "maxFeePerGas" in tx ? tx.maxFeePerGas : tx.gasPrice;
|
|
279
278
|
const maxPriorityFeePerGas =
|
|
280
279
|
"maxPriorityFeePerGas" in tx ? tx.maxPriorityFeePerGas : tx.gasPrice;
|
|
281
280
|
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
281
|
+
return (
|
|
282
|
+
baseFeePerGas +
|
|
283
|
+
BigIntUtils.min(maxFeePerGas - baseFeePerGas, maxPriorityFeePerGas)
|
|
285
284
|
);
|
|
286
285
|
}
|
|
287
286
|
|
|
@@ -296,7 +295,7 @@ export function getRpcReceiptOutputsFromLocalBlockExecution(
|
|
|
296
295
|
|
|
297
296
|
for (let i = 0; i < runBlockResult.results.length; i += 1) {
|
|
298
297
|
const tx = block.transactions[i];
|
|
299
|
-
const { createdAddress,
|
|
298
|
+
const { createdAddress, totalGasSpent } = runBlockResult.results[i];
|
|
300
299
|
const receipt = runBlockResult.receipts[i];
|
|
301
300
|
|
|
302
301
|
const logs = receipt.logs.map((log) => {
|
|
@@ -309,11 +308,11 @@ export function getRpcReceiptOutputsFromLocalBlockExecution(
|
|
|
309
308
|
transactionHash: bufferToRpcData(tx.hash()),
|
|
310
309
|
transactionIndex: numberToRpcQuantity(i),
|
|
311
310
|
blockHash: bufferToRpcData(block.hash()),
|
|
312
|
-
blockNumber: numberToRpcQuantity(
|
|
311
|
+
blockNumber: numberToRpcQuantity(block.header.number),
|
|
313
312
|
from: bufferToRpcData(tx.getSenderAddress().toBuffer()),
|
|
314
313
|
to: tx.to === undefined ? null : bufferToRpcData(tx.to.toBuffer()),
|
|
315
|
-
cumulativeGasUsed: numberToRpcQuantity(
|
|
316
|
-
gasUsed: numberToRpcQuantity(
|
|
314
|
+
cumulativeGasUsed: numberToRpcQuantity(receipt.cumulativeBlockGasUsed),
|
|
315
|
+
gasUsed: numberToRpcQuantity(totalGasSpent),
|
|
317
316
|
contractAddress:
|
|
318
317
|
createdAddress !== undefined
|
|
319
318
|
? bufferToRpcData(createdAddress.toBuffer())
|
|
@@ -322,9 +321,7 @@ export function getRpcReceiptOutputsFromLocalBlockExecution(
|
|
|
322
321
|
logsBloom: bufferToRpcData(receipt.bitvector),
|
|
323
322
|
// There's no way to execute an EIP-2718 tx locally if we aren't in
|
|
324
323
|
// an HF >= Berlin, so this check is enough
|
|
325
|
-
type: showTransactionType
|
|
326
|
-
? numberToRpcQuantity(tx.transactionType)
|
|
327
|
-
: undefined,
|
|
324
|
+
type: showTransactionType ? numberToRpcQuantity(tx.type) : undefined,
|
|
328
325
|
};
|
|
329
326
|
|
|
330
327
|
if ("stateRoot" in receipt) {
|
|
@@ -386,7 +383,7 @@ export function remoteReceiptToRpcReceiptOutput(
|
|
|
386
383
|
transactionIndex: numberToRpcQuantity(receipt.transactionIndex),
|
|
387
384
|
type:
|
|
388
385
|
showTransactionType || isTypedTransaction
|
|
389
|
-
? numberToRpcQuantity(tx.
|
|
386
|
+
? numberToRpcQuantity(tx.type)
|
|
390
387
|
: undefined,
|
|
391
388
|
effectiveGasPrice:
|
|
392
389
|
showEffectiveGasPrice || tx.type === 2
|
|
@@ -433,9 +430,7 @@ function getRpcLogOutput(
|
|
|
433
430
|
transactionHash: block !== undefined ? bufferToRpcData(tx.hash()) : null,
|
|
434
431
|
blockHash: block !== undefined ? bufferToRpcData(block.hash()) : null,
|
|
435
432
|
blockNumber:
|
|
436
|
-
block !== undefined
|
|
437
|
-
? numberToRpcQuantity(new BN(block.header.number))
|
|
438
|
-
: null,
|
|
433
|
+
block !== undefined ? numberToRpcQuantity(block.header.number) : null,
|
|
439
434
|
address: bufferToRpcData(log[0]),
|
|
440
435
|
data: bufferToRpcData(log[2]),
|
|
441
436
|
topics: log[1].map((topic: Buffer) => bufferToRpcData(topic)),
|
|
@@ -7,10 +7,9 @@ import type {
|
|
|
7
7
|
RequestArguments,
|
|
8
8
|
} from "../../../types";
|
|
9
9
|
|
|
10
|
-
import Common from "@
|
|
10
|
+
import { Common } from "@ignored/common";
|
|
11
11
|
import chalk from "chalk";
|
|
12
12
|
import debug from "debug";
|
|
13
|
-
import { BN } from "ethereumjs-util";
|
|
14
13
|
import { EventEmitter } from "events";
|
|
15
14
|
import fsExtra from "fs-extra";
|
|
16
15
|
import semver from "semver";
|
|
@@ -79,9 +78,9 @@ export class HardhatNetworkProvider
|
|
|
79
78
|
private readonly _networkName: string,
|
|
80
79
|
private readonly _chainId: number,
|
|
81
80
|
private readonly _networkId: number,
|
|
82
|
-
private readonly _blockGasLimit:
|
|
83
|
-
private readonly _initialBaseFeePerGas:
|
|
84
|
-
private readonly _minGasPrice:
|
|
81
|
+
private readonly _blockGasLimit: bigint,
|
|
82
|
+
private readonly _initialBaseFeePerGas: bigint | undefined,
|
|
83
|
+
private readonly _minGasPrice: bigint,
|
|
85
84
|
private readonly _throwOnTransactionFailures: boolean,
|
|
86
85
|
private readonly _throwOnCallFailures: boolean,
|
|
87
86
|
private readonly _automine: boolean,
|
|
@@ -353,7 +352,7 @@ export class HardhatNetworkProvider
|
|
|
353
352
|
node.removeListener("ethEvent", this._ethEventListener);
|
|
354
353
|
}
|
|
355
354
|
|
|
356
|
-
private _ethEventListener = (payload: { filterId:
|
|
355
|
+
private _ethEventListener = (payload: { filterId: bigint; result: any }) => {
|
|
357
356
|
const subscription = `0x${payload.filterId.toString(16)}`;
|
|
358
357
|
const result = payload.result;
|
|
359
358
|
this._emitLegacySubscriptionEvent(subscription, result);
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { rawDecode } from "ethereumjs-abi";
|
|
2
|
-
import { BN } from "ethereumjs-util";
|
|
3
2
|
|
|
4
3
|
import { assertHardhatInvariant } from "../../core/errors";
|
|
5
4
|
|
|
@@ -54,7 +53,7 @@ export class ReturnData {
|
|
|
54
53
|
return decoded.toString("utf8");
|
|
55
54
|
}
|
|
56
55
|
|
|
57
|
-
public decodePanic():
|
|
56
|
+
public decodePanic(): number {
|
|
58
57
|
assertHardhatInvariant(
|
|
59
58
|
this._selector === PANIC_SELECTOR,
|
|
60
59
|
"Expected return data to be a Panic(uint256)"
|
|
@@ -62,6 +61,10 @@ export class ReturnData {
|
|
|
62
61
|
|
|
63
62
|
const [errorCode] = rawDecode(["uint256"], this.value.slice(4));
|
|
64
63
|
|
|
65
|
-
return errorCode;
|
|
64
|
+
return errorCode.toNumber();
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
public getSelector(): string | undefined {
|
|
68
|
+
return this._selector;
|
|
66
69
|
}
|
|
67
70
|
}
|
package/src/internal/hardhat-network/provider/transactions/FakeSenderAccessListEIP2930Transaction.ts
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
|
-
import Common from "@
|
|
2
|
-
import
|
|
1
|
+
import { Common } from "@ignored/common";
|
|
2
|
+
import * as rlp from "@ignored/rlp";
|
|
3
|
+
import { AccessListEIP2930Transaction } from "@ignored/tx";
|
|
3
4
|
import {
|
|
4
5
|
AccessListEIP2930TxData,
|
|
5
6
|
AccessListEIP2930ValuesArray,
|
|
6
7
|
TxOptions,
|
|
7
|
-
} from "@
|
|
8
|
-
import { Address,
|
|
8
|
+
} from "@ignored/tx/dist/types";
|
|
9
|
+
import { Address, arrToBufArr, bufferToInt } from "@ignored/util";
|
|
9
10
|
|
|
10
11
|
import {
|
|
11
12
|
InternalError,
|
|
@@ -65,15 +66,11 @@ export class FakeSenderAccessListEIP2930Transaction extends AccessListEIP2930Tra
|
|
|
65
66
|
);
|
|
66
67
|
}
|
|
67
68
|
|
|
68
|
-
const values = rlp.decode(serialized.slice(1));
|
|
69
|
+
const values = arrToBufArr(rlp.decode(serialized.slice(1)));
|
|
69
70
|
|
|
70
|
-
|
|
71
|
-
throw new InvalidArgumentsError(
|
|
72
|
-
"Invalid serialized tx input. Must be array"
|
|
73
|
-
);
|
|
74
|
-
}
|
|
71
|
+
checkIsAccessListEIP2930ValuesArray(values);
|
|
75
72
|
|
|
76
|
-
return this.fromSenderAndValuesArray(sender, values
|
|
73
|
+
return this.fromSenderAndValuesArray(sender, values, opts);
|
|
77
74
|
}
|
|
78
75
|
|
|
79
76
|
public static fromSenderAndValuesArray(
|
|
@@ -81,12 +78,6 @@ export class FakeSenderAccessListEIP2930Transaction extends AccessListEIP2930Tra
|
|
|
81
78
|
values: AccessListEIP2930ValuesArray,
|
|
82
79
|
opts: TxOptions = {}
|
|
83
80
|
): FakeSenderAccessListEIP2930Transaction {
|
|
84
|
-
if (values.length !== 8 && values.length !== 11) {
|
|
85
|
-
throw new InvalidArgumentsError(
|
|
86
|
-
"Invalid EIP-2930 transaction. Only expecting 8 values (for unsigned tx) or 11 values (for signed tx)."
|
|
87
|
-
);
|
|
88
|
-
}
|
|
89
|
-
|
|
90
81
|
const [
|
|
91
82
|
chainId,
|
|
92
83
|
nonce,
|
|
@@ -112,9 +103,9 @@ export class FakeSenderAccessListEIP2930Transaction extends AccessListEIP2930Tra
|
|
|
112
103
|
value,
|
|
113
104
|
data: data ?? Buffer.from([]),
|
|
114
105
|
accessList: accessList ?? [],
|
|
115
|
-
v: v !== undefined ?
|
|
116
|
-
r: r !== undefined && r.length !== 0 ?
|
|
117
|
-
s: s !== undefined && s.length !== 0 ?
|
|
106
|
+
v: v !== undefined ? bufferToInt(v) : undefined, // EIP2930 supports v's with value 0 (empty Buffer)
|
|
107
|
+
r: r !== undefined && r.length !== 0 ? bufferToInt(r) : undefined,
|
|
108
|
+
s: s !== undefined && s.length !== 0 ? bufferToInt(s) : undefined,
|
|
118
109
|
},
|
|
119
110
|
opts
|
|
120
111
|
);
|
|
@@ -132,9 +123,9 @@ export class FakeSenderAccessListEIP2930Transaction extends AccessListEIP2930Tra
|
|
|
132
123
|
super(
|
|
133
124
|
{
|
|
134
125
|
...data,
|
|
135
|
-
v: data.v ??
|
|
136
|
-
r: data.r ??
|
|
137
|
-
s: data.s ??
|
|
126
|
+
v: data.v ?? 1,
|
|
127
|
+
r: data.r ?? 1,
|
|
128
|
+
s: data.s ?? 2,
|
|
138
129
|
},
|
|
139
130
|
{ ...opts, freeze: false }
|
|
140
131
|
);
|
|
@@ -157,7 +148,7 @@ export class FakeSenderAccessListEIP2930Transaction extends AccessListEIP2930Tra
|
|
|
157
148
|
);
|
|
158
149
|
}
|
|
159
150
|
|
|
160
|
-
public _processSignature(_v:
|
|
151
|
+
public _processSignature(_v: bigint, _r: Buffer, _s: Buffer): never {
|
|
161
152
|
throw new InternalError(
|
|
162
153
|
"`_processSignature` is not implemented in FakeSenderAccessListEIP2930Transaction"
|
|
163
154
|
);
|
|
@@ -191,3 +182,39 @@ export class FakeSenderAccessListEIP2930Transaction extends AccessListEIP2930Tra
|
|
|
191
182
|
return true;
|
|
192
183
|
}
|
|
193
184
|
}
|
|
185
|
+
|
|
186
|
+
function checkIsAccessListEIP2930ValuesArray(
|
|
187
|
+
values: unknown
|
|
188
|
+
): asserts values is AccessListEIP2930ValuesArray {
|
|
189
|
+
if (!Array.isArray(values)) {
|
|
190
|
+
throw new InvalidArgumentsError(
|
|
191
|
+
`Invalid deserialized tx. Expected a Buffer[], but got '${values as any}'`
|
|
192
|
+
);
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
if (values.length !== 8 && values.length !== 11) {
|
|
196
|
+
throw new InvalidArgumentsError(
|
|
197
|
+
"Invalid EIP-2930 transaction. Only expecting 8 values (for unsigned tx) or 11 values (for signed tx)."
|
|
198
|
+
);
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
// all elements in the array are buffers, except the 8th one that is an
|
|
202
|
+
// AccessListBuffer (an array of AccessListBufferItems)
|
|
203
|
+
for (const [i, value] of values.entries()) {
|
|
204
|
+
if (i === 7) {
|
|
205
|
+
if (!Array.isArray(value)) {
|
|
206
|
+
// we could check more things to assert that it's an AccessListBuffer,
|
|
207
|
+
// but we're assuming that just checking if it's an array is enough
|
|
208
|
+
throw new InvalidArgumentsError(
|
|
209
|
+
`Invalid deserialized tx. Expected a AccessListBuffer in position ${i}, but got '${value}'`
|
|
210
|
+
);
|
|
211
|
+
}
|
|
212
|
+
} else {
|
|
213
|
+
if (!Buffer.isBuffer(values[i])) {
|
|
214
|
+
throw new InvalidArgumentsError(
|
|
215
|
+
`Invalid deserialized tx. Expected a Buffer in position ${i}, but got '${value}'`
|
|
216
|
+
);
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
}
|
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
import
|
|
1
|
+
import * as rlp from "@ignored/rlp";
|
|
2
|
+
import { FeeMarketEIP1559Transaction } from "@ignored/tx";
|
|
2
3
|
import {
|
|
3
4
|
FeeMarketEIP1559TxData,
|
|
4
5
|
FeeMarketEIP1559ValuesArray,
|
|
5
6
|
TxOptions,
|
|
6
|
-
} from "@
|
|
7
|
-
import { Address,
|
|
7
|
+
} from "@ignored/tx/dist/types";
|
|
8
|
+
import { Address, arrToBufArr, bufferToInt } from "@ignored/util";
|
|
8
9
|
|
|
9
10
|
import {
|
|
10
11
|
InternalError,
|
|
@@ -64,15 +65,11 @@ export class FakeSenderEIP1559Transaction extends FeeMarketEIP1559Transaction {
|
|
|
64
65
|
);
|
|
65
66
|
}
|
|
66
67
|
|
|
67
|
-
const values = rlp.decode(serialized.slice(1));
|
|
68
|
+
const values = arrToBufArr(rlp.decode(serialized.slice(1)));
|
|
68
69
|
|
|
69
|
-
|
|
70
|
-
throw new InvalidArgumentsError(
|
|
71
|
-
"Invalid serialized tx input. Must be array"
|
|
72
|
-
);
|
|
73
|
-
}
|
|
70
|
+
checkIsFeeMarketEIP1559ValuesArray(values);
|
|
74
71
|
|
|
75
|
-
return this.fromSenderAndValuesArray(sender, values
|
|
72
|
+
return this.fromSenderAndValuesArray(sender, values, opts);
|
|
76
73
|
}
|
|
77
74
|
|
|
78
75
|
public static fromSenderAndValuesArray(
|
|
@@ -80,12 +77,6 @@ export class FakeSenderEIP1559Transaction extends FeeMarketEIP1559Transaction {
|
|
|
80
77
|
values: FeeMarketEIP1559ValuesArray,
|
|
81
78
|
opts: TxOptions = {}
|
|
82
79
|
): FakeSenderEIP1559Transaction {
|
|
83
|
-
if (values.length !== 9 && values.length !== 12) {
|
|
84
|
-
throw new InvalidArgumentsError(
|
|
85
|
-
"Invalid EIP-1559 transaction. Only expecting 9 values (for unsigned tx) or 12 values (for signed tx)."
|
|
86
|
-
);
|
|
87
|
-
}
|
|
88
|
-
|
|
89
80
|
const [
|
|
90
81
|
chainId,
|
|
91
82
|
nonce,
|
|
@@ -113,9 +104,9 @@ export class FakeSenderEIP1559Transaction extends FeeMarketEIP1559Transaction {
|
|
|
113
104
|
value,
|
|
114
105
|
data: data ?? Buffer.from([]),
|
|
115
106
|
accessList: accessList ?? [],
|
|
116
|
-
v: v !== undefined ?
|
|
117
|
-
r: r !== undefined && r.length !== 0 ?
|
|
118
|
-
s: s !== undefined && s.length !== 0 ?
|
|
107
|
+
v: v !== undefined ? bufferToInt(v) : undefined, // EIP1559 supports v's with value 0 (empty Buffer)
|
|
108
|
+
r: r !== undefined && r.length !== 0 ? bufferToInt(r) : undefined,
|
|
109
|
+
s: s !== undefined && s.length !== 0 ? bufferToInt(s) : undefined,
|
|
119
110
|
},
|
|
120
111
|
opts
|
|
121
112
|
);
|
|
@@ -131,9 +122,9 @@ export class FakeSenderEIP1559Transaction extends FeeMarketEIP1559Transaction {
|
|
|
131
122
|
super(
|
|
132
123
|
{
|
|
133
124
|
...data,
|
|
134
|
-
v: data.v ??
|
|
135
|
-
r: data.r ??
|
|
136
|
-
s: data.s ??
|
|
125
|
+
v: data.v ?? 1,
|
|
126
|
+
r: data.r ?? 1,
|
|
127
|
+
s: data.s ?? 2,
|
|
137
128
|
},
|
|
138
129
|
{ ...opts, freeze: false }
|
|
139
130
|
);
|
|
@@ -155,7 +146,7 @@ export class FakeSenderEIP1559Transaction extends FeeMarketEIP1559Transaction {
|
|
|
155
146
|
);
|
|
156
147
|
}
|
|
157
148
|
|
|
158
|
-
public _processSignature(_v:
|
|
149
|
+
public _processSignature(_v: bigint, _r: Buffer, _s: Buffer): never {
|
|
159
150
|
throw new InternalError(
|
|
160
151
|
"`_processSignature` is not implemented in FakeSenderEIP1559Transaction"
|
|
161
152
|
);
|
|
@@ -189,3 +180,39 @@ export class FakeSenderEIP1559Transaction extends FeeMarketEIP1559Transaction {
|
|
|
189
180
|
return true;
|
|
190
181
|
}
|
|
191
182
|
}
|
|
183
|
+
|
|
184
|
+
function checkIsFeeMarketEIP1559ValuesArray(
|
|
185
|
+
values: unknown
|
|
186
|
+
): asserts values is FeeMarketEIP1559ValuesArray {
|
|
187
|
+
if (!Array.isArray(values)) {
|
|
188
|
+
throw new InvalidArgumentsError(
|
|
189
|
+
`Invalid deserialized tx. Expected a Buffer[], but got '${values as any}'`
|
|
190
|
+
);
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
if (values.length !== 9 && values.length !== 12) {
|
|
194
|
+
throw new InvalidArgumentsError(
|
|
195
|
+
"Invalid EIP-1559 transaction. Only expecting 9 values (for unsigned tx) or 12 values (for signed tx)."
|
|
196
|
+
);
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
// all elements in the array are buffers, except the 9th one that is an
|
|
200
|
+
// AccessListBuffer (an array of AccessListBufferItems)
|
|
201
|
+
for (const [i, value] of values.entries()) {
|
|
202
|
+
if (i === 8) {
|
|
203
|
+
if (!Array.isArray(value)) {
|
|
204
|
+
// we could check more things to assert that it's an AccessListBuffer,
|
|
205
|
+
// but we're assuming that just checking if it's an array is enough
|
|
206
|
+
throw new InvalidArgumentsError(
|
|
207
|
+
`Invalid deserialized tx. Expected a AccessListBuffer in position ${i}, but got '${value}'`
|
|
208
|
+
);
|
|
209
|
+
}
|
|
210
|
+
} else {
|
|
211
|
+
if (!Buffer.isBuffer(values[i])) {
|
|
212
|
+
throw new InvalidArgumentsError(
|
|
213
|
+
`Invalid deserialized tx. Expected a Buffer in position ${i}, but got '${value}'`
|
|
214
|
+
);
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
}
|
|
@@ -1,8 +1,12 @@
|
|
|
1
|
-
import Common from "@
|
|
2
|
-
import
|
|
3
|
-
import {
|
|
1
|
+
import { Common } from "@ignored/common";
|
|
2
|
+
import * as rlp from "@ignored/rlp";
|
|
3
|
+
import { Transaction, TxData, TxOptions } from "@ignored/tx";
|
|
4
|
+
import { Address, arrToBufArr } from "@ignored/util";
|
|
4
5
|
|
|
5
|
-
import {
|
|
6
|
+
import {
|
|
7
|
+
InternalError,
|
|
8
|
+
InvalidArgumentsError,
|
|
9
|
+
} from "../../../core/providers/errors";
|
|
6
10
|
|
|
7
11
|
/* eslint-disable @nomiclabs/hardhat-internal-rules/only-hardhat-error */
|
|
8
12
|
|
|
@@ -51,11 +55,9 @@ export class FakeSenderTransaction extends Transaction {
|
|
|
51
55
|
serialized: Buffer,
|
|
52
56
|
opts?: TxOptions
|
|
53
57
|
) {
|
|
54
|
-
const values = rlp.decode(serialized);
|
|
58
|
+
const values = arrToBufArr(rlp.decode(serialized));
|
|
55
59
|
|
|
56
|
-
|
|
57
|
-
throw new Error("Invalid serialized tx input. Must be array");
|
|
58
|
-
}
|
|
60
|
+
checkIsFlatBufferArray(values);
|
|
59
61
|
|
|
60
62
|
return this.fromSenderAndValuesArray(sender, values, opts);
|
|
61
63
|
}
|
|
@@ -98,9 +100,9 @@ export class FakeSenderTransaction extends Transaction {
|
|
|
98
100
|
super(
|
|
99
101
|
{
|
|
100
102
|
...data,
|
|
101
|
-
v: data.v ??
|
|
102
|
-
r: data.r ??
|
|
103
|
-
s: data.s ??
|
|
103
|
+
v: data.v ?? 27,
|
|
104
|
+
r: data.r ?? 1,
|
|
105
|
+
s: data.s ?? 2,
|
|
104
106
|
},
|
|
105
107
|
{ ...opts, freeze: false }
|
|
106
108
|
);
|
|
@@ -182,3 +184,19 @@ FakeSenderTransactionPrototype._processSignature = function () {
|
|
|
182
184
|
"`_processSignature` is not implemented in FakeSenderTransaction"
|
|
183
185
|
);
|
|
184
186
|
};
|
|
187
|
+
|
|
188
|
+
function checkIsFlatBufferArray(values: unknown): asserts values is Buffer[] {
|
|
189
|
+
if (!Array.isArray(values)) {
|
|
190
|
+
throw new InvalidArgumentsError(
|
|
191
|
+
`Invalid deserialized tx. Expected a Buffer[], but got '${values as any}'`
|
|
192
|
+
);
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
for (const [i, value] of values.entries()) {
|
|
196
|
+
if (!Buffer.isBuffer(value)) {
|
|
197
|
+
throw new InvalidArgumentsError(
|
|
198
|
+
`Invalid deserialized tx. Expected a Buffer in position ${i}, but got '${value}'`
|
|
199
|
+
);
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
}
|
package/src/internal/hardhat-network/provider/transactions/ReadOnlyValidEIP1559Transaction.ts
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import Common from "@
|
|
2
|
-
import { FeeMarketEIP1559Transaction, TxOptions } from "@
|
|
3
|
-
import { Address
|
|
1
|
+
import { Common } from "@ignored/common";
|
|
2
|
+
import { FeeMarketEIP1559Transaction, TxOptions } from "@ignored/tx";
|
|
3
|
+
import { Address } from "@ignored/util";
|
|
4
4
|
|
|
5
5
|
import {
|
|
6
6
|
FeeMarketEIP1559TxData,
|
|
7
7
|
FeeMarketEIP1559ValuesArray,
|
|
8
|
-
} from "@
|
|
8
|
+
} from "@ignored/tx/src/types";
|
|
9
9
|
import { InternalError } from "../../../core/providers/errors";
|
|
10
|
-
import {
|
|
10
|
+
import { BigIntUtils } from "../../../util/bigint";
|
|
11
11
|
|
|
12
12
|
/* eslint-disable @nomiclabs/hardhat-internal-rules/only-hardhat-error */
|
|
13
13
|
|
|
@@ -56,26 +56,14 @@ export class ReadOnlyValidEIP1559Transaction extends FeeMarketEIP1559Transaction
|
|
|
56
56
|
private readonly _sender: Address;
|
|
57
57
|
|
|
58
58
|
constructor(sender: Address, data: FeeMarketEIP1559TxData = {}) {
|
|
59
|
-
const fakeCommon =
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
// supports EIP-1559
|
|
66
|
-
(fakeCommon as any).isActivatedEIP = (eip: number) => {
|
|
67
|
-
return LONDON_EIPS.has(eip);
|
|
68
|
-
};
|
|
69
|
-
|
|
70
|
-
// this class should only be used with EIP-1559 txs,
|
|
71
|
-
// which always have a `chainId` value
|
|
72
|
-
(fakeCommon as any).chainIdBN = () => {
|
|
73
|
-
if (data.chainId !== undefined) {
|
|
74
|
-
return new BN(data.chainId);
|
|
59
|
+
const fakeCommon = Common.custom(
|
|
60
|
+
{
|
|
61
|
+
chainId: BigIntUtils.fromBigIntLike(data.chainId),
|
|
62
|
+
},
|
|
63
|
+
{
|
|
64
|
+
hardfork: "london",
|
|
75
65
|
}
|
|
76
|
-
|
|
77
|
-
throw new Error("Expected txData to have a chainId");
|
|
78
|
-
};
|
|
66
|
+
);
|
|
79
67
|
|
|
80
68
|
super(data, { freeze: false, common: fakeCommon });
|
|
81
69
|
|
package/src/internal/hardhat-network/provider/transactions/ReadOnlyValidEIP2930Transaction.ts
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import Common from "@
|
|
1
|
+
import { Common } from "@ignored/common";
|
|
2
2
|
import {
|
|
3
3
|
AccessListEIP2930Transaction,
|
|
4
4
|
AccessListEIP2930TxData,
|
|
5
5
|
AccessListEIP2930ValuesArray,
|
|
6
6
|
TxOptions,
|
|
7
|
-
} from "@
|
|
8
|
-
import { Address
|
|
7
|
+
} from "@ignored/tx";
|
|
8
|
+
import { Address } from "@ignored/util";
|
|
9
9
|
|
|
10
10
|
import { InternalError } from "../../../core/providers/errors";
|
|
11
|
-
import {
|
|
11
|
+
import { BigIntUtils } from "../../../util/bigint";
|
|
12
12
|
|
|
13
13
|
/* eslint-disable @nomiclabs/hardhat-internal-rules/only-hardhat-error */
|
|
14
14
|
|
|
@@ -58,25 +58,14 @@ export class ReadOnlyValidEIP2930Transaction extends AccessListEIP2930Transactio
|
|
|
58
58
|
private readonly _sender: Address;
|
|
59
59
|
|
|
60
60
|
constructor(sender: Address, data: AccessListEIP2930TxData = {}) {
|
|
61
|
-
const fakeCommon =
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
(fakeCommon as any).isActivatedEIP = (eip: number) => {
|
|
68
|
-
return BERLIN_EIPS.has(eip);
|
|
69
|
-
};
|
|
70
|
-
|
|
71
|
-
// this class should only be used with EIP-2930 txs,
|
|
72
|
-
// which (we assume) always have a defined `chainId` value
|
|
73
|
-
(fakeCommon as any).chainIdBN = () => {
|
|
74
|
-
if (data.chainId !== undefined) {
|
|
75
|
-
return new BN(data.chainId);
|
|
61
|
+
const fakeCommon = Common.custom(
|
|
62
|
+
{
|
|
63
|
+
chainId: BigIntUtils.fromBigIntLike(data.chainId),
|
|
64
|
+
},
|
|
65
|
+
{
|
|
66
|
+
hardfork: "berlin",
|
|
76
67
|
}
|
|
77
|
-
|
|
78
|
-
throw new Error("Expected txData to have a chainId");
|
|
79
|
-
};
|
|
68
|
+
);
|
|
80
69
|
|
|
81
70
|
super(data, { freeze: false, common: fakeCommon });
|
|
82
71
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import Common from "@
|
|
2
|
-
import { Transaction, TxData, TxOptions } from "@
|
|
3
|
-
import { Address } from "
|
|
1
|
+
import { Common } from "@ignored/common";
|
|
2
|
+
import { Transaction, TxData, TxOptions } from "@ignored/tx";
|
|
3
|
+
import { Address } from "@ignored/util";
|
|
4
4
|
|
|
5
5
|
import { InternalError } from "../../../core/providers/errors";
|
|
6
6
|
|