hardhat 2.11.0-dev.0 → 2.11.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.
Files changed (406) hide show
  1. package/builtin-tasks/clean.js +2 -1
  2. package/builtin-tasks/clean.js.map +1 -1
  3. package/builtin-tasks/compile.js +52 -95
  4. package/builtin-tasks/compile.js.map +1 -1
  5. package/builtin-tasks/flatten.js +2 -21
  6. package/builtin-tasks/flatten.js.map +1 -1
  7. package/builtin-tasks/node.js +1 -1
  8. package/builtin-tasks/node.js.map +1 -1
  9. package/builtin-tasks/test.js +3 -3
  10. package/builtin-tasks/test.js.map +1 -1
  11. package/builtin-tasks/utils/solidity-files-cache.d.ts.map +1 -1
  12. package/builtin-tasks/utils/solidity-files-cache.js +5 -6
  13. package/builtin-tasks/utils/solidity-files-cache.js.map +1 -1
  14. package/internal/artifacts.d.ts +3 -11
  15. package/internal/artifacts.d.ts.map +1 -1
  16. package/internal/artifacts.js +266 -133
  17. package/internal/artifacts.js.map +1 -1
  18. package/internal/cli/cli.js +26 -12
  19. package/internal/cli/cli.js.map +1 -1
  20. package/internal/core/config/config-loading.js +2 -2
  21. package/internal/core/config/config-loading.js.map +1 -1
  22. package/internal/core/config/config-resolution.d.ts.map +1 -1
  23. package/internal/core/config/config-resolution.js +11 -31
  24. package/internal/core/config/config-resolution.js.map +1 -1
  25. package/internal/core/config/default-config.js +1 -1
  26. package/internal/core/config/default-config.js.map +1 -1
  27. package/internal/core/errors-list.d.ts +7 -0
  28. package/internal/core/errors-list.d.ts.map +1 -1
  29. package/internal/core/errors-list.js +28 -11
  30. package/internal/core/errors-list.js.map +1 -1
  31. package/internal/core/errors.d.ts +2 -1
  32. package/internal/core/errors.d.ts.map +1 -1
  33. package/internal/core/errors.js +5 -1
  34. package/internal/core/errors.js.map +1 -1
  35. package/internal/core/execution-mode.d.ts.map +1 -1
  36. package/internal/core/execution-mode.js +2 -21
  37. package/internal/core/execution-mode.js.map +1 -1
  38. package/internal/core/flamegraph.d.ts +4 -0
  39. package/internal/core/flamegraph.d.ts.map +1 -1
  40. package/internal/core/flamegraph.js +13 -3
  41. package/internal/core/flamegraph.js.map +1 -1
  42. package/internal/core/jsonrpc/types/base-types.d.ts.map +1 -1
  43. package/internal/core/jsonrpc/types/base-types.js +12 -12
  44. package/internal/core/jsonrpc/types/base-types.js.map +1 -1
  45. package/internal/core/params/hardhat-params.d.ts.map +1 -1
  46. package/internal/core/params/hardhat-params.js +18 -0
  47. package/internal/core/params/hardhat-params.js.map +1 -1
  48. package/internal/core/providers/accounts.js +9 -9
  49. package/internal/core/providers/accounts.js.map +1 -1
  50. package/internal/core/providers/construction.d.ts.map +1 -1
  51. package/internal/core/providers/construction.js +5 -6
  52. package/internal/core/providers/construction.js.map +1 -1
  53. package/internal/core/providers/gas-providers.d.ts +2 -2
  54. package/internal/core/providers/util.js +1 -1
  55. package/internal/core/providers/util.js.map +1 -1
  56. package/internal/core/runtime-environment.d.ts +6 -0
  57. package/internal/core/runtime-environment.d.ts.map +1 -1
  58. package/internal/core/runtime-environment.js +72 -6
  59. package/internal/core/runtime-environment.js.map +1 -1
  60. package/internal/core/typescript-support.d.ts +1 -1
  61. package/internal/core/typescript-support.d.ts.map +1 -1
  62. package/internal/core/typescript-support.js +6 -2
  63. package/internal/core/typescript-support.js.map +1 -1
  64. package/internal/hardhat-network/jsonrpc/client.d.ts +1 -1
  65. package/internal/hardhat-network/jsonrpc/client.d.ts.map +1 -1
  66. package/internal/hardhat-network/jsonrpc/client.js +10 -10
  67. package/internal/hardhat-network/jsonrpc/client.js.map +1 -1
  68. package/internal/hardhat-network/provider/BlockchainBase.d.ts +4 -4
  69. package/internal/hardhat-network/provider/BlockchainBase.d.ts.map +1 -1
  70. package/internal/hardhat-network/provider/BlockchainBase.js +31 -12
  71. package/internal/hardhat-network/provider/BlockchainBase.js.map +1 -1
  72. package/internal/hardhat-network/provider/BlockchainData.d.ts +3 -3
  73. package/internal/hardhat-network/provider/BlockchainData.d.ts.map +1 -1
  74. package/internal/hardhat-network/provider/BlockchainData.js +15 -15
  75. package/internal/hardhat-network/provider/BlockchainData.js.map +1 -1
  76. package/internal/hardhat-network/provider/HardhatBlockchain.d.ts +3 -3
  77. package/internal/hardhat-network/provider/HardhatBlockchain.d.ts.map +1 -1
  78. package/internal/hardhat-network/provider/HardhatBlockchain.js +2 -2
  79. package/internal/hardhat-network/provider/HardhatBlockchain.js.map +1 -1
  80. package/internal/hardhat-network/provider/PoolState.d.ts +1 -1
  81. package/internal/hardhat-network/provider/PoolState.d.ts.map +1 -1
  82. package/internal/hardhat-network/provider/PoolState.js +21 -2
  83. package/internal/hardhat-network/provider/PoolState.js.map +1 -1
  84. package/internal/hardhat-network/provider/TransactionQueue.d.ts +1 -1
  85. package/internal/hardhat-network/provider/TransactionQueue.d.ts.map +1 -1
  86. package/internal/hardhat-network/provider/TransactionQueue.js +22 -3
  87. package/internal/hardhat-network/provider/TransactionQueue.js.map +1 -1
  88. package/internal/hardhat-network/provider/TxPool.d.ts +4 -4
  89. package/internal/hardhat-network/provider/TxPool.d.ts.map +1 -1
  90. package/internal/hardhat-network/provider/TxPool.js +35 -16
  91. package/internal/hardhat-network/provider/TxPool.js.map +1 -1
  92. package/internal/hardhat-network/provider/ethereumjs-workarounds.js +4 -4
  93. package/internal/hardhat-network/provider/ethereumjs-workarounds.js.map +1 -1
  94. package/internal/hardhat-network/provider/filter.d.ts +1 -1
  95. package/internal/hardhat-network/provider/filter.d.ts.map +1 -1
  96. package/internal/hardhat-network/provider/filter.js +3 -3
  97. package/internal/hardhat-network/provider/filter.js.map +1 -1
  98. package/internal/hardhat-network/provider/fork/ForkBlockchain.d.ts +3 -3
  99. package/internal/hardhat-network/provider/fork/ForkBlockchain.d.ts.map +1 -1
  100. package/internal/hardhat-network/provider/fork/ForkBlockchain.js +13 -12
  101. package/internal/hardhat-network/provider/fork/ForkBlockchain.js.map +1 -1
  102. package/internal/hardhat-network/provider/fork/ForkStateManager.d.ts +3 -5
  103. package/internal/hardhat-network/provider/fork/ForkStateManager.d.ts.map +1 -1
  104. package/internal/hardhat-network/provider/fork/ForkStateManager.js +36 -40
  105. package/internal/hardhat-network/provider/fork/ForkStateManager.js.map +1 -1
  106. package/internal/hardhat-network/provider/fork/rpcToBlockData.d.ts +1 -1
  107. package/internal/hardhat-network/provider/fork/rpcToBlockData.d.ts.map +1 -1
  108. package/internal/hardhat-network/provider/fork/rpcToTxData.d.ts +2 -2
  109. package/internal/hardhat-network/provider/fork/rpcToTxData.d.ts.map +1 -1
  110. package/internal/hardhat-network/provider/fork/rpcToTxData.js.map +1 -1
  111. package/internal/hardhat-network/provider/modules/eth.d.ts +1 -1
  112. package/internal/hardhat-network/provider/modules/eth.d.ts.map +1 -1
  113. package/internal/hardhat-network/provider/modules/eth.js +22 -22
  114. package/internal/hardhat-network/provider/modules/eth.js.map +1 -1
  115. package/internal/hardhat-network/provider/modules/hardhat.d.ts +2 -0
  116. package/internal/hardhat-network/provider/modules/hardhat.d.ts.map +1 -1
  117. package/internal/hardhat-network/provider/modules/hardhat.js +20 -6
  118. package/internal/hardhat-network/provider/modules/hardhat.js.map +1 -1
  119. package/internal/hardhat-network/provider/modules/logger.d.ts +2 -2
  120. package/internal/hardhat-network/provider/modules/logger.d.ts.map +1 -1
  121. package/internal/hardhat-network/provider/modules/logger.js +14 -14
  122. package/internal/hardhat-network/provider/modules/logger.js.map +1 -1
  123. package/internal/hardhat-network/provider/modules/net.d.ts +1 -1
  124. package/internal/hardhat-network/provider/modules/net.d.ts.map +1 -1
  125. package/internal/hardhat-network/provider/modules/personal.js +3 -3
  126. package/internal/hardhat-network/provider/modules/personal.js.map +1 -1
  127. package/internal/hardhat-network/provider/modules/web3.d.ts.map +1 -1
  128. package/internal/hardhat-network/provider/modules/web3.js +4 -5
  129. package/internal/hardhat-network/provider/modules/web3.js.map +1 -1
  130. package/internal/hardhat-network/provider/node-types.d.ts +4 -4
  131. package/internal/hardhat-network/provider/node-types.d.ts.map +1 -1
  132. package/internal/hardhat-network/provider/node.d.ts +5 -4
  133. package/internal/hardhat-network/provider/node.d.ts.map +1 -1
  134. package/internal/hardhat-network/provider/node.js +71 -49
  135. package/internal/hardhat-network/provider/node.js.map +1 -1
  136. package/internal/hardhat-network/provider/output.d.ts +4 -4
  137. package/internal/hardhat-network/provider/output.d.ts.map +1 -1
  138. package/internal/hardhat-network/provider/output.js +24 -5
  139. package/internal/hardhat-network/provider/output.js.map +1 -1
  140. package/internal/hardhat-network/provider/provider.d.ts +2 -2
  141. package/internal/hardhat-network/provider/provider.d.ts.map +1 -1
  142. package/internal/hardhat-network/provider/provider.js +3 -3
  143. package/internal/hardhat-network/provider/provider.js.map +1 -1
  144. package/internal/hardhat-network/provider/return-data.d.ts +1 -1
  145. package/internal/hardhat-network/provider/return-data.d.ts.map +1 -1
  146. package/internal/hardhat-network/provider/return-data.js +5 -4
  147. package/internal/hardhat-network/provider/return-data.js.map +1 -1
  148. package/internal/hardhat-network/provider/transactions/FakeSenderAccessListEIP2930Transaction.d.ts +4 -4
  149. package/internal/hardhat-network/provider/transactions/FakeSenderAccessListEIP2930Transaction.d.ts.map +1 -1
  150. package/internal/hardhat-network/provider/transactions/FakeSenderAccessListEIP2930Transaction.js +8 -8
  151. package/internal/hardhat-network/provider/transactions/FakeSenderAccessListEIP2930Transaction.js.map +1 -1
  152. package/internal/hardhat-network/provider/transactions/FakeSenderEIP1559Transaction.d.ts +3 -3
  153. package/internal/hardhat-network/provider/transactions/FakeSenderEIP1559Transaction.d.ts.map +1 -1
  154. package/internal/hardhat-network/provider/transactions/FakeSenderEIP1559Transaction.js +8 -8
  155. package/internal/hardhat-network/provider/transactions/FakeSenderEIP1559Transaction.js.map +1 -1
  156. package/internal/hardhat-network/provider/transactions/FakeSenderTransaction.d.ts +3 -3
  157. package/internal/hardhat-network/provider/transactions/FakeSenderTransaction.d.ts.map +1 -1
  158. package/internal/hardhat-network/provider/transactions/FakeSenderTransaction.js +5 -5
  159. package/internal/hardhat-network/provider/transactions/FakeSenderTransaction.js.map +1 -1
  160. package/internal/hardhat-network/provider/transactions/ReadOnlyValidEIP1559Transaction.d.ts +4 -4
  161. package/internal/hardhat-network/provider/transactions/ReadOnlyValidEIP1559Transaction.d.ts.map +1 -1
  162. package/internal/hardhat-network/provider/transactions/ReadOnlyValidEIP1559Transaction.js +25 -6
  163. package/internal/hardhat-network/provider/transactions/ReadOnlyValidEIP1559Transaction.js.map +1 -1
  164. package/internal/hardhat-network/provider/transactions/ReadOnlyValidEIP2930Transaction.d.ts +3 -3
  165. package/internal/hardhat-network/provider/transactions/ReadOnlyValidEIP2930Transaction.d.ts.map +1 -1
  166. package/internal/hardhat-network/provider/transactions/ReadOnlyValidEIP2930Transaction.js +25 -6
  167. package/internal/hardhat-network/provider/transactions/ReadOnlyValidEIP2930Transaction.js.map +1 -1
  168. package/internal/hardhat-network/provider/transactions/ReadOnlyValidTransaction.d.ts +3 -3
  169. package/internal/hardhat-network/provider/transactions/ReadOnlyValidTransaction.d.ts.map +1 -1
  170. package/internal/hardhat-network/provider/transactions/ReadOnlyValidTransaction.js +2 -2
  171. package/internal/hardhat-network/provider/transactions/ReadOnlyValidTransaction.js.map +1 -1
  172. package/internal/hardhat-network/provider/types/HardhatBlockchainInterface.d.ts +2 -2
  173. package/internal/hardhat-network/provider/types/HardhatBlockchainInterface.d.ts.map +1 -1
  174. package/internal/hardhat-network/provider/utils/makeAccount.d.ts +1 -1
  175. package/internal/hardhat-network/provider/utils/makeAccount.d.ts.map +1 -1
  176. package/internal/hardhat-network/provider/utils/makeAccount.js +4 -4
  177. package/internal/hardhat-network/provider/utils/makeAccount.js.map +1 -1
  178. package/internal/hardhat-network/provider/utils/makeCommon.d.ts +1 -1
  179. package/internal/hardhat-network/provider/utils/makeCommon.d.ts.map +1 -1
  180. package/internal/hardhat-network/provider/utils/makeCommon.js +2 -2
  181. package/internal/hardhat-network/provider/utils/makeCommon.js.map +1 -1
  182. package/internal/hardhat-network/provider/utils/makeStateTrie.d.ts +1 -1
  183. package/internal/hardhat-network/provider/utils/makeStateTrie.d.ts.map +1 -1
  184. package/internal/hardhat-network/provider/utils/makeStateTrie.js +4 -4
  185. package/internal/hardhat-network/provider/utils/makeStateTrie.js.map +1 -1
  186. package/internal/hardhat-network/provider/utils/putGenesisBlock.d.ts +3 -3
  187. package/internal/hardhat-network/provider/utils/putGenesisBlock.d.ts.map +1 -1
  188. package/internal/hardhat-network/provider/utils/putGenesisBlock.js +4 -4
  189. package/internal/hardhat-network/provider/utils/putGenesisBlock.js.map +1 -1
  190. package/internal/hardhat-network/provider/utils/random.d.ts +2 -1
  191. package/internal/hardhat-network/provider/utils/random.d.ts.map +1 -1
  192. package/internal/hardhat-network/provider/utils/random.js +10 -9
  193. package/internal/hardhat-network/provider/utils/random.js.map +1 -1
  194. package/internal/hardhat-network/provider/utils/reorganizeTransactionsLists.js +21 -2
  195. package/internal/hardhat-network/provider/utils/reorganizeTransactionsLists.js.map +1 -1
  196. package/internal/hardhat-network/provider/utils/txMapToArray.d.ts +1 -1
  197. package/internal/hardhat-network/provider/utils/txMapToArray.d.ts.map +1 -1
  198. package/internal/hardhat-network/stack-traces/consoleLogger.js +45 -45
  199. package/internal/hardhat-network/stack-traces/consoleLogger.js.map +1 -1
  200. package/internal/hardhat-network/stack-traces/constants.d.ts +1 -1
  201. package/internal/hardhat-network/stack-traces/constants.d.ts.map +1 -1
  202. package/internal/hardhat-network/stack-traces/constants.js +1 -1
  203. package/internal/hardhat-network/stack-traces/constants.js.map +1 -1
  204. package/internal/hardhat-network/stack-traces/contracts-identifier.js +2 -2
  205. package/internal/hardhat-network/stack-traces/contracts-identifier.js.map +1 -1
  206. package/internal/hardhat-network/stack-traces/debug.js +13 -13
  207. package/internal/hardhat-network/stack-traces/debug.js.map +1 -1
  208. package/internal/hardhat-network/stack-traces/error-inferrer.js +2 -2
  209. package/internal/hardhat-network/stack-traces/error-inferrer.js.map +1 -1
  210. package/internal/hardhat-network/stack-traces/message-trace.d.ts +1 -1
  211. package/internal/hardhat-network/stack-traces/message-trace.d.ts.map +1 -1
  212. package/internal/hardhat-network/stack-traces/model.js +6 -6
  213. package/internal/hardhat-network/stack-traces/model.js.map +1 -1
  214. package/internal/hardhat-network/stack-traces/panic-errors.d.ts +1 -1
  215. package/internal/hardhat-network/stack-traces/panic-errors.js +9 -9
  216. package/internal/hardhat-network/stack-traces/panic-errors.js.map +1 -1
  217. package/internal/hardhat-network/stack-traces/solidity-errors.js +3 -3
  218. package/internal/hardhat-network/stack-traces/solidity-errors.js.map +1 -1
  219. package/internal/hardhat-network/stack-traces/solidity-stack-trace.d.ts +1 -1
  220. package/internal/hardhat-network/stack-traces/solidityTracer.d.ts +0 -2
  221. package/internal/hardhat-network/stack-traces/solidityTracer.d.ts.map +1 -1
  222. package/internal/hardhat-network/stack-traces/solidityTracer.js +2 -4
  223. package/internal/hardhat-network/stack-traces/solidityTracer.js.map +1 -1
  224. package/internal/hardhat-network/stack-traces/vm-debug-tracer.d.ts +1 -1
  225. package/internal/hardhat-network/stack-traces/vm-debug-tracer.d.ts.map +1 -1
  226. package/internal/hardhat-network/stack-traces/vm-debug-tracer.js +27 -25
  227. package/internal/hardhat-network/stack-traces/vm-debug-tracer.js.map +1 -1
  228. package/internal/hardhat-network/stack-traces/vm-tracer.d.ts +2 -2
  229. package/internal/hardhat-network/stack-traces/vm-tracer.d.ts.map +1 -1
  230. package/internal/hardhat-network/stack-traces/vm-tracer.js +15 -12
  231. package/internal/hardhat-network/stack-traces/vm-tracer.js.map +1 -1
  232. package/internal/lib/hardhat-lib.d.ts.map +1 -1
  233. package/internal/lib/hardhat-lib.js +0 -2
  234. package/internal/lib/hardhat-lib.js.map +1 -1
  235. package/internal/solidity/compilation-job.d.ts.map +1 -1
  236. package/internal/solidity/compilation-job.js +6 -7
  237. package/internal/solidity/compilation-job.js.map +1 -1
  238. package/internal/solidity/compiler/downloader.d.ts +66 -40
  239. package/internal/solidity/compiler/downloader.d.ts.map +1 -1
  240. package/internal/solidity/compiler/downloader.js +180 -154
  241. package/internal/solidity/compiler/downloader.js.map +1 -1
  242. package/internal/solidity/compiler/index.d.ts +8 -4
  243. package/internal/solidity/compiler/index.d.ts.map +1 -1
  244. package/internal/solidity/compiler/index.js +1 -1
  245. package/internal/solidity/compiler/index.js.map +1 -1
  246. package/internal/solidity/dependencyGraph.d.ts.map +1 -1
  247. package/internal/solidity/dependencyGraph.js +3 -5
  248. package/internal/solidity/dependencyGraph.js.map +1 -1
  249. package/internal/solidity/parse.d.ts.map +1 -1
  250. package/internal/solidity/parse.js +2 -58
  251. package/internal/solidity/parse.js.map +1 -1
  252. package/internal/solidity/resolver.d.ts +1 -0
  253. package/internal/solidity/resolver.d.ts.map +1 -1
  254. package/internal/solidity/resolver.js +33 -8
  255. package/internal/solidity/resolver.js.map +1 -1
  256. package/internal/util/bigint.d.ts +13 -24
  257. package/internal/util/bigint.d.ts.map +1 -1
  258. package/internal/util/bigint.js +22 -29
  259. package/internal/util/bigint.js.map +1 -1
  260. package/internal/util/download.d.ts.map +1 -1
  261. package/internal/util/download.js +1 -1
  262. package/internal/util/download.js.map +1 -1
  263. package/internal/util/fs-utils.d.ts +26 -9
  264. package/internal/util/fs-utils.d.ts.map +1 -1
  265. package/internal/util/fs-utils.js +111 -68
  266. package/internal/util/fs-utils.js.map +1 -1
  267. package/internal/util/glob.d.ts +13 -0
  268. package/internal/util/glob.d.ts.map +1 -1
  269. package/internal/util/glob.js +13 -0
  270. package/internal/util/glob.js.map +1 -1
  271. package/internal/util/keccak.d.ts +3 -0
  272. package/internal/util/keccak.d.ts.map +1 -0
  273. package/internal/util/keccak.js +12 -0
  274. package/internal/util/keccak.js.map +1 -0
  275. package/internal/util/scripts-runner.d.ts.map +1 -1
  276. package/internal/util/scripts-runner.js +7 -4
  277. package/internal/util/scripts-runner.js.map +1 -1
  278. package/package.json +15 -15
  279. package/register.js +1 -3
  280. package/register.js.map +1 -1
  281. package/sample-projects/javascript/contracts/Lock.sol +3 -3
  282. package/sample-projects/typescript/contracts/Lock.sol +3 -3
  283. package/src/builtin-tasks/clean.ts +9 -6
  284. package/src/builtin-tasks/compile.ts +96 -128
  285. package/src/builtin-tasks/flatten.ts +2 -3
  286. package/src/builtin-tasks/node.ts +2 -2
  287. package/src/builtin-tasks/test.ts +7 -3
  288. package/src/builtin-tasks/utils/solidity-files-cache.ts +9 -8
  289. package/src/internal/artifacts.ts +392 -182
  290. package/src/internal/cli/cli.ts +43 -17
  291. package/src/internal/core/config/config-loading.ts +1 -1
  292. package/src/internal/core/config/config-resolution.ts +12 -24
  293. package/src/internal/core/config/default-config.ts +1 -1
  294. package/src/internal/core/errors-list.ts +29 -13
  295. package/src/internal/core/errors.ts +10 -2
  296. package/src/internal/core/execution-mode.ts +2 -3
  297. package/src/internal/core/flamegraph.ts +270 -0
  298. package/src/internal/core/jsonrpc/types/base-types.ts +7 -3
  299. package/src/internal/core/params/hardhat-params.ts +18 -0
  300. package/src/internal/core/providers/accounts.ts +8 -8
  301. package/src/internal/core/providers/construction.ts +10 -8
  302. package/src/internal/core/providers/gas-providers.ts +2 -2
  303. package/src/internal/core/providers/util.ts +1 -1
  304. package/src/internal/core/runtime-environment.ts +103 -10
  305. package/src/internal/core/task-profiling.ts +56 -0
  306. package/src/internal/core/typescript-support.ts +11 -2
  307. package/src/internal/hardhat-network/jsonrpc/client.ts +1 -1
  308. package/src/internal/hardhat-network/provider/BlockchainBase.ts +6 -6
  309. package/src/internal/hardhat-network/provider/BlockchainData.ts +5 -5
  310. package/src/internal/hardhat-network/provider/HardhatBlockchain.ts +4 -4
  311. package/src/internal/hardhat-network/provider/PoolState.ts +2 -2
  312. package/src/internal/hardhat-network/provider/TransactionQueue.ts +2 -2
  313. package/src/internal/hardhat-network/provider/TxPool.ts +12 -5
  314. package/src/internal/hardhat-network/provider/ethereumjs-workarounds.ts +3 -3
  315. package/src/internal/hardhat-network/provider/filter.ts +2 -2
  316. package/src/internal/hardhat-network/provider/fork/ForkBlockchain.ts +10 -10
  317. package/src/internal/hardhat-network/provider/fork/ForkStateManager.ts +12 -18
  318. package/src/internal/hardhat-network/provider/fork/rpcToBlockData.ts +1 -1
  319. package/src/internal/hardhat-network/provider/fork/rpcToTxData.ts +5 -2
  320. package/src/internal/hardhat-network/provider/modules/eth.ts +10 -6
  321. package/src/internal/hardhat-network/provider/modules/hardhat.ts +25 -1
  322. package/src/internal/hardhat-network/provider/modules/logger.ts +3 -3
  323. package/src/internal/hardhat-network/provider/modules/net.ts +1 -1
  324. package/src/internal/hardhat-network/provider/modules/personal.ts +1 -1
  325. package/src/internal/hardhat-network/provider/modules/web3.ts +4 -6
  326. package/src/internal/hardhat-network/provider/node-types.ts +6 -6
  327. package/src/internal/hardhat-network/provider/node.ts +25 -12
  328. package/src/internal/hardhat-network/provider/output.ts +6 -6
  329. package/src/internal/hardhat-network/provider/provider.ts +7 -6
  330. package/src/internal/hardhat-network/provider/return-data.ts +9 -5
  331. package/src/internal/hardhat-network/provider/transactions/FakeSenderAccessListEIP2930Transaction.ts +9 -5
  332. package/src/internal/hardhat-network/provider/transactions/FakeSenderEIP1559Transaction.ts +8 -4
  333. package/src/internal/hardhat-network/provider/transactions/FakeSenderTransaction.ts +4 -4
  334. package/src/internal/hardhat-network/provider/transactions/ReadOnlyValidEIP1559Transaction.ts +8 -5
  335. package/src/internal/hardhat-network/provider/transactions/ReadOnlyValidEIP2930Transaction.ts +4 -4
  336. package/src/internal/hardhat-network/provider/transactions/ReadOnlyValidTransaction.ts +3 -3
  337. package/src/internal/hardhat-network/provider/types/HardhatBlockchainInterface.ts +2 -2
  338. package/src/internal/hardhat-network/provider/utils/makeAccount.ts +6 -1
  339. package/src/internal/hardhat-network/provider/utils/makeCommon.ts +1 -1
  340. package/src/internal/hardhat-network/provider/utils/makeStateTrie.ts +7 -3
  341. package/src/internal/hardhat-network/provider/utils/putGenesisBlock.ts +6 -6
  342. package/src/internal/hardhat-network/provider/utils/random.ts +17 -14
  343. package/src/internal/hardhat-network/provider/utils/reorganizeTransactionsLists.ts +1 -1
  344. package/src/internal/hardhat-network/stack-traces/consoleLogger.ts +1 -1
  345. package/src/internal/hardhat-network/stack-traces/constants.ts +2 -0
  346. package/src/internal/hardhat-network/stack-traces/contracts-identifier.ts +1 -1
  347. package/src/internal/hardhat-network/stack-traces/debug.ts +1 -1
  348. package/src/internal/hardhat-network/stack-traces/error-inferrer.ts +3 -3
  349. package/src/internal/hardhat-network/stack-traces/message-trace.ts +1 -1
  350. package/src/internal/hardhat-network/stack-traces/model.ts +1 -1
  351. package/src/internal/hardhat-network/stack-traces/panic-errors.ts +11 -11
  352. package/src/internal/hardhat-network/stack-traces/solidity-errors.ts +1 -1
  353. package/src/internal/hardhat-network/stack-traces/solidity-stack-trace.ts +1 -1
  354. package/src/internal/hardhat-network/stack-traces/solidityTracer.ts +1 -4
  355. package/src/internal/hardhat-network/stack-traces/vm-debug-tracer.ts +31 -17
  356. package/src/internal/hardhat-network/stack-traces/vm-tracer.ts +29 -14
  357. package/src/internal/lib/hardhat-lib.ts +0 -3
  358. package/src/internal/solidity/compilation-job.ts +11 -11
  359. package/src/internal/solidity/compiler/downloader.ts +271 -243
  360. package/src/internal/solidity/compiler/index.ts +13 -7
  361. package/src/internal/solidity/dependencyGraph.ts +12 -8
  362. package/src/internal/solidity/parse.ts +4 -70
  363. package/src/internal/solidity/resolver.ts +36 -8
  364. package/src/internal/util/bigint.ts +25 -43
  365. package/src/internal/util/download.ts +2 -2
  366. package/src/internal/util/fs-utils.ts +223 -0
  367. package/src/internal/util/glob.ts +13 -0
  368. package/src/internal/util/keccak.ts +5 -0
  369. package/src/internal/util/scripts-runner.ts +13 -4
  370. package/src/internal/util/wei-values.ts +1 -1
  371. package/src/internal/{hardhat-network/vendor → vendor}/await-semaphore/index.ts +0 -0
  372. package/src/profiling.ts +37 -0
  373. package/src/register.ts +1 -4
  374. package/src/types/artifacts.ts +21 -0
  375. package/src/types/config.ts +7 -7
  376. package/src/types/runtime.ts +2 -0
  377. package/src/utils/source-names.ts +36 -26
  378. package/types/artifacts.d.ts +19 -0
  379. package/types/artifacts.d.ts.map +1 -1
  380. package/types/config.d.ts +7 -7
  381. package/types/runtime.d.ts +2 -0
  382. package/types/runtime.d.ts.map +1 -1
  383. package/utils/source-names.d.ts.map +1 -1
  384. package/utils/source-names.js +25 -36
  385. package/utils/source-names.js.map +1 -1
  386. package/internal/hardhat-network/provider/fork/random.d.ts +0 -7
  387. package/internal/hardhat-network/provider/fork/random.d.ts.map +0 -1
  388. package/internal/hardhat-network/provider/fork/random.js +0 -32
  389. package/internal/hardhat-network/provider/fork/random.js.map +0 -1
  390. package/internal/hardhat-network/provider/utils/bnToHex.d.ts +0 -3
  391. package/internal/hardhat-network/provider/utils/bnToHex.d.ts.map +0 -1
  392. package/internal/hardhat-network/provider/utils/bnToHex.js +0 -9
  393. package/internal/hardhat-network/provider/utils/bnToHex.js.map +0 -1
  394. package/internal/hardhat-network/provider/utils/makeForkCommon.d.ts +0 -4
  395. package/internal/hardhat-network/provider/utils/makeForkCommon.d.ts.map +0 -1
  396. package/internal/hardhat-network/provider/utils/makeForkCommon.js +0 -16
  397. package/internal/hardhat-network/provider/utils/makeForkCommon.js.map +0 -1
  398. package/internal/hardhat-network/vendor/await-semaphore/index.d.ts +0 -12
  399. package/internal/hardhat-network/vendor/await-semaphore/index.d.ts.map +0 -1
  400. package/internal/hardhat-network/vendor/await-semaphore/index.js +0 -64
  401. package/internal/hardhat-network/vendor/await-semaphore/index.js.map +0 -1
  402. package/internal/util/antlr-prototype-pollution-workaround.d.ts +0 -16
  403. package/internal/util/antlr-prototype-pollution-workaround.d.ts.map +0 -1
  404. package/internal/util/antlr-prototype-pollution-workaround.js +0 -22
  405. package/internal/util/antlr-prototype-pollution-workaround.js.map +0 -1
  406. package/src/internal/util/antlr-prototype-pollution-workaround.ts +0 -17
@@ -1,7 +1,7 @@
1
1
  import * as t from "io-ts";
2
2
 
3
3
  import { SignTypedDataVersion, signTypedData } from "@metamask/eth-sig-util";
4
- import { FeeMarketEIP1559Transaction } from "@ignored/tx";
4
+ import { FeeMarketEIP1559Transaction } from "@nomicfoundation/ethereumjs-tx";
5
5
  import { EIP1193Provider, RequestArguments } from "../../../types";
6
6
  import { HardhatError } from "../errors";
7
7
  import { ERRORS } from "../errors-list";
@@ -44,7 +44,7 @@ export class LocalAccountsProvider extends ProviderWrapperWithChainId {
44
44
 
45
45
  public async request(args: RequestArguments): Promise<unknown> {
46
46
  const { ecsign, hashPersonalMessage, toRpcSig, toBuffer, bufferToHex } =
47
- await import("@ignored/util");
47
+ await import("@nomicfoundation/ethereumjs-util");
48
48
 
49
49
  if (
50
50
  args.method === "eth_accounts" ||
@@ -192,7 +192,7 @@ export class LocalAccountsProvider extends ProviderWrapperWithChainId {
192
192
  bufferToHex,
193
193
  toBuffer,
194
194
  privateToAddress,
195
- } = require("@ignored/util");
195
+ } = require("@nomicfoundation/ethereumjs-util");
196
196
 
197
197
  const privateKeys: Buffer[] = localAccountsHexPrivateKeys.map((h) =>
198
198
  toBuffer(h)
@@ -205,7 +205,7 @@ export class LocalAccountsProvider extends ProviderWrapperWithChainId {
205
205
  }
206
206
 
207
207
  private _getPrivateKeyForAddress(address: Buffer): Buffer {
208
- const { bufferToHex } = require("@ignored/util");
208
+ const { bufferToHex } = require("@nomicfoundation/ethereumjs-util");
209
209
  const pk = this._addressToPrivateKey.get(bufferToHex(address));
210
210
  if (pk === undefined) {
211
211
  throw new HardhatError(ERRORS.NETWORK.NOT_LOCAL_ACCOUNT, {
@@ -225,7 +225,7 @@ export class LocalAccountsProvider extends ProviderWrapperWithChainId {
225
225
  }
226
226
 
227
227
  private async _getNonce(address: Buffer): Promise<bigint> {
228
- const { bufferToHex } = await import("@ignored/util");
228
+ const { bufferToHex } = await import("@nomicfoundation/ethereumjs-util");
229
229
 
230
230
  const response = (await this._wrappedProvider.request({
231
231
  method: "eth_getTransactionCount",
@@ -241,10 +241,10 @@ export class LocalAccountsProvider extends ProviderWrapperWithChainId {
241
241
  privateKey: Buffer
242
242
  ): Promise<Buffer> {
243
243
  const { AccessListEIP2930Transaction, Transaction } = await import(
244
- "@ignored/tx"
244
+ "@nomicfoundation/ethereumjs-tx"
245
245
  );
246
246
 
247
- const { Common } = await import("@ignored/common");
247
+ const { Common } = await import("@nomicfoundation/ethereumjs-common");
248
248
 
249
249
  const txData = {
250
250
  ...transactionRequest,
@@ -308,7 +308,7 @@ export class HDWalletProvider extends LocalAccountsProvider {
308
308
  passphrase
309
309
  );
310
310
 
311
- const { bufferToHex } = require("@ignored/util");
311
+ const { bufferToHex } = require("@nomicfoundation/ethereumjs-util");
312
312
  const privateKeysAsHex = privateKeys.map((pk) => bufferToHex(pk));
313
313
  super(provider, privateKeysAsHex);
314
314
  }
@@ -11,14 +11,13 @@ import type {
11
11
  ProjectPathsConfig,
12
12
  } from "../../../types";
13
13
 
14
- import { HARDHAT_NETWORK_NAME } from "../../constants";
15
- import { ModulesLogger } from "../../hardhat-network/provider/modules/logger";
16
- import {
14
+ import type {
17
15
  ForkConfig,
18
16
  MempoolOrder,
19
17
  } from "../../hardhat-network/provider/node-types";
20
- import { getForkCacheDirPath } from "../../hardhat-network/provider/utils/disk-cache";
21
- import { BigIntUtils } from "../../util/bigint";
18
+ import type * as ModulesLoggerT from "../../hardhat-network/provider/modules/logger";
19
+ import type * as DiskCacheT from "../../hardhat-network/provider/utils/disk-cache";
20
+ import { HARDHAT_NETWORK_NAME } from "../../constants";
22
21
  import { parseDateString } from "../../util/date";
23
22
 
24
23
  import { normalizeHardhatNetworkAccountsConfig } from "./util";
@@ -72,9 +71,7 @@ export function createProvider(
72
71
  ) {
73
72
  forkConfig = {
74
73
  jsonRpcUrl: hardhatNetConfig.forking?.url,
75
- blockNumber: BigIntUtils.mapBigIntToNumber(
76
- hardhatNetConfig.forking?.blockNumber
77
- ),
74
+ blockNumber: hardhatNetConfig.forking?.blockNumber,
78
75
  httpHeaders: hardhatNetConfig.forking.httpHeaders,
79
76
  };
80
77
  }
@@ -83,6 +80,11 @@ export function createProvider(
83
80
  hardhatNetConfig.accounts
84
81
  );
85
82
 
83
+ const { ModulesLogger } =
84
+ require("../../hardhat-network/provider/modules/logger") as typeof ModulesLoggerT;
85
+ const { getForkCacheDirPath } =
86
+ require("../../hardhat-network/provider/utils/disk-cache") as typeof DiskCacheT;
87
+
86
88
  eip1193Provider = new HardhatNetworkProvider(
87
89
  hardhatNetConfig.hardfork,
88
90
  HARDHAT_NETWORK_NAME,
@@ -10,7 +10,7 @@ import { ProviderWrapper } from "./wrapper";
10
10
  const DEFAULT_GAS_MULTIPLIER = 1;
11
11
 
12
12
  export class FixedGasProvider extends ProviderWrapper {
13
- constructor(provider: EIP1193Provider, private readonly _gasLimit: bigint) {
13
+ constructor(provider: EIP1193Provider, private readonly _gasLimit: number) {
14
14
  super(provider);
15
15
  }
16
16
 
@@ -30,7 +30,7 @@ export class FixedGasProvider extends ProviderWrapper {
30
30
  }
31
31
 
32
32
  export class FixedGasPriceProvider extends ProviderWrapper {
33
- constructor(provider: EIP1193Provider, private readonly _gasPrice: bigint) {
33
+ constructor(provider: EIP1193Provider, private readonly _gasPrice: number) {
34
34
  super(provider);
35
35
  }
36
36
 
@@ -53,7 +53,7 @@ export function normalizeHardhatNetworkAccountsConfig(
53
53
  return accountsConfig;
54
54
  }
55
55
 
56
- const { bufferToHex } = require("@ignored/util");
56
+ const { bufferToHex } = require("@nomicfoundation/ethereumjs-util");
57
57
 
58
58
  return derivePrivateKeys(
59
59
  accountsConfig.mnemonic,
@@ -25,13 +25,21 @@ import { HardhatError } from "./errors";
25
25
  import { ERRORS } from "./errors-list";
26
26
  import { createProvider } from "./providers/construction";
27
27
  import { OverriddenTaskDefinition } from "./tasks/task-definitions";
28
+ import {
29
+ completeTaskProfile,
30
+ createParentTaskProfile,
31
+ createTaskProfile,
32
+ TaskProfile,
33
+ } from "./task-profiling";
28
34
 
29
35
  const log = debug("hardhat:core:hre");
30
36
 
31
37
  export class Environment implements HardhatRuntimeEnvironment {
32
38
  private static readonly _BLACKLISTED_PROPERTIES: string[] = [
33
39
  "injectToGlobal",
40
+ "entryTaskProfile",
34
41
  "_runTaskDefinition",
42
+ "_extenders",
35
43
  ];
36
44
 
37
45
  public network: Network;
@@ -40,6 +48,8 @@ export class Environment implements HardhatRuntimeEnvironment {
40
48
 
41
49
  private readonly _extenders: EnvironmentExtender[];
42
50
 
51
+ public entryTaskProfile?: TaskProfile;
52
+
43
53
  /**
44
54
  * Initializes the Hardhat Runtime Environment and the given
45
55
  * extender functions.
@@ -111,7 +121,11 @@ export class Environment implements HardhatRuntimeEnvironment {
111
121
  * @throws a HH303 if there aren't any defined tasks with the given name.
112
122
  * @returns a promise with the task's execution result.
113
123
  */
114
- public readonly run: RunTaskFunction = async (name, taskArguments = {}) => {
124
+ public readonly run: RunTaskFunction = async (
125
+ name,
126
+ taskArguments = {},
127
+ callerTaskProfile?: TaskProfile
128
+ ) => {
115
129
  const taskDefinition = this.tasks[name];
116
130
 
117
131
  log("Running task %s", name);
@@ -127,16 +141,32 @@ export class Environment implements HardhatRuntimeEnvironment {
127
141
  taskArguments
128
142
  );
129
143
 
144
+ let taskProfile: TaskProfile | undefined;
145
+ if (this.hardhatArguments.flamegraph === true) {
146
+ taskProfile = createTaskProfile(name);
147
+
148
+ if (callerTaskProfile !== undefined) {
149
+ callerTaskProfile.children.push(taskProfile);
150
+ } else {
151
+ this.entryTaskProfile = taskProfile;
152
+ }
153
+ }
154
+
130
155
  try {
131
156
  return await this._runTaskDefinition(
132
157
  taskDefinition,
133
- resolvedTaskArguments
158
+ resolvedTaskArguments,
159
+ taskProfile
134
160
  );
135
161
  } catch (e) {
136
162
  analyzeModuleNotFoundError(e, this.config.paths.configFile);
137
163
 
138
164
  // eslint-disable-next-line @nomiclabs/hardhat-internal-rules/only-hardhat-error
139
165
  throw e;
166
+ } finally {
167
+ if (taskProfile !== undefined) {
168
+ completeTaskProfile(taskProfile);
169
+ }
140
170
  }
141
171
  };
142
172
 
@@ -178,10 +208,15 @@ export class Environment implements HardhatRuntimeEnvironment {
178
208
  };
179
209
  }
180
210
 
211
+ /**
212
+ * @param taskProfile Undefined if we aren't computing task profiles
213
+ * @private
214
+ */
181
215
  private async _runTaskDefinition(
182
216
  taskDefinition: TaskDefinition,
183
- taskArguments: TaskArguments
184
- ) {
217
+ taskArguments: TaskArguments,
218
+ taskProfile?: TaskProfile
219
+ ): Promise<any> {
185
220
  let runSuperFunction: any;
186
221
 
187
222
  if (taskDefinition instanceof OverriddenTaskDefinition) {
@@ -190,10 +225,25 @@ export class Environment implements HardhatRuntimeEnvironment {
190
225
  ) => {
191
226
  log("Running %s's super", taskDefinition.name);
192
227
 
193
- return this._runTaskDefinition(
194
- taskDefinition.parentTaskDefinition,
195
- _taskArguments
196
- );
228
+ if (taskProfile === undefined) {
229
+ return this._runTaskDefinition(
230
+ taskDefinition.parentTaskDefinition,
231
+ _taskArguments
232
+ );
233
+ }
234
+
235
+ const parentTaskProfile = createParentTaskProfile(taskProfile);
236
+ taskProfile.children.push(parentTaskProfile);
237
+
238
+ try {
239
+ return await this._runTaskDefinition(
240
+ taskDefinition.parentTaskDefinition,
241
+ _taskArguments,
242
+ parentTaskProfile
243
+ );
244
+ } finally {
245
+ completeTaskProfile(parentTaskProfile);
246
+ }
197
247
  };
198
248
 
199
249
  runSuperFunction.isDefined = true;
@@ -213,10 +263,53 @@ export class Environment implements HardhatRuntimeEnvironment {
213
263
  const previousRunSuper: any = globalAsAny.runSuper;
214
264
  globalAsAny.runSuper = runSuper;
215
265
 
216
- const uninjectFromGlobal = this.injectToGlobal();
266
+ let modifiedHreWithParentTaskProfile: any | undefined;
267
+ if (this.hardhatArguments.flamegraph === true) {
268
+ // We create a modified version of `this`, as we want to keep track of the
269
+ // `taskProfile` and use it as `callerTaskProfile` if the action calls
270
+ // `run`, and add a few utility methods.
271
+ //
272
+ // Note that for this to work we need to set the prototype later
273
+ modifiedHreWithParentTaskProfile = {
274
+ ...this,
275
+ run: (_name: string, _taskArguments: TaskArguments) =>
276
+ (this as any).run(_name, _taskArguments, taskProfile),
277
+ adhocProfile: async (_name: string, f: () => Promise<any>) => {
278
+ const adhocProfile = createTaskProfile(_name);
279
+ taskProfile!.children.push(adhocProfile);
280
+ try {
281
+ return await f();
282
+ } finally {
283
+ completeTaskProfile(adhocProfile);
284
+ }
285
+ },
286
+ adhocProfileSync: (_name: string, f: () => any) => {
287
+ const adhocProfile = createTaskProfile(_name);
288
+ taskProfile!.children.push(adhocProfile);
289
+ try {
290
+ return f();
291
+ } finally {
292
+ completeTaskProfile(adhocProfile);
293
+ }
294
+ },
295
+ };
296
+
297
+ Object.setPrototypeOf(
298
+ modifiedHreWithParentTaskProfile,
299
+ Object.getPrototypeOf(this)
300
+ );
301
+ }
302
+
303
+ const uninjectFromGlobal =
304
+ modifiedHreWithParentTaskProfile?.injectToGlobal() ??
305
+ this.injectToGlobal();
217
306
 
218
307
  try {
219
- return await taskDefinition.action(taskArguments, this, runSuper);
308
+ return await taskDefinition.action(
309
+ taskArguments,
310
+ modifiedHreWithParentTaskProfile ?? this,
311
+ runSuper
312
+ );
220
313
  } finally {
221
314
  uninjectFromGlobal();
222
315
  globalAsAny.runSuper = previousRunSuper;
@@ -0,0 +1,56 @@
1
+ export interface TaskProfile {
2
+ name: string;
3
+ start: bigint;
4
+ end?: bigint;
5
+ children: TaskProfile[];
6
+ parallel?: boolean;
7
+ }
8
+
9
+ export function createTaskProfile(name: string): TaskProfile {
10
+ return {
11
+ name,
12
+ start: process.hrtime.bigint(),
13
+ children: [],
14
+ };
15
+ }
16
+
17
+ export function completeTaskProfile(taskProfile: TaskProfile) {
18
+ taskProfile.end = process.hrtime.bigint();
19
+ }
20
+
21
+ export function createParentTaskProfile(taskProfile: TaskProfile): TaskProfile {
22
+ return createTaskProfile(`super::${taskProfile.name}`);
23
+ }
24
+
25
+ /**
26
+ * Sets `parallel` to `true` to any children that was running at the same time
27
+ * of another.
28
+ *
29
+ * We assume `children[]` is in chronological `start` order.
30
+ */
31
+ export function flagParallelChildren(
32
+ profile: TaskProfile,
33
+ isParentParallel = false
34
+ ) {
35
+ if (isParentParallel) {
36
+ profile.parallel = true;
37
+ for (const child of profile.children) {
38
+ child.parallel = true;
39
+ }
40
+ } else {
41
+ for (const [i, child] of profile.children.entries()) {
42
+ if (i === 0) {
43
+ continue;
44
+ }
45
+ const prevChild = profile.children[i - 1];
46
+ if (child.start < prevChild.end!) {
47
+ prevChild.parallel = true;
48
+ child.parallel = true;
49
+ }
50
+ }
51
+ }
52
+
53
+ for (const child of profile.children) {
54
+ flagParallelChildren(child, child.parallel);
55
+ }
56
+ }
@@ -38,7 +38,10 @@ export function isTypescriptSupported() {
38
38
  return cachedIsTypescriptSupported;
39
39
  }
40
40
 
41
- export function loadTsNode(tsConfigPath?: string) {
41
+ export function loadTsNode(
42
+ tsConfigPath?: string,
43
+ shouldTypecheck: boolean = false
44
+ ) {
42
45
  try {
43
46
  require.resolve("typescript");
44
47
  } catch {
@@ -67,8 +70,14 @@ export function loadTsNode(tsConfigPath?: string) {
67
70
  process.env.TS_NODE_FILES = "true";
68
71
  }
69
72
 
73
+ let tsNodeRequirement = "ts-node/register";
74
+
75
+ if (!shouldTypecheck) {
76
+ tsNodeRequirement += "/transpile-only";
77
+ }
78
+
70
79
  // eslint-disable-next-line import/no-extraneous-dependencies
71
- require("ts-node/register");
80
+ require(tsNodeRequirement);
72
81
  }
73
82
 
74
83
  function isTypescriptFile(path: string): boolean {
@@ -1,4 +1,4 @@
1
- import { Address, bufferToHex } from "@ignored/util";
1
+ import { Address, bufferToHex } from "@nomicfoundation/ethereumjs-util";
2
2
  import fsExtra from "fs-extra";
3
3
  import * as t from "io-ts";
4
4
  import path from "path";
@@ -1,16 +1,16 @@
1
- import { Block, BlockHeader } from "@ignored/block";
1
+ import { Block, BlockHeader } from "@nomicfoundation/ethereumjs-block";
2
2
  import {
3
3
  BlockchainInterface,
4
4
  CasperConsensus,
5
5
  CliqueConsensus,
6
6
  Consensus,
7
7
  EthashConsensus,
8
- } from "@ignored/blockchain";
9
- import { Common, ConsensusAlgorithm } from "@ignored/common";
10
- import { TypedTransaction } from "@ignored/tx";
8
+ } from "@nomicfoundation/ethereumjs-blockchain";
9
+ import { Common, ConsensusAlgorithm } from "@nomicfoundation/ethereumjs-common";
10
+ import { TypedTransaction } from "@nomicfoundation/ethereumjs-tx";
11
11
 
12
12
  import { assertHardhatInvariant } from "../../core/errors";
13
- import { BigIntUtils } from "../../util/bigint";
13
+ import * as BigIntUtils from "../../util/bigint";
14
14
  import { BlockchainData } from "./BlockchainData";
15
15
  import { RpcReceiptOutput } from "./output";
16
16
 
@@ -23,7 +23,7 @@ export abstract class BlockchainBase {
23
23
  constructor(protected _common: Common) {
24
24
  this._data = new BlockchainData(_common);
25
25
 
26
- // copied from blockchain.ts in @ignored/blockchain
26
+ // copied from blockchain.ts in @nomicfoundation/ethereumjs-blockchain
27
27
  switch (this._common.consensusAlgorithm()) {
28
28
  case ConsensusAlgorithm.Casper:
29
29
  this.consensus = new CasperConsensus();
@@ -1,8 +1,8 @@
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 { Bloom } from "@ignored/vm";
1
+ import { Block } from "@nomicfoundation/ethereumjs-block";
2
+ import { Common } from "@nomicfoundation/ethereumjs-common";
3
+ import { TypedTransaction } from "@nomicfoundation/ethereumjs-tx";
4
+ import { bufferToHex } from "@nomicfoundation/ethereumjs-util";
5
+ import { Bloom } from "@nomicfoundation/ethereumjs-vm";
6
6
 
7
7
  import { assertHardhatInvariant } from "../../core/errors";
8
8
  import { bloomFilter, filterLogs } from "./filter";
@@ -1,7 +1,7 @@
1
- import { Block } from "@ignored/block";
2
- import { Common } from "@ignored/common";
3
- import { TypedTransaction } from "@ignored/tx";
4
- import { zeros } from "@ignored/util";
1
+ import { Block } from "@nomicfoundation/ethereumjs-block";
2
+ import { Common } from "@nomicfoundation/ethereumjs-common";
3
+ import { TypedTransaction } from "@nomicfoundation/ethereumjs-tx";
4
+ import { zeros } from "@nomicfoundation/ethereumjs-util";
5
5
 
6
6
  import { BlockchainBase } from "./BlockchainBase";
7
7
  import { FilterParams } from "./node-types";
@@ -1,11 +1,11 @@
1
- import { TypedTransaction } from "@ignored/tx";
1
+ import { TypedTransaction } from "@nomicfoundation/ethereumjs-tx";
2
2
  import {
3
3
  List as ImmutableList,
4
4
  Map as ImmutableMap,
5
5
  Record as ImmutableRecord,
6
6
  } from "immutable";
7
7
 
8
- import { BigIntUtils } from "../../util/bigint";
8
+ import * as BigIntUtils from "../../util/bigint";
9
9
 
10
10
  export interface OrderedTransaction {
11
11
  orderId: number;
@@ -1,8 +1,8 @@
1
- import { TypedTransaction } from "@ignored/tx";
1
+ import { TypedTransaction } from "@nomicfoundation/ethereumjs-tx";
2
2
  import Heap from "mnemonist/heap";
3
3
 
4
4
  import { InternalError, InvalidInputError } from "../../core/providers/errors";
5
- import { BigIntUtils } from "../../util/bigint";
5
+ import * as BigIntUtils from "../../util/bigint";
6
6
  import { MempoolOrder } from "./node-types";
7
7
  import { OrderedTransaction } from "./PoolState";
8
8
 
@@ -1,11 +1,18 @@
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";
1
+ import { Common } from "@nomicfoundation/ethereumjs-common";
2
+ import {
3
+ TransactionFactory,
4
+ TypedTransaction,
5
+ } from "@nomicfoundation/ethereumjs-tx";
6
+ import { StateManager } from "@nomicfoundation/ethereumjs-statemanager";
7
+ import {
8
+ Address,
9
+ bufferToHex,
10
+ toBuffer,
11
+ } from "@nomicfoundation/ethereumjs-util";
5
12
  import { List as ImmutableList, Record as ImmutableRecord } from "immutable";
6
13
 
7
14
  import { InvalidInputError } from "../../core/providers/errors";
8
- import { BigIntUtils } from "../../util/bigint";
15
+ import * as BigIntUtils from "../../util/bigint";
9
16
 
10
17
  import {
11
18
  AddressToTransactions,
@@ -1,10 +1,10 @@
1
- import { TransactionFactory } from "@ignored/tx";
2
- import { BaseTransaction } from "@ignored/tx/dist/baseTransaction";
1
+ import { TransactionFactory } from "@nomicfoundation/ethereumjs-tx";
2
+ import { BaseTransaction } from "@nomicfoundation/ethereumjs-tx/dist/baseTransaction";
3
3
  import {
4
4
  AccessListEIP2930TxData,
5
5
  TxData,
6
6
  TxOptions,
7
- } from "@ignored/tx/dist/types";
7
+ } from "@nomicfoundation/ethereumjs-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,5 +1,5 @@
1
- import { bufferToHex, toBuffer } from "@ignored/util";
2
- import { Bloom } from "@ignored/vm";
1
+ import { bufferToHex, toBuffer } from "@nomicfoundation/ethereumjs-util";
2
+ import { Bloom } from "@nomicfoundation/ethereumjs-vm";
3
3
 
4
4
  import { RpcLogOutput } from "./output";
5
5
 
@@ -1,9 +1,9 @@
1
- import { Block } from "@ignored/block";
2
- import { Common } from "@ignored/common";
3
- import { TypedTransaction } from "@ignored/tx";
4
- import { Address } from "@ignored/util";
1
+ import { Block } from "@nomicfoundation/ethereumjs-block";
2
+ import { Common } from "@nomicfoundation/ethereumjs-common";
3
+ import { TypedTransaction } from "@nomicfoundation/ethereumjs-tx";
4
+ import { Address } from "@nomicfoundation/ethereumjs-util";
5
5
 
6
- import { FeeMarketEIP1559TxData } from "@ignored/tx/dist/types";
6
+ import { FeeMarketEIP1559TxData } from "@nomicfoundation/ethereumjs-tx/dist/types";
7
7
  import { RpcBlockWithTransactions } from "../../../core/jsonrpc/types/output/block";
8
8
  import { RpcTransactionReceipt } from "../../../core/jsonrpc/types/output/receipt";
9
9
  import { RpcTransaction } from "../../../core/jsonrpc/types/output/transaction";
@@ -252,13 +252,13 @@ export class ForkBlockchain
252
252
  return undefined;
253
253
  }
254
254
 
255
- const forkNetworkId = this._jsonRpcClient.getNetworkId();
256
- const common = new Common({ chain: forkNetworkId });
257
-
255
+ const common = this._common.copy();
258
256
  // We set the common's hardfork to Berlin if the remote block doesn't have
259
257
  // EIP-1559 activated. The reason for this is that ethereumjs throws if we
260
258
  // have a base fee for an older hardfork, and set a default one for London.
261
- if (rpcBlock.baseFeePerGas === undefined) {
259
+ if (rpcBlock.baseFeePerGas !== undefined) {
260
+ common.setHardfork("london"); // TODO: consider changing this to "latest hardfork"
261
+ } else {
262
262
  common.setHardfork("berlin");
263
263
  }
264
264
 
@@ -276,7 +276,7 @@ export class ForkBlockchain
276
276
  freeze: false,
277
277
 
278
278
  // don't validate things like the size of `extraData` in the header
279
- consensusFormatValidation: false,
279
+ skipConsensusFormatValidation: true,
280
280
  });
281
281
 
282
282
  for (const transaction of rpcBlock.transactions) {
@@ -1,4 +1,4 @@
1
- import { StateManager } from "@ignored/statemanager";
1
+ import { StateManager } from "@nomicfoundation/ethereumjs-statemanager";
2
2
  import {
3
3
  Account,
4
4
  bigIntToHex,
@@ -8,12 +8,12 @@ import {
8
8
  KECCAK256_NULL,
9
9
  toBuffer,
10
10
  unpadBuffer,
11
- } from "@ignored/util";
12
- import { keccak256 } from "ethereum-cryptography/keccak";
11
+ } from "@nomicfoundation/ethereumjs-util";
13
12
  import { Map as ImmutableMap, Record as ImmutableRecord } from "immutable";
14
13
 
15
14
  import { assertHardhatInvariant } from "../../../core/errors";
16
15
  import { InternalError } from "../../../core/providers/errors";
16
+ import { keccak256 } from "../../../util/keccak";
17
17
  import { JsonRpcClient } from "../../jsonrpc/client";
18
18
  import { GenesisAccount } from "../node-types";
19
19
  import { makeAccount } from "../utils/makeAccount";
@@ -52,12 +52,6 @@ export class ForkStateManager implements StateManager {
52
52
  private _contextBlockNumber = this._forkBlockNumber;
53
53
  private _contextChanged = false;
54
54
 
55
- // used by the DefaultStateManager calls
56
- private _accessedStorage: Array<Map<string, Set<string>>> = [new Map()];
57
- private _accessedStorageReverted: Array<Map<string, Set<string>>> = [
58
- new Map(),
59
- ];
60
-
61
55
  constructor(
62
56
  private readonly _jsonRpcClient: JsonRpcClient,
63
57
  private readonly _forkBlockNumber: bigint
@@ -258,7 +252,6 @@ export class ForkStateManager implements StateManager {
258
252
  public async checkpoint(): Promise<void> {
259
253
  const stateRoot = await this.getStateRoot();
260
254
  this._stateCheckpoints.push(bufferToHex(stateRoot));
261
- this._accessedStorage.push(new Map());
262
255
  }
263
256
 
264
257
  public async commit(): Promise<void> {
@@ -274,11 +267,6 @@ export class ForkStateManager implements StateManager {
274
267
  throw notCheckpointedError("revert");
275
268
  }
276
269
  await this.setStateRoot(toBuffer(checkpointedRoot));
277
-
278
- const lastItem = this._accessedStorage.pop();
279
- if (lastItem !== undefined) {
280
- this._accessedStorageReverted.push(lastItem);
281
- }
282
270
  }
283
271
 
284
272
  public async getStateRoot(): Promise<Buffer> {
@@ -438,9 +426,15 @@ export class ForkStateManager implements StateManager {
438
426
  }
439
427
 
440
428
  public async modifyAccountFields(
441
- _address: Address,
442
- _accountFields: any
429
+ address: Address,
430
+ accountFields: any
443
431
  ): Promise<void> {
444
- // not implemented
432
+ // copied from BaseStateManager
433
+ const account = await this.getAccount(address);
434
+ account.nonce = accountFields.nonce ?? account.nonce;
435
+ account.balance = accountFields.balance ?? account.balance;
436
+ account.storageRoot = accountFields.storageRoot ?? account.storageRoot;
437
+ account.codeHash = accountFields.codeHash ?? account.codeHash;
438
+ await this.putAccount(address, account);
445
439
  }
446
440
  }
@@ -1,4 +1,4 @@
1
- import { BlockData } from "@ignored/block";
1
+ import { BlockData } from "@nomicfoundation/ethereumjs-block";
2
2
 
3
3
  import { RpcBlockWithTransactions } from "../../../core/jsonrpc/types/output/block";
4
4