@aztec/p2p 0.0.1-commit.dbf9cec → 0.0.1-commit.ddcf04837

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 (339) 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 +46 -38
  10. package/dest/client/test/tx_proposal_collector/proposal_tx_collector_worker.js +17 -6
  11. package/dest/config.d.ts +125 -100
  12. package/dest/config.d.ts.map +1 -1
  13. package/dest/config.js +92 -33
  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 +7 -5
  21. package/dest/mem_pools/attestation_pool/attestation_pool.d.ts.map +1 -1
  22. package/dest/mem_pools/attestation_pool/attestation_pool.js +16 -9
  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/instrumentation.d.ts +4 -2
  27. package/dest/mem_pools/instrumentation.d.ts.map +1 -1
  28. package/dest/mem_pools/instrumentation.js +16 -14
  29. package/dest/mem_pools/tx_pool_v2/eviction/fee_payer_balance_eviction_rule.d.ts +1 -1
  30. package/dest/mem_pools/tx_pool_v2/eviction/fee_payer_balance_eviction_rule.d.ts.map +1 -1
  31. package/dest/mem_pools/tx_pool_v2/eviction/fee_payer_balance_eviction_rule.js +2 -1
  32. package/dest/mem_pools/tx_pool_v2/eviction/interfaces.d.ts +7 -1
  33. package/dest/mem_pools/tx_pool_v2/eviction/interfaces.d.ts.map +1 -1
  34. package/dest/mem_pools/tx_pool_v2/eviction/invalid_txs_after_reorg_rule.js +2 -2
  35. package/dest/mem_pools/tx_pool_v2/eviction/low_priority_pre_add_rule.d.ts +1 -1
  36. package/dest/mem_pools/tx_pool_v2/eviction/low_priority_pre_add_rule.d.ts.map +1 -1
  37. package/dest/mem_pools/tx_pool_v2/eviction/low_priority_pre_add_rule.js +8 -6
  38. package/dest/mem_pools/tx_pool_v2/eviction/nullifier_conflict_rule.d.ts +2 -2
  39. package/dest/mem_pools/tx_pool_v2/eviction/nullifier_conflict_rule.d.ts.map +1 -1
  40. package/dest/mem_pools/tx_pool_v2/eviction/nullifier_conflict_rule.js +2 -2
  41. package/dest/mem_pools/tx_pool_v2/interfaces.d.ts +9 -5
  42. package/dest/mem_pools/tx_pool_v2/interfaces.d.ts.map +1 -1
  43. package/dest/mem_pools/tx_pool_v2/interfaces.js +2 -1
  44. package/dest/mem_pools/tx_pool_v2/tx_metadata.d.ts +25 -10
  45. package/dest/mem_pools/tx_pool_v2/tx_metadata.d.ts.map +1 -1
  46. package/dest/mem_pools/tx_pool_v2/tx_metadata.js +39 -12
  47. package/dest/mem_pools/tx_pool_v2/tx_pool_indices.d.ts +1 -1
  48. package/dest/mem_pools/tx_pool_v2/tx_pool_indices.d.ts.map +1 -1
  49. package/dest/mem_pools/tx_pool_v2/tx_pool_indices.js +26 -43
  50. package/dest/mem_pools/tx_pool_v2/tx_pool_v2.d.ts +4 -2
  51. package/dest/mem_pools/tx_pool_v2/tx_pool_v2.d.ts.map +1 -1
  52. package/dest/mem_pools/tx_pool_v2/tx_pool_v2.js +6 -0
  53. package/dest/mem_pools/tx_pool_v2/tx_pool_v2_impl.d.ts +2 -1
  54. package/dest/mem_pools/tx_pool_v2/tx_pool_v2_impl.d.ts.map +1 -1
  55. package/dest/mem_pools/tx_pool_v2/tx_pool_v2_impl.js +24 -6
  56. package/dest/msg_validators/attestation_validator/attestation_validator.d.ts +5 -2
  57. package/dest/msg_validators/attestation_validator/attestation_validator.d.ts.map +1 -1
  58. package/dest/msg_validators/attestation_validator/attestation_validator.js +20 -11
  59. package/dest/msg_validators/attestation_validator/fisherman_attestation_validator.d.ts +4 -2
  60. package/dest/msg_validators/attestation_validator/fisherman_attestation_validator.d.ts.map +1 -1
  61. package/dest/msg_validators/attestation_validator/fisherman_attestation_validator.js +2 -2
  62. package/dest/msg_validators/clock_tolerance.d.ts +12 -1
  63. package/dest/msg_validators/clock_tolerance.d.ts.map +1 -1
  64. package/dest/msg_validators/clock_tolerance.js +54 -3
  65. package/dest/msg_validators/proposal_validator/block_proposal_validator.d.ts +7 -4
  66. package/dest/msg_validators/proposal_validator/block_proposal_validator.d.ts.map +1 -1
  67. package/dest/msg_validators/proposal_validator/block_proposal_validator.js +10 -2
  68. package/dest/msg_validators/proposal_validator/checkpoint_proposal_validator.d.ts +7 -4
  69. package/dest/msg_validators/proposal_validator/checkpoint_proposal_validator.d.ts.map +1 -1
  70. package/dest/msg_validators/proposal_validator/checkpoint_proposal_validator.js +16 -2
  71. package/dest/msg_validators/proposal_validator/proposal_validator.d.ts +15 -8
  72. package/dest/msg_validators/proposal_validator/proposal_validator.d.ts.map +1 -1
  73. package/dest/msg_validators/proposal_validator/proposal_validator.js +67 -47
  74. package/dest/msg_validators/tx_validator/allowed_public_setup.d.ts +2 -1
  75. package/dest/msg_validators/tx_validator/allowed_public_setup.d.ts.map +1 -1
  76. package/dest/msg_validators/tx_validator/allowed_public_setup.js +24 -20
  77. package/dest/msg_validators/tx_validator/allowed_setup_helpers.d.ts +17 -0
  78. package/dest/msg_validators/tx_validator/allowed_setup_helpers.d.ts.map +1 -0
  79. package/dest/msg_validators/tx_validator/allowed_setup_helpers.js +24 -0
  80. package/dest/msg_validators/tx_validator/archive_cache.js +1 -1
  81. package/dest/msg_validators/tx_validator/contract_instance_validator.d.ts +9 -0
  82. package/dest/msg_validators/tx_validator/contract_instance_validator.d.ts.map +1 -0
  83. package/dest/msg_validators/tx_validator/contract_instance_validator.js +48 -0
  84. package/dest/msg_validators/tx_validator/data_validator.d.ts +1 -1
  85. package/dest/msg_validators/tx_validator/data_validator.d.ts.map +1 -1
  86. package/dest/msg_validators/tx_validator/data_validator.js +35 -2
  87. package/dest/msg_validators/tx_validator/factory.d.ts +23 -4
  88. package/dest/msg_validators/tx_validator/factory.d.ts.map +1 -1
  89. package/dest/msg_validators/tx_validator/factory.js +36 -10
  90. package/dest/msg_validators/tx_validator/fee_payer_balance.d.ts +1 -1
  91. package/dest/msg_validators/tx_validator/fee_payer_balance.d.ts.map +1 -1
  92. package/dest/msg_validators/tx_validator/fee_payer_balance.js +6 -2
  93. package/dest/msg_validators/tx_validator/gas_validator.d.ts +13 -4
  94. package/dest/msg_validators/tx_validator/gas_validator.d.ts.map +1 -1
  95. package/dest/msg_validators/tx_validator/gas_validator.js +49 -17
  96. package/dest/msg_validators/tx_validator/index.d.ts +2 -1
  97. package/dest/msg_validators/tx_validator/index.d.ts.map +1 -1
  98. package/dest/msg_validators/tx_validator/index.js +1 -0
  99. package/dest/msg_validators/tx_validator/metadata_validator.d.ts +1 -1
  100. package/dest/msg_validators/tx_validator/metadata_validator.d.ts.map +1 -1
  101. package/dest/msg_validators/tx_validator/metadata_validator.js +4 -4
  102. package/dest/msg_validators/tx_validator/phases_validator.d.ts +22 -2
  103. package/dest/msg_validators/tx_validator/phases_validator.d.ts.map +1 -1
  104. package/dest/msg_validators/tx_validator/phases_validator.js +72 -24
  105. package/dest/services/data_store.d.ts +1 -1
  106. package/dest/services/data_store.d.ts.map +1 -1
  107. package/dest/services/data_store.js +5 -5
  108. package/dest/services/dummy_service.d.ts +6 -3
  109. package/dest/services/dummy_service.d.ts.map +1 -1
  110. package/dest/services/dummy_service.js +6 -1
  111. package/dest/services/encoding.d.ts +5 -1
  112. package/dest/services/encoding.d.ts.map +1 -1
  113. package/dest/services/encoding.js +7 -1
  114. package/dest/services/gossipsub/topic_score_params.d.ts +13 -2
  115. package/dest/services/gossipsub/topic_score_params.d.ts.map +1 -1
  116. package/dest/services/gossipsub/topic_score_params.js +21 -4
  117. package/dest/services/libp2p/libp2p_service.d.ts +15 -25
  118. package/dest/services/libp2p/libp2p_service.d.ts.map +1 -1
  119. package/dest/services/libp2p/libp2p_service.js +165 -126
  120. package/dest/services/peer-manager/metrics.d.ts +3 -1
  121. package/dest/services/peer-manager/metrics.d.ts.map +1 -1
  122. package/dest/services/peer-manager/metrics.js +6 -0
  123. package/dest/services/peer-manager/peer_manager.d.ts +6 -2
  124. package/dest/services/peer-manager/peer_manager.d.ts.map +1 -1
  125. package/dest/services/peer-manager/peer_manager.js +39 -11
  126. package/dest/services/peer-manager/peer_scoring.d.ts +7 -2
  127. package/dest/services/peer-manager/peer_scoring.d.ts.map +1 -1
  128. package/dest/services/peer-manager/peer_scoring.js +32 -10
  129. package/dest/services/reqresp/batch-tx-requester/batch_tx_requester.d.ts +11 -8
  130. package/dest/services/reqresp/batch-tx-requester/batch_tx_requester.d.ts.map +1 -1
  131. package/dest/services/reqresp/batch-tx-requester/batch_tx_requester.js +69 -65
  132. package/dest/services/reqresp/batch-tx-requester/interface.d.ts +3 -2
  133. package/dest/services/reqresp/batch-tx-requester/interface.d.ts.map +1 -1
  134. package/dest/services/reqresp/batch-tx-requester/missing_txs.d.ts +5 -4
  135. package/dest/services/reqresp/batch-tx-requester/missing_txs.d.ts.map +1 -1
  136. package/dest/services/reqresp/batch-tx-requester/missing_txs.js +13 -7
  137. package/dest/services/reqresp/batch-tx-requester/peer_collection.d.ts +3 -1
  138. package/dest/services/reqresp/batch-tx-requester/peer_collection.d.ts.map +1 -1
  139. package/dest/services/reqresp/batch-tx-requester/peer_collection.js +3 -0
  140. package/dest/services/reqresp/config.d.ts +3 -3
  141. package/dest/services/reqresp/config.d.ts.map +1 -1
  142. package/dest/services/reqresp/interface.d.ts +14 -9
  143. package/dest/services/reqresp/interface.d.ts.map +1 -1
  144. package/dest/services/reqresp/interface.js +10 -11
  145. package/dest/services/reqresp/metrics.d.ts +1 -1
  146. package/dest/services/reqresp/metrics.d.ts.map +1 -1
  147. package/dest/services/reqresp/metrics.js +0 -1
  148. package/dest/services/reqresp/protocols/index.d.ts +1 -2
  149. package/dest/services/reqresp/protocols/index.d.ts.map +1 -1
  150. package/dest/services/reqresp/protocols/index.js +0 -1
  151. package/dest/services/reqresp/protocols/tx.d.ts +1 -1
  152. package/dest/services/reqresp/protocols/tx.d.ts.map +1 -1
  153. package/dest/services/reqresp/protocols/tx.js +1 -3
  154. package/dest/services/reqresp/rate-limiter/rate_limiter.d.ts +5 -4
  155. package/dest/services/reqresp/rate-limiter/rate_limiter.d.ts.map +1 -1
  156. package/dest/services/reqresp/rate-limiter/rate_limiter.js +10 -8
  157. package/dest/services/reqresp/rate-limiter/rate_limits.d.ts +1 -1
  158. package/dest/services/reqresp/rate-limiter/rate_limits.d.ts.map +1 -1
  159. package/dest/services/reqresp/rate-limiter/rate_limits.js +0 -10
  160. package/dest/services/reqresp/reqresp.d.ts +4 -2
  161. package/dest/services/reqresp/reqresp.d.ts.map +1 -1
  162. package/dest/services/reqresp/reqresp.js +28 -11
  163. package/dest/services/service.d.ts +5 -2
  164. package/dest/services/service.d.ts.map +1 -1
  165. package/dest/services/tx_collection/fast_tx_collection.d.ts +1 -4
  166. package/dest/services/tx_collection/fast_tx_collection.d.ts.map +1 -1
  167. package/dest/services/tx_collection/fast_tx_collection.js +57 -73
  168. package/dest/services/tx_collection/file_store_tx_source.d.ts +5 -4
  169. package/dest/services/tx_collection/file_store_tx_source.d.ts.map +1 -1
  170. package/dest/services/tx_collection/file_store_tx_source.js +39 -29
  171. package/dest/services/tx_collection/proposal_tx_collector.d.ts +6 -7
  172. package/dest/services/tx_collection/proposal_tx_collector.d.ts.map +1 -1
  173. package/dest/services/tx_collection/proposal_tx_collector.js +4 -4
  174. package/dest/services/tx_collection/request_tracker.d.ts +53 -0
  175. package/dest/services/tx_collection/request_tracker.d.ts.map +1 -0
  176. package/dest/services/tx_collection/request_tracker.js +84 -0
  177. package/dest/services/tx_collection/slow_tx_collection.js +1 -1
  178. package/dest/services/tx_collection/tx_collection.d.ts +3 -6
  179. package/dest/services/tx_collection/tx_collection.d.ts.map +1 -1
  180. package/dest/services/tx_collection/tx_source.d.ts +6 -5
  181. package/dest/services/tx_collection/tx_source.d.ts.map +1 -1
  182. package/dest/services/tx_collection/tx_source.js +9 -7
  183. package/dest/test-helpers/make-test-p2p-clients.d.ts +1 -1
  184. package/dest/test-helpers/make-test-p2p-clients.d.ts.map +1 -1
  185. package/dest/test-helpers/mock-pubsub.d.ts +11 -3
  186. package/dest/test-helpers/mock-pubsub.d.ts.map +1 -1
  187. package/dest/test-helpers/mock-pubsub.js +35 -10
  188. package/dest/test-helpers/reqresp-nodes.d.ts +1 -1
  189. package/dest/test-helpers/reqresp-nodes.d.ts.map +1 -1
  190. package/dest/test-helpers/reqresp-nodes.js +1 -2
  191. package/dest/test-helpers/testbench-utils.d.ts +1 -1
  192. package/dest/test-helpers/testbench-utils.d.ts.map +1 -1
  193. package/dest/test-helpers/testbench-utils.js +23 -3
  194. package/dest/testbench/p2p_client_testbench_worker.js +68 -16
  195. package/dest/testbench/worker_client_manager.d.ts +10 -1
  196. package/dest/testbench/worker_client_manager.d.ts.map +1 -1
  197. package/dest/testbench/worker_client_manager.js +55 -3
  198. package/dest/util.d.ts +1 -1
  199. package/package.json +14 -14
  200. package/src/client/factory.ts +43 -14
  201. package/src/client/interface.ts +9 -1
  202. package/src/client/p2p_client.ts +50 -39
  203. package/src/client/test/tx_proposal_collector/proposal_tx_collector_worker.ts +19 -9
  204. package/src/config.ts +137 -35
  205. package/src/errors/p2p-service.error.ts +11 -0
  206. package/src/index.ts +0 -1
  207. package/src/mem_pools/attestation_pool/attestation_pool.ts +17 -12
  208. package/src/mem_pools/attestation_pool/attestation_pool_test_suite.ts +6 -6
  209. package/src/mem_pools/index.ts +0 -3
  210. package/src/mem_pools/instrumentation.ts +17 -13
  211. package/src/mem_pools/tx_pool_v2/README.md +9 -1
  212. package/src/mem_pools/tx_pool_v2/eviction/fee_payer_balance_eviction_rule.ts +2 -1
  213. package/src/mem_pools/tx_pool_v2/eviction/interfaces.ts +11 -1
  214. package/src/mem_pools/tx_pool_v2/eviction/invalid_txs_after_reorg_rule.ts +3 -3
  215. package/src/mem_pools/tx_pool_v2/eviction/low_priority_pre_add_rule.ts +15 -6
  216. package/src/mem_pools/tx_pool_v2/eviction/nullifier_conflict_rule.ts +2 -1
  217. package/src/mem_pools/tx_pool_v2/interfaces.ts +9 -4
  218. package/src/mem_pools/tx_pool_v2/tx_metadata.ts +60 -14
  219. package/src/mem_pools/tx_pool_v2/tx_pool_indices.ts +29 -43
  220. package/src/mem_pools/tx_pool_v2/tx_pool_v2.ts +16 -1
  221. package/src/mem_pools/tx_pool_v2/tx_pool_v2_impl.ts +28 -6
  222. package/src/msg_validators/attestation_validator/README.md +49 -0
  223. package/src/msg_validators/attestation_validator/attestation_validator.ts +21 -9
  224. package/src/msg_validators/attestation_validator/fisherman_attestation_validator.ts +4 -1
  225. package/src/msg_validators/clock_tolerance.ts +72 -3
  226. package/src/msg_validators/proposal_validator/README.md +123 -0
  227. package/src/msg_validators/proposal_validator/block_proposal_validator.ts +17 -4
  228. package/src/msg_validators/proposal_validator/checkpoint_proposal_validator.ts +23 -7
  229. package/src/msg_validators/proposal_validator/proposal_validator.ts +79 -49
  230. package/src/msg_validators/tx_validator/README.md +5 -1
  231. package/src/msg_validators/tx_validator/allowed_public_setup.ts +22 -27
  232. package/src/msg_validators/tx_validator/allowed_setup_helpers.ts +31 -0
  233. package/src/msg_validators/tx_validator/archive_cache.ts +1 -1
  234. package/src/msg_validators/tx_validator/contract_instance_validator.ts +56 -0
  235. package/src/msg_validators/tx_validator/data_validator.ts +42 -1
  236. package/src/msg_validators/tx_validator/factory.ts +43 -3
  237. package/src/msg_validators/tx_validator/fee_payer_balance.ts +6 -2
  238. package/src/msg_validators/tx_validator/gas_validator.ts +65 -16
  239. package/src/msg_validators/tx_validator/index.ts +1 -0
  240. package/src/msg_validators/tx_validator/metadata_validator.ts +12 -4
  241. package/src/msg_validators/tx_validator/phases_validator.ts +82 -27
  242. package/src/services/data_store.ts +5 -13
  243. package/src/services/dummy_service.ts +8 -2
  244. package/src/services/encoding.ts +9 -1
  245. package/src/services/gossipsub/topic_score_params.ts +36 -4
  246. package/src/services/libp2p/libp2p_service.ts +164 -139
  247. package/src/services/peer-manager/metrics.ts +7 -0
  248. package/src/services/peer-manager/peer_manager.ts +45 -11
  249. package/src/services/peer-manager/peer_scoring.ts +27 -5
  250. package/src/services/reqresp/README.md +229 -0
  251. package/src/services/reqresp/batch-tx-requester/README.md +46 -7
  252. package/src/services/reqresp/batch-tx-requester/batch_tx_requester.ts +64 -69
  253. package/src/services/reqresp/batch-tx-requester/interface.ts +2 -1
  254. package/src/services/reqresp/batch-tx-requester/missing_txs.ts +13 -6
  255. package/src/services/reqresp/batch-tx-requester/peer_collection.ts +5 -0
  256. package/src/services/reqresp/config.ts +2 -2
  257. package/src/services/reqresp/interface.ts +21 -11
  258. package/src/services/reqresp/metrics.ts +0 -1
  259. package/src/services/reqresp/protocols/index.ts +0 -1
  260. package/src/services/reqresp/protocols/tx.ts +1 -3
  261. package/src/services/reqresp/rate-limiter/rate_limiter.ts +13 -9
  262. package/src/services/reqresp/rate-limiter/rate_limits.ts +0 -10
  263. package/src/services/reqresp/reqresp.ts +37 -12
  264. package/src/services/service.ts +6 -1
  265. package/src/services/tx_collection/fast_tx_collection.ts +57 -83
  266. package/src/services/tx_collection/file_store_tx_source.ts +43 -31
  267. package/src/services/tx_collection/proposal_tx_collector.ts +8 -13
  268. package/src/services/tx_collection/request_tracker.ts +127 -0
  269. package/src/services/tx_collection/slow_tx_collection.ts +1 -1
  270. package/src/services/tx_collection/tx_collection.ts +3 -5
  271. package/src/services/tx_collection/tx_source.ts +8 -7
  272. package/src/test-helpers/make-test-p2p-clients.ts +1 -1
  273. package/src/test-helpers/mock-pubsub.ts +31 -5
  274. package/src/test-helpers/reqresp-nodes.ts +3 -3
  275. package/src/test-helpers/testbench-utils.ts +30 -3
  276. package/src/testbench/p2p_client_testbench_worker.ts +72 -15
  277. package/src/testbench/worker_client_manager.ts +68 -6
  278. package/src/util.ts +1 -1
  279. package/dest/mem_pools/tx_pool/aztec_kv_tx_pool.d.ts +0 -125
  280. package/dest/mem_pools/tx_pool/aztec_kv_tx_pool.d.ts.map +0 -1
  281. package/dest/mem_pools/tx_pool/aztec_kv_tx_pool.js +0 -596
  282. package/dest/mem_pools/tx_pool/eviction/eviction_manager.d.ts +0 -32
  283. package/dest/mem_pools/tx_pool/eviction/eviction_manager.d.ts.map +0 -1
  284. package/dest/mem_pools/tx_pool/eviction/eviction_manager.js +0 -112
  285. package/dest/mem_pools/tx_pool/eviction/eviction_strategy.d.ts +0 -157
  286. package/dest/mem_pools/tx_pool/eviction/eviction_strategy.d.ts.map +0 -1
  287. package/dest/mem_pools/tx_pool/eviction/eviction_strategy.js +0 -52
  288. package/dest/mem_pools/tx_pool/eviction/fee_payer_balance_eviction_rule.d.ts +0 -16
  289. package/dest/mem_pools/tx_pool/eviction/fee_payer_balance_eviction_rule.d.ts.map +0 -1
  290. package/dest/mem_pools/tx_pool/eviction/fee_payer_balance_eviction_rule.js +0 -122
  291. package/dest/mem_pools/tx_pool/eviction/invalid_txs_after_mining_rule.d.ts +0 -17
  292. package/dest/mem_pools/tx_pool/eviction/invalid_txs_after_mining_rule.d.ts.map +0 -1
  293. package/dest/mem_pools/tx_pool/eviction/invalid_txs_after_mining_rule.js +0 -84
  294. package/dest/mem_pools/tx_pool/eviction/invalid_txs_after_reorg_rule.d.ts +0 -19
  295. package/dest/mem_pools/tx_pool/eviction/invalid_txs_after_reorg_rule.d.ts.map +0 -1
  296. package/dest/mem_pools/tx_pool/eviction/invalid_txs_after_reorg_rule.js +0 -78
  297. package/dest/mem_pools/tx_pool/eviction/low_priority_eviction_rule.d.ts +0 -26
  298. package/dest/mem_pools/tx_pool/eviction/low_priority_eviction_rule.d.ts.map +0 -1
  299. package/dest/mem_pools/tx_pool/eviction/low_priority_eviction_rule.js +0 -84
  300. package/dest/mem_pools/tx_pool/eviction/nullifier_conflict_pre_add_rule.d.ts +0 -25
  301. package/dest/mem_pools/tx_pool/eviction/nullifier_conflict_pre_add_rule.d.ts.map +0 -1
  302. package/dest/mem_pools/tx_pool/eviction/nullifier_conflict_pre_add_rule.js +0 -57
  303. package/dest/mem_pools/tx_pool/index.d.ts +0 -3
  304. package/dest/mem_pools/tx_pool/index.d.ts.map +0 -1
  305. package/dest/mem_pools/tx_pool/index.js +0 -2
  306. package/dest/mem_pools/tx_pool/priority.d.ts +0 -12
  307. package/dest/mem_pools/tx_pool/priority.d.ts.map +0 -1
  308. package/dest/mem_pools/tx_pool/priority.js +0 -15
  309. package/dest/mem_pools/tx_pool/tx_pool.d.ts +0 -127
  310. package/dest/mem_pools/tx_pool/tx_pool.d.ts.map +0 -1
  311. package/dest/mem_pools/tx_pool/tx_pool.js +0 -3
  312. package/dest/mem_pools/tx_pool/tx_pool_test_suite.d.ts +0 -7
  313. package/dest/mem_pools/tx_pool/tx_pool_test_suite.d.ts.map +0 -1
  314. package/dest/mem_pools/tx_pool/tx_pool_test_suite.js +0 -400
  315. package/dest/msg_validators/proposal_validator/proposal_validator_test_suite.d.ts +0 -23
  316. package/dest/msg_validators/proposal_validator/proposal_validator_test_suite.d.ts.map +0 -1
  317. package/dest/msg_validators/proposal_validator/proposal_validator_test_suite.js +0 -212
  318. package/dest/services/reqresp/protocols/block.d.ts +0 -9
  319. package/dest/services/reqresp/protocols/block.d.ts.map +0 -1
  320. package/dest/services/reqresp/protocols/block.js +0 -32
  321. package/dest/services/tx_collection/missing_txs_tracker.d.ts +0 -32
  322. package/dest/services/tx_collection/missing_txs_tracker.d.ts.map +0 -1
  323. package/dest/services/tx_collection/missing_txs_tracker.js +0 -27
  324. package/src/mem_pools/tx_pool/README.md +0 -270
  325. package/src/mem_pools/tx_pool/aztec_kv_tx_pool.ts +0 -746
  326. package/src/mem_pools/tx_pool/eviction/eviction_manager.ts +0 -132
  327. package/src/mem_pools/tx_pool/eviction/eviction_strategy.ts +0 -208
  328. package/src/mem_pools/tx_pool/eviction/fee_payer_balance_eviction_rule.ts +0 -162
  329. package/src/mem_pools/tx_pool/eviction/invalid_txs_after_mining_rule.ts +0 -104
  330. package/src/mem_pools/tx_pool/eviction/invalid_txs_after_reorg_rule.ts +0 -93
  331. package/src/mem_pools/tx_pool/eviction/low_priority_eviction_rule.ts +0 -106
  332. package/src/mem_pools/tx_pool/eviction/nullifier_conflict_pre_add_rule.ts +0 -75
  333. package/src/mem_pools/tx_pool/index.ts +0 -2
  334. package/src/mem_pools/tx_pool/priority.ts +0 -20
  335. package/src/mem_pools/tx_pool/tx_pool.ts +0 -141
  336. package/src/mem_pools/tx_pool/tx_pool_test_suite.ts +0 -319
  337. package/src/msg_validators/proposal_validator/proposal_validator_test_suite.ts +0 -230
  338. package/src/services/reqresp/protocols/block.ts +0 -37
  339. package/src/services/tx_collection/missing_txs_tracker.ts +0 -52
@@ -45,6 +45,7 @@ import { TxPoolIndices } from './tx_pool_indices.js';
45
45
  export interface TxPoolV2Callbacks {
46
46
  onTxsAdded: (txs: Tx[], opts: { source?: string }) => void;
47
47
  onTxsRemoved: (txHashes: string[] | bigint[]) => void;
48
+ onTxsMined: (txHashes: string[]) => void;
48
49
  }
49
50
 
50
51
  /**
@@ -61,6 +62,7 @@ export class TxPoolV2Impl {
61
62
  #l2BlockSource: L2BlockSource;
62
63
  #worldStateSynchronizer: WorldStateSynchronizer;
63
64
  #createTxValidator: TxPoolV2Dependencies['createTxValidator'];
65
+ #checkAllowedSetupCalls: TxPoolV2Dependencies['checkAllowedSetupCalls'];
64
66
 
65
67
  // === In-Memory Indices ===
66
68
  #indices: TxPoolIndices = new TxPoolIndices();
@@ -92,6 +94,7 @@ export class TxPoolV2Impl {
92
94
  this.#l2BlockSource = deps.l2BlockSource;
93
95
  this.#worldStateSynchronizer = deps.worldStateSynchronizer;
94
96
  this.#createTxValidator = deps.createTxValidator;
97
+ this.#checkAllowedSetupCalls = deps.checkAllowedSetupCalls;
95
98
 
96
99
  this.#config = { ...DEFAULT_TX_POOL_V2_CONFIG, ...config };
97
100
  this.#archive = new TxArchive(archiveStore, this.#config.archivedTxLimit, log);
@@ -213,7 +216,9 @@ export class TxPoolV2Impl {
213
216
  // in-memory reads, and buffered DB writes. Nothing here can throw an unhandled exception.
214
217
  const poolAccess = this.#createPreAddPoolAccess();
215
218
  const preAddContext: PreAddContext | undefined =
216
- opts.feeComparisonOnly !== undefined ? { feeComparisonOnly: opts.feeComparisonOnly } : undefined;
219
+ opts.feeComparisonOnly !== undefined
220
+ ? { feeComparisonOnly: opts.feeComparisonOnly, priceBumpPercentage: this.#config.priceBumpPercentage }
221
+ : undefined;
217
222
 
218
223
  await this.#store.transactionAsync(async () => {
219
224
  for (const tx of txs) {
@@ -351,6 +356,7 @@ export class TxPoolV2Impl {
351
356
 
352
357
  // Check if already in pool
353
358
  if (this.#indices.has(txHashStr)) {
359
+ this.#log.verbose(`canAddPendingTx: tx ${txHashStr} already in pool`);
354
360
  return 'ignored';
355
361
  }
356
362
 
@@ -359,26 +365,37 @@ export class TxPoolV2Impl {
359
365
  const poolAccess = this.#createPreAddPoolAccess();
360
366
  const preAddResult = await this.#evictionManager.runPreAddRules(meta, poolAccess);
361
367
 
362
- return preAddResult.shouldIgnore ? 'ignored' : 'accepted';
368
+ if (preAddResult.shouldIgnore) {
369
+ this.#log.verbose(`canAddPendingTx: tx ${txHashStr} ignored by pre-add rule`, {
370
+ reason: preAddResult.reason?.message ?? 'no reason provided',
371
+ });
372
+ return 'ignored';
373
+ }
374
+ return 'accepted';
363
375
  }
364
376
 
365
377
  async addProtectedTxs(txs: Tx[], block: BlockHeader, opts: { source?: string }): Promise<void> {
366
378
  const slotNumber = block.globalVariables.slotNumber;
367
379
 
380
+ // Precompute setup-call allow-list flags outside the store transaction
381
+ const allowedFlags = await Promise.all(txs.map(tx => this.#checkAllowedSetupCalls(tx)));
382
+
368
383
  await this.#store.transactionAsync(async () => {
369
- for (const tx of txs) {
384
+ for (let i = 0; i < txs.length; i++) {
385
+ const tx = txs[i];
370
386
  const txHash = tx.getTxHash();
371
387
  const txHashStr = txHash.toString();
372
388
  const isNew = !this.#indices.has(txHashStr);
373
389
  const minedBlockId = await this.#getMinedBlockId(txHash);
374
390
 
375
391
  if (isNew) {
392
+ const meta = await buildTxMetaData(tx, allowedFlags[i]);
376
393
  // New tx - add as mined or protected (callback emitted by #addTx)
377
394
  if (minedBlockId) {
378
- await this.#addTx(tx, { mined: minedBlockId }, opts);
395
+ await this.#addTx(tx, { mined: minedBlockId }, opts, meta);
379
396
  this.#indices.setProtection(txHashStr, slotNumber);
380
397
  } else {
381
- await this.#addTx(tx, { protected: slotNumber }, opts);
398
+ await this.#addTx(tx, { protected: slotNumber }, opts, meta);
382
399
  }
383
400
  } else {
384
401
  // Existing tx - update protection and mined status
@@ -498,6 +515,10 @@ export class TxPoolV2Impl {
498
515
  await this.#evictionManager.evictAfterNewBlock(block.header, nullifiers, feePayers);
499
516
  });
500
517
 
518
+ if (found.length > 0) {
519
+ this.#callbacks.onTxsMined(found.map(m => m.txHash));
520
+ }
521
+
501
522
  this.#log.info(`Marked ${found.length} txs as mined in block ${blockId.number}`);
502
523
  }
503
524
 
@@ -969,7 +990,8 @@ export class TxPoolV2Impl {
969
990
 
970
991
  try {
971
992
  const tx = Tx.fromBuffer(buffer);
972
- const meta = await buildTxMetaData(tx);
993
+ const allowedSetupCalls = await this.#checkAllowedSetupCalls(tx);
994
+ const meta = await buildTxMetaData(tx, allowedSetupCalls);
973
995
  loaded.push({ tx, meta });
974
996
  } catch (err) {
975
997
  this.#log.warn(`Failed to deserialize tx ${txHashStr}, deleting`, { err });
@@ -0,0 +1,49 @@
1
+ # Attestation Validation
2
+
3
+ This module validates `CheckpointAttestation` gossipsub messages. Attestations are signatures from committee members endorsing a checkpoint proposal.
4
+
5
+ **Topic**: `checkpoint_attestation` | **Snappy size limit**: 5 KB
6
+
7
+ ## Stage 1: AttestationValidator (Gossipsub Validation)
8
+
9
+ | # | Rule | Consequence | Severity | File |
10
+ |---|------|-------------|----------|------|
11
+ | 1 | **Slot timeliness**: `currentSlot` or `nextSlot`. Previous slot within 500ms: IGNORE. Older: REJECT. | REJECT or IGNORE | HighToleranceError | `attestation_validator.ts` |
12
+ | 2 | **Attester signature**: `getSender()` must recover valid address | REJECT | LowToleranceError | same |
13
+ | 3 | **Attester in committee**: recovered address in committee for slot | REJECT | HighToleranceError | same |
14
+ | 4 | **Proposer exists**: `getProposerAttesterAddressInSlot` must return defined | REJECT | HighToleranceError | same |
15
+ | 5 | **Proposer signature**: `getProposer()` must recover valid address | REJECT | LowToleranceError | same |
16
+ | 6 | **Proposer matches expected**: recovered proposer = expected for slot | REJECT | HighToleranceError | same |
17
+ | 7 | **NoCommitteeError**: committee unavailable | REJECT | LowToleranceError | same |
18
+
19
+ **Fisherman mode extension** (`FishermanAttestationValidator`): if a checkpoint proposal for the same archive exists in pool, the attestation's `ConsensusPayload` must `.equals()` the stored proposal's payload. On mismatch: REJECT + LowToleranceError.
20
+
21
+ ## Stage 2: Pool Admission
22
+
23
+ | # | Rule | Consequence |
24
+ |---|------|-------------|
25
+ | 8 | Sender recoverable (pool-side) | Silent drop |
26
+ | 9 | Not a duplicate (same slot + proposalId + signer) | IGNORE |
27
+ | 10 | Per-signer cap: `MAX_ATTESTATIONS_PER_SLOT_AND_SIGNER` = 2 | IGNORE |
28
+
29
+ Own attestations added via `addOwnCheckpointAttestations` bypass the per-signer cap.
30
+
31
+ ## Stage 3: Equivocation Detection
32
+
33
+ When a signer's attestation count for a slot reaches exactly 2 (different proposals): `duplicateAttestationCallback` fires -> `WANT_TO_SLASH_EVENT` with `OffenseType.DUPLICATE_ATTESTATION`. Attestation still ACCEPTED and rebroadcast. Callback fires once (not again at count 3+).
34
+
35
+ ## Validation at L1 Checkpoint Submission (Archiver)
36
+
37
+ | Rule | Consequence | File |
38
+ |------|-------------|------|
39
+ | Each attestation must have recoverable signature (or address-only is allowed but does not count toward quorum) | Checkpoint rejected as invalid | `archiver/src/modules/validation.ts` |
40
+ | Attestation at index `i` must correspond to committee member at index `i` | Checkpoint rejected as invalid | same |
41
+ | Valid attestation count >= floor(committee * 2/3) + 1 | Checkpoint rejected as invalid | same |
42
+ | No committee / escape hatch open | Accepted unconditionally | same |
43
+
44
+ Note: `skipValidateCheckpointAttestations` config flag bypasses all archiver attestation validation.
45
+
46
+ ## Gossipsub Topic Scoring
47
+
48
+ P3 enabled with expected messages per slot = `targetCommitteeSize`. Conservative threshold (30% of convergence value). Max P3 penalty = -34 per topic.
49
+
@@ -8,14 +8,21 @@ import {
8
8
  type ValidationResult,
9
9
  } from '@aztec/stdlib/p2p';
10
10
 
11
- import { isWithinClockTolerance } from '../clock_tolerance.js';
11
+ import { PipeliningWindow, isWithinClockTolerance } from '../clock_tolerance.js';
12
12
 
13
13
  export class CheckpointAttestationValidator implements P2PValidator<CheckpointAttestation> {
14
14
  protected epochCache: EpochCacheInterface;
15
15
  protected logger: Logger;
16
+ private readonly pipeliningWindow: PipeliningWindow;
16
17
 
17
- constructor(epochCache: EpochCacheInterface) {
18
+ constructor(
19
+ epochCache: EpochCacheInterface,
20
+ opts: {
21
+ l1PublishingTime?: number;
22
+ },
23
+ ) {
18
24
  this.epochCache = epochCache;
25
+ this.pipeliningWindow = new PipeliningWindow(epochCache, { l1PublishingTime: opts.l1PublishingTime });
19
26
  this.logger = createLogger('p2p:checkpoint-attestation-validator');
20
27
  }
21
28
 
@@ -23,18 +30,23 @@ export class CheckpointAttestationValidator implements P2PValidator<CheckpointAt
23
30
  const slotNumber = message.payload.header.slotNumber;
24
31
 
25
32
  try {
26
- const { currentSlot, nextSlot } = this.epochCache.getCurrentAndNextSlot();
33
+ // Use target slots since proposals target pipeline slots (slot + 1 when pipelining).
34
+ const { targetSlot, nextSlot } = this.epochCache.getTargetAndNextSlot();
27
35
 
28
- if (slotNumber !== currentSlot && slotNumber !== nextSlot) {
29
- // Check if message is for previous slot and within clock tolerance
30
- if (!isWithinClockTolerance(slotNumber, currentSlot, this.epochCache)) {
36
+ if (slotNumber !== targetSlot && slotNumber !== nextSlot) {
37
+ // When pipelining, accept attestations for the current slot (built in the previous slot)
38
+ // until the target slot reaches its L1 publish cutoff.
39
+ if (this.pipeliningWindow.acceptsAttestation(slotNumber)) {
40
+ // Fall through to remaining validation (signature, committee, etc.)
41
+ } else if (!isWithinClockTolerance(slotNumber, targetSlot, this.epochCache)) {
31
42
  this.logger.warn(
32
- `Checkpoint attestation slot ${slotNumber} is not current (${currentSlot}) or next (${nextSlot}) slot`,
43
+ `Checkpoint attestation slot ${slotNumber} is not current (${targetSlot}) or next (${nextSlot}) slot`,
33
44
  );
34
45
  return { result: 'reject', severity: PeerErrorSeverity.HighToleranceError };
46
+ } else {
47
+ this.logger.debug(`Ignoring checkpoint attestation for previous slot ${slotNumber} within clock tolerance`);
48
+ return { result: 'ignore' };
35
49
  }
36
- this.logger.debug(`Ignoring checkpoint attestation for previous slot ${slotNumber} within clock tolerance`);
37
- return { result: 'ignore' };
38
50
  }
39
51
 
40
52
  // Verify the signature is valid
@@ -20,8 +20,11 @@ export class FishermanAttestationValidator extends CheckpointAttestationValidato
20
20
  epochCache: EpochCacheInterface,
21
21
  private attestationPool: AttestationPoolApi,
22
22
  telemetryClient: TelemetryClient,
23
+ opts: {
24
+ l1PublishingTime?: number;
25
+ } = {},
23
26
  ) {
24
- super(epochCache);
27
+ super(epochCache, opts);
25
28
  this.logger = this.logger.createChild('[FISHERMAN]');
26
29
 
27
30
  const meter = telemetryClient.getMeter('FishermanAttestationValidator');
@@ -1,5 +1,6 @@
1
1
  import type { EpochCacheInterface } from '@aztec/epoch-cache';
2
2
  import { SlotNumber } from '@aztec/foundation/branded-types';
3
+ import { DEFAULT_P2P_PROPAGATION_TIME, createPipelinedCheckpointTimingModel } from '@aztec/stdlib/timetable';
3
4
 
4
5
  /**
5
6
  * Maximum clock disparity tolerance for P2P message validation (in milliseconds).
@@ -36,10 +37,11 @@ export function isWithinClockTolerance(
36
37
  }
37
38
 
38
39
  // Check how far we are into the current slot (in milliseconds)
39
- const { ts: slotStartTs, nowMs, slot } = epochCache.getEpochAndSlotNow();
40
+ const { ts: slotStartTs, nowMs } = epochCache.getEpochAndSlotNow();
41
+ const targetSlot = epochCache.getTargetSlot();
40
42
 
41
- // Sanity check: ensure the epoch cache's current slot matches the expected current slot
42
- if (slot !== currentSlot) {
43
+ // Sanity check: ensure the epoch cache's target slot matches the expected current slot
44
+ if (targetSlot !== currentSlot) {
43
45
  return false;
44
46
  }
45
47
 
@@ -49,3 +51,70 @@ export function isWithinClockTolerance(
49
51
 
50
52
  return elapsedMs < MAXIMUM_GOSSIP_CLOCK_DISPARITY_MS;
51
53
  }
54
+
55
+ /**
56
+ * Checks if a message should be accepted under the pipelining grace period.
57
+ *
58
+ * When pipelining is enabled, `targetSlot = slotNow + 1`. A proposal built in slot N-1
59
+ * for slot N arrives when validators are in slot N, so their `targetSlot = N+1`.
60
+ * This function accepts proposals for the current wallclock slot if we're within the
61
+ * first `windowSeconds` seconds of the slot (the pipelining grace period). - see stdlib/timetable/index.ts
62
+ *
63
+ * @param messageSlot - The slot number from the received message
64
+ * @param epochCache - EpochCache to get timing and pipelining state
65
+ * @param windowSeconds - The window grace period allowed for attestations into the next slot
66
+ * @returns true if pipelining is enabled, the message is for the current slot, and we're within the grace period
67
+ */
68
+ function isWithinPipeliningWindow(
69
+ messageSlot: SlotNumber,
70
+ epochCache: EpochCacheInterface,
71
+ windowSeconds: number,
72
+ ): boolean {
73
+ if (!epochCache.isProposerPipeliningEnabled()) {
74
+ return false;
75
+ }
76
+
77
+ const currentSlot = epochCache.getSlotNow();
78
+ if (messageSlot !== currentSlot) {
79
+ return false;
80
+ }
81
+
82
+ const { ts: slotStartTs, nowMs } = epochCache.getEpochAndSlotNow();
83
+ const slotStartMs = slotStartTs * 1000n;
84
+ const elapsedMs = Number(nowMs - slotStartMs);
85
+ const windowMs = windowSeconds * 1000 + MAXIMUM_GOSSIP_CLOCK_DISPARITY_MS;
86
+
87
+ return elapsedMs < windowMs;
88
+ }
89
+
90
+ export class PipeliningWindow {
91
+ private readonly proposalWindowIntoTargetSlot: number;
92
+ private readonly attestationWindowIntoTargetSlot: number;
93
+
94
+ constructor(
95
+ private readonly epochCache: EpochCacheInterface,
96
+ opts: {
97
+ p2pPropagationTime?: number;
98
+ l1PublishingTime?: number;
99
+ } = {},
100
+ ) {
101
+ const l1Constants = epochCache.getL1Constants();
102
+ const checkpointTiming = createPipelinedCheckpointTimingModel({
103
+ aztecSlotDuration: l1Constants.slotDuration,
104
+ ethereumSlotDuration: l1Constants.ethereumSlotDuration,
105
+ l1PublishingTime: opts.l1PublishingTime ?? l1Constants.ethereumSlotDuration,
106
+ p2pPropagationTime: opts.p2pPropagationTime ?? DEFAULT_P2P_PROPAGATION_TIME,
107
+ });
108
+
109
+ this.proposalWindowIntoTargetSlot = checkpointTiming.proposalWindowIntoTargetSlot;
110
+ this.attestationWindowIntoTargetSlot = checkpointTiming.attestationWindowIntoTargetSlot;
111
+ }
112
+
113
+ public acceptsProposal(messageSlot: SlotNumber): boolean {
114
+ return isWithinPipeliningWindow(messageSlot, this.epochCache, this.proposalWindowIntoTargetSlot);
115
+ }
116
+
117
+ public acceptsAttestation(messageSlot: SlotNumber): boolean {
118
+ return isWithinPipeliningWindow(messageSlot, this.epochCache, this.attestationWindowIntoTargetSlot);
119
+ }
120
+ }
@@ -0,0 +1,123 @@
1
+ # Proposal Validation
2
+
3
+ This module validates `BlockProposal` and `CheckpointProposal` gossipsub messages. Both share the same base `ProposalValidator` (neither subclass overrides `validate()`), with checkpoint-specific logic layered on top in the gossipsub handler.
4
+
5
+ ## BlockProposal
6
+
7
+ **Topic**: `block_proposal` | **Snappy size limit**: 10 MB
8
+
9
+ ### Stage 1: Gossipsub Validation (ProposalValidator)
10
+
11
+ File: `proposal_validator.ts`
12
+
13
+ | # | Rule | Consequence | Severity |
14
+ |---|------|-------------|----------|
15
+ | 1 | **Slot check**: must be `currentSlot` or `nextSlot`. Previous slot within 500ms tolerance: IGNORE. | REJECT | HighToleranceError |
16
+ | 2 | **Signature**: `getSender()` must recover a valid address. If `signedTxs` present, its recovered sender must match. | REJECT | MidToleranceError |
17
+ | 3 | **Txs permitted**: if `disableTransactions`, must have 0 txHashes and 0 embedded txs | REJECT | MidToleranceError |
18
+ | 4 | **Max txs**: `txHashes.length <= maxTxsPerBlock` | REJECT | MidToleranceError |
19
+ | 5 | **Embedded txs in txHashes**: every embedded tx's hash must appear in `txHashes` | REJECT | MidToleranceError |
20
+ | 6 | **Proposer check**: signer must match expected proposer for slot (skipped if committee size = 0) | REJECT | MidToleranceError |
21
+ | 7 | **Tx hash integrity**: each embedded tx's recomputed hash must match declared hash | REJECT | LowToleranceError |
22
+ | 8 | **NoCommitteeError**: epoch cache cannot determine committee | REJECT | LowToleranceError |
23
+
24
+ Deserialization guards: `BlockProposal.fromBuffer` and `SignedTxs.fromBuffer` both enforce `txCount <= MAX_TXS_PER_BLOCK` (65536). Violation -> REJECT + LowToleranceError.
25
+
26
+ ### Stage 2: Mempool (Attestation Pool)
27
+
28
+ | # | Rule | Consequence |
29
+ |---|------|-------------|
30
+ | 9 | **Duplicate**: same archive root already stored | IGNORE (no penalty) |
31
+ | 10 | **Per-position cap**: max 2 proposals per (slot, indexWithinCheckpoint) | REJECT + HighToleranceError |
32
+ | 11 | **Equivocation**: >1 distinct proposal for same (slot, index) | ACCEPT (rebroadcast for detection). At count=2: `duplicateProposalCallback` fires -> slash event (`OffenseType.DUPLICATE_PROPOSAL`, configured via `slashDuplicateProposalPenalty`) |
33
+
34
+ ### Stage 3: Validator-Client Processing (BlockProposalHandler)
35
+
36
+ Only runs on validator nodes. Non-validator nodes use a default handler that triggers tx collection without deep validation.
37
+
38
+ | # | Rule | Failure Reason |
39
+ |---|------|----------------|
40
+ | 12 | Signature re-check | `invalid_proposal` |
41
+ | 13 | ProposalValidator re-run | `invalid_proposal` |
42
+ | 14 | Self-proposal filter | Ignored silently |
43
+ | 15 | Parent block exists (`lastArchive.root` matches known block or genesis) | `parent_block_not_found` |
44
+ | 16 | Parent block slot <= proposal slot | `parent_block_wrong_slot` |
45
+ | 17 | Block number not already in archiver | `block_number_already_exists` |
46
+ | 18 | Checkpoint number consistency (multiple sub-rules for first/non-first blocks) | `invalid_proposal` |
47
+ | 19 | Global variables consistency (non-first block: chainId, version, slot, timestamp, coinbase, feeRecipient, gasFees match parent) | `global_variables_mismatch` |
48
+ | 20 | L1-to-L2 message hash matches `proposal.inHash` | `in_hash_mismatch` |
49
+ | 21 | All txs referenced by `txHashes` obtainable | `txs_not_available` |
50
+ | 22 | **Re-execution**: processed tx count matches `txHashes.length` | `timeout` (ReExTimeoutError) |
51
+ | 23 | **Re-execution**: no failed txs | `failed_txs` (ReExFailedTxsError) -- **SLASHABLE** |
52
+ | 24 | **Re-execution**: archive root and header match proposal | `state_mismatch` (ReExStateMismatchError) -- **SLASHABLE** |
53
+
54
+ **Escape hatch**: during escape hatch periods (`isEscapeHatchOpenAtSlot`), re-execution and slashing are both disabled, and the proposal is rejected locally.
55
+
56
+ **Conditional re-execution**: rules 22-24 only run when at least one condition is true: `fishermanMode` enabled, `slashBroadcastedInvalidBlockPenalty > 0`, committee membership, `alwaysReexecuteBlockProposals`, or `blobClient.canUpload()`.
57
+
58
+ **Slashing**: only `state_mismatch` and `failed_txs` trigger on-chain slashing (`OffenseType.BROADCASTED_INVALID_BLOCK_PROPOSAL`, gated by `slashBroadcastedInvalidBlockPenalty > 0`). Unknown errors during re-execution do NOT slash.
59
+
60
+ **Embedded tx validation**: txs in `signedTxs` are validated via `createTxValidatorForBlockProposalReceivedTxs` (well-formedness only) when stored in the tx pool. Invalid embedded txs are rejected from the pool but do not cause the block proposal itself to be rejected at gossipsub level.
61
+
62
+ ### Gossipsub Topic Scoring
63
+
64
+ | Parameter | Effect |
65
+ |-----------|--------|
66
+ | P4 (invalidMessageDeliveries) | weight = -20, decay over 4 slots |
67
+ | P3 (meshMessageDeliveries) | Enabled only when `expectedBlockProposalsPerSlot > 0` (MBPS mode) |
68
+ | P1/P2 | Only active when P3 is enabled |
69
+
70
+ ---
71
+
72
+ ## CheckpointProposal
73
+
74
+ **Topic**: `checkpoint_proposal` | **Snappy size limit**: 10 MB
75
+
76
+ ### Stage 1: Gossipsub Validation (ProposalValidator)
77
+
78
+ Same `ProposalValidator.validate()` as BlockProposal (shared implementation, neither subclass overrides it). See BlockProposal Stage 1 rules 1-8.
79
+
80
+ ### Stage 2: Embedded Block Proposal Validation (if `lastBlock` present)
81
+
82
+ The checkpoint's embedded `lastBlock` is extracted via `getBlockProposal()` and validated through `BlockProposalValidator.validate()` plus block mempool checks.
83
+
84
+ | Rule | Consequence | File |
85
+ |------|-------------|------|
86
+ | Block proposal must pass `BlockProposalValidator.validate()` | If REJECT: entire checkpoint REJECTED | `libp2p_service.ts` |
87
+ | Block proposal must not exceed per-position cap (2) | Checkpoint REJECTED + HighToleranceError | same |
88
+ | Block equivocation detected (>1 proposals for same slot+index) | Checkpoint REJECTED (block itself is ACCEPT for re-broadcast) | same |
89
+
90
+ ### Stage 3: Mempool (Attestation Pool)
91
+
92
+ | Rule | Consequence | File |
93
+ |------|-------------|------|
94
+ | Duplicate (same archive ID) | IGNORE (no penalty). Embedded block still processed if valid. | `attestation_pool.ts` |
95
+ | Per-slot cap: `MAX_CHECKPOINT_PROPOSALS_PER_SLOT` = 2 | REJECT + HighToleranceError. Embedded block still processed. | same |
96
+
97
+ ### Stage 4: Equivocation Detection
98
+
99
+ When >1 checkpoint proposals exist for same slot (count > 1): ACCEPT (re-broadcast). At count == 2 (exactly): `duplicateProposalCallback` fires. Proposal NOT further processed. Callback fires only once per equivocation pair.
100
+
101
+ ### Stage 5: Validator-Client Consensus Validation
102
+
103
+ Determines whether the validator signs an attestation.
104
+
105
+ | Rule | Consequence | File |
106
+ |------|-------------|------|
107
+ | Escape hatch open | No attestation | `validator-client/src/validator.ts` |
108
+ | Signature invalid (re-check) | No attestation | same |
109
+ | Self-proposal | No attestation (ignored) | same |
110
+ | `feeAssetPriceModifier` outside [-100, +100] bps | No attestation | same |
111
+ | Not in committee (unless fisherman mode) | No attestation | same |
112
+ | Checkpoint header mismatch (computed vs proposal) | No attestation | same |
113
+ | Archive root mismatch | No attestation | same |
114
+ | Epoch out hash mismatch | No attestation | same |
115
+ | Last block not found / not matching | No attestation | same |
116
+ | Already attested to this or earlier slot | No attestation (unless `attestToEquivocatedProposals`) | same |
117
+
118
+ **`skipCheckpointProposalValidation` config**: when true, the re-execution checks (header/archive/epoch hash) are all skipped. Signature, fee modifier, committee, escape hatch, and equivocation checks still apply.
119
+
120
+ ### Gossipsub Topic Scoring
121
+
122
+ P3 enabled with expected rate of 1 message per slot. P4 weight = -20, max P3 penalty = -34 per topic.
123
+
@@ -1,10 +1,23 @@
1
1
  import type { EpochCacheInterface } from '@aztec/epoch-cache';
2
- import type { BlockProposal, P2PValidator } from '@aztec/stdlib/p2p';
2
+ import type { BlockProposal, P2PValidator, ValidationResult } from '@aztec/stdlib/p2p';
3
3
 
4
4
  import { ProposalValidator } from '../proposal_validator/proposal_validator.js';
5
5
 
6
- export class BlockProposalValidator extends ProposalValidator<BlockProposal> implements P2PValidator<BlockProposal> {
7
- constructor(epochCache: EpochCacheInterface, opts: { txsPermitted: boolean }) {
8
- super(epochCache, opts, 'p2p:block_proposal_validator');
6
+ export class BlockProposalValidator implements P2PValidator<BlockProposal> {
7
+ private proposalValidator: ProposalValidator;
8
+
9
+ constructor(
10
+ epochCache: EpochCacheInterface,
11
+ opts: { txsPermitted: boolean; maxTxsPerBlock?: number; p2pPropagationTime?: number },
12
+ ) {
13
+ this.proposalValidator = new ProposalValidator(epochCache, opts, 'p2p:block_proposal_validator');
14
+ }
15
+
16
+ async validate(proposal: BlockProposal): Promise<ValidationResult> {
17
+ const headerResult = await this.proposalValidator.validate(proposal);
18
+ if (headerResult.result !== 'accept') {
19
+ return headerResult;
20
+ }
21
+ return this.proposalValidator.validateTxs(proposal);
9
22
  }
10
23
  }
@@ -1,13 +1,29 @@
1
1
  import type { EpochCacheInterface } from '@aztec/epoch-cache';
2
- import type { CheckpointProposal, P2PValidator } from '@aztec/stdlib/p2p';
2
+ import type { CheckpointProposal, P2PValidator, ValidationResult } from '@aztec/stdlib/p2p';
3
3
 
4
4
  import { ProposalValidator } from '../proposal_validator/proposal_validator.js';
5
5
 
6
- export class CheckpointProposalValidator
7
- extends ProposalValidator<CheckpointProposal>
8
- implements P2PValidator<CheckpointProposal>
9
- {
10
- constructor(epochCache: EpochCacheInterface, opts: { txsPermitted: boolean }) {
11
- super(epochCache, opts, 'p2p:checkpoint_proposal_validator');
6
+ export class CheckpointProposalValidator implements P2PValidator<CheckpointProposal> {
7
+ private proposalValidator: ProposalValidator;
8
+
9
+ constructor(
10
+ epochCache: EpochCacheInterface,
11
+ opts: { txsPermitted: boolean; maxTxsPerBlock?: number; p2pPropagationTime?: number },
12
+ ) {
13
+ this.proposalValidator = new ProposalValidator(epochCache, opts, 'p2p:checkpoint_proposal_validator');
14
+ }
15
+
16
+ async validate(proposal: CheckpointProposal): Promise<ValidationResult> {
17
+ const headerResult = await this.proposalValidator.validate(proposal);
18
+ if (headerResult.result !== 'accept') {
19
+ return headerResult;
20
+ }
21
+
22
+ const blockProposal = proposal.getBlockProposal();
23
+ if (blockProposal) {
24
+ return this.proposalValidator.validateTxs(blockProposal);
25
+ }
26
+
27
+ return { result: 'accept' };
12
28
  }
13
29
  }