@aztec/p2p 0.0.1-commit.f504929 → 0.0.1-commit.f5d02921e

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 (283) hide show
  1. package/README.md +129 -3
  2. package/dest/client/factory.d.ts +2 -2
  3. package/dest/client/factory.d.ts.map +1 -1
  4. package/dest/client/factory.js +25 -11
  5. package/dest/client/interface.d.ts +9 -2
  6. package/dest/client/interface.d.ts.map +1 -1
  7. package/dest/client/p2p_client.d.ts +3 -2
  8. package/dest/client/p2p_client.d.ts.map +1 -1
  9. package/dest/client/p2p_client.js +37 -36
  10. package/dest/client/test/tx_proposal_collector/proposal_tx_collector_worker.js +17 -6
  11. package/dest/config.d.ts +24 -2
  12. package/dest/config.d.ts.map +1 -1
  13. package/dest/config.js +66 -7
  14. package/dest/errors/p2p-service.error.d.ts +9 -0
  15. package/dest/errors/p2p-service.error.d.ts.map +1 -0
  16. package/dest/errors/p2p-service.error.js +10 -0
  17. package/dest/index.d.ts +1 -2
  18. package/dest/index.d.ts.map +1 -1
  19. package/dest/index.js +0 -1
  20. package/dest/mem_pools/attestation_pool/attestation_pool.d.ts +4 -4
  21. package/dest/mem_pools/attestation_pool/attestation_pool.d.ts.map +1 -1
  22. package/dest/mem_pools/attestation_pool/attestation_pool.js +6 -5
  23. package/dest/mem_pools/attestation_pool/attestation_pool_test_suite.js +6 -6
  24. package/dest/mem_pools/index.d.ts +1 -2
  25. package/dest/mem_pools/index.d.ts.map +1 -1
  26. package/dest/mem_pools/tx_pool_v2/eviction/fee_payer_balance_eviction_rule.d.ts +1 -1
  27. package/dest/mem_pools/tx_pool_v2/eviction/fee_payer_balance_eviction_rule.d.ts.map +1 -1
  28. package/dest/mem_pools/tx_pool_v2/eviction/fee_payer_balance_eviction_rule.js +2 -1
  29. package/dest/mem_pools/tx_pool_v2/eviction/interfaces.d.ts +7 -1
  30. package/dest/mem_pools/tx_pool_v2/eviction/interfaces.d.ts.map +1 -1
  31. package/dest/mem_pools/tx_pool_v2/eviction/low_priority_pre_add_rule.d.ts +1 -1
  32. package/dest/mem_pools/tx_pool_v2/eviction/low_priority_pre_add_rule.d.ts.map +1 -1
  33. package/dest/mem_pools/tx_pool_v2/eviction/low_priority_pre_add_rule.js +8 -6
  34. package/dest/mem_pools/tx_pool_v2/eviction/nullifier_conflict_rule.d.ts +2 -2
  35. package/dest/mem_pools/tx_pool_v2/eviction/nullifier_conflict_rule.d.ts.map +1 -1
  36. package/dest/mem_pools/tx_pool_v2/eviction/nullifier_conflict_rule.js +2 -2
  37. package/dest/mem_pools/tx_pool_v2/interfaces.d.ts +9 -5
  38. package/dest/mem_pools/tx_pool_v2/interfaces.d.ts.map +1 -1
  39. package/dest/mem_pools/tx_pool_v2/interfaces.js +2 -1
  40. package/dest/mem_pools/tx_pool_v2/tx_metadata.d.ts +25 -10
  41. package/dest/mem_pools/tx_pool_v2/tx_metadata.d.ts.map +1 -1
  42. package/dest/mem_pools/tx_pool_v2/tx_metadata.js +38 -11
  43. package/dest/mem_pools/tx_pool_v2/tx_pool_indices.d.ts +1 -1
  44. package/dest/mem_pools/tx_pool_v2/tx_pool_indices.d.ts.map +1 -1
  45. package/dest/mem_pools/tx_pool_v2/tx_pool_indices.js +26 -43
  46. package/dest/mem_pools/tx_pool_v2/tx_pool_v2.d.ts +4 -2
  47. package/dest/mem_pools/tx_pool_v2/tx_pool_v2.d.ts.map +1 -1
  48. package/dest/mem_pools/tx_pool_v2/tx_pool_v2.js +3 -0
  49. package/dest/mem_pools/tx_pool_v2/tx_pool_v2_impl.d.ts +1 -1
  50. package/dest/mem_pools/tx_pool_v2/tx_pool_v2_impl.d.ts.map +1 -1
  51. package/dest/mem_pools/tx_pool_v2/tx_pool_v2_impl.js +21 -6
  52. package/dest/msg_validators/attestation_validator/attestation_validator.d.ts +1 -1
  53. package/dest/msg_validators/attestation_validator/attestation_validator.d.ts.map +1 -1
  54. package/dest/msg_validators/attestation_validator/attestation_validator.js +5 -4
  55. package/dest/msg_validators/clock_tolerance.d.ts +1 -1
  56. package/dest/msg_validators/clock_tolerance.d.ts.map +1 -1
  57. package/dest/msg_validators/clock_tolerance.js +4 -3
  58. package/dest/msg_validators/proposal_validator/block_proposal_validator.d.ts +5 -4
  59. package/dest/msg_validators/proposal_validator/block_proposal_validator.d.ts.map +1 -1
  60. package/dest/msg_validators/proposal_validator/block_proposal_validator.js +10 -2
  61. package/dest/msg_validators/proposal_validator/checkpoint_proposal_validator.d.ts +5 -4
  62. package/dest/msg_validators/proposal_validator/checkpoint_proposal_validator.d.ts.map +1 -1
  63. package/dest/msg_validators/proposal_validator/checkpoint_proposal_validator.js +16 -2
  64. package/dest/msg_validators/proposal_validator/proposal_validator.d.ts +12 -9
  65. package/dest/msg_validators/proposal_validator/proposal_validator.d.ts.map +1 -1
  66. package/dest/msg_validators/proposal_validator/proposal_validator.js +51 -49
  67. package/dest/msg_validators/tx_validator/allowed_public_setup.d.ts +1 -1
  68. package/dest/msg_validators/tx_validator/allowed_public_setup.d.ts.map +1 -1
  69. package/dest/msg_validators/tx_validator/allowed_public_setup.js +21 -32
  70. package/dest/msg_validators/tx_validator/allowed_setup_helpers.d.ts +17 -0
  71. package/dest/msg_validators/tx_validator/allowed_setup_helpers.d.ts.map +1 -0
  72. package/dest/msg_validators/tx_validator/allowed_setup_helpers.js +24 -0
  73. package/dest/msg_validators/tx_validator/contract_instance_validator.d.ts +9 -0
  74. package/dest/msg_validators/tx_validator/contract_instance_validator.d.ts.map +1 -0
  75. package/dest/msg_validators/tx_validator/contract_instance_validator.js +48 -0
  76. package/dest/msg_validators/tx_validator/data_validator.d.ts +1 -1
  77. package/dest/msg_validators/tx_validator/data_validator.d.ts.map +1 -1
  78. package/dest/msg_validators/tx_validator/data_validator.js +35 -2
  79. package/dest/msg_validators/tx_validator/factory.d.ts +23 -4
  80. package/dest/msg_validators/tx_validator/factory.d.ts.map +1 -1
  81. package/dest/msg_validators/tx_validator/factory.js +36 -10
  82. package/dest/msg_validators/tx_validator/fee_payer_balance.d.ts +1 -1
  83. package/dest/msg_validators/tx_validator/fee_payer_balance.d.ts.map +1 -1
  84. package/dest/msg_validators/tx_validator/fee_payer_balance.js +6 -2
  85. package/dest/msg_validators/tx_validator/gas_validator.d.ts +13 -4
  86. package/dest/msg_validators/tx_validator/gas_validator.d.ts.map +1 -1
  87. package/dest/msg_validators/tx_validator/gas_validator.js +39 -9
  88. package/dest/msg_validators/tx_validator/index.d.ts +2 -1
  89. package/dest/msg_validators/tx_validator/index.d.ts.map +1 -1
  90. package/dest/msg_validators/tx_validator/index.js +1 -0
  91. package/dest/msg_validators/tx_validator/metadata_validator.d.ts +1 -1
  92. package/dest/msg_validators/tx_validator/metadata_validator.d.ts.map +1 -1
  93. package/dest/msg_validators/tx_validator/metadata_validator.js +4 -4
  94. package/dest/msg_validators/tx_validator/phases_validator.d.ts +21 -1
  95. package/dest/msg_validators/tx_validator/phases_validator.d.ts.map +1 -1
  96. package/dest/msg_validators/tx_validator/phases_validator.js +49 -2
  97. package/dest/services/dummy_service.d.ts +5 -3
  98. package/dest/services/dummy_service.d.ts.map +1 -1
  99. package/dest/services/dummy_service.js +5 -1
  100. package/dest/services/encoding.d.ts +5 -1
  101. package/dest/services/encoding.d.ts.map +1 -1
  102. package/dest/services/encoding.js +7 -1
  103. package/dest/services/libp2p/libp2p_service.d.ts +14 -11
  104. package/dest/services/libp2p/libp2p_service.d.ts.map +1 -1
  105. package/dest/services/libp2p/libp2p_service.js +146 -74
  106. package/dest/services/peer-manager/peer_manager.d.ts +6 -2
  107. package/dest/services/peer-manager/peer_manager.d.ts.map +1 -1
  108. package/dest/services/peer-manager/peer_manager.js +22 -8
  109. package/dest/services/peer-manager/peer_scoring.d.ts +5 -2
  110. package/dest/services/peer-manager/peer_scoring.d.ts.map +1 -1
  111. package/dest/services/peer-manager/peer_scoring.js +28 -10
  112. package/dest/services/reqresp/batch-tx-requester/batch_tx_requester.d.ts +11 -8
  113. package/dest/services/reqresp/batch-tx-requester/batch_tx_requester.d.ts.map +1 -1
  114. package/dest/services/reqresp/batch-tx-requester/batch_tx_requester.js +69 -65
  115. package/dest/services/reqresp/batch-tx-requester/interface.d.ts +3 -2
  116. package/dest/services/reqresp/batch-tx-requester/interface.d.ts.map +1 -1
  117. package/dest/services/reqresp/batch-tx-requester/missing_txs.d.ts +5 -4
  118. package/dest/services/reqresp/batch-tx-requester/missing_txs.d.ts.map +1 -1
  119. package/dest/services/reqresp/batch-tx-requester/missing_txs.js +13 -7
  120. package/dest/services/reqresp/batch-tx-requester/peer_collection.d.ts +3 -1
  121. package/dest/services/reqresp/batch-tx-requester/peer_collection.d.ts.map +1 -1
  122. package/dest/services/reqresp/batch-tx-requester/peer_collection.js +3 -0
  123. package/dest/services/reqresp/rate-limiter/rate_limiter.d.ts +5 -4
  124. package/dest/services/reqresp/rate-limiter/rate_limiter.d.ts.map +1 -1
  125. package/dest/services/reqresp/rate-limiter/rate_limiter.js +10 -8
  126. package/dest/services/reqresp/reqresp.d.ts +1 -1
  127. package/dest/services/reqresp/reqresp.d.ts.map +1 -1
  128. package/dest/services/reqresp/reqresp.js +17 -9
  129. package/dest/services/service.d.ts +5 -2
  130. package/dest/services/service.d.ts.map +1 -1
  131. package/dest/services/tx_collection/fast_tx_collection.d.ts +1 -4
  132. package/dest/services/tx_collection/fast_tx_collection.d.ts.map +1 -1
  133. package/dest/services/tx_collection/fast_tx_collection.js +57 -73
  134. package/dest/services/tx_collection/file_store_tx_source.d.ts +5 -4
  135. package/dest/services/tx_collection/file_store_tx_source.d.ts.map +1 -1
  136. package/dest/services/tx_collection/file_store_tx_source.js +39 -29
  137. package/dest/services/tx_collection/proposal_tx_collector.d.ts +6 -7
  138. package/dest/services/tx_collection/proposal_tx_collector.d.ts.map +1 -1
  139. package/dest/services/tx_collection/proposal_tx_collector.js +4 -4
  140. package/dest/services/tx_collection/request_tracker.d.ts +53 -0
  141. package/dest/services/tx_collection/request_tracker.d.ts.map +1 -0
  142. package/dest/services/tx_collection/request_tracker.js +84 -0
  143. package/dest/services/tx_collection/slow_tx_collection.js +1 -1
  144. package/dest/services/tx_collection/tx_collection.d.ts +3 -6
  145. package/dest/services/tx_collection/tx_collection.d.ts.map +1 -1
  146. package/dest/services/tx_collection/tx_source.d.ts +6 -5
  147. package/dest/services/tx_collection/tx_source.d.ts.map +1 -1
  148. package/dest/services/tx_collection/tx_source.js +9 -7
  149. package/dest/test-helpers/make-test-p2p-clients.d.ts +1 -1
  150. package/dest/test-helpers/make-test-p2p-clients.d.ts.map +1 -1
  151. package/dest/test-helpers/reqresp-nodes.d.ts +1 -1
  152. package/dest/test-helpers/reqresp-nodes.d.ts.map +1 -1
  153. package/dest/test-helpers/testbench-utils.d.ts +1 -1
  154. package/dest/test-helpers/testbench-utils.d.ts.map +1 -1
  155. package/dest/test-helpers/testbench-utils.js +22 -3
  156. package/dest/testbench/p2p_client_testbench_worker.js +46 -16
  157. package/dest/testbench/worker_client_manager.d.ts +3 -1
  158. package/dest/testbench/worker_client_manager.d.ts.map +1 -1
  159. package/dest/testbench/worker_client_manager.js +6 -3
  160. package/dest/util.d.ts +1 -1
  161. package/package.json +14 -14
  162. package/src/client/factory.ts +43 -14
  163. package/src/client/interface.ts +9 -1
  164. package/src/client/p2p_client.ts +39 -36
  165. package/src/client/test/tx_proposal_collector/proposal_tx_collector_worker.ts +19 -9
  166. package/src/config.ts +92 -4
  167. package/src/errors/p2p-service.error.ts +11 -0
  168. package/src/index.ts +0 -1
  169. package/src/mem_pools/attestation_pool/attestation_pool.ts +7 -5
  170. package/src/mem_pools/attestation_pool/attestation_pool_test_suite.ts +6 -6
  171. package/src/mem_pools/index.ts +0 -3
  172. package/src/mem_pools/tx_pool_v2/README.md +9 -1
  173. package/src/mem_pools/tx_pool_v2/eviction/fee_payer_balance_eviction_rule.ts +2 -1
  174. package/src/mem_pools/tx_pool_v2/eviction/interfaces.ts +11 -1
  175. package/src/mem_pools/tx_pool_v2/eviction/low_priority_pre_add_rule.ts +15 -6
  176. package/src/mem_pools/tx_pool_v2/eviction/nullifier_conflict_rule.ts +2 -1
  177. package/src/mem_pools/tx_pool_v2/interfaces.ts +9 -4
  178. package/src/mem_pools/tx_pool_v2/tx_metadata.ts +59 -13
  179. package/src/mem_pools/tx_pool_v2/tx_pool_indices.ts +29 -43
  180. package/src/mem_pools/tx_pool_v2/tx_pool_v2.ts +13 -1
  181. package/src/mem_pools/tx_pool_v2/tx_pool_v2_impl.ts +23 -6
  182. package/src/msg_validators/attestation_validator/README.md +49 -0
  183. package/src/msg_validators/attestation_validator/attestation_validator.ts +5 -4
  184. package/src/msg_validators/clock_tolerance.ts +4 -3
  185. package/src/msg_validators/proposal_validator/README.md +123 -0
  186. package/src/msg_validators/proposal_validator/block_proposal_validator.ts +13 -3
  187. package/src/msg_validators/proposal_validator/checkpoint_proposal_validator.ts +19 -6
  188. package/src/msg_validators/proposal_validator/proposal_validator.ts +63 -53
  189. package/src/msg_validators/tx_validator/README.md +5 -1
  190. package/src/msg_validators/tx_validator/allowed_public_setup.ts +16 -35
  191. package/src/msg_validators/tx_validator/allowed_setup_helpers.ts +31 -0
  192. package/src/msg_validators/tx_validator/contract_instance_validator.ts +56 -0
  193. package/src/msg_validators/tx_validator/data_validator.ts +42 -1
  194. package/src/msg_validators/tx_validator/factory.ts +43 -3
  195. package/src/msg_validators/tx_validator/fee_payer_balance.ts +6 -2
  196. package/src/msg_validators/tx_validator/gas_validator.ts +41 -8
  197. package/src/msg_validators/tx_validator/index.ts +1 -0
  198. package/src/msg_validators/tx_validator/metadata_validator.ts +12 -4
  199. package/src/msg_validators/tx_validator/phases_validator.ts +60 -1
  200. package/src/services/dummy_service.ts +7 -2
  201. package/src/services/encoding.ts +9 -1
  202. package/src/services/libp2p/libp2p_service.ts +147 -87
  203. package/src/services/peer-manager/peer_manager.ts +26 -8
  204. package/src/services/peer-manager/peer_scoring.ts +21 -5
  205. package/src/services/reqresp/README.md +229 -0
  206. package/src/services/reqresp/batch-tx-requester/README.md +46 -7
  207. package/src/services/reqresp/batch-tx-requester/batch_tx_requester.ts +64 -69
  208. package/src/services/reqresp/batch-tx-requester/interface.ts +2 -1
  209. package/src/services/reqresp/batch-tx-requester/missing_txs.ts +13 -6
  210. package/src/services/reqresp/batch-tx-requester/peer_collection.ts +5 -0
  211. package/src/services/reqresp/rate-limiter/rate_limiter.ts +13 -9
  212. package/src/services/reqresp/reqresp.ts +19 -11
  213. package/src/services/service.ts +6 -1
  214. package/src/services/tx_collection/fast_tx_collection.ts +57 -83
  215. package/src/services/tx_collection/file_store_tx_source.ts +43 -31
  216. package/src/services/tx_collection/proposal_tx_collector.ts +8 -13
  217. package/src/services/tx_collection/request_tracker.ts +127 -0
  218. package/src/services/tx_collection/slow_tx_collection.ts +1 -1
  219. package/src/services/tx_collection/tx_collection.ts +3 -5
  220. package/src/services/tx_collection/tx_source.ts +8 -7
  221. package/src/test-helpers/make-test-p2p-clients.ts +1 -1
  222. package/src/test-helpers/reqresp-nodes.ts +1 -1
  223. package/src/test-helpers/testbench-utils.ts +29 -3
  224. package/src/testbench/p2p_client_testbench_worker.ts +45 -15
  225. package/src/testbench/worker_client_manager.ts +13 -6
  226. package/src/util.ts +1 -1
  227. package/dest/mem_pools/tx_pool/aztec_kv_tx_pool.d.ts +0 -125
  228. package/dest/mem_pools/tx_pool/aztec_kv_tx_pool.d.ts.map +0 -1
  229. package/dest/mem_pools/tx_pool/aztec_kv_tx_pool.js +0 -596
  230. package/dest/mem_pools/tx_pool/eviction/eviction_manager.d.ts +0 -32
  231. package/dest/mem_pools/tx_pool/eviction/eviction_manager.d.ts.map +0 -1
  232. package/dest/mem_pools/tx_pool/eviction/eviction_manager.js +0 -112
  233. package/dest/mem_pools/tx_pool/eviction/eviction_strategy.d.ts +0 -157
  234. package/dest/mem_pools/tx_pool/eviction/eviction_strategy.d.ts.map +0 -1
  235. package/dest/mem_pools/tx_pool/eviction/eviction_strategy.js +0 -52
  236. package/dest/mem_pools/tx_pool/eviction/fee_payer_balance_eviction_rule.d.ts +0 -16
  237. package/dest/mem_pools/tx_pool/eviction/fee_payer_balance_eviction_rule.d.ts.map +0 -1
  238. package/dest/mem_pools/tx_pool/eviction/fee_payer_balance_eviction_rule.js +0 -122
  239. package/dest/mem_pools/tx_pool/eviction/invalid_txs_after_mining_rule.d.ts +0 -17
  240. package/dest/mem_pools/tx_pool/eviction/invalid_txs_after_mining_rule.d.ts.map +0 -1
  241. package/dest/mem_pools/tx_pool/eviction/invalid_txs_after_mining_rule.js +0 -84
  242. package/dest/mem_pools/tx_pool/eviction/invalid_txs_after_reorg_rule.d.ts +0 -19
  243. package/dest/mem_pools/tx_pool/eviction/invalid_txs_after_reorg_rule.d.ts.map +0 -1
  244. package/dest/mem_pools/tx_pool/eviction/invalid_txs_after_reorg_rule.js +0 -78
  245. package/dest/mem_pools/tx_pool/eviction/low_priority_eviction_rule.d.ts +0 -26
  246. package/dest/mem_pools/tx_pool/eviction/low_priority_eviction_rule.d.ts.map +0 -1
  247. package/dest/mem_pools/tx_pool/eviction/low_priority_eviction_rule.js +0 -84
  248. package/dest/mem_pools/tx_pool/eviction/nullifier_conflict_pre_add_rule.d.ts +0 -25
  249. package/dest/mem_pools/tx_pool/eviction/nullifier_conflict_pre_add_rule.d.ts.map +0 -1
  250. package/dest/mem_pools/tx_pool/eviction/nullifier_conflict_pre_add_rule.js +0 -57
  251. package/dest/mem_pools/tx_pool/index.d.ts +0 -3
  252. package/dest/mem_pools/tx_pool/index.d.ts.map +0 -1
  253. package/dest/mem_pools/tx_pool/index.js +0 -2
  254. package/dest/mem_pools/tx_pool/priority.d.ts +0 -12
  255. package/dest/mem_pools/tx_pool/priority.d.ts.map +0 -1
  256. package/dest/mem_pools/tx_pool/priority.js +0 -15
  257. package/dest/mem_pools/tx_pool/tx_pool.d.ts +0 -127
  258. package/dest/mem_pools/tx_pool/tx_pool.d.ts.map +0 -1
  259. package/dest/mem_pools/tx_pool/tx_pool.js +0 -3
  260. package/dest/mem_pools/tx_pool/tx_pool_test_suite.d.ts +0 -7
  261. package/dest/mem_pools/tx_pool/tx_pool_test_suite.d.ts.map +0 -1
  262. package/dest/mem_pools/tx_pool/tx_pool_test_suite.js +0 -400
  263. package/dest/msg_validators/proposal_validator/proposal_validator_test_suite.d.ts +0 -24
  264. package/dest/msg_validators/proposal_validator/proposal_validator_test_suite.d.ts.map +0 -1
  265. package/dest/msg_validators/proposal_validator/proposal_validator_test_suite.js +0 -378
  266. package/dest/services/tx_collection/missing_txs_tracker.d.ts +0 -32
  267. package/dest/services/tx_collection/missing_txs_tracker.d.ts.map +0 -1
  268. package/dest/services/tx_collection/missing_txs_tracker.js +0 -27
  269. package/src/mem_pools/tx_pool/README.md +0 -270
  270. package/src/mem_pools/tx_pool/aztec_kv_tx_pool.ts +0 -746
  271. package/src/mem_pools/tx_pool/eviction/eviction_manager.ts +0 -132
  272. package/src/mem_pools/tx_pool/eviction/eviction_strategy.ts +0 -208
  273. package/src/mem_pools/tx_pool/eviction/fee_payer_balance_eviction_rule.ts +0 -162
  274. package/src/mem_pools/tx_pool/eviction/invalid_txs_after_mining_rule.ts +0 -104
  275. package/src/mem_pools/tx_pool/eviction/invalid_txs_after_reorg_rule.ts +0 -93
  276. package/src/mem_pools/tx_pool/eviction/low_priority_eviction_rule.ts +0 -106
  277. package/src/mem_pools/tx_pool/eviction/nullifier_conflict_pre_add_rule.ts +0 -75
  278. package/src/mem_pools/tx_pool/index.ts +0 -2
  279. package/src/mem_pools/tx_pool/priority.ts +0 -20
  280. package/src/mem_pools/tx_pool/tx_pool.ts +0 -141
  281. package/src/mem_pools/tx_pool/tx_pool_test_suite.ts +0 -319
  282. package/src/msg_validators/proposal_validator/proposal_validator_test_suite.ts +0 -373
  283. package/src/services/tx_collection/missing_txs_tracker.ts +0 -52
@@ -9,7 +9,7 @@ import type { BatchTxRequesterConfig } from '../reqresp/batch-tx-requester/confi
9
9
  import type { BatchTxRequesterLibP2PService } from '../reqresp/batch-tx-requester/interface.js';
10
10
  import type { IBatchRequestTxValidator } from '../reqresp/batch-tx-requester/tx_validator.js';
11
11
  import { type BlockTxsSource, ReqRespSubProtocol, chunkTxHashesRequest } from '../reqresp/index.js';
12
- import type { IMissingTxsTracker } from './missing_txs_tracker.js';
12
+ import type { IRequestTracker } from './request_tracker.js';
13
13
 
14
14
  /**
15
15
  * Strategy interface for collecting missing transactions for a block or proposal.
@@ -18,17 +18,15 @@ import type { IMissingTxsTracker } from './missing_txs_tracker.js';
18
18
  export interface MissingTxsCollector {
19
19
  /**
20
20
  * Collect missing transactions for a block or proposal.
21
- * @param missingTxsTracker - The missing transactions tracker
21
+ * @param requestTracker - The missing transactions tracker
22
22
  * @param blockTxsSource - The block or proposal containing the transactions
23
23
  * @param pinnedPeer - Optional peer expected to have the transactions
24
- * @param timeoutMs - Timeout in milliseconds
25
24
  * @returns The collected transactions
26
25
  */
27
26
  collectTxs(
28
- missingTxsTracker: IMissingTxsTracker,
27
+ requestTracker: IRequestTracker,
29
28
  blockTxsSource: BlockTxsSource,
30
29
  pinnedPeer: PeerId | undefined,
31
- timeoutMs: number,
32
30
  ): Promise<Tx[]>;
33
31
  }
34
32
 
@@ -46,10 +44,9 @@ export class BatchTxRequesterCollector implements MissingTxsCollector {
46
44
  ) {}
47
45
 
48
46
  async collectTxs(
49
- missingTxsTracker: IMissingTxsTracker,
47
+ requestTracker: IRequestTracker,
50
48
  blockTxsSource: BlockTxsSource,
51
49
  pinnedPeer: PeerId | undefined,
52
- timeoutMs: number,
53
50
  ): Promise<Tx[]> {
54
51
  const {
55
52
  batchTxRequesterSmartParallelWorkerCount: smartParallelWorkerCount,
@@ -59,10 +56,9 @@ export class BatchTxRequesterCollector implements MissingTxsCollector {
59
56
  } = this.batchTxRequesterConfig ?? {};
60
57
 
61
58
  const batchRequester = new BatchTxRequester(
62
- missingTxsTracker,
59
+ requestTracker,
63
60
  blockTxsSource,
64
61
  pinnedPeer,
65
- timeoutMs,
66
62
  this.p2pService,
67
63
  this.log,
68
64
  this.dateProvider,
@@ -94,16 +90,15 @@ export class SendBatchRequestCollector implements MissingTxsCollector {
94
90
  ) {}
95
91
 
96
92
  async collectTxs(
97
- missingTxsTracker: IMissingTxsTracker,
93
+ requestTracker: IRequestTracker,
98
94
  _blockTxsSource: BlockTxsSource,
99
95
  pinnedPeer: PeerId | undefined,
100
- timeoutMs: number,
101
96
  ): Promise<Tx[]> {
102
97
  const txs = await this.p2pService.reqResp.sendBatchRequest<ReqRespSubProtocol.TX>(
103
98
  ReqRespSubProtocol.TX,
104
- chunkTxHashesRequest(Array.from(missingTxsTracker.missingTxHashes).map(TxHash.fromString)),
99
+ chunkTxHashesRequest(Array.from(requestTracker.missingTxHashes).map(TxHash.fromString)),
105
100
  pinnedPeer,
106
- timeoutMs,
101
+ requestTracker.timeoutMs,
107
102
  this.maxPeers,
108
103
  this.maxRetryAttempts,
109
104
  );
@@ -0,0 +1,127 @@
1
+ import { type PromiseWithResolvers, promiseWithResolvers } from '@aztec/foundation/promise';
2
+ import type { DateProvider } from '@aztec/foundation/timer';
3
+ import { TxHash } from '@aztec/stdlib/tx';
4
+ import type { Tx } from '@aztec/stdlib/tx';
5
+
6
+ /**
7
+ * Tracks which transactions are still missing and need to be fetched.
8
+ * Manages the request deadline and serves as the sole source of cancellation signal.
9
+ * The request is cancelled when all txs are fetched or the deadline expires.
10
+ */
11
+ export interface IRequestTracker {
12
+ /** Returns the set of transaction hashes that are still missing. */
13
+ get missingTxHashes(): Set<string>;
14
+ /** Size of this.missingTxHashes */
15
+ get numberOfMissingTxs(): number;
16
+ /** Are all requested txs fetched */
17
+ allFetched(): boolean;
18
+ /** Checks that transaction is still missing */
19
+ isMissing(txHash: string): boolean;
20
+ /** Marks a transaction as fetched. Returns true if it was previously missing. */
21
+ markFetched(tx: Tx): boolean;
22
+ /** Get list of collected txs */
23
+ get collectedTxs(): Tx[];
24
+ /** The deadline for this request. */
25
+ get deadline(): Date;
26
+ /** Remaining time in milliseconds until deadline. Returns 0 if already past. */
27
+ get timeoutMs(): number;
28
+ /** Checks whether the request is cancelled (deadline expired or all fetched). May trigger cancellation if deadline has passed. */
29
+ checkCancelled(): boolean;
30
+ /** Resolves when deadline expires or all txs are fetched. */
31
+ get cancellationToken(): Promise<void>;
32
+ /** Externally cancel the request. */
33
+ cancel(): void;
34
+ }
35
+
36
+ export class RequestTracker implements IRequestTracker {
37
+ public readonly collectedTxs: Tx[] = [];
38
+ private done = false;
39
+ private readonly cancellationTokenPromise: PromiseWithResolvers<void>;
40
+ private readonly deadlineTimer: ReturnType<typeof setTimeout> | undefined;
41
+
42
+ private constructor(
43
+ public readonly missingTxHashes: Set<string>,
44
+ public readonly deadline: Date,
45
+ private readonly dateProvider?: DateProvider,
46
+ ) {
47
+ this.cancellationTokenPromise = promiseWithResolvers<void>();
48
+
49
+ if (missingTxHashes.size === 0) {
50
+ this.finish();
51
+ return;
52
+ }
53
+
54
+ const now = this.dateProvider?.now() ?? Date.now();
55
+ const remaining = deadline.getTime() - now;
56
+ if (remaining <= 0) {
57
+ this.finish();
58
+ } else {
59
+ this.deadlineTimer = setTimeout(() => this.finish(), remaining);
60
+ }
61
+ }
62
+
63
+ public static create(hashes: TxHash[] | string[], deadline: Date, dateProvider?: DateProvider) {
64
+ return new RequestTracker(new Set(hashes.map(hash => hash.toString())), deadline, dateProvider);
65
+ }
66
+
67
+ markFetched(tx: Tx): boolean {
68
+ if (this.missingTxHashes.delete(tx.txHash.toString())) {
69
+ this.collectedTxs.push(tx);
70
+ if (this.allFetched()) {
71
+ this.finish();
72
+ }
73
+ return true;
74
+ }
75
+ return false;
76
+ }
77
+
78
+ get numberOfMissingTxs(): number {
79
+ return this.missingTxHashes.size;
80
+ }
81
+
82
+ allFetched(): boolean {
83
+ return this.numberOfMissingTxs === 0;
84
+ }
85
+
86
+ isMissing(txHash: string): boolean {
87
+ return this.missingTxHashes.has(txHash.toString());
88
+ }
89
+
90
+ get timeoutMs(): number {
91
+ const now = this.dateProvider?.now() ?? Date.now();
92
+ return Math.max(0, this.deadline.getTime() - now);
93
+ }
94
+
95
+ checkCancelled(): boolean {
96
+ if (this.done) {
97
+ return true;
98
+ }
99
+ // Synchronous fallback: check deadline even if setTimeout hasn't fired yet.
100
+ // This prevents macrotask starvation in tight async loops from blocking cancellation.
101
+ const now = this.dateProvider?.now() ?? Date.now();
102
+ if (now >= this.deadline.getTime()) {
103
+ this.finish();
104
+ return true;
105
+ }
106
+ return false;
107
+ }
108
+
109
+ get cancellationToken(): Promise<void> {
110
+ return this.cancellationTokenPromise.promise;
111
+ }
112
+
113
+ cancel(): void {
114
+ this.finish();
115
+ }
116
+
117
+ private finish() {
118
+ if (this.done) {
119
+ return;
120
+ }
121
+ this.done = true;
122
+ if (this.deadlineTimer) {
123
+ clearTimeout(this.deadlineTimer);
124
+ }
125
+ this.cancellationTokenPromise.resolve();
126
+ }
127
+ }
@@ -196,7 +196,7 @@ export class SlowTxCollection {
196
196
  // from mined unproven blocks it has seen in the past.
197
197
  const fastRequests = this.fastCollection.getFastCollectionRequests();
198
198
  const fastCollectionTxs: Set<string> = new Set(
199
- fastRequests.values().flatMap(r => Array.from(r.missingTxTracker.missingTxHashes)),
199
+ fastRequests.values().flatMap(r => Array.from(r.requestTracker.missingTxHashes)),
200
200
  );
201
201
 
202
202
  // Return all missing txs that are not in fastCollectionTxs and are ready for reqresp if requested
@@ -1,7 +1,7 @@
1
1
  import { BlockNumber } from '@aztec/foundation/branded-types';
2
2
  import { compactArray } from '@aztec/foundation/collection';
3
3
  import { type Logger, createLogger } from '@aztec/foundation/log';
4
- import { type PromiseWithResolvers, RunningPromise } from '@aztec/foundation/promise';
4
+ import { RunningPromise } from '@aztec/foundation/promise';
5
5
  import { sleep } from '@aztec/foundation/sleep';
6
6
  import { DateProvider } from '@aztec/foundation/timer';
7
7
  import type { L2Block, L2BlockInfo } from '@aztec/stdlib/block';
@@ -19,7 +19,7 @@ import type { TxCollectionConfig } from './config.js';
19
19
  import { FastTxCollection } from './fast_tx_collection.js';
20
20
  import { FileStoreTxCollection } from './file_store_tx_collection.js';
21
21
  import type { FileStoreTxSource } from './file_store_tx_source.js';
22
- import type { IMissingTxsTracker } from './missing_txs_tracker.js';
22
+ import type { IRequestTracker } from './request_tracker.js';
23
23
  import { SlowTxCollection, getProofDeadlineForSlot } from './slow_tx_collection.js';
24
24
  import { type TxAddContext, TxCollectionSink } from './tx_collection_sink.js';
25
25
  import type { TxSource } from './tx_source.js';
@@ -33,10 +33,8 @@ export type FastCollectionRequestInput =
33
33
  | { type: 'proposal'; blockProposal: BlockProposal; blockNumber: BlockNumber };
34
34
 
35
35
  export type FastCollectionRequest = FastCollectionRequestInput & {
36
- missingTxTracker: IMissingTxsTracker;
37
- deadline: Date;
36
+ requestTracker: IRequestTracker;
38
37
  blockInfo: L2BlockInfo;
39
- promise: PromiseWithResolvers<void>;
40
38
  };
41
39
 
42
40
  /**
@@ -2,7 +2,7 @@ import { getVKTreeRoot } from '@aztec/noir-protocol-circuits-types/vk-tree';
2
2
  import { protocolContractsHash } from '@aztec/protocol-contracts';
3
3
  import type { ChainConfig } from '@aztec/stdlib/config';
4
4
  import { type AztecNode, createAztecNodeClient } from '@aztec/stdlib/interfaces/client';
5
- import type { Tx, TxHash } from '@aztec/stdlib/tx';
5
+ import type { Tx, TxHash, TxValidator } from '@aztec/stdlib/tx';
6
6
  import { type ComponentsVersions, getComponentsVersionsFromConfig } from '@aztec/stdlib/versioning';
7
7
  import { makeTracedFetch } from '@aztec/telemetry-client';
8
8
 
@@ -16,12 +16,13 @@ export interface TxSource {
16
16
  export class NodeRpcTxSource implements TxSource {
17
17
  constructor(
18
18
  private readonly client: Pick<AztecNode, 'getTxsByHash'>,
19
+ private readonly txValidator: TxValidator,
19
20
  private readonly info: string,
20
21
  ) {}
21
22
 
22
- public static fromUrl(nodeUrl: string, versions: ComponentsVersions): NodeRpcTxSource {
23
+ public static fromUrl(nodeUrl: string, txValidator: TxValidator, versions: ComponentsVersions): NodeRpcTxSource {
23
24
  const client = createAztecNodeClient(nodeUrl, versions, makeTracedFetch([1, 2, 3], false));
24
- return new NodeRpcTxSource(client, nodeUrl);
25
+ return new NodeRpcTxSource(client, txValidator, nodeUrl);
25
26
  }
26
27
 
27
28
  public getInfo() {
@@ -38,8 +39,8 @@ export class NodeRpcTxSource implements TxSource {
38
39
  const invalidTxHashes: string[] = [];
39
40
  await Promise.all(
40
41
  txs.map(async tx => {
41
- const isValid = await tx.validateTxHash();
42
- if (isValid) {
42
+ const validation = await this.txValidator.validateTx(tx);
43
+ if (validation.result === 'valid') {
43
44
  validTxs.push(tx);
44
45
  } else {
45
46
  invalidTxHashes.push(tx.getTxHash().toString());
@@ -50,7 +51,7 @@ export class NodeRpcTxSource implements TxSource {
50
51
  }
51
52
  }
52
53
 
53
- export function createNodeRpcTxSources(urls: string[], chainConfig: ChainConfig) {
54
+ export function createNodeRpcTxSources(urls: string[], txValidator: TxValidator, chainConfig: ChainConfig) {
54
55
  const versions = getComponentsVersionsFromConfig(chainConfig, protocolContractsHash, getVKTreeRoot());
55
- return urls.map(url => NodeRpcTxSource.fromUrl(url, versions));
56
+ return urls.map(url => NodeRpcTxSource.fromUrl(url, txValidator, versions));
56
57
  }
@@ -4,9 +4,9 @@ import { SecretValue } from '@aztec/foundation/config';
4
4
  import { type Logger, createLogger } from '@aztec/foundation/log';
5
5
  import { retryUntil } from '@aztec/foundation/retry';
6
6
  import { sleep } from '@aztec/foundation/sleep';
7
- import type { DataStoreConfig } from '@aztec/kv-store/config';
8
7
  import { openTmpStore } from '@aztec/kv-store/lmdb-v2';
9
8
  import type { WorldStateSynchronizer } from '@aztec/stdlib/interfaces/server';
9
+ import type { DataStoreConfig } from '@aztec/stdlib/kv-store';
10
10
 
11
11
  import { createP2PClient } from '../client/index.js';
12
12
  import type { P2PClient } from '../client/p2p_client.js';
@@ -2,7 +2,6 @@ import type { EpochCache } from '@aztec/epoch-cache';
2
2
  import { timesParallel } from '@aztec/foundation/collection';
3
3
  import { SecretValue } from '@aztec/foundation/config';
4
4
  import { createLogger } from '@aztec/foundation/log';
5
- import type { DataStoreConfig } from '@aztec/kv-store/config';
6
5
  import { openTmpStore } from '@aztec/kv-store/lmdb-v2';
7
6
  import type { L2BlockSource } from '@aztec/stdlib/block';
8
7
  import { type ChainConfig, emptyChainConfig } from '@aztec/stdlib/config';
@@ -12,6 +11,7 @@ import type {
12
11
  IVCProofVerificationResult,
13
12
  WorldStateSynchronizer,
14
13
  } from '@aztec/stdlib/interfaces/server';
14
+ import type { DataStoreConfig } from '@aztec/stdlib/kv-store';
15
15
  import type { Tx } from '@aztec/stdlib/tx';
16
16
  import { compressComponentVersions } from '@aztec/stdlib/versioning';
17
17
  import { type TelemetryClient, getTelemetryClient } from '@aztec/telemetry-client';
@@ -273,17 +273,41 @@ export class InMemoryAttestationPool {
273
273
  * Creates a mock EpochCache for testing.
274
274
  */
275
275
  export function createMockEpochCache(): EpochCacheInterface {
276
- return {
276
+ const cache: EpochCacheInterface = {
277
277
  getCommittee: () => Promise.resolve({ committee: [], seed: 1n, epoch: EpochNumber.ZERO, isEscapeHatchOpen: false }),
278
278
  getProposerIndexEncoding: () => '0x' as `0x${string}`,
279
- getEpochAndSlotNow: () => ({ epoch: EpochNumber.ZERO, slot: SlotNumber.ZERO, ts: 0n, nowMs: 0n }),
279
+ getSlotNow: () => SlotNumber.ZERO,
280
+ getTargetSlot: () => SlotNumber.ZERO,
281
+ getEpochNow: () => EpochNumber.ZERO,
282
+ getTargetEpoch: () => EpochNumber.ZERO,
283
+ getEpochAndSlotNow: () => ({
284
+ epoch: EpochNumber.ZERO,
285
+ slot: SlotNumber.ZERO,
286
+ ts: 0n,
287
+ nowMs: 0n,
288
+ }),
289
+ isProposerPipeliningEnabled: () => false,
280
290
  computeProposerIndex: () => 0n,
281
291
  getCurrentAndNextSlot: () => ({ currentSlot: SlotNumber.ZERO, nextSlot: SlotNumber.ZERO }),
292
+ getTargetAndNextSlot: () => ({ targetSlot: SlotNumber.ZERO, nextSlot: SlotNumber.ZERO }),
282
293
  getProposerAttesterAddressInSlot: () => Promise.resolve(undefined),
283
- getEpochAndSlotInNextL1Slot: () => ({ epoch: EpochNumber.ZERO, slot: SlotNumber.ZERO, ts: 0n, now: 0n }),
294
+ getEpochAndSlotInNextL1Slot: () => ({
295
+ epoch: EpochNumber.ZERO,
296
+ slot: SlotNumber.ZERO,
297
+ ts: 0n,
298
+ nowSeconds: 0n,
299
+ }),
300
+ getTargetEpochAndSlotInNextL1Slot: () => ({
301
+ epoch: EpochNumber.ZERO,
302
+ slot: SlotNumber.ZERO,
303
+ ts: 0n,
304
+ nowSeconds: 0n,
305
+ }),
284
306
  isInCommittee: () => Promise.resolve(false),
285
307
  getRegisteredValidators: () => Promise.resolve([]),
286
308
  filterInCommittee: () => Promise.resolve([]),
309
+ isEscapeHatchOpen: () => Promise.resolve(false),
310
+ isEscapeHatchOpenAtSlot: () => Promise.resolve(false),
287
311
  getL1Constants: () => ({
288
312
  l1StartBlock: 0n,
289
313
  l1GenesisTime: 0n,
@@ -292,8 +316,10 @@ export function createMockEpochCache(): EpochCacheInterface {
292
316
  ethereumSlotDuration: 1,
293
317
  proofSubmissionEpochs: 1,
294
318
  targetCommitteeSize: 48,
319
+ rollupManaLimit: Number.MAX_SAFE_INTEGER,
295
320
  }),
296
321
  };
322
+ return cache;
297
323
  }
298
324
 
299
325
  /**
@@ -12,13 +12,13 @@ import { Fr } from '@aztec/foundation/curves/bn254';
12
12
  import { type Logger, createLogger } from '@aztec/foundation/log';
13
13
  import { sleep } from '@aztec/foundation/sleep';
14
14
  import { DateProvider, Timer } from '@aztec/foundation/timer';
15
- import type { DataStoreConfig } from '@aztec/kv-store/config';
16
15
  import { openTmpStore } from '@aztec/kv-store/lmdb-v2';
17
16
  import { getVKTreeRoot } from '@aztec/noir-protocol-circuits-types/vk-tree';
18
17
  import { protocolContractsHash } from '@aztec/protocol-contracts';
19
18
  import type { L2BlockSource } from '@aztec/stdlib/block';
20
19
  import type { ContractDataSource } from '@aztec/stdlib/contract';
21
20
  import type { ClientProtocolCircuitVerifier, WorldStateSynchronizer } from '@aztec/stdlib/interfaces/server';
21
+ import type { DataStoreConfig } from '@aztec/stdlib/kv-store';
22
22
  import { type BlockProposal, P2PMessage } from '@aztec/stdlib/p2p';
23
23
  import { ChonkProof } from '@aztec/stdlib/proofs';
24
24
  import { makeAztecAddress, makeBlockHeader, makeBlockProposal, mockTx } from '@aztec/stdlib/testing';
@@ -40,7 +40,7 @@ import type { IBatchRequestTxValidator } from '../services/reqresp/batch-tx-requ
40
40
  import { RateLimitStatus } from '../services/reqresp/rate-limiter/rate_limiter.js';
41
41
  import type { ReqResp } from '../services/reqresp/reqresp.js';
42
42
  import type { PeerDiscoveryService } from '../services/service.js';
43
- import { MissingTxsTracker } from '../services/tx_collection/missing_txs_tracker.js';
43
+ import { RequestTracker } from '../services/tx_collection/request_tracker.js';
44
44
  import { AlwaysTrueCircuitVerifier } from '../test-helpers/index.js';
45
45
  import {
46
46
  BENCHMARK_CONSTANTS,
@@ -273,10 +273,9 @@ async function runAggregatorBenchmark(
273
273
  noopTxValidator,
274
274
  );
275
275
  const fetchedTxs = await collector.collectTxs(
276
- MissingTxsTracker.fromArray(txHashes),
276
+ RequestTracker.create(txHashes, new Date(Date.now() + timeoutMs)),
277
277
  blockProposal,
278
278
  pinnedPeer,
279
- timeoutMs,
280
279
  );
281
280
  const durationMs = timer.ms();
282
281
  return {
@@ -293,10 +292,9 @@ async function runAggregatorBenchmark(
293
292
  BENCHMARK_CONSTANTS.FIXED_MAX_RETRY_ATTEMPTS,
294
293
  );
295
294
  const fetchedTxs = await collector.collectTxs(
296
- MissingTxsTracker.fromArray(txHashes),
295
+ RequestTracker.create(txHashes, new Date(Date.now() + timeoutMs)),
297
296
  blockProposal,
298
297
  pinnedPeer,
299
- timeoutMs,
300
298
  );
301
299
  const durationMs = timer.ms();
302
300
  return {
@@ -323,6 +321,37 @@ let workerConfig: P2PConfig | null = null;
323
321
  let workerLogger: Logger | null = null;
324
322
  let kvStore: Awaited<ReturnType<typeof openTmpStore>> | null = null;
325
323
 
324
+ async function stopWorker() {
325
+ try {
326
+ if (workerClient) {
327
+ await workerClient.stop();
328
+ workerClient = null;
329
+ }
330
+ } catch (e) {
331
+ workerLogger?.error('Error stopping worker client', e);
332
+ }
333
+ try {
334
+ if (kvStore?.close) {
335
+ await kvStore.close();
336
+ kvStore = null;
337
+ }
338
+ } catch (e) {
339
+ workerLogger?.error('Error closing kv store', e);
340
+ }
341
+ }
342
+
343
+ function gracefulExit(code: number = 0) {
344
+ try {
345
+ if (process.connected) {
346
+ process.disconnect();
347
+ }
348
+ } catch {
349
+ // IPC channel already closed
350
+ }
351
+ // Safety fallback if lingering handles prevent the event loop from draining
352
+ setTimeout(() => process.exit(code), 5000).unref();
353
+ }
354
+
326
355
  // eslint-disable-next-line @typescript-eslint/no-misused-promises
327
356
  process.on('message', async msg => {
328
357
  const {
@@ -340,6 +369,7 @@ process.on('message', async msg => {
340
369
  const config: P2PConfig = {
341
370
  ...rawConfig,
342
371
  peerIdPrivateKey: rawConfig.peerIdPrivateKey ? new SecretValue(rawConfig.peerIdPrivateKey) : undefined,
372
+ priceBumpPercentage: 10n,
343
373
  } as P2PConfig;
344
374
 
345
375
  workerConfig = config;
@@ -411,13 +441,8 @@ process.on('message', async msg => {
411
441
  const cmd = msg as any;
412
442
  switch (cmd.type) {
413
443
  case 'STOP':
414
- if (workerClient) {
415
- await workerClient.stop();
416
- }
417
- if (kvStore?.close) {
418
- await kvStore.close();
419
- }
420
- process.exit(0);
444
+ await stopWorker();
445
+ gracefulExit(0);
421
446
  break;
422
447
 
423
448
  case 'SEND_TX':
@@ -494,7 +519,12 @@ process.on('message', async msg => {
494
519
  }
495
520
  }
496
521
  } catch (err: any) {
497
- process.send!({ type: 'ERROR', error: err.message });
498
- process.exit(1);
522
+ try {
523
+ process.send!({ type: 'ERROR', error: err.message });
524
+ } catch {
525
+ // IPC channel may be closed
526
+ }
527
+ await stopWorker();
528
+ gracefulExit(1);
499
529
  }
500
530
  });
@@ -72,7 +72,6 @@ class WorkerClientManager {
72
72
  destroy() {
73
73
  this.cleanup().catch((error: Error) => {
74
74
  this.logger.error('Failed to cleanup worker client manager', error);
75
- process.exit(1);
76
75
  });
77
76
  }
78
77
 
@@ -81,13 +80,15 @@ class WorkerClientManager {
81
80
  * Note: We send the raw peerIdPrivateKey string instead of SecretValue
82
81
  * because SecretValue.toJSON() returns '[Redacted]', losing the value.
83
82
  * The worker must re-wrap it in SecretValue.
83
+ * We also omit priceBumpPercentage since it's a bigint and can't be
84
+ * serialized over IPC (which uses JSON under the hood).
84
85
  */
85
86
  private createClientConfig(
86
87
  clientIndex: number,
87
88
  port: number,
88
89
  otherNodes: string[],
89
- ): Omit<P2PConfig, 'peerIdPrivateKey'> & { peerIdPrivateKey: string } & Partial<ChainConfig> {
90
- return {
90
+ ): Omit<P2PConfig, 'peerIdPrivateKey' | 'priceBumpPercentage'> & { peerIdPrivateKey: string } & Partial<ChainConfig> {
91
+ const { priceBumpPercentage: _, ...config } = {
91
92
  ...getP2PDefaultConfig(),
92
93
  p2pEnabled: true,
93
94
  peerIdPrivateKey: this.peerIdPrivateKeys[clientIndex],
@@ -96,7 +97,10 @@ class WorkerClientManager {
96
97
  p2pPort: port,
97
98
  bootstrapNodes: [...otherNodes],
98
99
  ...this.p2pConfig,
99
- } as Omit<P2PConfig, 'peerIdPrivateKey'> & { peerIdPrivateKey: string } & Partial<ChainConfig>;
100
+ };
101
+ return config as Omit<P2PConfig, 'peerIdPrivateKey' | 'priceBumpPercentage'> & {
102
+ peerIdPrivateKey: string;
103
+ } & Partial<ChainConfig>;
100
104
  }
101
105
 
102
106
  /**
@@ -104,7 +108,9 @@ class WorkerClientManager {
104
108
  * Config uses raw string for peerIdPrivateKey (not SecretValue) for IPC serialization.
105
109
  */
106
110
  private spawnWorkerProcess(
107
- config: Omit<P2PConfig, 'peerIdPrivateKey'> & { peerIdPrivateKey: string } & Partial<ChainConfig>,
111
+ config: Omit<P2PConfig, 'peerIdPrivateKey' | 'priceBumpPercentage'> & {
112
+ peerIdPrivateKey: string;
113
+ } & Partial<ChainConfig>,
108
114
  clientIndex: number,
109
115
  ): [ChildProcess, Promise<void>] {
110
116
  const useCompiled = existsSync(workerJsPath);
@@ -483,7 +489,8 @@ class WorkerClientManager {
483
489
  };
484
490
 
485
491
  this.processes[0].send(aggregatorCmd);
486
- const result = await this.waitForBenchResult(0, config.timeoutMs + 30000);
492
+ const aggregatorBudgetMs = config.timeoutMs + BENCHMARK_CONSTANTS.MAX_PEER_WAIT_MS + 30000;
493
+ const result = await this.waitForBenchResult(0, aggregatorBudgetMs);
487
494
 
488
495
  this.logger.info(
489
496
  `Benchmark complete: fetched=${result.fetchedCount}/${config.txCount}, duration=${result.durationMs.toFixed(0)}ms, success=${result.success}`,
package/src/util.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  import { SecretValue } from '@aztec/foundation/config';
2
2
  import type { Logger } from '@aztec/foundation/log';
3
3
  import type { AztecAsyncKVStore, AztecAsyncSingleton } from '@aztec/kv-store';
4
- import type { DataStoreConfig } from '@aztec/kv-store/config';
4
+ import type { DataStoreConfig } from '@aztec/stdlib/kv-store';
5
5
 
6
6
  import type { GossipSub } from '@chainsafe/libp2p-gossipsub';
7
7
  import { generateKeyPair, marshalPrivateKey, unmarshalPrivateKey } from '@libp2p/crypto/keys';