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,7 +1,7 @@
|
|
|
1
|
-
import { Block } from "@
|
|
2
|
-
import Common from "@
|
|
3
|
-
import { TypedTransaction } from "@
|
|
4
|
-
import {
|
|
1
|
+
import { Block } from "@ignored/block";
|
|
2
|
+
import { Common } from "@ignored/common";
|
|
3
|
+
import { TypedTransaction } from "@ignored/tx";
|
|
4
|
+
import { zeros } from "@ignored/util";
|
|
5
5
|
|
|
6
6
|
import { BlockchainBase } from "./BlockchainBase";
|
|
7
7
|
import { FilterParams } from "./node-types";
|
|
@@ -14,30 +14,30 @@ export class HardhatBlockchain
|
|
|
14
14
|
extends BlockchainBase
|
|
15
15
|
implements HardhatBlockchainInterface
|
|
16
16
|
{
|
|
17
|
-
private _length =
|
|
17
|
+
private _length = 0n;
|
|
18
18
|
|
|
19
19
|
constructor(common: Common) {
|
|
20
20
|
super(common);
|
|
21
21
|
}
|
|
22
22
|
|
|
23
|
-
public getLatestBlockNumber():
|
|
24
|
-
return
|
|
23
|
+
public getLatestBlockNumber(): bigint {
|
|
24
|
+
return BigInt(this._length - 1n);
|
|
25
25
|
}
|
|
26
26
|
|
|
27
27
|
public async addBlock(block: Block): Promise<Block> {
|
|
28
28
|
this._validateBlock(block);
|
|
29
29
|
const totalDifficulty = await this._computeTotalDifficulty(block);
|
|
30
30
|
this._data.addBlock(block, totalDifficulty);
|
|
31
|
-
this._length +=
|
|
31
|
+
this._length += 1n;
|
|
32
32
|
return block;
|
|
33
33
|
}
|
|
34
34
|
|
|
35
35
|
public reserveBlocks(
|
|
36
|
-
count:
|
|
37
|
-
interval:
|
|
36
|
+
count: bigint,
|
|
37
|
+
interval: bigint,
|
|
38
38
|
previousBlockStateRoot: Buffer,
|
|
39
|
-
previousBlockTotalDifficulty:
|
|
40
|
-
previousBlockBaseFeePerGas:
|
|
39
|
+
previousBlockTotalDifficulty: bigint,
|
|
40
|
+
previousBlockBaseFeePerGas: bigint | undefined
|
|
41
41
|
) {
|
|
42
42
|
super.reserveBlocks(
|
|
43
43
|
count,
|
|
@@ -46,7 +46,7 @@ export class HardhatBlockchain
|
|
|
46
46
|
previousBlockTotalDifficulty,
|
|
47
47
|
previousBlockBaseFeePerGas
|
|
48
48
|
);
|
|
49
|
-
this._length
|
|
49
|
+
this._length += count;
|
|
50
50
|
}
|
|
51
51
|
|
|
52
52
|
public deleteLaterBlocks(block: Block): void {
|
|
@@ -55,10 +55,10 @@ export class HardhatBlockchain
|
|
|
55
55
|
throw new Error("Invalid block");
|
|
56
56
|
}
|
|
57
57
|
|
|
58
|
-
this._delBlock(actual.header.number
|
|
58
|
+
this._delBlock(actual.header.number + 1n);
|
|
59
59
|
}
|
|
60
60
|
|
|
61
|
-
public async getTotalDifficulty(blockHash: Buffer): Promise<
|
|
61
|
+
public async getTotalDifficulty(blockHash: Buffer): Promise<bigint> {
|
|
62
62
|
const totalDifficulty = this._data.getTotalDifficulty(blockHash);
|
|
63
63
|
if (totalDifficulty === undefined) {
|
|
64
64
|
throw new Error("Block not found");
|
|
@@ -88,18 +88,18 @@ export class HardhatBlockchain
|
|
|
88
88
|
}
|
|
89
89
|
|
|
90
90
|
private _validateBlock(block: Block) {
|
|
91
|
-
const blockNumber = block.header.number
|
|
91
|
+
const blockNumber = block.header.number;
|
|
92
92
|
const parentHash = block.header.parentHash;
|
|
93
|
-
const parent = this._data.getBlockByNumber(
|
|
93
|
+
const parent = this._data.getBlockByNumber(BigInt(blockNumber - 1n));
|
|
94
94
|
|
|
95
|
-
if (this._length !== blockNumber) {
|
|
95
|
+
if (BigInt(this._length) !== blockNumber) {
|
|
96
96
|
throw new Error(
|
|
97
97
|
`Invalid block number ${blockNumber}. Expected ${this._length}.`
|
|
98
98
|
);
|
|
99
99
|
}
|
|
100
100
|
|
|
101
101
|
if (
|
|
102
|
-
(blockNumber ===
|
|
102
|
+
(blockNumber === 0n && !parentHash.equals(zeros(32))) ||
|
|
103
103
|
(blockNumber > 0 &&
|
|
104
104
|
parent !== undefined &&
|
|
105
105
|
!parentHash.equals(parent.hash()))
|
|
@@ -108,8 +108,8 @@ export class HardhatBlockchain
|
|
|
108
108
|
}
|
|
109
109
|
}
|
|
110
110
|
|
|
111
|
-
protected _delBlock(blockNumber:
|
|
111
|
+
protected _delBlock(blockNumber: bigint): void {
|
|
112
112
|
super._delBlock(blockNumber);
|
|
113
|
-
this._length = blockNumber
|
|
113
|
+
this._length = blockNumber;
|
|
114
114
|
}
|
|
115
115
|
}
|
|
@@ -1,12 +1,11 @@
|
|
|
1
|
-
import { TypedTransaction } from "@
|
|
2
|
-
import { BN } from "ethereumjs-util";
|
|
1
|
+
import { TypedTransaction } from "@ignored/tx";
|
|
3
2
|
import {
|
|
4
3
|
List as ImmutableList,
|
|
5
4
|
Map as ImmutableMap,
|
|
6
5
|
Record as ImmutableRecord,
|
|
7
6
|
} from "immutable";
|
|
8
7
|
|
|
9
|
-
import {
|
|
8
|
+
import { BigIntUtils } from "../../util/bigint";
|
|
10
9
|
|
|
11
10
|
export interface OrderedTransaction {
|
|
12
11
|
orderId: number;
|
|
@@ -45,5 +44,5 @@ export const makePoolState = ImmutableRecord<PoolState>({
|
|
|
45
44
|
pendingTransactions: ImmutableMap<string, SenderTransactions>(),
|
|
46
45
|
queuedTransactions: ImmutableMap<string, SenderTransactions>(),
|
|
47
46
|
hashToTransaction: ImmutableMap<string, SerializedTransaction>(),
|
|
48
|
-
blockGasLimit:
|
|
47
|
+
blockGasLimit: BigIntUtils.toHex(9500000),
|
|
49
48
|
});
|
|
@@ -1,12 +1,15 @@
|
|
|
1
|
-
import { TypedTransaction } from "@
|
|
2
|
-
import { BN } from "ethereumjs-util";
|
|
1
|
+
import { TypedTransaction } from "@ignored/tx";
|
|
3
2
|
import Heap from "mnemonist/heap";
|
|
4
3
|
|
|
5
4
|
import { InternalError, InvalidInputError } from "../../core/providers/errors";
|
|
5
|
+
import { BigIntUtils } from "../../util/bigint";
|
|
6
6
|
import { MempoolOrder } from "./node-types";
|
|
7
7
|
import { OrderedTransaction } from "./PoolState";
|
|
8
8
|
|
|
9
|
-
function getEffectiveMinerFee(
|
|
9
|
+
function getEffectiveMinerFee(
|
|
10
|
+
tx: OrderedTransaction,
|
|
11
|
+
baseFee?: bigint
|
|
12
|
+
): bigint {
|
|
10
13
|
// This mimics the EIP-1559 normalize_transaction function
|
|
11
14
|
const maxFeePerGas =
|
|
12
15
|
"gasPrice" in tx.data ? tx.data.gasPrice : tx.data.maxFeePerGas;
|
|
@@ -18,18 +21,18 @@ function getEffectiveMinerFee(tx: OrderedTransaction, baseFee?: BN): BN {
|
|
|
18
21
|
return maxFeePerGas;
|
|
19
22
|
}
|
|
20
23
|
|
|
21
|
-
return
|
|
24
|
+
return BigIntUtils.min(maxPriorityFeePerGas, maxFeePerGas - baseFee);
|
|
22
25
|
}
|
|
23
26
|
|
|
24
27
|
function decreasingOrderEffectiveMinerFeeComparator(
|
|
25
28
|
left: OrderedTransaction,
|
|
26
29
|
right: OrderedTransaction,
|
|
27
|
-
baseFee?:
|
|
30
|
+
baseFee?: bigint
|
|
28
31
|
) {
|
|
29
32
|
const leftEffectiveMinerFee = getEffectiveMinerFee(left, baseFee);
|
|
30
33
|
const rightEffectiveMinerFee = getEffectiveMinerFee(right, baseFee);
|
|
31
34
|
|
|
32
|
-
const cmp =
|
|
35
|
+
const cmp = BigIntUtils.cmp(rightEffectiveMinerFee, leftEffectiveMinerFee);
|
|
33
36
|
|
|
34
37
|
if (cmp !== 0) {
|
|
35
38
|
return cmp;
|
|
@@ -49,7 +52,7 @@ function decreasingOrderComparator(
|
|
|
49
52
|
|
|
50
53
|
function getOrderedTransactionHeap(
|
|
51
54
|
mempoolOrder: MempoolOrder,
|
|
52
|
-
baseFee?:
|
|
55
|
+
baseFee?: bigint
|
|
53
56
|
): Heap<OrderedTransaction> {
|
|
54
57
|
switch (mempoolOrder) {
|
|
55
58
|
case "priority":
|
|
@@ -98,7 +101,7 @@ export class TransactionQueue {
|
|
|
98
101
|
constructor(
|
|
99
102
|
pendingTransactions: Map<string, OrderedTransaction[]>,
|
|
100
103
|
mempoolOrder: MempoolOrder,
|
|
101
|
-
baseFee?:
|
|
104
|
+
baseFee?: bigint
|
|
102
105
|
) {
|
|
103
106
|
this._heap = getOrderedTransactionHeap(mempoolOrder, baseFee);
|
|
104
107
|
|
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
import Common from "@
|
|
2
|
-
import { TransactionFactory, TypedTransaction } from "@
|
|
3
|
-
import { StateManager } from "@
|
|
4
|
-
import { Address,
|
|
1
|
+
import { Common } from "@ignored/common";
|
|
2
|
+
import { TransactionFactory, TypedTransaction } from "@ignored/tx";
|
|
3
|
+
import { StateManager } from "@ignored/statemanager";
|
|
4
|
+
import { Address, bufferToHex, toBuffer } from "@ignored/util";
|
|
5
5
|
import { List as ImmutableList, Record as ImmutableRecord } from "immutable";
|
|
6
6
|
|
|
7
7
|
import { InvalidInputError } from "../../core/providers/errors";
|
|
8
|
+
import { BigIntUtils } from "../../util/bigint";
|
|
8
9
|
|
|
9
10
|
import {
|
|
10
11
|
AddressToTransactions,
|
|
@@ -17,7 +18,6 @@ import {
|
|
|
17
18
|
} from "./PoolState";
|
|
18
19
|
import { FakeSenderAccessListEIP2930Transaction } from "./transactions/FakeSenderAccessListEIP2930Transaction";
|
|
19
20
|
import { FakeSenderTransaction } from "./transactions/FakeSenderTransaction";
|
|
20
|
-
import { bnToHex } from "./utils/bnToHex";
|
|
21
21
|
import { reorganizeTransactionsLists } from "./utils/reorganizeTransactionsLists";
|
|
22
22
|
import { FakeSenderEIP1559Transaction } from "./transactions/FakeSenderEIP1559Transaction";
|
|
23
23
|
|
|
@@ -35,7 +35,7 @@ export function serializeTransaction(
|
|
|
35
35
|
orderId: tx.orderId,
|
|
36
36
|
fakeFrom: isFake ? tx.data.getSenderAddress().toString() : undefined,
|
|
37
37
|
data: rlpSerialization,
|
|
38
|
-
txType: tx.data.
|
|
38
|
+
txType: tx.data.type,
|
|
39
39
|
});
|
|
40
40
|
}
|
|
41
41
|
|
|
@@ -95,11 +95,11 @@ export class TxPool {
|
|
|
95
95
|
|
|
96
96
|
constructor(
|
|
97
97
|
private readonly _stateManager: StateManager,
|
|
98
|
-
blockGasLimit:
|
|
98
|
+
blockGasLimit: bigint,
|
|
99
99
|
common: Common
|
|
100
100
|
) {
|
|
101
101
|
this._state = makePoolState({
|
|
102
|
-
blockGasLimit:
|
|
102
|
+
blockGasLimit: BigIntUtils.toHex(blockGasLimit),
|
|
103
103
|
});
|
|
104
104
|
this._deserializeTransaction = (tx) => deserializeTransaction(tx, common);
|
|
105
105
|
}
|
|
@@ -111,9 +111,9 @@ export class TxPool {
|
|
|
111
111
|
|
|
112
112
|
await this._validateTransaction(tx, senderAddress, nextConfirmedNonce);
|
|
113
113
|
|
|
114
|
-
const txNonce =
|
|
114
|
+
const txNonce = tx.nonce;
|
|
115
115
|
|
|
116
|
-
if (txNonce
|
|
116
|
+
if (txNonce > nextPendingNonce) {
|
|
117
117
|
this._addQueuedTransaction(tx);
|
|
118
118
|
} else {
|
|
119
119
|
this._addPendingTransaction(tx);
|
|
@@ -238,7 +238,7 @@ export class TxPool {
|
|
|
238
238
|
* Returns the next available nonce for an address, taking into account
|
|
239
239
|
* its pending transactions.
|
|
240
240
|
*/
|
|
241
|
-
public async getNextPendingNonce(accountAddress: Address): Promise<
|
|
241
|
+
public async getNextPendingNonce(accountAddress: Address): Promise<bigint> {
|
|
242
242
|
const pendingTxs = this._getPendingForAddress(accountAddress.toString());
|
|
243
243
|
const lastPendingTx = pendingTxs?.last(undefined);
|
|
244
244
|
|
|
@@ -248,16 +248,16 @@ export class TxPool {
|
|
|
248
248
|
|
|
249
249
|
const lastPendingTxNonce =
|
|
250
250
|
this._deserializeTransaction(lastPendingTx).data.nonce;
|
|
251
|
-
return lastPendingTxNonce
|
|
251
|
+
return lastPendingTxNonce + 1n;
|
|
252
252
|
}
|
|
253
253
|
|
|
254
|
-
public getBlockGasLimit():
|
|
255
|
-
return
|
|
254
|
+
public getBlockGasLimit(): bigint {
|
|
255
|
+
return BigInt(this._state.get("blockGasLimit"));
|
|
256
256
|
}
|
|
257
257
|
|
|
258
|
-
public setBlockGasLimit(newLimit:
|
|
258
|
+
public setBlockGasLimit(newLimit: bigint | number) {
|
|
259
259
|
if (typeof newLimit === "number") {
|
|
260
|
-
newLimit =
|
|
260
|
+
newLimit = BigInt(newLimit);
|
|
261
261
|
}
|
|
262
262
|
|
|
263
263
|
this._setBlockGasLimit(newLimit);
|
|
@@ -274,8 +274,8 @@ export class TxPool {
|
|
|
274
274
|
const senderAccount = await this._stateManager.getAccount(
|
|
275
275
|
Address.fromString(address)
|
|
276
276
|
);
|
|
277
|
-
const senderNonce =
|
|
278
|
-
const senderBalance =
|
|
277
|
+
const senderNonce = senderAccount.nonce;
|
|
278
|
+
const senderBalance = senderAccount.balance;
|
|
279
279
|
|
|
280
280
|
let moveToQueued = false;
|
|
281
281
|
for (const tx of txs) {
|
|
@@ -289,7 +289,7 @@ export class TxPool {
|
|
|
289
289
|
continue;
|
|
290
290
|
}
|
|
291
291
|
|
|
292
|
-
const txNonce =
|
|
292
|
+
const txNonce = deserializedTx.data.nonce;
|
|
293
293
|
|
|
294
294
|
if (
|
|
295
295
|
!this._isTxValid(deserializedTx, txNonce, senderNonce, senderBalance)
|
|
@@ -298,7 +298,7 @@ export class TxPool {
|
|
|
298
298
|
|
|
299
299
|
// if we are dropping a pending transaction with a valid nonce,
|
|
300
300
|
// then we move all the following txs to the queued list
|
|
301
|
-
if (txNonce
|
|
301
|
+
if (txNonce >= senderNonce) {
|
|
302
302
|
moveToQueued = true;
|
|
303
303
|
}
|
|
304
304
|
}
|
|
@@ -312,12 +312,12 @@ export class TxPool {
|
|
|
312
312
|
const senderAccount = await this._stateManager.getAccount(
|
|
313
313
|
Address.fromString(address)
|
|
314
314
|
);
|
|
315
|
-
const senderNonce =
|
|
316
|
-
const senderBalance =
|
|
315
|
+
const senderNonce = senderAccount.nonce;
|
|
316
|
+
const senderBalance = senderAccount.balance;
|
|
317
317
|
|
|
318
318
|
for (const tx of txs) {
|
|
319
319
|
const deserializedTx = this._deserializeTransaction(tx);
|
|
320
|
-
const txNonce =
|
|
320
|
+
const txNonce = deserializedTx.data.nonce;
|
|
321
321
|
|
|
322
322
|
if (
|
|
323
323
|
!this._isTxValid(deserializedTx, txNonce, senderNonce, senderBalance)
|
|
@@ -420,7 +420,7 @@ export class TxPool {
|
|
|
420
420
|
private async _validateTransaction(
|
|
421
421
|
tx: TypedTransaction,
|
|
422
422
|
senderAddress: Address,
|
|
423
|
-
senderNonce:
|
|
423
|
+
senderNonce: bigint
|
|
424
424
|
) {
|
|
425
425
|
if (this._knownTransaction(tx)) {
|
|
426
426
|
throw new InvalidInputError(
|
|
@@ -428,7 +428,7 @@ export class TxPool {
|
|
|
428
428
|
);
|
|
429
429
|
}
|
|
430
430
|
|
|
431
|
-
const txNonce =
|
|
431
|
+
const txNonce = tx.nonce;
|
|
432
432
|
|
|
433
433
|
// Geth returns this error if trying to create a contract and no data is provided
|
|
434
434
|
if (tx.to === undefined && tx.data.length === 0) {
|
|
@@ -438,28 +438,28 @@ export class TxPool {
|
|
|
438
438
|
}
|
|
439
439
|
|
|
440
440
|
const senderAccount = await this._stateManager.getAccount(senderAddress);
|
|
441
|
-
const senderBalance =
|
|
441
|
+
const senderBalance = senderAccount.balance;
|
|
442
442
|
|
|
443
443
|
const maxFee = "gasPrice" in tx ? tx.gasPrice : tx.maxFeePerGas;
|
|
444
|
-
const txMaxUpfrontCost = tx.gasLimit
|
|
444
|
+
const txMaxUpfrontCost = tx.gasLimit * maxFee + tx.value;
|
|
445
445
|
|
|
446
|
-
if (txMaxUpfrontCost
|
|
446
|
+
if (txMaxUpfrontCost > senderBalance) {
|
|
447
447
|
throw new InvalidInputError(
|
|
448
448
|
`sender doesn't have enough funds to send tx. The max upfront cost is: ${txMaxUpfrontCost.toString()}` +
|
|
449
449
|
` and the sender's account only has: ${senderBalance.toString()}`
|
|
450
450
|
);
|
|
451
451
|
}
|
|
452
452
|
|
|
453
|
-
if (txNonce
|
|
453
|
+
if (txNonce < senderNonce) {
|
|
454
454
|
throw new InvalidInputError(
|
|
455
455
|
`Nonce too low. Expected nonce to be at least ${senderNonce.toString()} but got ${txNonce.toString()}.`
|
|
456
456
|
);
|
|
457
457
|
}
|
|
458
458
|
|
|
459
|
-
const gasLimit =
|
|
459
|
+
const gasLimit = tx.gasLimit;
|
|
460
460
|
const baseFee = tx.getBaseFee();
|
|
461
461
|
|
|
462
|
-
if (gasLimit
|
|
462
|
+
if (gasLimit < baseFee) {
|
|
463
463
|
throw new InvalidInputError(
|
|
464
464
|
`Transaction requires at least ${baseFee.toString()} gas but got ${gasLimit.toString()}`
|
|
465
465
|
);
|
|
@@ -467,7 +467,7 @@ export class TxPool {
|
|
|
467
467
|
|
|
468
468
|
const blockGasLimit = this.getBlockGasLimit();
|
|
469
469
|
|
|
470
|
-
if (gasLimit
|
|
470
|
+
if (gasLimit > blockGasLimit) {
|
|
471
471
|
throw new InvalidInputError(
|
|
472
472
|
`Transaction gas limit is ${gasLimit.toString()} and exceeds block gas limit of ${blockGasLimit.toString()}`
|
|
473
473
|
);
|
|
@@ -550,8 +550,8 @@ export class TxPool {
|
|
|
550
550
|
);
|
|
551
551
|
}
|
|
552
552
|
|
|
553
|
-
private _setBlockGasLimit(newLimit:
|
|
554
|
-
this._state = this._state.set("blockGasLimit",
|
|
553
|
+
private _setBlockGasLimit(newLimit: bigint) {
|
|
554
|
+
this._state = this._state.set("blockGasLimit", BigIntUtils.toHex(newLimit));
|
|
555
555
|
}
|
|
556
556
|
|
|
557
557
|
private _deleteTransactionByHash(hash: Buffer) {
|
|
@@ -563,16 +563,16 @@ export class TxPool {
|
|
|
563
563
|
|
|
564
564
|
private _isTxValid(
|
|
565
565
|
tx: OrderedTransaction,
|
|
566
|
-
txNonce:
|
|
567
|
-
senderNonce:
|
|
568
|
-
senderBalance:
|
|
566
|
+
txNonce: bigint,
|
|
567
|
+
senderNonce: bigint,
|
|
568
|
+
senderBalance: bigint
|
|
569
569
|
): boolean {
|
|
570
|
-
const txGasLimit =
|
|
570
|
+
const txGasLimit = tx.data.gasLimit;
|
|
571
571
|
|
|
572
572
|
return (
|
|
573
|
-
txGasLimit
|
|
574
|
-
txNonce
|
|
575
|
-
tx.data.getUpfrontCost()
|
|
573
|
+
txGasLimit <= this.getBlockGasLimit() &&
|
|
574
|
+
txNonce >= senderNonce &&
|
|
575
|
+
tx.data.getUpfrontCost() <= senderBalance
|
|
576
576
|
);
|
|
577
577
|
}
|
|
578
578
|
|
|
@@ -580,9 +580,11 @@ export class TxPool {
|
|
|
580
580
|
* Returns the next available nonce for an address, ignoring its
|
|
581
581
|
* pending transactions.
|
|
582
582
|
*/
|
|
583
|
-
private async _getNextConfirmedNonce(
|
|
583
|
+
private async _getNextConfirmedNonce(
|
|
584
|
+
accountAddress: Address
|
|
585
|
+
): Promise<bigint> {
|
|
584
586
|
const account = await this._stateManager.getAccount(accountAddress);
|
|
585
|
-
return
|
|
587
|
+
return account.nonce;
|
|
586
588
|
}
|
|
587
589
|
|
|
588
590
|
/**
|
|
@@ -633,8 +635,8 @@ export class TxPool {
|
|
|
633
635
|
return;
|
|
634
636
|
}
|
|
635
637
|
|
|
636
|
-
const existingTxEntry = txs.findEntry(
|
|
637
|
-
this._deserializeTransaction(tx).data.nonce
|
|
638
|
+
const existingTxEntry = txs.findEntry(
|
|
639
|
+
(tx) => this._deserializeTransaction(tx).data.nonce === newTx.data.nonce
|
|
638
640
|
);
|
|
639
641
|
|
|
640
642
|
if (existingTxEntry === undefined) {
|
|
@@ -645,27 +647,23 @@ export class TxPool {
|
|
|
645
647
|
|
|
646
648
|
const deserializedExistingTx = this._deserializeTransaction(existingTx);
|
|
647
649
|
|
|
648
|
-
const currentMaxFeePerGas =
|
|
650
|
+
const currentMaxFeePerGas =
|
|
649
651
|
"gasPrice" in deserializedExistingTx.data
|
|
650
652
|
? deserializedExistingTx.data.gasPrice
|
|
651
|
-
: deserializedExistingTx.data.maxFeePerGas
|
|
652
|
-
);
|
|
653
|
+
: deserializedExistingTx.data.maxFeePerGas;
|
|
653
654
|
|
|
654
|
-
const currentPriorityFeePerGas =
|
|
655
|
+
const currentPriorityFeePerGas =
|
|
655
656
|
"gasPrice" in deserializedExistingTx.data
|
|
656
657
|
? deserializedExistingTx.data.gasPrice
|
|
657
|
-
: deserializedExistingTx.data.maxPriorityFeePerGas
|
|
658
|
-
);
|
|
658
|
+
: deserializedExistingTx.data.maxPriorityFeePerGas;
|
|
659
659
|
|
|
660
|
-
const newMaxFeePerGas =
|
|
661
|
-
"gasPrice" in newTx.data ? newTx.data.gasPrice : newTx.data.maxFeePerGas
|
|
662
|
-
);
|
|
660
|
+
const newMaxFeePerGas =
|
|
661
|
+
"gasPrice" in newTx.data ? newTx.data.gasPrice : newTx.data.maxFeePerGas;
|
|
663
662
|
|
|
664
|
-
const newPriorityFeePerGas =
|
|
663
|
+
const newPriorityFeePerGas =
|
|
665
664
|
"gasPrice" in newTx.data
|
|
666
665
|
? newTx.data.gasPrice
|
|
667
|
-
: newTx.data.maxPriorityFeePerGas
|
|
668
|
-
);
|
|
666
|
+
: newTx.data.maxPriorityFeePerGas;
|
|
669
667
|
|
|
670
668
|
const minNewMaxFeePerGas = this._getMinNewFeePrice(currentMaxFeePerGas);
|
|
671
669
|
|
|
@@ -673,13 +671,13 @@ export class TxPool {
|
|
|
673
671
|
currentPriorityFeePerGas
|
|
674
672
|
);
|
|
675
673
|
|
|
676
|
-
if (newMaxFeePerGas
|
|
674
|
+
if (newMaxFeePerGas < minNewMaxFeePerGas) {
|
|
677
675
|
throw new InvalidInputError(
|
|
678
676
|
`Replacement transaction underpriced. A gasPrice/maxFeePerGas of at least ${minNewMaxFeePerGas.toString()} is necessary to replace the existing transaction with nonce ${newTx.data.nonce.toString()}.`
|
|
679
677
|
);
|
|
680
678
|
}
|
|
681
679
|
|
|
682
|
-
if (newPriorityFeePerGas
|
|
680
|
+
if (newPriorityFeePerGas < minNewPriorityFeePerGas) {
|
|
683
681
|
throw new InvalidInputError(
|
|
684
682
|
`Replacement transaction underpriced. A gasPrice/maxPriorityFeePerGas of at least ${minNewPriorityFeePerGas.toString()} is necessary to replace the existing transaction with nonce ${newTx.data.nonce.toString()}.`
|
|
685
683
|
);
|
|
@@ -692,13 +690,13 @@ export class TxPool {
|
|
|
692
690
|
return newTxs;
|
|
693
691
|
}
|
|
694
692
|
|
|
695
|
-
private _getMinNewFeePrice(feePrice:
|
|
696
|
-
let minNewPriorityFee = feePrice
|
|
693
|
+
private _getMinNewFeePrice(feePrice: bigint): bigint {
|
|
694
|
+
let minNewPriorityFee = feePrice * 110n;
|
|
697
695
|
|
|
698
|
-
if (minNewPriorityFee
|
|
699
|
-
minNewPriorityFee = minNewPriorityFee
|
|
696
|
+
if (minNewPriorityFee % 100n === 0n) {
|
|
697
|
+
minNewPriorityFee = minNewPriorityFee / 100n;
|
|
700
698
|
} else {
|
|
701
|
-
minNewPriorityFee = minNewPriorityFee
|
|
699
|
+
minNewPriorityFee = minNewPriorityFee / 100n + 1n;
|
|
702
700
|
}
|
|
703
701
|
|
|
704
702
|
return minNewPriorityFee;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { TransactionFactory } from "@
|
|
2
|
-
import { BaseTransaction } from "@
|
|
1
|
+
import { TransactionFactory } from "@ignored/tx";
|
|
2
|
+
import { BaseTransaction } from "@ignored/tx/dist/baseTransaction";
|
|
3
3
|
import {
|
|
4
4
|
AccessListEIP2930TxData,
|
|
5
5
|
TxData,
|
|
6
6
|
TxOptions,
|
|
7
|
-
} from "@
|
|
7
|
+
} from "@ignored/tx/dist/types";
|
|
8
8
|
|
|
9
9
|
// This is a hack to prevent Block.fromBlockData from recreating our
|
|
10
10
|
// transactions and changing their types. Note fromBlockData is used
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
1
|
+
import { bufferToHex, toBuffer } from "@ignored/util";
|
|
2
|
+
import { Bloom } from "@ignored/vm";
|
|
3
3
|
|
|
4
4
|
import { RpcLogOutput } from "./output";
|
|
5
5
|
|
|
6
|
-
export const LATEST_BLOCK =
|
|
6
|
+
export const LATEST_BLOCK = -1n;
|
|
7
7
|
|
|
8
8
|
export enum Type {
|
|
9
9
|
LOGS_SUBSCRIPTION = 0,
|
|
@@ -12,14 +12,14 @@ export enum Type {
|
|
|
12
12
|
}
|
|
13
13
|
|
|
14
14
|
export interface FilterCriteria {
|
|
15
|
-
fromBlock:
|
|
16
|
-
toBlock:
|
|
15
|
+
fromBlock: bigint;
|
|
16
|
+
toBlock: bigint;
|
|
17
17
|
addresses: Buffer[];
|
|
18
18
|
normalizedTopics: Array<Array<Buffer | null> | null>;
|
|
19
19
|
}
|
|
20
20
|
|
|
21
21
|
export interface Filter {
|
|
22
|
-
id:
|
|
22
|
+
id: bigint;
|
|
23
23
|
type: Type;
|
|
24
24
|
criteria?: FilterCriteria;
|
|
25
25
|
deadline: Date;
|
|
@@ -73,15 +73,12 @@ export function filterLogs(
|
|
|
73
73
|
): RpcLogOutput[] {
|
|
74
74
|
const filteredLogs: RpcLogOutput[] = [];
|
|
75
75
|
for (const log of logs) {
|
|
76
|
-
const blockNumber =
|
|
77
|
-
if (blockNumber
|
|
76
|
+
const blockNumber = BigInt(log.blockNumber!);
|
|
77
|
+
if (blockNumber < criteria.fromBlock) {
|
|
78
78
|
continue;
|
|
79
79
|
}
|
|
80
80
|
|
|
81
|
-
if (
|
|
82
|
-
!criteria.toBlock.eq(LATEST_BLOCK) &&
|
|
83
|
-
blockNumber.gt(criteria.toBlock)
|
|
84
|
-
) {
|
|
81
|
+
if (criteria.toBlock !== LATEST_BLOCK && blockNumber > criteria.toBlock) {
|
|
85
82
|
continue;
|
|
86
83
|
}
|
|
87
84
|
|