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

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 (483) hide show
  1. package/README.md +130 -3
  2. package/dest/bootstrap/bootstrap.d.ts +1 -1
  3. package/dest/bootstrap/bootstrap.d.ts.map +1 -1
  4. package/dest/bootstrap/bootstrap.js +22 -6
  5. package/dest/client/factory.d.ts +5 -4
  6. package/dest/client/factory.d.ts.map +1 -1
  7. package/dest/client/factory.js +39 -16
  8. package/dest/client/interface.d.ts +52 -12
  9. package/dest/client/interface.d.ts.map +1 -1
  10. package/dest/client/p2p_client.d.ts +36 -20
  11. package/dest/client/p2p_client.d.ts.map +1 -1
  12. package/dest/client/p2p_client.js +142 -81
  13. package/dest/config.d.ts +163 -98
  14. package/dest/config.d.ts.map +1 -1
  15. package/dest/config.js +130 -20
  16. package/dest/errors/p2p-service.error.d.ts +9 -0
  17. package/dest/errors/p2p-service.error.d.ts.map +1 -0
  18. package/dest/errors/p2p-service.error.js +10 -0
  19. package/dest/errors/reqresp.error.d.ts +9 -16
  20. package/dest/errors/reqresp.error.d.ts.map +1 -1
  21. package/dest/errors/reqresp.error.js +10 -17
  22. package/dest/index.d.ts +1 -2
  23. package/dest/index.d.ts.map +1 -1
  24. package/dest/index.js +0 -1
  25. package/dest/mem_pools/attestation_pool/attestation_pool.d.ts +101 -59
  26. package/dest/mem_pools/attestation_pool/attestation_pool.d.ts.map +1 -1
  27. package/dest/mem_pools/attestation_pool/attestation_pool.js +272 -199
  28. package/dest/mem_pools/attestation_pool/attestation_pool_test_suite.d.ts +1 -1
  29. package/dest/mem_pools/attestation_pool/attestation_pool_test_suite.d.ts.map +1 -1
  30. package/dest/mem_pools/attestation_pool/attestation_pool_test_suite.js +224 -65
  31. package/dest/mem_pools/attestation_pool/mocks.d.ts +1 -1
  32. package/dest/mem_pools/attestation_pool/mocks.d.ts.map +1 -1
  33. package/dest/mem_pools/attestation_pool/mocks.js +6 -4
  34. package/dest/mem_pools/index.d.ts +1 -2
  35. package/dest/mem_pools/index.d.ts.map +1 -1
  36. package/dest/mem_pools/instrumentation.d.ts +9 -4
  37. package/dest/mem_pools/instrumentation.d.ts.map +1 -1
  38. package/dest/mem_pools/instrumentation.js +28 -9
  39. package/dest/mem_pools/tx_pool_v2/archive/tx_archive.d.ts +10 -5
  40. package/dest/mem_pools/tx_pool_v2/archive/tx_archive.d.ts.map +1 -1
  41. package/dest/mem_pools/tx_pool_v2/archive/tx_archive.js +29 -20
  42. package/dest/mem_pools/tx_pool_v2/deleted_pool.d.ts +3 -3
  43. package/dest/mem_pools/tx_pool_v2/deleted_pool.d.ts.map +1 -1
  44. package/dest/mem_pools/tx_pool_v2/deleted_pool.js +6 -6
  45. package/dest/mem_pools/tx_pool_v2/eviction/fee_payer_balance_eviction_rule.d.ts +1 -1
  46. package/dest/mem_pools/tx_pool_v2/eviction/fee_payer_balance_eviction_rule.d.ts.map +1 -1
  47. package/dest/mem_pools/tx_pool_v2/eviction/fee_payer_balance_eviction_rule.js +5 -4
  48. package/dest/mem_pools/tx_pool_v2/eviction/fee_payer_balance_pre_add_rule.d.ts +1 -1
  49. package/dest/mem_pools/tx_pool_v2/eviction/fee_payer_balance_pre_add_rule.d.ts.map +1 -1
  50. package/dest/mem_pools/tx_pool_v2/eviction/fee_payer_balance_pre_add_rule.js +3 -1
  51. package/dest/mem_pools/tx_pool_v2/eviction/index.d.ts +2 -1
  52. package/dest/mem_pools/tx_pool_v2/eviction/index.d.ts.map +1 -1
  53. package/dest/mem_pools/tx_pool_v2/eviction/index.js +1 -0
  54. package/dest/mem_pools/tx_pool_v2/eviction/insufficient_fee_per_gas_eviction_rule.d.ts +16 -0
  55. package/dest/mem_pools/tx_pool_v2/eviction/insufficient_fee_per_gas_eviction_rule.d.ts.map +1 -0
  56. package/dest/mem_pools/tx_pool_v2/eviction/insufficient_fee_per_gas_eviction_rule.js +64 -0
  57. package/dest/mem_pools/tx_pool_v2/eviction/interfaces.d.ts +7 -1
  58. package/dest/mem_pools/tx_pool_v2/eviction/interfaces.d.ts.map +1 -1
  59. package/dest/mem_pools/tx_pool_v2/eviction/invalid_txs_after_mining_rule.d.ts +1 -1
  60. package/dest/mem_pools/tx_pool_v2/eviction/invalid_txs_after_mining_rule.d.ts.map +1 -1
  61. package/dest/mem_pools/tx_pool_v2/eviction/invalid_txs_after_mining_rule.js +3 -4
  62. package/dest/mem_pools/tx_pool_v2/eviction/invalid_txs_after_reorg_rule.d.ts +1 -1
  63. package/dest/mem_pools/tx_pool_v2/eviction/invalid_txs_after_reorg_rule.d.ts.map +1 -1
  64. package/dest/mem_pools/tx_pool_v2/eviction/invalid_txs_after_reorg_rule.js +6 -7
  65. package/dest/mem_pools/tx_pool_v2/eviction/low_priority_eviction_rule.d.ts +1 -1
  66. package/dest/mem_pools/tx_pool_v2/eviction/low_priority_eviction_rule.d.ts.map +1 -1
  67. package/dest/mem_pools/tx_pool_v2/eviction/low_priority_eviction_rule.js +6 -5
  68. package/dest/mem_pools/tx_pool_v2/eviction/low_priority_pre_add_rule.d.ts +1 -1
  69. package/dest/mem_pools/tx_pool_v2/eviction/low_priority_pre_add_rule.d.ts.map +1 -1
  70. package/dest/mem_pools/tx_pool_v2/eviction/low_priority_pre_add_rule.js +8 -6
  71. package/dest/mem_pools/tx_pool_v2/eviction/nullifier_conflict_rule.d.ts +2 -2
  72. package/dest/mem_pools/tx_pool_v2/eviction/nullifier_conflict_rule.d.ts.map +1 -1
  73. package/dest/mem_pools/tx_pool_v2/eviction/nullifier_conflict_rule.js +2 -2
  74. package/dest/mem_pools/tx_pool_v2/instrumentation.d.ts +11 -1
  75. package/dest/mem_pools/tx_pool_v2/instrumentation.d.ts.map +1 -1
  76. package/dest/mem_pools/tx_pool_v2/instrumentation.js +24 -0
  77. package/dest/mem_pools/tx_pool_v2/interfaces.d.ts +41 -9
  78. package/dest/mem_pools/tx_pool_v2/interfaces.d.ts.map +1 -1
  79. package/dest/mem_pools/tx_pool_v2/interfaces.js +3 -1
  80. package/dest/mem_pools/tx_pool_v2/tx_metadata.d.ts +29 -11
  81. package/dest/mem_pools/tx_pool_v2/tx_metadata.d.ts.map +1 -1
  82. package/dest/mem_pools/tx_pool_v2/tx_metadata.js +46 -16
  83. package/dest/mem_pools/tx_pool_v2/tx_pool_indices.d.ts +15 -1
  84. package/dest/mem_pools/tx_pool_v2/tx_pool_indices.d.ts.map +1 -1
  85. package/dest/mem_pools/tx_pool_v2/tx_pool_indices.js +55 -41
  86. package/dest/mem_pools/tx_pool_v2/tx_pool_v2.d.ts +19 -4
  87. package/dest/mem_pools/tx_pool_v2/tx_pool_v2.d.ts.map +1 -1
  88. package/dest/mem_pools/tx_pool_v2/tx_pool_v2.js +86 -32
  89. package/dest/mem_pools/tx_pool_v2/tx_pool_v2_impl.d.ts +50 -6
  90. package/dest/mem_pools/tx_pool_v2/tx_pool_v2_impl.d.ts.map +1 -1
  91. package/dest/mem_pools/tx_pool_v2/tx_pool_v2_impl.js +262 -131
  92. package/dest/msg_validators/attestation_validator/attestation_validator.d.ts +10 -3
  93. package/dest/msg_validators/attestation_validator/attestation_validator.d.ts.map +1 -1
  94. package/dest/msg_validators/attestation_validator/attestation_validator.js +38 -15
  95. package/dest/msg_validators/attestation_validator/fisherman_attestation_validator.d.ts +7 -3
  96. package/dest/msg_validators/attestation_validator/fisherman_attestation_validator.d.ts.map +1 -1
  97. package/dest/msg_validators/attestation_validator/fisherman_attestation_validator.js +4 -5
  98. package/dest/msg_validators/proposal_validator/block_proposal_validator.d.ts +11 -5
  99. package/dest/msg_validators/proposal_validator/block_proposal_validator.d.ts.map +1 -1
  100. package/dest/msg_validators/proposal_validator/block_proposal_validator.js +11 -3
  101. package/dest/msg_validators/proposal_validator/checkpoint_proposal_validator.d.ts +11 -5
  102. package/dest/msg_validators/proposal_validator/checkpoint_proposal_validator.d.ts.map +1 -1
  103. package/dest/msg_validators/proposal_validator/checkpoint_proposal_validator.js +23 -3
  104. package/dest/msg_validators/proposal_validator/proposal_validator.d.ts +35 -10
  105. package/dest/msg_validators/proposal_validator/proposal_validator.d.ts.map +1 -1
  106. package/dest/msg_validators/proposal_validator/proposal_validator.js +128 -56
  107. package/dest/msg_validators/tx_validator/aggregate_tx_validator.d.ts +1 -1
  108. package/dest/msg_validators/tx_validator/aggregate_tx_validator.d.ts.map +1 -1
  109. package/dest/msg_validators/tx_validator/aggregate_tx_validator.js +8 -15
  110. package/dest/msg_validators/tx_validator/allowed_public_setup.d.ts +1 -1
  111. package/dest/msg_validators/tx_validator/allowed_public_setup.d.ts.map +1 -1
  112. package/dest/msg_validators/tx_validator/allowed_public_setup.js +21 -32
  113. package/dest/msg_validators/tx_validator/allowed_setup_helpers.d.ts +17 -0
  114. package/dest/msg_validators/tx_validator/allowed_setup_helpers.d.ts.map +1 -0
  115. package/dest/msg_validators/tx_validator/allowed_setup_helpers.js +24 -0
  116. package/dest/msg_validators/tx_validator/archive_cache.js +1 -1
  117. package/dest/msg_validators/tx_validator/cached_tx_validator.d.ts +15 -0
  118. package/dest/msg_validators/tx_validator/cached_tx_validator.d.ts.map +1 -0
  119. package/dest/msg_validators/tx_validator/cached_tx_validator.js +19 -0
  120. package/dest/msg_validators/tx_validator/contract_instance_validator.d.ts +9 -0
  121. package/dest/msg_validators/tx_validator/contract_instance_validator.d.ts.map +1 -0
  122. package/dest/msg_validators/tx_validator/contract_instance_validator.js +48 -0
  123. package/dest/msg_validators/tx_validator/data_validator.d.ts +2 -1
  124. package/dest/msg_validators/tx_validator/data_validator.d.ts.map +1 -1
  125. package/dest/msg_validators/tx_validator/data_validator.js +36 -2
  126. package/dest/msg_validators/tx_validator/factory.d.ts +25 -7
  127. package/dest/msg_validators/tx_validator/factory.d.ts.map +1 -1
  128. package/dest/msg_validators/tx_validator/factory.js +55 -16
  129. package/dest/msg_validators/tx_validator/fee_payer_balance.d.ts +1 -1
  130. package/dest/msg_validators/tx_validator/fee_payer_balance.d.ts.map +1 -1
  131. package/dest/msg_validators/tx_validator/fee_payer_balance.js +6 -2
  132. package/dest/msg_validators/tx_validator/gas_validator.d.ts +53 -7
  133. package/dest/msg_validators/tx_validator/gas_validator.d.ts.map +1 -1
  134. package/dest/msg_validators/tx_validator/gas_validator.js +88 -41
  135. package/dest/msg_validators/tx_validator/index.d.ts +4 -1
  136. package/dest/msg_validators/tx_validator/index.d.ts.map +1 -1
  137. package/dest/msg_validators/tx_validator/index.js +3 -0
  138. package/dest/msg_validators/tx_validator/metadata_validator.d.ts +1 -1
  139. package/dest/msg_validators/tx_validator/metadata_validator.d.ts.map +1 -1
  140. package/dest/msg_validators/tx_validator/metadata_validator.js +4 -4
  141. package/dest/msg_validators/tx_validator/phases_validator.d.ts +21 -1
  142. package/dest/msg_validators/tx_validator/phases_validator.d.ts.map +1 -1
  143. package/dest/msg_validators/tx_validator/phases_validator.js +49 -2
  144. package/dest/msg_validators/tx_validator/tx_proof_validator.d.ts +2 -1
  145. package/dest/msg_validators/tx_validator/tx_proof_validator.d.ts.map +1 -1
  146. package/dest/msg_validators/tx_validator/tx_proof_validator.js +2 -0
  147. package/dest/msg_validators/tx_validator/tx_validation_cache.d.ts +48 -0
  148. package/dest/msg_validators/tx_validator/tx_validation_cache.d.ts.map +1 -0
  149. package/dest/msg_validators/tx_validator/tx_validation_cache.js +68 -0
  150. package/dest/services/data_store.d.ts +1 -1
  151. package/dest/services/data_store.d.ts.map +1 -1
  152. package/dest/services/data_store.js +5 -5
  153. package/dest/services/discv5/discV5_service.d.ts +13 -2
  154. package/dest/services/discv5/discV5_service.d.ts.map +1 -1
  155. package/dest/services/discv5/discV5_service.js +119 -23
  156. package/dest/services/discv5/persisted_enr_store.d.ts +38 -0
  157. package/dest/services/discv5/persisted_enr_store.d.ts.map +1 -0
  158. package/dest/services/discv5/persisted_enr_store.js +145 -0
  159. package/dest/services/dummy_service.d.ts +18 -16
  160. package/dest/services/dummy_service.d.ts.map +1 -1
  161. package/dest/services/dummy_service.js +21 -16
  162. package/dest/services/encoding.d.ts +23 -6
  163. package/dest/services/encoding.d.ts.map +1 -1
  164. package/dest/services/encoding.js +32 -16
  165. package/dest/services/gossipsub/topic_score_params.d.ts +6 -12
  166. package/dest/services/gossipsub/topic_score_params.d.ts.map +1 -1
  167. package/dest/services/gossipsub/topic_score_params.js +4 -14
  168. package/dest/services/libp2p/instrumentation.d.ts +6 -1
  169. package/dest/services/libp2p/instrumentation.d.ts.map +1 -1
  170. package/dest/services/libp2p/instrumentation.js +21 -0
  171. package/dest/services/libp2p/libp2p_service.d.ts +51 -51
  172. package/dest/services/libp2p/libp2p_service.d.ts.map +1 -1
  173. package/dest/services/libp2p/libp2p_service.js +499 -333
  174. package/dest/services/peer-manager/peer_manager.d.ts +31 -3
  175. package/dest/services/peer-manager/peer_manager.d.ts.map +1 -1
  176. package/dest/services/peer-manager/peer_manager.js +125 -25
  177. package/dest/services/peer-manager/peer_scoring.d.ts +34 -2
  178. package/dest/services/peer-manager/peer_scoring.d.ts.map +1 -1
  179. package/dest/services/peer-manager/peer_scoring.js +102 -13
  180. package/dest/services/reqresp/batch-tx-requester/batch_tx_requester.d.ts +4 -8
  181. package/dest/services/reqresp/batch-tx-requester/batch_tx_requester.d.ts.map +1 -1
  182. package/dest/services/reqresp/batch-tx-requester/batch_tx_requester.js +81 -86
  183. package/dest/services/reqresp/batch-tx-requester/interface.d.ts +10 -6
  184. package/dest/services/reqresp/batch-tx-requester/interface.d.ts.map +1 -1
  185. package/dest/services/reqresp/batch-tx-requester/missing_txs.d.ts +5 -4
  186. package/dest/services/reqresp/batch-tx-requester/missing_txs.d.ts.map +1 -1
  187. package/dest/services/reqresp/batch-tx-requester/missing_txs.js +13 -7
  188. package/dest/services/reqresp/batch-tx-requester/peer_collection.d.ts +3 -1
  189. package/dest/services/reqresp/batch-tx-requester/peer_collection.d.ts.map +1 -1
  190. package/dest/services/reqresp/batch-tx-requester/peer_collection.js +3 -0
  191. package/dest/services/reqresp/batch-tx-requester/tx_validator.d.ts +5 -14
  192. package/dest/services/reqresp/batch-tx-requester/tx_validator.d.ts.map +1 -1
  193. package/dest/services/reqresp/batch-tx-requester/tx_validator.js +6 -20
  194. package/dest/services/reqresp/config.d.ts +15 -3
  195. package/dest/services/reqresp/config.d.ts.map +1 -1
  196. package/dest/services/reqresp/config.js +11 -0
  197. package/dest/services/reqresp/interface.d.ts +16 -18
  198. package/dest/services/reqresp/interface.d.ts.map +1 -1
  199. package/dest/services/reqresp/interface.js +10 -20
  200. package/dest/services/reqresp/metrics.d.ts +1 -1
  201. package/dest/services/reqresp/metrics.d.ts.map +1 -1
  202. package/dest/services/reqresp/metrics.js +0 -1
  203. package/dest/services/reqresp/protocols/block_txs/bitvector.d.ts +4 -3
  204. package/dest/services/reqresp/protocols/block_txs/bitvector.d.ts.map +1 -1
  205. package/dest/services/reqresp/protocols/block_txs/bitvector.js +3 -2
  206. package/dest/services/reqresp/protocols/block_txs/block_txs_handler.d.ts +1 -1
  207. package/dest/services/reqresp/protocols/block_txs/block_txs_handler.d.ts.map +1 -1
  208. package/dest/services/reqresp/protocols/block_txs/block_txs_handler.js +31 -28
  209. package/dest/services/reqresp/protocols/block_txs/block_txs_reqresp.d.ts +12 -7
  210. package/dest/services/reqresp/protocols/block_txs/block_txs_reqresp.d.ts.map +1 -1
  211. package/dest/services/reqresp/protocols/block_txs/block_txs_reqresp.js +42 -24
  212. package/dest/services/reqresp/protocols/index.d.ts +1 -2
  213. package/dest/services/reqresp/protocols/index.d.ts.map +1 -1
  214. package/dest/services/reqresp/protocols/index.js +0 -1
  215. package/dest/services/reqresp/protocols/tx.d.ts +1 -1
  216. package/dest/services/reqresp/protocols/tx.d.ts.map +1 -1
  217. package/dest/services/reqresp/protocols/tx.js +1 -3
  218. package/dest/services/reqresp/rate-limiter/rate_limiter.d.ts +5 -4
  219. package/dest/services/reqresp/rate-limiter/rate_limiter.d.ts.map +1 -1
  220. package/dest/services/reqresp/rate-limiter/rate_limiter.js +10 -8
  221. package/dest/services/reqresp/rate-limiter/rate_limits.d.ts +1 -1
  222. package/dest/services/reqresp/rate-limiter/rate_limits.d.ts.map +1 -1
  223. package/dest/services/reqresp/rate-limiter/rate_limits.js +3 -13
  224. package/dest/services/reqresp/reqresp.d.ts +7 -29
  225. package/dest/services/reqresp/reqresp.d.ts.map +1 -1
  226. package/dest/services/reqresp/reqresp.js +73 -215
  227. package/dest/services/service.d.ts +43 -18
  228. package/dest/services/service.d.ts.map +1 -1
  229. package/dest/services/tx_collection/config.d.ts +2 -23
  230. package/dest/services/tx_collection/config.d.ts.map +1 -1
  231. package/dest/services/tx_collection/config.js +2 -55
  232. package/dest/services/tx_collection/file_store_tx_collection.d.ts +12 -28
  233. package/dest/services/tx_collection/file_store_tx_collection.d.ts.map +1 -1
  234. package/dest/services/tx_collection/file_store_tx_collection.js +43 -83
  235. package/dest/services/tx_collection/file_store_tx_source.d.ts +5 -4
  236. package/dest/services/tx_collection/file_store_tx_source.d.ts.map +1 -1
  237. package/dest/services/tx_collection/file_store_tx_source.js +39 -29
  238. package/dest/services/tx_collection/index.d.ts +2 -3
  239. package/dest/services/tx_collection/index.d.ts.map +1 -1
  240. package/dest/services/tx_collection/index.js +0 -1
  241. package/dest/services/tx_collection/instrumentation.d.ts +1 -1
  242. package/dest/services/tx_collection/instrumentation.d.ts.map +1 -1
  243. package/dest/services/tx_collection/instrumentation.js +0 -2
  244. package/dest/services/tx_collection/request_tracker.d.ts +53 -0
  245. package/dest/services/tx_collection/request_tracker.d.ts.map +1 -0
  246. package/dest/services/tx_collection/request_tracker.js +84 -0
  247. package/dest/services/tx_collection/tx_collection.d.ts +36 -55
  248. package/dest/services/tx_collection/tx_collection.d.ts.map +1 -1
  249. package/dest/services/tx_collection/tx_collection.js +275 -119
  250. package/dest/services/tx_collection/tx_collection_sink.d.ts +1 -1
  251. package/dest/services/tx_collection/tx_collection_sink.js +2 -2
  252. package/dest/services/tx_collection/tx_source.d.ts +6 -5
  253. package/dest/services/tx_collection/tx_source.d.ts.map +1 -1
  254. package/dest/services/tx_collection/tx_source.js +13 -8
  255. package/dest/services/tx_file_store/tx_file_store.d.ts +1 -3
  256. package/dest/services/tx_file_store/tx_file_store.d.ts.map +1 -1
  257. package/dest/services/tx_file_store/tx_file_store.js +4 -14
  258. package/dest/services/tx_provider.d.ts +3 -1
  259. package/dest/services/tx_provider.d.ts.map +1 -1
  260. package/dest/services/tx_provider.js +3 -0
  261. package/dest/test-helpers/make-test-p2p-clients.d.ts +1 -1
  262. package/dest/test-helpers/make-test-p2p-clients.d.ts.map +1 -1
  263. package/dest/test-helpers/make-test-p2p-clients.js +5 -2
  264. package/dest/test-helpers/mock-pubsub.d.ts +33 -9
  265. package/dest/test-helpers/mock-pubsub.d.ts.map +1 -1
  266. package/dest/test-helpers/mock-pubsub.js +57 -44
  267. package/dest/test-helpers/reqresp-nodes.d.ts +4 -5
  268. package/dest/test-helpers/reqresp-nodes.d.ts.map +1 -1
  269. package/dest/test-helpers/reqresp-nodes.js +16 -18
  270. package/dest/test-helpers/test_tx_provider.d.ts +3 -1
  271. package/dest/test-helpers/test_tx_provider.d.ts.map +1 -1
  272. package/dest/test-helpers/test_tx_provider.js +3 -0
  273. package/dest/test-helpers/testbench-utils.d.ts +15 -14
  274. package/dest/test-helpers/testbench-utils.d.ts.map +1 -1
  275. package/dest/test-helpers/testbench-utils.js +49 -15
  276. package/dest/testbench/p2p_client_testbench_worker.d.ts +3 -5
  277. package/dest/testbench/p2p_client_testbench_worker.d.ts.map +1 -1
  278. package/dest/testbench/p2p_client_testbench_worker.js +104 -41
  279. package/dest/testbench/worker_client_manager.d.ts +12 -6
  280. package/dest/testbench/worker_client_manager.d.ts.map +1 -1
  281. package/dest/testbench/worker_client_manager.js +57 -11
  282. package/dest/util.d.ts +12 -7
  283. package/dest/util.d.ts.map +1 -1
  284. package/dest/util.js +35 -14
  285. package/dest/versioning.d.ts +3 -6
  286. package/dest/versioning.d.ts.map +1 -1
  287. package/dest/versioning.js +3 -24
  288. package/package.json +17 -17
  289. package/src/bootstrap/bootstrap.ts +17 -3
  290. package/src/client/factory.ts +62 -9
  291. package/src/client/interface.ts +48 -18
  292. package/src/client/p2p_client.ts +159 -113
  293. package/src/client/test/{tx_proposal_collector/README.md → p2p_client.batch_tx_requester.bench.README.md} +23 -53
  294. package/src/config.ts +233 -20
  295. package/src/errors/p2p-service.error.ts +11 -0
  296. package/src/errors/reqresp.error.ts +13 -19
  297. package/src/index.ts +0 -1
  298. package/src/mem_pools/attestation_pool/attestation_pool.ts +327 -242
  299. package/src/mem_pools/attestation_pool/attestation_pool_test_suite.ts +244 -69
  300. package/src/mem_pools/attestation_pool/mocks.ts +13 -8
  301. package/src/mem_pools/index.ts +0 -3
  302. package/src/mem_pools/instrumentation.ts +18 -12
  303. package/src/mem_pools/tx_pool_v2/README.md +9 -1
  304. package/src/mem_pools/tx_pool_v2/archive/tx_archive.ts +30 -20
  305. package/src/mem_pools/tx_pool_v2/deleted_pool.ts +7 -7
  306. package/src/mem_pools/tx_pool_v2/eviction/fee_payer_balance_eviction_rule.ts +4 -5
  307. package/src/mem_pools/tx_pool_v2/eviction/fee_payer_balance_pre_add_rule.ts +3 -2
  308. package/src/mem_pools/tx_pool_v2/eviction/index.ts +1 -0
  309. package/src/mem_pools/tx_pool_v2/eviction/insufficient_fee_per_gas_eviction_rule.ts +67 -0
  310. package/src/mem_pools/tx_pool_v2/eviction/interfaces.ts +11 -1
  311. package/src/mem_pools/tx_pool_v2/eviction/invalid_txs_after_mining_rule.ts +1 -3
  312. package/src/mem_pools/tx_pool_v2/eviction/invalid_txs_after_reorg_rule.ts +5 -7
  313. package/src/mem_pools/tx_pool_v2/eviction/low_priority_eviction_rule.ts +5 -6
  314. package/src/mem_pools/tx_pool_v2/eviction/low_priority_pre_add_rule.ts +15 -6
  315. package/src/mem_pools/tx_pool_v2/eviction/nullifier_conflict_rule.ts +2 -1
  316. package/src/mem_pools/tx_pool_v2/instrumentation.ts +27 -0
  317. package/src/mem_pools/tx_pool_v2/interfaces.ts +40 -8
  318. package/src/mem_pools/tx_pool_v2/tx_metadata.ts +72 -20
  319. package/src/mem_pools/tx_pool_v2/tx_pool_indices.ts +62 -41
  320. package/src/mem_pools/tx_pool_v2/tx_pool_v2.ts +107 -32
  321. package/src/mem_pools/tx_pool_v2/tx_pool_v2_impl.ts +291 -137
  322. package/src/msg_validators/attestation_validator/README.md +49 -0
  323. package/src/msg_validators/attestation_validator/attestation_validator.ts +46 -14
  324. package/src/msg_validators/attestation_validator/fisherman_attestation_validator.ts +15 -7
  325. package/src/msg_validators/proposal_validator/README.md +123 -0
  326. package/src/msg_validators/proposal_validator/block_proposal_validator.ts +26 -4
  327. package/src/msg_validators/proposal_validator/checkpoint_proposal_validator.ts +43 -7
  328. package/src/msg_validators/proposal_validator/proposal_validator.ts +150 -58
  329. package/src/msg_validators/tx_validator/README.md +17 -3
  330. package/src/msg_validators/tx_validator/aggregate_tx_validator.ts +3 -12
  331. package/src/msg_validators/tx_validator/allowed_public_setup.ts +16 -35
  332. package/src/msg_validators/tx_validator/allowed_setup_helpers.ts +31 -0
  333. package/src/msg_validators/tx_validator/archive_cache.ts +1 -1
  334. package/src/msg_validators/tx_validator/cached_tx_validator.ts +31 -0
  335. package/src/msg_validators/tx_validator/contract_instance_validator.ts +56 -0
  336. package/src/msg_validators/tx_validator/data_validator.ts +44 -1
  337. package/src/msg_validators/tx_validator/factory.ts +66 -9
  338. package/src/msg_validators/tx_validator/fee_payer_balance.ts +6 -2
  339. package/src/msg_validators/tx_validator/gas_validator.ts +117 -39
  340. package/src/msg_validators/tx_validator/index.ts +3 -0
  341. package/src/msg_validators/tx_validator/metadata_validator.ts +12 -4
  342. package/src/msg_validators/tx_validator/phases_validator.ts +60 -1
  343. package/src/msg_validators/tx_validator/tx_proof_validator.ts +2 -0
  344. package/src/msg_validators/tx_validator/tx_validation_cache.ts +101 -0
  345. package/src/services/data_store.ts +5 -13
  346. package/src/services/discv5/discV5_service.ts +126 -14
  347. package/src/services/discv5/persisted_enr_store.ts +158 -0
  348. package/src/services/dummy_service.ts +26 -40
  349. package/src/services/encoding.ts +35 -19
  350. package/src/services/gossipsub/README.md +33 -11
  351. package/src/services/gossipsub/topic_score_params.ts +9 -18
  352. package/src/services/libp2p/instrumentation.ts +22 -0
  353. package/src/services/libp2p/libp2p_service.ts +560 -369
  354. package/src/services/peer-manager/peer_manager.ts +138 -24
  355. package/src/services/peer-manager/peer_scoring.ts +102 -8
  356. package/src/services/reqresp/README.md +194 -0
  357. package/src/services/reqresp/batch-tx-requester/README.md +46 -7
  358. package/src/services/reqresp/batch-tx-requester/batch_tx_requester.ts +77 -95
  359. package/src/services/reqresp/batch-tx-requester/interface.ts +13 -5
  360. package/src/services/reqresp/batch-tx-requester/missing_txs.ts +13 -6
  361. package/src/services/reqresp/batch-tx-requester/peer_collection.ts +5 -0
  362. package/src/services/reqresp/batch-tx-requester/tx_validator.ts +12 -25
  363. package/src/services/reqresp/config.ts +19 -2
  364. package/src/services/reqresp/interface.ts +21 -47
  365. package/src/services/reqresp/metrics.ts +0 -1
  366. package/src/services/reqresp/protocols/block_txs/bitvector.ts +3 -2
  367. package/src/services/reqresp/protocols/block_txs/block_txs_handler.ts +34 -30
  368. package/src/services/reqresp/protocols/block_txs/block_txs_reqresp.ts +47 -20
  369. package/src/services/reqresp/protocols/index.ts +0 -1
  370. package/src/services/reqresp/protocols/tx.ts +1 -3
  371. package/src/services/reqresp/rate-limiter/rate_limiter.ts +13 -9
  372. package/src/services/reqresp/rate-limiter/rate_limits.ts +3 -13
  373. package/src/services/reqresp/reqresp.ts +84 -259
  374. package/src/services/service.ts +51 -35
  375. package/src/services/tx_collection/config.ts +3 -80
  376. package/src/services/tx_collection/file_store_tx_collection.ts +54 -103
  377. package/src/services/tx_collection/file_store_tx_source.ts +43 -31
  378. package/src/services/tx_collection/index.ts +1 -6
  379. package/src/services/tx_collection/instrumentation.ts +1 -7
  380. package/src/services/tx_collection/request_tracker.ts +127 -0
  381. package/src/services/tx_collection/tx_collection.ts +331 -176
  382. package/src/services/tx_collection/tx_collection_sink.ts +2 -2
  383. package/src/services/tx_collection/tx_source.ts +10 -8
  384. package/src/services/tx_file_store/tx_file_store.ts +5 -17
  385. package/src/services/tx_provider.ts +5 -0
  386. package/src/test-helpers/make-test-p2p-clients.ts +4 -1
  387. package/src/test-helpers/mock-pubsub.ts +61 -60
  388. package/src/test-helpers/reqresp-nodes.ts +13 -23
  389. package/src/test-helpers/test_tx_provider.ts +5 -0
  390. package/src/test-helpers/testbench-utils.ts +63 -28
  391. package/src/testbench/p2p_client_testbench_worker.ts +111 -57
  392. package/src/testbench/worker_client_manager.ts +72 -25
  393. package/src/util.ts +33 -18
  394. package/src/versioning.ts +3 -33
  395. package/dest/client/test/tx_proposal_collector/proposal_tx_collector_worker.d.ts +0 -2
  396. package/dest/client/test/tx_proposal_collector/proposal_tx_collector_worker.d.ts.map +0 -1
  397. package/dest/client/test/tx_proposal_collector/proposal_tx_collector_worker.js +0 -304
  398. package/dest/client/test/tx_proposal_collector/proposal_tx_collector_worker_protocol.d.ts +0 -73
  399. package/dest/client/test/tx_proposal_collector/proposal_tx_collector_worker_protocol.d.ts.map +0 -1
  400. package/dest/client/test/tx_proposal_collector/proposal_tx_collector_worker_protocol.js +0 -8
  401. package/dest/mem_pools/tx_pool/aztec_kv_tx_pool.d.ts +0 -125
  402. package/dest/mem_pools/tx_pool/aztec_kv_tx_pool.d.ts.map +0 -1
  403. package/dest/mem_pools/tx_pool/aztec_kv_tx_pool.js +0 -596
  404. package/dest/mem_pools/tx_pool/eviction/eviction_manager.d.ts +0 -32
  405. package/dest/mem_pools/tx_pool/eviction/eviction_manager.d.ts.map +0 -1
  406. package/dest/mem_pools/tx_pool/eviction/eviction_manager.js +0 -112
  407. package/dest/mem_pools/tx_pool/eviction/eviction_strategy.d.ts +0 -157
  408. package/dest/mem_pools/tx_pool/eviction/eviction_strategy.d.ts.map +0 -1
  409. package/dest/mem_pools/tx_pool/eviction/eviction_strategy.js +0 -52
  410. package/dest/mem_pools/tx_pool/eviction/fee_payer_balance_eviction_rule.d.ts +0 -16
  411. package/dest/mem_pools/tx_pool/eviction/fee_payer_balance_eviction_rule.d.ts.map +0 -1
  412. package/dest/mem_pools/tx_pool/eviction/fee_payer_balance_eviction_rule.js +0 -122
  413. package/dest/mem_pools/tx_pool/eviction/invalid_txs_after_mining_rule.d.ts +0 -17
  414. package/dest/mem_pools/tx_pool/eviction/invalid_txs_after_mining_rule.d.ts.map +0 -1
  415. package/dest/mem_pools/tx_pool/eviction/invalid_txs_after_mining_rule.js +0 -84
  416. package/dest/mem_pools/tx_pool/eviction/invalid_txs_after_reorg_rule.d.ts +0 -19
  417. package/dest/mem_pools/tx_pool/eviction/invalid_txs_after_reorg_rule.d.ts.map +0 -1
  418. package/dest/mem_pools/tx_pool/eviction/invalid_txs_after_reorg_rule.js +0 -78
  419. package/dest/mem_pools/tx_pool/eviction/low_priority_eviction_rule.d.ts +0 -26
  420. package/dest/mem_pools/tx_pool/eviction/low_priority_eviction_rule.d.ts.map +0 -1
  421. package/dest/mem_pools/tx_pool/eviction/low_priority_eviction_rule.js +0 -84
  422. package/dest/mem_pools/tx_pool/eviction/nullifier_conflict_pre_add_rule.d.ts +0 -25
  423. package/dest/mem_pools/tx_pool/eviction/nullifier_conflict_pre_add_rule.d.ts.map +0 -1
  424. package/dest/mem_pools/tx_pool/eviction/nullifier_conflict_pre_add_rule.js +0 -57
  425. package/dest/mem_pools/tx_pool/index.d.ts +0 -3
  426. package/dest/mem_pools/tx_pool/index.d.ts.map +0 -1
  427. package/dest/mem_pools/tx_pool/index.js +0 -2
  428. package/dest/mem_pools/tx_pool/priority.d.ts +0 -12
  429. package/dest/mem_pools/tx_pool/priority.d.ts.map +0 -1
  430. package/dest/mem_pools/tx_pool/priority.js +0 -15
  431. package/dest/mem_pools/tx_pool/tx_pool.d.ts +0 -127
  432. package/dest/mem_pools/tx_pool/tx_pool.d.ts.map +0 -1
  433. package/dest/mem_pools/tx_pool/tx_pool.js +0 -3
  434. package/dest/mem_pools/tx_pool/tx_pool_test_suite.d.ts +0 -7
  435. package/dest/mem_pools/tx_pool/tx_pool_test_suite.d.ts.map +0 -1
  436. package/dest/mem_pools/tx_pool/tx_pool_test_suite.js +0 -400
  437. package/dest/msg_validators/clock_tolerance.d.ts +0 -21
  438. package/dest/msg_validators/clock_tolerance.d.ts.map +0 -1
  439. package/dest/msg_validators/clock_tolerance.js +0 -37
  440. package/dest/msg_validators/proposal_validator/proposal_validator_test_suite.d.ts +0 -24
  441. package/dest/msg_validators/proposal_validator/proposal_validator_test_suite.d.ts.map +0 -1
  442. package/dest/msg_validators/proposal_validator/proposal_validator_test_suite.js +0 -378
  443. package/dest/services/reqresp/connection-sampler/batch_connection_sampler.d.ts +0 -64
  444. package/dest/services/reqresp/connection-sampler/batch_connection_sampler.d.ts.map +0 -1
  445. package/dest/services/reqresp/connection-sampler/batch_connection_sampler.js +0 -151
  446. package/dest/services/reqresp/protocols/block.d.ts +0 -9
  447. package/dest/services/reqresp/protocols/block.d.ts.map +0 -1
  448. package/dest/services/reqresp/protocols/block.js +0 -32
  449. package/dest/services/tx_collection/fast_tx_collection.d.ts +0 -54
  450. package/dest/services/tx_collection/fast_tx_collection.d.ts.map +0 -1
  451. package/dest/services/tx_collection/fast_tx_collection.js +0 -327
  452. package/dest/services/tx_collection/missing_txs_tracker.d.ts +0 -32
  453. package/dest/services/tx_collection/missing_txs_tracker.d.ts.map +0 -1
  454. package/dest/services/tx_collection/missing_txs_tracker.js +0 -27
  455. package/dest/services/tx_collection/proposal_tx_collector.d.ts +0 -49
  456. package/dest/services/tx_collection/proposal_tx_collector.d.ts.map +0 -1
  457. package/dest/services/tx_collection/proposal_tx_collector.js +0 -50
  458. package/dest/services/tx_collection/slow_tx_collection.d.ts +0 -57
  459. package/dest/services/tx_collection/slow_tx_collection.d.ts.map +0 -1
  460. package/dest/services/tx_collection/slow_tx_collection.js +0 -211
  461. package/src/client/test/tx_proposal_collector/proposal_tx_collector_worker.ts +0 -345
  462. package/src/client/test/tx_proposal_collector/proposal_tx_collector_worker_protocol.ts +0 -43
  463. package/src/mem_pools/tx_pool/README.md +0 -270
  464. package/src/mem_pools/tx_pool/aztec_kv_tx_pool.ts +0 -746
  465. package/src/mem_pools/tx_pool/eviction/eviction_manager.ts +0 -132
  466. package/src/mem_pools/tx_pool/eviction/eviction_strategy.ts +0 -208
  467. package/src/mem_pools/tx_pool/eviction/fee_payer_balance_eviction_rule.ts +0 -162
  468. package/src/mem_pools/tx_pool/eviction/invalid_txs_after_mining_rule.ts +0 -104
  469. package/src/mem_pools/tx_pool/eviction/invalid_txs_after_reorg_rule.ts +0 -93
  470. package/src/mem_pools/tx_pool/eviction/low_priority_eviction_rule.ts +0 -106
  471. package/src/mem_pools/tx_pool/eviction/nullifier_conflict_pre_add_rule.ts +0 -75
  472. package/src/mem_pools/tx_pool/index.ts +0 -2
  473. package/src/mem_pools/tx_pool/priority.ts +0 -20
  474. package/src/mem_pools/tx_pool/tx_pool.ts +0 -141
  475. package/src/mem_pools/tx_pool/tx_pool_test_suite.ts +0 -319
  476. package/src/msg_validators/clock_tolerance.ts +0 -51
  477. package/src/msg_validators/proposal_validator/proposal_validator_test_suite.ts +0 -373
  478. package/src/services/reqresp/connection-sampler/batch_connection_sampler.ts +0 -161
  479. package/src/services/reqresp/protocols/block.ts +0 -37
  480. package/src/services/tx_collection/fast_tx_collection.ts +0 -387
  481. package/src/services/tx_collection/missing_txs_tracker.ts +0 -52
  482. package/src/services/tx_collection/proposal_tx_collector.ts +0 -113
  483. package/src/services/tx_collection/slow_tx_collection.ts +0 -266
@@ -1,6 +1,6 @@
1
- # ProposalTxCollector Benchmarks
1
+ # BatchTxRequester Benchmarks
2
2
 
3
- This benchmark suite measures **how quickly a proposer node can fetch missing transactions from P2P peers** when building a block proposal. It compares two alternative transaction-collection implementations under several controlled "who-has-which-txs" distributions.
3
+ This benchmark suite measures **how quickly a proposer node can fetch missing transactions from P2P peers** when building a block proposal under several controlled "who-has-which-txs" distributions.
4
4
 
5
5
  ## Purpose
6
6
 
@@ -10,12 +10,6 @@ This benchmark answers:
10
10
 
11
11
  - How long does it take to fetch **N missing txs** (N ∈ **{10, 50, 100, 500}**)?
12
12
  - How do different **peer availability patterns** affect performance?
13
- - Which collector strategy performs better under each pattern?
14
-
15
- The suite compares two collectors:
16
-
17
- - **`BatchTxRequesterCollector`** (collector type: `batch-requester`)
18
- - **`SendBatchRequestCollector`** (collector type: `send-batch-request`)
19
13
 
20
14
  ## Architecture
21
15
 
@@ -24,7 +18,7 @@ The benchmark runs a small simulated network on localhost:
24
18
  ```
25
19
  ┌─────────────────────────────────────────────────────────────────────┐
26
20
  │ Test Process (Driver) │
27
- │ p2p_client.proposal_tx_collector.bench.test.ts │
21
+ │ p2p_client.batch_tx_requester.bench.test.ts │
28
22
  │ ┌─────────────────────────────────────────────────────────────┐ │
29
23
  │ │ WorkerClientManager │ │
30
24
  │ │ (src/testbench/worker_client_manager.ts) │ │
@@ -34,7 +28,7 @@ The benchmark runs a small simulated network on localhost:
34
28
  │ ▼ ▼ ▼ │
35
29
  │ ┌───────────┐ ┌───────────┐ ┌───────────┐ │
36
30
  │ │ Worker 0 │◄──────►│ Worker 1 │◄──────►│ Worker N-1│ │
37
- │ │ (Collector│ P2P │(Responder)│ P2P │(Responder)│ │
31
+ │ │(Aggregator│ P2P │(Responder)│ P2P │(Responder)│ │
38
32
  │ │ Node) │ │ │ │ │ │
39
33
  │ │ TxPool:[] │ │ TxPool: │ │ TxPool: │ │
40
34
  │ │ │ │ [txs...] │ │ [txs...] │ │
@@ -54,12 +48,12 @@ Using separate OS processes makes the setup closer to real networking behavior (
54
48
 
55
49
  The network is intentionally asymmetric:
56
50
 
57
- - **Worker 0 is the collector/proposer node**
51
+ - **Worker 0 is the aggregator/proposer node**
58
52
  - Starts with an **empty tx pool** (`[]`)
59
- - Is the only worker instructed to run the collector for each `BENCH_REQRESP` command
53
+ - Is the only worker instructed to run `BatchTxRequester` for each `BENCH_REQRESP` command
60
54
  - **Workers 1..N-1 are responder peers**
61
55
  - Locally generate and filter txs according to the distribution pattern
62
- - Respond to req/resp queries made by Worker 0's collector
56
+ - Respond to req/resp queries made by Worker 0's `BatchTxRequester`
63
57
 
64
58
  This models a proposer that has only `txHashes` in a proposal and must fetch the full tx bodies from the network.
65
59
 
@@ -72,7 +66,7 @@ Each benchmark case generates `missingTxCount` mock txs and assigns them to peer
72
66
  **Every responder peer has every transaction.**
73
67
 
74
68
  - Simulates the best-case: high replication / high gossip success
75
- - Expectation: collector should quickly succeed; differences mostly reflect collector overhead and batching strategy
69
+ - Expectation: the requester should quickly succeed; differences mostly reflect requester overhead and batching strategy
76
70
 
77
71
  ### `sparse`
78
72
 
@@ -81,7 +75,7 @@ Each benchmark case generates `missingTxCount` mock txs and assigns them to peer
81
75
  Each responder is bucketed and holds txs whose index falls into its bucket or the "next" bucket (striped by tx index).
82
76
 
83
77
  - Simulates partial propagation, churn, or uneven mempool convergence
84
- - Expectation: collector must query multiple peers and cope with "misses"
78
+ - Expectation: the requester must query multiple peers and cope with "misses"
85
79
 
86
80
  ### `pinned-only`
87
81
 
@@ -92,33 +86,13 @@ Each responder is bucketed and holds txs whose index falls into its bucket or th
92
86
 
93
87
  > **Guardrail:** the pinned peer index must be within `(0, numberOfPeers)` (Worker 0 cannot be pinned).
94
88
 
95
- ## Collectors Under Test
96
-
97
- ### `BatchTxRequesterCollector` (`batch-requester`)
98
-
99
- ```typescript
100
- new BatchTxRequesterCollector(p2pService, logger, new DateProvider())
101
- ```
102
-
103
- Uses the P2P service plus internal logic to fetch missing txs, coordinating requests in a batched or staged way.
104
-
105
- ### `SendBatchRequestCollector` (`send-batch-request`)
106
-
107
- ```typescript
108
- const maxPeers = 10;
109
- const maxRetryAttempts = Math.max(peerIds.length, 3);
110
- new SendBatchRequestCollector(p2pService, maxPeers, maxRetryAttempts)
111
- ```
112
-
113
- Explicitly caps the number of peers it will involve (`maxPeers`) and uses a retry budget derived from peer count.
114
-
115
89
  ## Test Parameters
116
90
 
117
91
  | Parameter | Value | Description |
118
92
  |-----------|-------|-------------|
119
93
  | `PEERS_PER_RUN` | 30 | Number of worker processes spawned |
120
94
  | `MISSING_TX_COUNTS` | 10, 50, 100, 500 | Number of missing transactions to fetch |
121
- | `TIMEOUT_MS` | 30,000 ms | Collector timeout per case |
95
+ | `TIMEOUT_MS` | 30,000 ms | Per-case timeout for the requester |
122
96
  | `TEST_TIMEOUT_MS` | 600,000 ms | Overall Jest timeout (10 minutes) |
123
97
 
124
98
  ## Running
@@ -127,13 +101,13 @@ From the p2p package:
127
101
 
128
102
  ```bash
129
103
  cd yarn-project/p2p
130
- yarn test src/client/test/tx_proposal_collector/p2p_client.proposal_tx_collector.bench.test.ts
104
+ yarn test src/client/test/p2p_client.batch_tx_requester.bench.test.ts
131
105
  ```
132
106
 
133
107
  Or from repo root:
134
108
 
135
109
  ```bash
136
- yarn test p2p_client.proposal_tx_collector.bench.test.ts
110
+ yarn test p2p_client.batch_tx_requester.bench.test.ts
137
111
  ```
138
112
 
139
113
  The benchmark is intentionally long due to spawning many processes and running multiple cases.
@@ -145,14 +119,12 @@ The benchmark is intentionally long due to spawning many processes and running m
145
119
  If no env vars are set, the suite prints a table:
146
120
 
147
121
  ```
148
- | Collector | Distribution | Missing | Duration (ms) | Fetched | Success |
149
- |---------------------|--------------|---------|---------------|---------|---------|
150
- | batch-requester | pinned-only | 10 | 123 | 10 | Yes |
151
- | send-batch-request | pinned-only | 10 | 145 | 10 | Yes |
122
+ | Distribution | Missing | Duration (ms) | Fetched | Success |
123
+ |--------------|---------|---------------|---------|---------|
124
+ | pinned-only | 10 | 123 | 10 | Yes |
125
+ | pinned-only | 50 | 145 | 50 | Yes |
152
126
  ```
153
127
 
154
- Plus a comparison summary stating which collector was faster per `(distribution, missing)` pair.
155
-
156
128
  ### JSON metrics (for CI/dashboards)
157
129
 
158
130
  ```bash
@@ -160,8 +132,8 @@ BENCH_OUTPUT=/path/results.json yarn test ...
160
132
  ```
161
133
 
162
134
  Writes JSON metrics like:
163
- - `ProposalTxCollector/<collector>/<distribution>/missing_<N>/duration` (ms)
164
- - `ProposalTxCollector/<collector>/<distribution>/missing_<N>/fetched` (txs)
135
+ - `BatchTxRequester/<distribution>/missing_<N>/duration` (ms)
136
+ - `BatchTxRequester/<distribution>/missing_<N>/fetched` (txs)
165
137
 
166
138
  ### Markdown file output
167
139
 
@@ -175,14 +147,14 @@ Writes the pretty table + summary to disk.
175
147
 
176
148
  For each case the benchmark records:
177
149
 
178
- - `durationMs`: wall-clock time spent inside the collector call
179
- - `fetchedCount`: how many txs were returned by the collector
150
+ - `durationMs`: wall-clock time spent inside the requester call
151
+ - `fetchedCount`: how many txs were returned by the requester
180
152
  - `success`: `fetchedCount === missingTxCount`
181
153
 
182
154
  **Guidelines:**
183
155
 
184
156
  - **Always check `Success` first.** A faster run that fetched fewer txs is not a win.
185
- - Compare collectors **within the same distribution + missing count** only.
157
+ - Compare runs **within the same distribution + missing count** only.
186
158
  - Expect `pinned-only` to highlight pinned-peer behavior (fast if pinned peer is used effectively; slow if the algorithm wastes time sampling other peers).
187
159
  - Expect `sparse` to be the most "network-like" stress case, since many peers won't have each requested tx.
188
160
 
@@ -193,7 +165,7 @@ Inside each worker, the benchmark intentionally reduces variability:
193
165
  - **Unlimited rate limits** are installed so the req/resp rate limiter doesn't dominate results
194
166
  - **Deterministic tx generation** ensures all workers see the same tx set without large IPC payloads
195
167
 
196
- This makes the benchmark better for *comparing collectors* (A vs B), but it is **not** a perfect model of production networking conditions.
168
+ This makes the benchmark better for tracking regressions, but it is **not** a perfect model of production networking conditions.
197
169
 
198
170
  ## Limitations
199
171
 
@@ -207,9 +179,7 @@ This benchmark does **not** measure:
207
179
 
208
180
  | File | Purpose |
209
181
  |------|---------|
210
- | `p2p_client.proposal_tx_collector.bench.test.ts` | Test suite (cases, distributions, output formatting) |
211
- | `proposal_tx_collector_worker.ts` | Collector-specific worker implementation |
212
- | `proposal_tx_collector_worker_protocol.ts` | IPC message types and serialization |
182
+ | `p2p_client.batch_tx_requester.bench.test.ts` | Test suite (cases, distributions, output formatting) |
213
183
  | `src/testbench/worker_client_manager.ts` | Worker process manager (forking, IPC, orchestration) |
214
184
  | `src/testbench/p2p_client_testbench_worker.ts` | General testbench worker implementation |
215
185
  | `src/test-helpers/testbench-utils.ts` | Shared mocks and utilities (InMemoryTxPool, InMemoryAttestationPool, etc.) |
package/src/config.ts CHANGED
@@ -1,16 +1,18 @@
1
1
  import {
2
2
  type ConfigMappingsType,
3
3
  SecretValue,
4
+ bigintConfigHelper,
4
5
  booleanConfigHelper,
6
+ floatConfigHelper,
5
7
  getConfigFromMappings,
6
8
  getDefaultConfig,
7
9
  numberConfigHelper,
10
+ optionalNumberConfigHelper,
8
11
  percentageConfigHelper,
9
12
  pickConfigMappings,
10
13
  secretStringConfigHelper,
11
14
  } from '@aztec/foundation/config';
12
15
  import { Fr } from '@aztec/foundation/curves/bn254';
13
- import { type DataStoreConfig, dataConfigMappings } from '@aztec/kv-store/config';
14
16
  import { FunctionSelector } from '@aztec/stdlib/abi/function-selector';
15
17
  import { AztecAddress } from '@aztec/stdlib/aztec-address';
16
18
  import {
@@ -20,6 +22,7 @@ import {
20
22
  chainConfigMappings,
21
23
  sharedSequencerConfigMappings,
22
24
  } from '@aztec/stdlib/config';
25
+ import { type DataStoreConfig, dataConfigMappings } from '@aztec/stdlib/kv-store';
23
26
 
24
27
  import {
25
28
  type BatchTxRequesterConfig,
@@ -38,16 +41,28 @@ export interface P2PConfig
38
41
  ChainConfig,
39
42
  TxCollectionConfig,
40
43
  TxFileStoreConfig,
41
- Pick<SequencerConfig, 'blockDurationMs' | 'expectedBlockProposalsPerSlot' | 'maxTxsPerBlock'> {
44
+ Pick<
45
+ SequencerConfig,
46
+ | 'expectedBlockProposalsPerSlot'
47
+ | 'maxTxsPerBlock'
48
+ | 'checkpointProposalSyncGraceSeconds'
49
+ | 'maxBlocksPerCheckpoint'
50
+ >,
51
+ // `blockDurationMs` is optional on the loose `SequencerConfig` but is always populated for p2p via
52
+ // the shared `numberConfigHelper(3000)` mapping, so it is required here.
53
+ Required<Pick<SequencerConfig, 'blockDurationMs'>> {
54
+ /** Maximum transactions per block for validation. Overrides maxTxsPerBlock for gossip validation when set. */
55
+ validateMaxTxsPerBlock?: number;
56
+
57
+ /** Maximum transactions per checkpoint for validation. Used as fallback for maxTxsPerBlock when that is not set. */
58
+ validateMaxTxsPerCheckpoint?: number;
59
+
42
60
  /** A flag dictating whether the P2P subsystem should be enabled. */
43
61
  p2pEnabled: boolean;
44
62
 
45
63
  /** The frequency in which to check for new L2 blocks. */
46
64
  blockCheckIntervalMS: number;
47
65
 
48
- /** The frequency in which to check for new L2 slots. */
49
- slotCheckIntervalMS: number;
50
-
51
66
  /** The number of blocks to fetch in a single batch. */
52
67
  blockRequestBatchSize: number;
53
68
 
@@ -57,6 +72,9 @@ export interface P2PConfig
57
72
  /** The frequency in which to check for new peers. */
58
73
  peerCheckIntervalMS: number;
59
74
 
75
+ /** How long to ban a peer after it fails MAX_DIAL_ATTEMPTS dials. */
76
+ peerFailedBanTimeMs: number;
77
+
60
78
  /** Size of queue of L2 blocks to store. */
61
79
  l2QueueSize: number;
62
80
 
@@ -90,9 +108,21 @@ export interface P2PConfig
90
108
  /** The maximum number of peers (a peer count above this will cause the node to refuse connection attempts) */
91
109
  maxPeerCount: number;
92
110
 
111
+ /**
112
+ * Minimum number of connected peers for the p2p component to report itself as healthy on the node status endpoint.
113
+ * Defaults to zero, so p2p health is reported but never fails the check: the first node of a fresh network
114
+ * legitimately runs with no peers, and failing readiness by default would prevent bootstrapping the network.
115
+ */
116
+ p2pHealthMinPeers: number;
117
+
93
118
  /** If announceUdpAddress or announceTcpAddress are not provided, query for the IP address of the machine. Default is false. */
94
119
  queryForIp: boolean;
95
120
 
121
+ /**
122
+ * HTTPS URLs that return plain-text public IPv4, tried in order when resolving the announce IP (e.g. when `queryForIp` is true and `p2pIp` is unset).
123
+ */
124
+ publicIpServices: string[];
125
+
96
126
  /** The interval of the gossipsub heartbeat to perform maintenance tasks. */
97
127
  gossipsubInterval: number;
98
128
 
@@ -120,6 +150,13 @@ export interface P2PConfig
120
150
  /** How long to keep message IDs in the seen cache (ms). */
121
151
  gossipsubSeenTTL: number;
122
152
 
153
+ /**
154
+ * Maximum clock-disparity tolerance (ms) applied to proposal/attestation gossip receive windows. Both
155
+ * ends of each acceptance window are widened by this much so peers are not penalized for messages valid
156
+ * when sent but arriving slightly early or late due to clock skew (Ethereum's MAXIMUM_GOSSIP_CLOCK_DISPARITY).
157
+ */
158
+ maxGossipClockDisparityMs: number;
159
+
123
160
  /** The 'age' (in # of L2 blocks) of a processed tx after which we heavily penalize a peer for re-sending it. */
124
161
  doubleSpendSeverePeerPenaltyWindow: number;
125
162
 
@@ -135,6 +172,9 @@ export interface P2PConfig
135
172
  /** The values for the peer scoring system. Passed as a comma separated list of values in order: low, mid, high tolerance errors. */
136
173
  peerPenaltyValues: number[];
137
174
 
175
+ /** How long (in seconds) a peer is banned for once its score drops below the ban threshold. */
176
+ peerBanDurationSeconds: number;
177
+
138
178
  /** Limit of transactions to archive in the tx pool. Once the archived tx limit is reached, the oldest archived txs will be purged. */
139
179
  archivedTxLimit: number;
140
180
 
@@ -159,6 +199,9 @@ export interface P2PConfig
159
199
  /** The node's seen message ID cache size */
160
200
  seenMessageCacheSize: number;
161
201
 
202
+ /** Maximum number of (validator, tx) pairs to keep in the tx validation LRU cache. */
203
+ txValidationCacheSize: number;
204
+
162
205
  /** True to disable the status handshake on peer connected. */
163
206
  p2pDisableStatusHandshake?: boolean;
164
207
 
@@ -190,11 +233,67 @@ export interface P2PConfig
190
233
 
191
234
  /** Minimum age (ms) a transaction must have been in the pool before it's eligible for block building. */
192
235
  minTxPoolAgeMs: number;
236
+
237
+ /**
238
+ * Number of full L2 slots to wait after a checkpoint's slot before declaring its txs missing
239
+ * for data-withholding slashing.
240
+ */
241
+ slashDataWithholdingToleranceSlots: number;
242
+
243
+ /**
244
+ * Number of L2 slots after a mined block's slot to keep collecting its missing txs. Clamped
245
+ * up so that collection always runs at least until the data-withholding slash verdict is
246
+ * rendered (`block.slot + slashDataWithholdingToleranceSlots + 1`). Defaults to undefined,
247
+ * in which case the tolerance window is used directly.
248
+ */
249
+ p2pMissingTxCollectionDeadlineSlots?: number;
250
+
251
+ /** Minimum percentage fee increase required to replace an existing tx via RPC (0 = no bump). */
252
+ priceBumpPercentage: bigint;
253
+
254
+ /**
255
+ * Number of slots behind the finalized tip to keep finalized txs for before deleting them. 0 deletes
256
+ * at the finalized tip (default).
257
+ */
258
+ keepFinalizedTxsForSlots: number;
259
+
260
+ /** Drop incoming block and checkpoint proposals at the libp2p dispatch layer (for testing only) */
261
+ skipIncomingProposals?: boolean;
262
+
263
+ /** Accept proposal gossip regardless of slot timing (for testing only). */
264
+ skipProposalSlotValidation?: boolean;
265
+
266
+ /**
267
+ * Whether this node skips checkpoint proposal validation and always attests. When set, the checkpoint
268
+ * attestation is created and broadcast before the embedded last block is processed, so it is not delayed
269
+ * past the slot's attestation window by that block's re-execution. Mirrors the validator config flag.
270
+ */
271
+ skipCheckpointProposalValidation?: boolean;
193
272
  }
194
273
 
195
274
  export const DEFAULT_P2P_PORT = 40400;
196
275
 
276
+ /** Default endpoints used to discover this machine's public IPv4 when `queryForIp` is enabled. */
277
+ export const DEFAULT_PUBLIC_IP_SERVICES: string[] = [
278
+ 'https://api.ipify.org/',
279
+ 'https://checkip.amazonaws.com/',
280
+ 'https://ifconfig.me/ip',
281
+ 'https://icanhazip.com/',
282
+ ];
283
+
197
284
  export const p2pConfigMappings: ConfigMappingsType<P2PConfig> = {
285
+ validateMaxTxsPerBlock: {
286
+ env: 'VALIDATOR_MAX_TX_PER_BLOCK',
287
+ description:
288
+ 'Maximum transactions per block for validation. Overrides maxTxsPerBlock for gossip validation when set.',
289
+ ...optionalNumberConfigHelper(),
290
+ },
291
+ validateMaxTxsPerCheckpoint: {
292
+ env: 'VALIDATOR_MAX_TX_PER_CHECKPOINT',
293
+ description:
294
+ 'Maximum transactions per checkpoint for validation. Used as fallback for maxTxsPerBlock when that is not set.',
295
+ ...optionalNumberConfigHelper(),
296
+ },
198
297
  p2pEnabled: {
199
298
  env: 'P2P_ENABLED',
200
299
  description: 'A flag dictating whether the P2P subsystem should be enabled.',
@@ -210,11 +309,6 @@ export const p2pConfigMappings: ConfigMappingsType<P2PConfig> = {
210
309
  description: 'The frequency in which to check for new L2 blocks.',
211
310
  ...numberConfigHelper(100),
212
311
  },
213
- slotCheckIntervalMS: {
214
- env: 'P2P_SLOT_CHECK_INTERVAL_MS',
215
- description: 'The frequency in which to check for new L2 slots.',
216
- ...numberConfigHelper(1000),
217
- },
218
312
  debugDisableColocationPenalty: {
219
313
  env: 'DEBUG_P2P_DISABLE_COLOCATION_PENALTY',
220
314
  description: 'DEBUG: Disable colocation penalty - NEVER set to true in production',
@@ -225,6 +319,11 @@ export const p2pConfigMappings: ConfigMappingsType<P2PConfig> = {
225
319
  description: 'The frequency in which to check for new peers.',
226
320
  ...numberConfigHelper(30_000),
227
321
  },
322
+ peerFailedBanTimeMs: {
323
+ env: 'P2P_PEER_FAILED_BAN_TIME_MS',
324
+ description: 'How long to ban a peer after it fails maximum dial attempts.',
325
+ ...numberConfigHelper(5 * 60 * 1000),
326
+ },
228
327
  l2QueueSize: {
229
328
  env: 'P2P_L2_QUEUE_SIZE',
230
329
  description: 'Size of queue of L2 blocks to store.',
@@ -279,12 +378,29 @@ export const p2pConfigMappings: ConfigMappingsType<P2PConfig> = {
279
378
  description: 'The maximum number of peers to connect to.',
280
379
  ...numberConfigHelper(100),
281
380
  },
381
+ p2pHealthMinPeers: {
382
+ env: 'P2P_HEALTH_MIN_PEERS',
383
+ description:
384
+ 'Minimum number of connected peers for p2p to be reported as healthy on the status endpoint. Zero never fails the check.',
385
+ ...numberConfigHelper(0),
386
+ },
282
387
  queryForIp: {
283
388
  env: 'P2P_QUERY_FOR_IP',
284
389
  description:
285
390
  'If announceUdpAddress or announceTcpAddress are not provided, query for the IP address of the machine. Default is false.',
286
391
  ...booleanConfigHelper(),
287
392
  },
393
+ publicIpServices: {
394
+ env: 'P2P_PUBLIC_IP_SERVICES',
395
+ parseEnv: (val: string) =>
396
+ val
397
+ .split(',')
398
+ .map(s => s.trim())
399
+ .filter(Boolean),
400
+ description:
401
+ 'Comma-separated HTTPS URLs that return plain-text public IPv4. Used when P2P_QUERY_FOR_IP is true and P2P_IP is unset. Tried in order until one succeeds.',
402
+ defaultValue: DEFAULT_PUBLIC_IP_SERVICES,
403
+ },
288
404
  gossipsubInterval: {
289
405
  env: 'P2P_GOSSIPSUB_INTERVAL_MS',
290
406
  description: 'The interval of the gossipsub heartbeat to perform maintenance tasks.',
@@ -318,7 +434,7 @@ export const p2pConfigMappings: ConfigMappingsType<P2PConfig> = {
318
434
  gossipsubMcacheLength: {
319
435
  env: 'P2P_GOSSIPSUB_MCACHE_LENGTH',
320
436
  description: 'The number of gossipsub interval message cache windows to keep.',
321
- ...numberConfigHelper(6),
437
+ ...numberConfigHelper(12),
322
438
  },
323
439
  gossipsubMcacheGossip: {
324
440
  env: 'P2P_GOSSIPSUB_MCACHE_GOSSIP',
@@ -330,20 +446,26 @@ export const p2pConfigMappings: ConfigMappingsType<P2PConfig> = {
330
446
  description: 'How long to keep message IDs in the seen cache.',
331
447
  ...numberConfigHelper(20 * 60 * 1000),
332
448
  },
449
+ maxGossipClockDisparityMs: {
450
+ env: 'P2P_MAX_GOSSIP_CLOCK_DISPARITY_MS',
451
+ description:
452
+ 'Maximum clock-disparity tolerance (ms) applied to both ends of proposal/attestation gossip receive windows.',
453
+ ...numberConfigHelper(500),
454
+ },
333
455
  gossipsubTxTopicWeight: {
334
456
  env: 'P2P_GOSSIPSUB_TX_TOPIC_WEIGHT',
335
457
  description: 'The weight of the tx topic for the gossipsub protocol.',
336
- ...numberConfigHelper(1),
458
+ ...floatConfigHelper(1),
337
459
  },
338
460
  gossipsubTxInvalidMessageDeliveriesWeight: {
339
461
  env: 'P2P_GOSSIPSUB_TX_INVALID_MESSAGE_DELIVERIES_WEIGHT',
340
462
  description: 'The weight of the tx invalid message deliveries for the gossipsub protocol.',
341
- ...numberConfigHelper(-20),
463
+ ...floatConfigHelper(-20),
342
464
  },
343
465
  gossipsubTxInvalidMessageDeliveriesDecay: {
344
466
  env: 'P2P_GOSSIPSUB_TX_INVALID_MESSAGE_DELIVERIES_DECAY',
345
467
  description: 'Determines how quickly the penalty for invalid message deliveries decays over time. Between 0 and 1.',
346
- ...numberConfigHelper(0.5),
468
+ ...floatConfigHelper(0.5),
347
469
  },
348
470
  peerPenaltyValues: {
349
471
  env: 'P2P_PEER_PENALTY_VALUES',
@@ -352,6 +474,11 @@ export const p2pConfigMappings: ConfigMappingsType<P2PConfig> = {
352
474
  'The values for the peer scoring system. Passed as a comma separated list of values in order: low, mid, high tolerance errors.',
353
475
  defaultValue: [2, 10, 50],
354
476
  },
477
+ peerBanDurationSeconds: {
478
+ env: 'P2P_PEER_BAN_DURATION_SECONDS',
479
+ description: 'How long (in seconds) a peer is banned for once its score drops below the ban threshold.',
480
+ ...numberConfigHelper(24 * 60 * 60),
481
+ },
355
482
  doubleSpendSeverePeerPenaltyWindow: {
356
483
  env: 'P2P_DOUBLE_SPEND_SEVERE_PEER_PENALTY_WINDOW',
357
484
  description: 'The "age" (in L2 blocks) of a tx after which we heavily penalize a peer for sending it.',
@@ -390,16 +517,16 @@ export const p2pConfigMappings: ConfigMappingsType<P2PConfig> = {
390
517
  },
391
518
  p2pStoreMapSizeKb: {
392
519
  env: 'P2P_STORE_MAP_SIZE_KB',
393
- parseEnv: (val: string | undefined) => (val ? +val : undefined),
520
+ ...optionalNumberConfigHelper(),
394
521
  description: 'The maximum possible size of the P2P DB in KB. Overwrites the general dataStoreMapSizeKb.',
395
522
  },
396
523
  txPublicSetupAllowListExtend: {
397
524
  env: 'TX_PUBLIC_SETUP_ALLOWLIST',
398
525
  parseEnv: (val: string) => parseAllowList(val),
399
526
  description:
400
- 'Additional entries to extend the default setup allow list. Format: I:address:selector,C:classId:selector',
527
+ 'Additional entries to extend the default setup allow list. Format: I:address:selector[:flags],C:classId:selector[:flags]. Flags: os (onlySelf), rn (rejectNullMsgSender), cl=N (calldataLength), joined with +.',
401
528
  printDefault: () =>
402
- 'Default: AuthRegistry._set_authorized, FeeJuice._increase_public_balance, Token._increase_public_balance, Token.transfer_in_public',
529
+ 'Default: AuthRegistry._set_authorized, AuthRegistry.set_authorized, FeeJuice._increase_public_balance',
403
530
  },
404
531
  maxPendingTxCount: {
405
532
  env: 'P2P_MAX_PENDING_TX_COUNT',
@@ -413,6 +540,11 @@ export const p2pConfigMappings: ConfigMappingsType<P2PConfig> = {
413
540
  description: 'The number of messages to keep in the seen message cache',
414
541
  ...numberConfigHelper(100_000), // 100K
415
542
  },
543
+ txValidationCacheSize: {
544
+ env: 'P2P_TX_VALIDATION_CACHE_SIZE',
545
+ description: 'Maximum number of items to keep in the tx validation LRU cache.',
546
+ ...numberConfigHelper(5_000),
547
+ },
416
548
  p2pDisableStatusHandshake: {
417
549
  env: 'P2P_DISABLE_STATUS_HANDSHAKE',
418
550
  description: 'True to disable the status handshake on peer connected.',
@@ -460,12 +592,55 @@ export const p2pConfigMappings: ConfigMappingsType<P2PConfig> = {
460
592
  'Broadcast block proposals even when a conflicting proposal for the same slot already exists in the pool (for testing purposes only).',
461
593
  ...booleanConfigHelper(false),
462
594
  },
595
+ skipIncomingProposals: {
596
+ description: 'Drop incoming block and checkpoint proposals at the libp2p dispatch layer (for testing only)',
597
+ ...booleanConfigHelper(false),
598
+ },
599
+ skipProposalSlotValidation: {
600
+ description: 'Accept proposal gossip regardless of slot timing (for testing only)',
601
+ ...booleanConfigHelper(false),
602
+ },
603
+ skipCheckpointProposalValidation: {
604
+ description:
605
+ 'Skip checkpoint proposal validation and always attest, broadcasting the attestation before processing the embedded last block',
606
+ ...booleanConfigHelper(false),
607
+ },
463
608
  minTxPoolAgeMs: {
464
609
  env: 'P2P_MIN_TX_POOL_AGE_MS',
465
610
  description: 'Minimum age (ms) a transaction must have been in the pool before it is eligible for block building.',
466
611
  ...numberConfigHelper(2_000),
467
612
  },
468
- ...sharedSequencerConfigMappings,
613
+ slashDataWithholdingToleranceSlots: {
614
+ env: 'SLASH_DATA_WITHHOLDING_TOLERANCE_SLOTS',
615
+ description:
616
+ 'L2 slots to wait after a checkpoint slot before declaring its txs missing. Drives both the data-withholding slasher check and the missing-tx collection deadline.',
617
+ ...numberConfigHelper(3),
618
+ },
619
+ p2pMissingTxCollectionDeadlineSlots: {
620
+ env: 'P2P_MISSING_TX_COLLECTION_DEADLINE_SLOTS',
621
+ description:
622
+ 'Optional deadline (in L2 slots after the block slot) for collecting missing txs for unproven mined blocks. Clamped up to the data-withholding tolerance window so collection never gives up before the slash verdict.',
623
+ ...optionalNumberConfigHelper(),
624
+ },
625
+ priceBumpPercentage: {
626
+ env: 'P2P_RPC_PRICE_BUMP_PERCENTAGE',
627
+ description:
628
+ 'Minimum percentage fee increase required to replace an existing tx via RPC. Even at 0%, replacement still requires paying at least 1 unit more.',
629
+ ...bigintConfigHelper(10n),
630
+ },
631
+ keepFinalizedTxsForSlots: {
632
+ env: 'P2P_KEEP_FINALIZED_TXS_FOR_SLOTS',
633
+ description:
634
+ 'Number of slots behind the finalized tip to keep finalized txs for before deleting them. 0 deletes at the finalized tip.',
635
+ ...numberConfigHelper(0),
636
+ },
637
+ ...pickConfigMappings(sharedSequencerConfigMappings, [
638
+ 'expectedBlockProposalsPerSlot',
639
+ 'maxTxsPerBlock',
640
+ 'checkpointProposalSyncGraceSeconds',
641
+ 'maxBlocksPerCheckpoint',
642
+ 'blockDurationMs',
643
+ ]),
469
644
  ...p2pReqRespConfigMappings,
470
645
  ...batchTxRequesterConfigMappings,
471
646
  ...chainConfigMappings,
@@ -498,6 +673,7 @@ export type BootnodeConfig = Pick<
498
673
  | 'bootstrapNodes'
499
674
  | 'listenAddress'
500
675
  | 'queryForIp'
676
+ | 'publicIpServices'
501
677
  > &
502
678
  Required<Pick<P2PConfig, 'p2pIp' | 'p2pPort'>> &
503
679
  Pick<DataStoreConfig, 'dataDirectory' | 'dataStoreMapSizeKb'> &
@@ -515,6 +691,7 @@ const bootnodeConfigKeys: (keyof BootnodeConfig)[] = [
515
691
  'bootstrapNodes',
516
692
  'l1ChainId',
517
693
  'queryForIp',
694
+ 'publicIpServices',
518
695
  ];
519
696
 
520
697
  export const bootnodeConfigMappings = pickConfigMappings(
@@ -522,12 +699,45 @@ export const bootnodeConfigMappings = pickConfigMappings(
522
699
  bootnodeConfigKeys,
523
700
  );
524
701
 
702
+ /**
703
+ * Parses a `+`-separated flags string into validation properties for an allow list entry.
704
+ * Supported flags: `os` (onlySelf), `rn` (rejectNullMsgSender), `cl=N` (calldataLength).
705
+ */
706
+ function parseFlags(
707
+ flags: string,
708
+ entry: string,
709
+ ): { onlySelf?: boolean; rejectNullMsgSender?: boolean; calldataLength?: number } {
710
+ const result: { onlySelf?: boolean; rejectNullMsgSender?: boolean; calldataLength?: number } = {};
711
+ for (const flag of flags.split('+')) {
712
+ if (flag === 'os') {
713
+ result.onlySelf = true;
714
+ } else if (flag === 'rn') {
715
+ result.rejectNullMsgSender = true;
716
+ } else if (flag.startsWith('cl=')) {
717
+ const n = parseInt(flag.slice(3), 10);
718
+ if (isNaN(n) || n < 0) {
719
+ throw new Error(
720
+ `Invalid allow list entry "${entry}": invalid calldataLength in flag "${flag}". Expected a non-negative integer.`,
721
+ );
722
+ }
723
+ result.calldataLength = n;
724
+ } else {
725
+ throw new Error(`Invalid allow list entry "${entry}": unknown flag "${flag}". Supported flags: os, rn, cl=N.`);
726
+ }
727
+ }
728
+ return result;
729
+ }
730
+
525
731
  /**
526
732
  * Parses a string to a list of allowed elements.
527
733
  * Each entry is expected to be of one of the following formats:
528
734
  * `I:${address}:${selector}` — instance (contract address) with function selector
529
735
  * `C:${classId}:${selector}` — class with function selector
530
736
  *
737
+ * An optional flags segment can be appended after the selector:
738
+ * `I:${address}:${selector}:${flags}` or `C:${classId}:${selector}:${flags}`
739
+ * where flags is a `+`-separated list of: `os` (onlySelf), `rn` (rejectNullMsgSender), `cl=N` (calldataLength).
740
+ *
531
741
  * @param value The string to parse
532
742
  * @returns A list of allowed elements
533
743
  */
@@ -543,7 +753,7 @@ export function parseAllowList(value: string): AllowedElement[] {
543
753
  if (!trimmed) {
544
754
  continue;
545
755
  }
546
- const [typeString, identifierString, selectorString] = trimmed.split(':');
756
+ const [typeString, identifierString, selectorString, flagsString] = trimmed.split(':');
547
757
 
548
758
  if (!selectorString) {
549
759
  throw new Error(
@@ -552,16 +762,19 @@ export function parseAllowList(value: string): AllowedElement[] {
552
762
  }
553
763
 
554
764
  const selector = FunctionSelector.fromString(selectorString);
765
+ const flags = flagsString ? parseFlags(flagsString, trimmed) : {};
555
766
 
556
767
  if (typeString === 'I') {
557
768
  entries.push({
558
- address: AztecAddress.fromString(identifierString),
769
+ address: AztecAddress.fromStringUnsafe(identifierString),
559
770
  selector,
771
+ ...flags,
560
772
  });
561
773
  } else if (typeString === 'C') {
562
774
  entries.push({
563
775
  classId: Fr.fromHexString(identifierString),
564
776
  selector,
777
+ ...flags,
565
778
  });
566
779
  } else {
567
780
  throw new Error(
@@ -0,0 +1,11 @@
1
+ /** Checkpoint Proposal Received Callback Not Registered Error
2
+ *
3
+ * Error triggered if the allNodesCheckpointReceivedCallback is not registered
4
+ * @category Errors
5
+ */
6
+ export class CheckpointProposalReceivedCallbackNotRegisteredError extends Error {
7
+ constructor() {
8
+ super('FATAL (allNodesCheckpointReceivedCallback): All nodes should register a checkpoint proposal handler');
9
+ this.name = 'CheckpointProposalReceivedCallbackNotRegisteredError';
10
+ }
11
+ }