@aztec/p2p 0.0.1-commit.8f9871590 → 0.0.1-commit.934299a21

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 (202) hide show
  1. package/dest/client/factory.d.ts +3 -2
  2. package/dest/client/factory.d.ts.map +1 -1
  3. package/dest/client/factory.js +13 -23
  4. package/dest/client/interface.d.ts +9 -18
  5. package/dest/client/interface.d.ts.map +1 -1
  6. package/dest/client/p2p_client.d.ts +5 -16
  7. package/dest/client/p2p_client.d.ts.map +1 -1
  8. package/dest/client/p2p_client.js +40 -71
  9. package/dest/client/test/tx_proposal_collector/proposal_tx_collector_worker.js +5 -5
  10. package/dest/config.d.ts +4 -6
  11. package/dest/config.d.ts.map +1 -1
  12. package/dest/config.js +0 -5
  13. package/dest/errors/tx-pool.error.d.ts +8 -0
  14. package/dest/errors/tx-pool.error.d.ts.map +1 -0
  15. package/dest/errors/tx-pool.error.js +9 -0
  16. package/dest/mem_pools/tx_pool_v2/deleted_pool.d.ts +3 -1
  17. package/dest/mem_pools/tx_pool_v2/deleted_pool.d.ts.map +1 -1
  18. package/dest/mem_pools/tx_pool_v2/deleted_pool.js +9 -0
  19. package/dest/mem_pools/tx_pool_v2/eviction/eviction_manager.d.ts +3 -3
  20. package/dest/mem_pools/tx_pool_v2/eviction/eviction_manager.d.ts.map +1 -1
  21. package/dest/mem_pools/tx_pool_v2/eviction/eviction_manager.js +18 -9
  22. package/dest/mem_pools/tx_pool_v2/eviction/fee_payer_balance_eviction_rule.js +3 -3
  23. package/dest/mem_pools/tx_pool_v2/eviction/fee_payer_balance_pre_add_rule.d.ts +3 -3
  24. package/dest/mem_pools/tx_pool_v2/eviction/fee_payer_balance_pre_add_rule.d.ts.map +1 -1
  25. package/dest/mem_pools/tx_pool_v2/eviction/fee_payer_balance_pre_add_rule.js +10 -4
  26. package/dest/mem_pools/tx_pool_v2/eviction/index.d.ts +2 -2
  27. package/dest/mem_pools/tx_pool_v2/eviction/index.d.ts.map +1 -1
  28. package/dest/mem_pools/tx_pool_v2/eviction/index.js +1 -1
  29. package/dest/mem_pools/tx_pool_v2/eviction/interfaces.d.ts +48 -5
  30. package/dest/mem_pools/tx_pool_v2/eviction/interfaces.d.ts.map +1 -1
  31. package/dest/mem_pools/tx_pool_v2/eviction/interfaces.js +8 -0
  32. package/dest/mem_pools/tx_pool_v2/eviction/invalid_txs_after_mining_rule.js +2 -2
  33. package/dest/mem_pools/tx_pool_v2/eviction/invalid_txs_after_reorg_rule.js +5 -5
  34. package/dest/mem_pools/tx_pool_v2/eviction/low_priority_eviction_rule.d.ts +2 -2
  35. package/dest/mem_pools/tx_pool_v2/eviction/low_priority_eviction_rule.d.ts.map +1 -1
  36. package/dest/mem_pools/tx_pool_v2/eviction/low_priority_eviction_rule.js +12 -6
  37. package/dest/mem_pools/tx_pool_v2/eviction/low_priority_pre_add_rule.d.ts +4 -4
  38. package/dest/mem_pools/tx_pool_v2/eviction/low_priority_pre_add_rule.d.ts.map +1 -1
  39. package/dest/mem_pools/tx_pool_v2/eviction/low_priority_pre_add_rule.js +14 -4
  40. package/dest/mem_pools/tx_pool_v2/eviction/nullifier_conflict_rule.d.ts +3 -3
  41. package/dest/mem_pools/tx_pool_v2/eviction/nullifier_conflict_rule.d.ts.map +1 -1
  42. package/dest/mem_pools/tx_pool_v2/eviction/nullifier_conflict_rule.js +2 -2
  43. package/dest/mem_pools/tx_pool_v2/instrumentation.d.ts +15 -0
  44. package/dest/mem_pools/tx_pool_v2/instrumentation.d.ts.map +1 -0
  45. package/dest/mem_pools/tx_pool_v2/instrumentation.js +43 -0
  46. package/dest/mem_pools/tx_pool_v2/interfaces.d.ts +16 -6
  47. package/dest/mem_pools/tx_pool_v2/interfaces.d.ts.map +1 -1
  48. package/dest/mem_pools/tx_pool_v2/interfaces.js +3 -1
  49. package/dest/mem_pools/tx_pool_v2/tx_metadata.d.ts +12 -2
  50. package/dest/mem_pools/tx_pool_v2/tx_metadata.d.ts.map +1 -1
  51. package/dest/mem_pools/tx_pool_v2/tx_metadata.js +37 -1
  52. package/dest/mem_pools/tx_pool_v2/tx_pool_indices.d.ts +5 -2
  53. package/dest/mem_pools/tx_pool_v2/tx_pool_indices.d.ts.map +1 -1
  54. package/dest/mem_pools/tx_pool_v2/tx_pool_indices.js +12 -2
  55. package/dest/mem_pools/tx_pool_v2/tx_pool_v2.d.ts +6 -3
  56. package/dest/mem_pools/tx_pool_v2/tx_pool_v2.d.ts.map +1 -1
  57. package/dest/mem_pools/tx_pool_v2/tx_pool_v2.js +6 -5
  58. package/dest/mem_pools/tx_pool_v2/tx_pool_v2_impl.d.ts +11 -5
  59. package/dest/mem_pools/tx_pool_v2/tx_pool_v2_impl.d.ts.map +1 -1
  60. package/dest/mem_pools/tx_pool_v2/tx_pool_v2_impl.js +241 -130
  61. package/dest/msg_validators/tx_validator/aggregate_tx_validator.d.ts +2 -2
  62. package/dest/msg_validators/tx_validator/aggregate_tx_validator.d.ts.map +1 -1
  63. package/dest/msg_validators/tx_validator/aggregate_tx_validator.js +3 -3
  64. package/dest/msg_validators/tx_validator/factory.d.ts +114 -6
  65. package/dest/msg_validators/tx_validator/factory.d.ts.map +1 -1
  66. package/dest/msg_validators/tx_validator/factory.js +219 -58
  67. package/dest/msg_validators/tx_validator/gas_validator.d.ts +58 -3
  68. package/dest/msg_validators/tx_validator/gas_validator.d.ts.map +1 -1
  69. package/dest/msg_validators/tx_validator/gas_validator.js +73 -36
  70. package/dest/msg_validators/tx_validator/index.d.ts +2 -1
  71. package/dest/msg_validators/tx_validator/index.d.ts.map +1 -1
  72. package/dest/msg_validators/tx_validator/index.js +1 -0
  73. package/dest/msg_validators/tx_validator/nullifier_cache.d.ts +14 -0
  74. package/dest/msg_validators/tx_validator/nullifier_cache.d.ts.map +1 -0
  75. package/dest/msg_validators/tx_validator/nullifier_cache.js +24 -0
  76. package/dest/services/dummy_service.d.ts +4 -4
  77. package/dest/services/dummy_service.d.ts.map +1 -1
  78. package/dest/services/dummy_service.js +4 -4
  79. package/dest/services/encoding.d.ts +1 -1
  80. package/dest/services/encoding.d.ts.map +1 -1
  81. package/dest/services/encoding.js +2 -1
  82. package/dest/services/gossipsub/topic_score_params.d.ts +18 -6
  83. package/dest/services/gossipsub/topic_score_params.d.ts.map +1 -1
  84. package/dest/services/gossipsub/topic_score_params.js +32 -10
  85. package/dest/services/libp2p/libp2p_service.d.ts +11 -7
  86. package/dest/services/libp2p/libp2p_service.d.ts.map +1 -1
  87. package/dest/services/libp2p/libp2p_service.js +62 -71
  88. package/dest/services/reqresp/batch-tx-requester/batch_tx_requester.d.ts +4 -3
  89. package/dest/services/reqresp/batch-tx-requester/batch_tx_requester.d.ts.map +1 -1
  90. package/dest/services/reqresp/batch-tx-requester/batch_tx_requester.js +19 -46
  91. package/dest/services/reqresp/batch-tx-requester/interface.d.ts +2 -6
  92. package/dest/services/reqresp/batch-tx-requester/interface.d.ts.map +1 -1
  93. package/dest/services/reqresp/batch-tx-requester/missing_txs.d.ts +10 -13
  94. package/dest/services/reqresp/batch-tx-requester/missing_txs.d.ts.map +1 -1
  95. package/dest/services/reqresp/batch-tx-requester/missing_txs.js +25 -46
  96. package/dest/services/reqresp/batch-tx-requester/peer_collection.d.ts +17 -11
  97. package/dest/services/reqresp/batch-tx-requester/peer_collection.d.ts.map +1 -1
  98. package/dest/services/reqresp/batch-tx-requester/peer_collection.js +49 -15
  99. package/dest/services/reqresp/batch-tx-requester/tx_validator.js +2 -2
  100. package/dest/services/service.d.ts +5 -3
  101. package/dest/services/service.d.ts.map +1 -1
  102. package/dest/services/tx_collection/fast_tx_collection.d.ts +1 -1
  103. package/dest/services/tx_collection/fast_tx_collection.d.ts.map +1 -1
  104. package/dest/services/tx_collection/fast_tx_collection.js +39 -33
  105. package/dest/services/tx_collection/file_store_tx_collection.d.ts +1 -1
  106. package/dest/services/tx_collection/file_store_tx_collection.d.ts.map +1 -1
  107. package/dest/services/tx_collection/file_store_tx_collection.js +4 -2
  108. package/dest/services/tx_collection/file_store_tx_source.d.ts +15 -6
  109. package/dest/services/tx_collection/file_store_tx_source.d.ts.map +1 -1
  110. package/dest/services/tx_collection/file_store_tx_source.js +47 -16
  111. package/dest/services/tx_collection/instrumentation.d.ts +1 -1
  112. package/dest/services/tx_collection/instrumentation.d.ts.map +1 -1
  113. package/dest/services/tx_collection/instrumentation.js +2 -1
  114. package/dest/services/tx_collection/missing_txs_tracker.d.ts +32 -0
  115. package/dest/services/tx_collection/missing_txs_tracker.d.ts.map +1 -0
  116. package/dest/services/tx_collection/missing_txs_tracker.js +27 -0
  117. package/dest/services/tx_collection/proposal_tx_collector.d.ts +7 -6
  118. package/dest/services/tx_collection/proposal_tx_collector.d.ts.map +1 -1
  119. package/dest/services/tx_collection/proposal_tx_collector.js +5 -4
  120. package/dest/services/tx_collection/slow_tx_collection.d.ts +2 -2
  121. package/dest/services/tx_collection/slow_tx_collection.d.ts.map +1 -1
  122. package/dest/services/tx_collection/slow_tx_collection.js +10 -8
  123. package/dest/services/tx_collection/tx_collection.d.ts +5 -4
  124. package/dest/services/tx_collection/tx_collection.d.ts.map +1 -1
  125. package/dest/services/tx_collection/tx_collection_sink.d.ts +6 -5
  126. package/dest/services/tx_collection/tx_collection_sink.d.ts.map +1 -1
  127. package/dest/services/tx_collection/tx_collection_sink.js +13 -22
  128. package/dest/services/tx_collection/tx_source.d.ts +8 -3
  129. package/dest/services/tx_collection/tx_source.d.ts.map +1 -1
  130. package/dest/services/tx_collection/tx_source.js +19 -2
  131. package/dest/services/tx_file_store/tx_file_store.js +1 -1
  132. package/dest/services/tx_provider.d.ts +3 -3
  133. package/dest/services/tx_provider.d.ts.map +1 -1
  134. package/dest/services/tx_provider.js +4 -4
  135. package/dest/test-helpers/mock-pubsub.d.ts +3 -2
  136. package/dest/test-helpers/mock-pubsub.d.ts.map +1 -1
  137. package/dest/test-helpers/mock-pubsub.js +6 -0
  138. package/dest/test-helpers/testbench-utils.d.ts +6 -3
  139. package/dest/test-helpers/testbench-utils.d.ts.map +1 -1
  140. package/dest/test-helpers/testbench-utils.js +1 -1
  141. package/dest/testbench/p2p_client_testbench_worker.d.ts +2 -2
  142. package/dest/testbench/p2p_client_testbench_worker.d.ts.map +1 -1
  143. package/dest/testbench/p2p_client_testbench_worker.js +6 -6
  144. package/dest/util.d.ts +2 -2
  145. package/dest/util.d.ts.map +1 -1
  146. package/package.json +14 -14
  147. package/src/client/factory.ts +19 -35
  148. package/src/client/interface.ts +16 -19
  149. package/src/client/p2p_client.ts +46 -93
  150. package/src/client/test/tx_proposal_collector/proposal_tx_collector_worker.ts +18 -8
  151. package/src/config.ts +2 -10
  152. package/src/errors/tx-pool.error.ts +12 -0
  153. package/src/mem_pools/tx_pool_v2/deleted_pool.ts +11 -0
  154. package/src/mem_pools/tx_pool_v2/eviction/eviction_manager.ts +21 -8
  155. package/src/mem_pools/tx_pool_v2/eviction/fee_payer_balance_eviction_rule.ts +3 -3
  156. package/src/mem_pools/tx_pool_v2/eviction/fee_payer_balance_pre_add_rule.ts +15 -4
  157. package/src/mem_pools/tx_pool_v2/eviction/index.ts +4 -0
  158. package/src/mem_pools/tx_pool_v2/eviction/interfaces.ts +49 -4
  159. package/src/mem_pools/tx_pool_v2/eviction/invalid_txs_after_mining_rule.ts +2 -2
  160. package/src/mem_pools/tx_pool_v2/eviction/invalid_txs_after_reorg_rule.ts +5 -5
  161. package/src/mem_pools/tx_pool_v2/eviction/low_priority_eviction_rule.ts +12 -9
  162. package/src/mem_pools/tx_pool_v2/eviction/low_priority_pre_add_rule.ts +24 -6
  163. package/src/mem_pools/tx_pool_v2/eviction/nullifier_conflict_rule.ts +3 -3
  164. package/src/mem_pools/tx_pool_v2/instrumentation.ts +69 -0
  165. package/src/mem_pools/tx_pool_v2/interfaces.ts +15 -6
  166. package/src/mem_pools/tx_pool_v2/tx_metadata.ts +46 -2
  167. package/src/mem_pools/tx_pool_v2/tx_pool_indices.ts +14 -3
  168. package/src/mem_pools/tx_pool_v2/tx_pool_v2.ts +12 -7
  169. package/src/mem_pools/tx_pool_v2/tx_pool_v2_impl.ts +264 -125
  170. package/src/msg_validators/tx_validator/README.md +115 -0
  171. package/src/msg_validators/tx_validator/aggregate_tx_validator.ts +3 -3
  172. package/src/msg_validators/tx_validator/factory.ts +353 -77
  173. package/src/msg_validators/tx_validator/gas_validator.ts +90 -27
  174. package/src/msg_validators/tx_validator/index.ts +1 -0
  175. package/src/msg_validators/tx_validator/nullifier_cache.ts +30 -0
  176. package/src/services/dummy_service.ts +6 -6
  177. package/src/services/encoding.ts +2 -1
  178. package/src/services/gossipsub/README.md +29 -14
  179. package/src/services/gossipsub/topic_score_params.ts +49 -13
  180. package/src/services/libp2p/libp2p_service.ts +75 -79
  181. package/src/services/reqresp/batch-tx-requester/batch_tx_requester.ts +20 -48
  182. package/src/services/reqresp/batch-tx-requester/interface.ts +1 -5
  183. package/src/services/reqresp/batch-tx-requester/missing_txs.ts +23 -71
  184. package/src/services/reqresp/batch-tx-requester/peer_collection.ts +63 -24
  185. package/src/services/reqresp/batch-tx-requester/tx_validator.ts +2 -2
  186. package/src/services/service.ts +11 -2
  187. package/src/services/tx_collection/fast_tx_collection.ts +51 -30
  188. package/src/services/tx_collection/file_store_tx_collection.ts +7 -3
  189. package/src/services/tx_collection/file_store_tx_source.ts +61 -17
  190. package/src/services/tx_collection/instrumentation.ts +7 -1
  191. package/src/services/tx_collection/missing_txs_tracker.ts +52 -0
  192. package/src/services/tx_collection/proposal_tx_collector.ts +8 -7
  193. package/src/services/tx_collection/slow_tx_collection.ts +8 -9
  194. package/src/services/tx_collection/tx_collection.ts +4 -3
  195. package/src/services/tx_collection/tx_collection_sink.ts +15 -29
  196. package/src/services/tx_collection/tx_source.ts +22 -3
  197. package/src/services/tx_file_store/tx_file_store.ts +1 -1
  198. package/src/services/tx_provider.ts +2 -2
  199. package/src/test-helpers/mock-pubsub.ts +10 -0
  200. package/src/test-helpers/testbench-utils.ts +3 -3
  201. package/src/testbench/p2p_client_testbench_worker.ts +18 -11
  202. package/src/util.ts +7 -1
@@ -21,11 +21,11 @@ import { getTelemetryClient } from '@aztec/telemetry-client';
21
21
  import { TopicValidatorResult } from '@libp2p/interface';
22
22
  import { peerIdFromString } from '@libp2p/peer-id';
23
23
  import { createP2PClient } from '../index.js';
24
- import { LibP2PService } from '../services/libp2p/libp2p_service.js';
24
+ import { BatchTxRequesterCollector, LibP2PService, SendBatchRequestCollector } from '../services/index.js';
25
25
  import { RateLimitStatus } from '../services/reqresp/rate-limiter/rate_limiter.js';
26
- import { BatchTxRequesterCollector, SendBatchRequestCollector } from '../services/tx_collection/proposal_tx_collector.js';
27
- import { AlwaysTrueCircuitVerifier } from '../test-helpers/reqresp-nodes.js';
28
- import { BENCHMARK_CONSTANTS, InMemoryAttestationPool, InMemoryTxPool, UNLIMITED_RATE_LIMIT_QUOTA, createMockEpochCache, createMockWorldStateSynchronizer, filterTxsByDistribution } from '../test-helpers/testbench-utils.js';
26
+ import { MissingTxsTracker } from '../services/tx_collection/missing_txs_tracker.js';
27
+ import { AlwaysTrueCircuitVerifier } from '../test-helpers/index.js';
28
+ import { BENCHMARK_CONSTANTS, InMemoryAttestationPool, InMemoryTxPool, UNLIMITED_RATE_LIMIT_QUOTA, createMockEpochCache, createMockWorldStateSynchronizer, filterTxsByDistribution } from '../test-helpers/index.js';
29
29
  export { COLLECTOR_DISPLAY_NAMES } from '../test-helpers/testbench-utils.js';
30
30
  const txCache = new Map();
31
31
  class TestLibP2PService extends LibP2PService {
@@ -154,7 +154,7 @@ async function runAggregatorBenchmark(client, blockProposal, collectorType, time
154
154
  timer = new Timer();
155
155
  if (collectorType === 'batch-requester') {
156
156
  const collector = new BatchTxRequesterCollector(batchTxRequesterService, logger, new DateProvider(), noopTxValidator);
157
- const fetchedTxs = await collector.collectTxs(txHashes, blockProposal, pinnedPeer, timeoutMs);
157
+ const fetchedTxs = await collector.collectTxs(MissingTxsTracker.fromArray(txHashes), blockProposal, pinnedPeer, timeoutMs);
158
158
  const durationMs = timer.ms();
159
159
  return {
160
160
  type: 'BENCH_RESULT',
@@ -164,7 +164,7 @@ async function runAggregatorBenchmark(client, blockProposal, collectorType, time
164
164
  };
165
165
  }
166
166
  const collector = new SendBatchRequestCollector(batchTxRequesterService, BENCHMARK_CONSTANTS.FIXED_MAX_PEERS, BENCHMARK_CONSTANTS.FIXED_MAX_RETRY_ATTEMPTS);
167
- const fetchedTxs = await collector.collectTxs(txHashes, blockProposal, pinnedPeer, timeoutMs);
167
+ const fetchedTxs = await collector.collectTxs(MissingTxsTracker.fromArray(txHashes), blockProposal, pinnedPeer, timeoutMs);
168
168
  const durationMs = timer.ms();
169
169
  return {
170
170
  type: 'BENCH_RESULT',
package/dest/util.d.ts CHANGED
@@ -10,7 +10,7 @@ import type { Libp2p } from 'libp2p';
10
10
  import type { P2PConfig } from './config.js';
11
11
  export interface PubSubLibp2p extends Pick<Libp2p, 'status' | 'start' | 'stop' | 'peerId'> {
12
12
  services: {
13
- pubsub: Pick<GossipSub, 'addEventListener' | 'removeEventListener' | 'publish' | 'subscribe' | 'reportMessageValidationResult' | 'direct'> & {
13
+ pubsub: Pick<GossipSub, 'addEventListener' | 'removeEventListener' | 'publish' | 'subscribe' | 'reportMessageValidationResult' | 'direct' | 'getMeshPeers'> & {
14
14
  score: Pick<GossipSub['score'], 'score'>;
15
15
  };
16
16
  };
@@ -58,4 +58,4 @@ export declare function getPeerIdPrivateKey(config: {
58
58
  * @returns The peer ID.
59
59
  */
60
60
  export declare function createLibP2PPeerIdFromPrivateKey(privateKey: string): Promise<PeerId>;
61
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidXRpbC5kLnRzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vc3JjL3V0aWwudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsT0FBTyxFQUFFLFdBQVcsRUFBRSxNQUFNLDBCQUEwQixDQUFDO0FBQ3ZELE9BQU8sS0FBSyxFQU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C9B,QAAQ,EAAE,QAAQ,CAAC;IACnB,MAAM,EAAE,SAAS,CAAC;IAClB,UAAU,EAAE;QACV,iBAAiB,EAAE,iBAAiB,CAAC;KACtC,CAAC;CACH,CAAC,CAAC;AAEH;;;;;;;6CAO6C;AAC7C,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,KAAK,GAAG,KAAK,GAAG,MAAM,CAOjG;AAED;;GAEG;AACH,wBAAsB,WAAW,IAAI,OAAO,CAAC,MAAM,CAAC,CAQnD;AAED,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAGzD;AAED,wBAAsB,yBAAyB,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAW9F;AAcD,wBAAsB,2BAA2B,CAC/C,OAAO,EAAE,SAAS,GAAG,eAAe,GACnC,OAAO,CAAC,SAAS,GAAG,eAAe,CAAC,CAmBtC;AAED;;;;;;;;GAQG;AACH,wBAAsB,mBAAmB,CACvC,MAAM,EAAE;IAAE,gBAAgB,CAAC,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC;IAAC,oBAAoB,CAAC,EAAE,MAAM,CAAC;IAAC,aAAa,CAAC,EAAE,MAAM,CAAA;CAAE,EACzG,KAAK,EAAE,iBAAiB,EACxB,MAAM,EAAE,MAAM,GACb,OAAO,CAAC,WAAW,CAAC,MAAM,CAAC,CAAC,CA2D9B;AAED;;;;GAIG;AACH,wBAAsB,gCAAgC,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAS1F"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aztec/p2p",
3
- "version": "0.0.1-commit.8f9871590",
3
+ "version": "0.0.1-commit.934299a21",
4
4
  "type": "module",
5
5
  "exports": {
6
6
  ".": "./dest/index.js",
@@ -67,17 +67,17 @@
67
67
  ]
68
68
  },
69
69
  "dependencies": {
70
- "@aztec/constants": "0.0.1-commit.8f9871590",
71
- "@aztec/epoch-cache": "0.0.1-commit.8f9871590",
72
- "@aztec/ethereum": "0.0.1-commit.8f9871590",
73
- "@aztec/foundation": "0.0.1-commit.8f9871590",
74
- "@aztec/kv-store": "0.0.1-commit.8f9871590",
75
- "@aztec/noir-contracts.js": "0.0.1-commit.8f9871590",
76
- "@aztec/noir-protocol-circuits-types": "0.0.1-commit.8f9871590",
77
- "@aztec/protocol-contracts": "0.0.1-commit.8f9871590",
78
- "@aztec/simulator": "0.0.1-commit.8f9871590",
79
- "@aztec/stdlib": "0.0.1-commit.8f9871590",
80
- "@aztec/telemetry-client": "0.0.1-commit.8f9871590",
70
+ "@aztec/constants": "0.0.1-commit.934299a21",
71
+ "@aztec/epoch-cache": "0.0.1-commit.934299a21",
72
+ "@aztec/ethereum": "0.0.1-commit.934299a21",
73
+ "@aztec/foundation": "0.0.1-commit.934299a21",
74
+ "@aztec/kv-store": "0.0.1-commit.934299a21",
75
+ "@aztec/noir-contracts.js": "0.0.1-commit.934299a21",
76
+ "@aztec/noir-protocol-circuits-types": "0.0.1-commit.934299a21",
77
+ "@aztec/protocol-contracts": "0.0.1-commit.934299a21",
78
+ "@aztec/simulator": "0.0.1-commit.934299a21",
79
+ "@aztec/stdlib": "0.0.1-commit.934299a21",
80
+ "@aztec/telemetry-client": "0.0.1-commit.934299a21",
81
81
  "@chainsafe/libp2p-gossipsub": "13.0.0",
82
82
  "@chainsafe/libp2p-noise": "^15.0.0",
83
83
  "@chainsafe/libp2p-yamux": "^6.0.2",
@@ -104,8 +104,8 @@
104
104
  "xxhash-wasm": "^1.1.0"
105
105
  },
106
106
  "devDependencies": {
107
- "@aztec/archiver": "0.0.1-commit.8f9871590",
108
- "@aztec/world-state": "0.0.1-commit.8f9871590",
107
+ "@aztec/archiver": "0.0.1-commit.934299a21",
108
+ "@aztec/world-state": "0.0.1-commit.934299a21",
109
109
  "@jest/globals": "^30.0.0",
110
110
  "@types/jest": "^30.0.0",
111
111
  "@types/node": "^22.15.17",
@@ -1,15 +1,15 @@
1
1
  import type { EpochCacheInterface } from '@aztec/epoch-cache';
2
+ import { BlockNumber } from '@aztec/foundation/branded-types';
2
3
  import { type Logger, createLogger } from '@aztec/foundation/log';
3
4
  import { DateProvider } from '@aztec/foundation/timer';
4
5
  import type { AztecAsyncKVStore } from '@aztec/kv-store';
5
6
  import type { DataStoreConfig } from '@aztec/kv-store/config';
6
7
  import { AztecLMDBStoreV2, createStore } from '@aztec/kv-store/lmdb-v2';
7
- import type { BlockHash, L2BlockSource } from '@aztec/stdlib/block';
8
+ import type { L2BlockSource } from '@aztec/stdlib/block';
8
9
  import type { ChainConfig } from '@aztec/stdlib/config';
9
10
  import type { ContractDataSource } from '@aztec/stdlib/contract';
10
- import type { ClientProtocolCircuitVerifier, WorldStateSynchronizer } from '@aztec/stdlib/interfaces/server';
11
+ import type { AztecNode, ClientProtocolCircuitVerifier, WorldStateSynchronizer } from '@aztec/stdlib/interfaces/server';
11
12
  import { P2PClientType } from '@aztec/stdlib/p2p';
12
- import { MerkleTreeId } from '@aztec/stdlib/trees';
13
13
  import { type TelemetryClient, getTelemetryClient } from '@aztec/telemetry-client';
14
14
 
15
15
  import { P2PClient } from '../client/p2p_client.js';
@@ -17,16 +17,13 @@ import type { P2PConfig } from '../config.js';
17
17
  import { AttestationPool, type AttestationPoolApi } from '../mem_pools/attestation_pool/attestation_pool.js';
18
18
  import type { MemPools } from '../mem_pools/interface.js';
19
19
  import type { TxPoolV2 } from '../mem_pools/tx_pool_v2/interfaces.js';
20
- import type { TxMetaData } from '../mem_pools/tx_pool_v2/tx_metadata.js';
21
20
  import { AztecKVTxPoolV2 } from '../mem_pools/tx_pool_v2/tx_pool_v2.js';
22
- import { AggregateTxValidator } from '../msg_validators/tx_validator/aggregate_tx_validator.js';
23
- import { BlockHeaderTxValidator } from '../msg_validators/tx_validator/block_header_validator.js';
24
- import { DoubleSpendTxValidator } from '../msg_validators/tx_validator/double_spend_validator.js';
21
+ import { createTxValidatorForTransactionsEnteringPendingTxPool } from '../msg_validators/index.js';
25
22
  import { DummyP2PService } from '../services/dummy_service.js';
26
23
  import { LibP2PService } from '../services/index.js';
27
24
  import { createFileStoreTxSources } from '../services/tx_collection/file_store_tx_source.js';
28
25
  import { TxCollection } from '../services/tx_collection/tx_collection.js';
29
- import { type TxSource, createNodeRpcTxSources } from '../services/tx_collection/tx_source.js';
26
+ import { NodeRpcTxSource, type TxSource, createNodeRpcTxSources } from '../services/tx_collection/tx_source.js';
30
27
  import { TxFileStore } from '../services/tx_file_store/tx_file_store.js';
31
28
  import { configureP2PClientAddresses, createLibP2PPeerIdFromPrivateKey, getPeerIdPrivateKey } from '../util.js';
32
29
 
@@ -36,6 +33,7 @@ export type P2PClientDeps<T extends P2PClientType> = {
36
33
  attestationPool?: AttestationPoolApi;
37
34
  logger?: Logger;
38
35
  txCollectionNodeSources?: TxSource[];
36
+ rpcTxProviders?: AztecNode[];
39
37
  p2pServiceFactory?: (...args: Parameters<(typeof LibP2PService)['new']>) => Promise<LibP2PService<T>>;
40
38
  };
41
39
 
@@ -79,32 +77,6 @@ export async function createP2PClient<T extends P2PClientType>(
79
77
  const rollupAddress = inputConfig.l1Contracts.rollupAddress.toString().toLowerCase().replace(/^0x/, '');
80
78
  const txFileStoreBasePath = `aztec-${inputConfig.l1ChainId}-${inputConfig.rollupVersion}-0x${rollupAddress}`;
81
79
 
82
- /** Validator factory for pool re-validation (double-spend + block header only). */
83
- const createPoolTxValidator = async () => {
84
- await worldStateSynchronizer.syncImmediate();
85
- return new AggregateTxValidator<TxMetaData>(
86
- new DoubleSpendTxValidator<TxMetaData>(
87
- {
88
- nullifiersExist: async (nullifiers: Buffer[]) => {
89
- const merkleTree = worldStateSynchronizer.getCommitted();
90
- const indices = await merkleTree.findLeafIndices(MerkleTreeId.NULLIFIER_TREE, nullifiers);
91
- return indices.map(index => index !== undefined);
92
- },
93
- },
94
- bindings,
95
- ),
96
- new BlockHeaderTxValidator<TxMetaData>(
97
- {
98
- getArchiveIndices: (archives: BlockHash[]) => {
99
- const merkleTree = worldStateSynchronizer.getCommitted();
100
- return merkleTree.findLeafIndices(MerkleTreeId.ARCHIVE, archives);
101
- },
102
- },
103
- bindings,
104
- ),
105
- );
106
- };
107
-
108
80
  const txPool =
109
81
  deps.txPool ??
110
82
  new AztecKVTxPoolV2(
@@ -113,13 +85,23 @@ export async function createP2PClient<T extends P2PClientType>(
113
85
  {
114
86
  l2BlockSource: archiver,
115
87
  worldStateSynchronizer,
116
- createTxValidator: createPoolTxValidator,
88
+ createTxValidator: async () => {
89
+ // We accept transactions if they are not expired by the next slot and block number (checked based on the ExpirationTimestamp field)
90
+ const currentBlockNumber = await archiver.getBlockNumber();
91
+ const { ts: nextSlotTimestamp } = epochCache.getEpochAndSlotInNextL1Slot();
92
+ return createTxValidatorForTransactionsEnteringPendingTxPool(
93
+ worldStateSynchronizer,
94
+ nextSlotTimestamp,
95
+ BlockNumber(currentBlockNumber + 1),
96
+ );
97
+ },
117
98
  },
118
99
  telemetry,
119
100
  {
120
101
  maxPendingTxCount: config.maxPendingTxCount,
121
102
  archivedTxLimit: config.archivedTxLimit,
122
103
  minTxPoolAgeMs: config.minTxPoolAgeMs,
104
+ dropTransactionsProbability: config.dropTransactionsProbability,
123
105
  },
124
106
  dateProvider,
125
107
  );
@@ -147,6 +129,7 @@ export async function createP2PClient<T extends P2PClientType>(
147
129
 
148
130
  const nodeSources = [
149
131
  ...createNodeRpcTxSources(config.txCollectionNodeRpcUrls, config),
132
+ ...(deps.rpcTxProviders ?? []).map((node, i) => new NodeRpcTxSource(node, `node-rpc-provider-${i}`)),
150
133
  ...(deps.txCollectionNodeSources ?? []),
151
134
  ];
152
135
  if (nodeSources.length > 0) {
@@ -159,6 +142,7 @@ export async function createP2PClient<T extends P2PClientType>(
159
142
  config.txCollectionFileStoreUrls,
160
143
  txFileStoreBasePath,
161
144
  logger.createChild('file-store-tx-source'),
145
+ telemetry,
162
146
  );
163
147
  if (fileStoreSources.length > 0) {
164
148
  logger.info(`Using ${fileStoreSources.length} file store sources for tx collection.`, {
@@ -1,7 +1,13 @@
1
1
  import type { SlotNumber } from '@aztec/foundation/branded-types';
2
2
  import type { EthAddress, L2BlockId } from '@aztec/stdlib/block';
3
- import type { P2PApiFull } from '@aztec/stdlib/interfaces/server';
4
- import type { BlockProposal, CheckpointAttestation, CheckpointProposal, P2PClientType } from '@aztec/stdlib/p2p';
3
+ import type { ITxProvider, P2PApiFull } from '@aztec/stdlib/interfaces/server';
4
+ import type {
5
+ BlockProposal,
6
+ CheckpointAttestation,
7
+ CheckpointProposal,
8
+ P2PClientType,
9
+ TopicType,
10
+ } from '@aztec/stdlib/p2p';
5
11
  import type { BlockHeader, Tx, TxHash } from '@aztec/stdlib/tx';
6
12
 
7
13
  import type { PeerId } from '@libp2p/interface';
@@ -107,13 +113,6 @@ export type P2P<T extends P2PClientType = P2PClientType.Full> = P2PApiFull<T> &
107
113
  **/
108
114
  sendTx(tx: Tx): Promise<void>;
109
115
 
110
- /**
111
- * Adds transactions to the pool. Does not send to peers or validate the tx.
112
- * @param txs - The transactions.
113
- * @returns The number of txs added to the pool. Note if the transaction already exists, it will not be added again.
114
- **/
115
- addTxsToPool(txs: Tx[]): Promise<number>;
116
-
117
116
  /**
118
117
  * Handles failed transaction execution by removing txs from the pool.
119
118
  * @param txHashes - Hashes of the transactions that failed execution.
@@ -141,14 +140,6 @@ export type P2P<T extends P2PClientType = P2PClientType.Full> = P2PApiFull<T> &
141
140
  */
142
141
  hasTxsInPool(txHashes: TxHash[]): Promise<boolean[]>;
143
142
 
144
- /**
145
- * Returns transactions in the transaction pool by hash, requesting from the network if not found.
146
- * @param txHashes - Hashes of tx to return.
147
- * @param pinnedPeerId - An optional peer id that will be used to request the tx from (in addition to other random peers).
148
- * @returns An array of tx or undefined.
149
- */
150
- getTxsByHash(txHashes: TxHash[], pinnedPeerId: PeerId | undefined): Promise<(Tx | undefined)[]>;
151
-
152
143
  /**
153
144
  * Returns an archived transaction from the transaction pool by its hash.
154
145
  * @param txHash - Hash of tx to return.
@@ -220,10 +211,13 @@ export type P2P<T extends P2PClientType = P2PClientType.Full> = P2PApiFull<T> &
220
211
  /** Identifies a p2p client. */
221
212
  isP2PClient(): true;
222
213
 
214
+ /** Returns the tx provider used for fetching transactions. */
215
+ getTxProvider(): ITxProvider;
216
+
223
217
  updateP2PConfig(config: Partial<P2PConfig>): Promise<void>;
224
218
 
225
- /** Validates a set of txs. */
226
- validate(txs: Tx[]): Promise<void>;
219
+ /** Validates a set of txs received in a block proposal. */
220
+ validateTxsReceivedInBlockProposal(txs: Tx[]): Promise<void>;
227
221
 
228
222
  /** Clears the db. */
229
223
  clear(): Promise<void>;
@@ -241,4 +235,7 @@ export type P2P<T extends P2PClientType = P2PClientType.Full> = P2PApiFull<T> &
241
235
 
242
236
  /** If node running this P2P stack is validator, passes in validator address to P2P layer */
243
237
  registerThisValidatorAddresses(address: EthAddress[]): void;
238
+
239
+ /** Returns the number of peers in the GossipSub mesh for a given topic type. */
240
+ getGossipMeshPeerCount(topicType: TopicType): Promise<number>;
244
241
  };
@@ -1,12 +1,13 @@
1
1
  import { GENESIS_BLOCK_HEADER_HASH } from '@aztec/constants';
2
2
  import type { EpochCacheInterface } from '@aztec/epoch-cache';
3
- import { BlockNumber, SlotNumber } from '@aztec/foundation/branded-types';
3
+ import { BlockNumber, CheckpointNumber, SlotNumber } from '@aztec/foundation/branded-types';
4
4
  import { createLogger } from '@aztec/foundation/log';
5
5
  import { RunningPromise } from '@aztec/foundation/promise';
6
6
  import { DateProvider } from '@aztec/foundation/timer';
7
7
  import type { AztecAsyncKVStore, AztecAsyncSingleton } from '@aztec/kv-store';
8
8
  import { L2TipsKVStore } from '@aztec/kv-store/stores';
9
9
  import {
10
+ type CheckpointId,
10
11
  type EthAddress,
11
12
  type L2Block,
12
13
  type L2BlockId,
@@ -24,6 +25,7 @@ import {
24
25
  CheckpointAttestation,
25
26
  type CheckpointProposal,
26
27
  type P2PClientType,
28
+ type TopicType,
27
29
  } from '@aztec/stdlib/p2p';
28
30
  import type { BlockHeader, Tx, TxHash } from '@aztec/stdlib/tx';
29
31
  import { Attributes, type TelemetryClient, WithTracer, getTelemetryClient, trackSpan } from '@aztec/telemetry-client';
@@ -32,6 +34,7 @@ import type { PeerId } from '@libp2p/interface';
32
34
  import type { ENR } from '@nethermindeth/enr';
33
35
 
34
36
  import { type P2PConfig, getP2PDefaultConfig } from '../config.js';
37
+ import { TxPoolError } from '../errors/tx-pool.error.js';
35
38
  import type { AttestationPoolApi } from '../mem_pools/attestation_pool/attestation_pool.js';
36
39
  import type { MemPools } from '../mem_pools/interface.js';
37
40
  import type { TxPoolV2 } from '../mem_pools/tx_pool_v2/interfaces.js';
@@ -41,7 +44,6 @@ import {
41
44
  type ReqRespSubProtocolHandler,
42
45
  type ReqRespSubProtocolValidators,
43
46
  } from '../services/reqresp/interface.js';
44
- import { chunkTxHashesRequest } from '../services/reqresp/protocols/tx.js';
45
47
  import type {
46
48
  DuplicateAttestationInfo,
47
49
  DuplicateProposalInfo,
@@ -165,6 +167,10 @@ export class P2PClient<T extends P2PClientType = P2PClientType.Full>
165
167
  return Promise.resolve(this.p2pService.getPeers(includePending));
166
168
  }
167
169
 
170
+ public getGossipMeshPeerCount(topicType: TopicType): Promise<number> {
171
+ return Promise.resolve(this.p2pService.getGossipMeshPeerCount(topicType));
172
+ }
173
+
168
174
  public getL2BlockHash(number: BlockNumber): Promise<string | undefined> {
169
175
  return this.l2Tips.getL2BlockHash(number);
170
176
  }
@@ -200,7 +206,7 @@ export class P2PClient<T extends P2PClientType = P2PClientType.Full>
200
206
  break;
201
207
  case 'chain-pruned':
202
208
  this.txCollection.stopCollectingForBlocksAfter(event.block.number);
203
- await this.handlePruneL2Blocks(event.block);
209
+ await this.handlePruneL2Blocks(event.block, event.checkpoint);
204
210
  break;
205
211
  case 'chain-checkpointed':
206
212
  break;
@@ -426,36 +432,6 @@ export class P2PClient<T extends P2PClientType = P2PClientType.Full>
426
432
  this.p2pService.registerDuplicateAttestationCallback(callback);
427
433
  }
428
434
 
429
- /**
430
- * Uses the batched Request Response protocol to request a set of transactions from the network.
431
- */
432
- private async requestTxsByHash(txHashes: TxHash[], pinnedPeerId: PeerId | undefined): Promise<Tx[]> {
433
- const timeoutMs = 8000; // Longer timeout for now
434
- const maxRetryAttempts = 10; // Keep retrying within the timeout
435
- const requests = chunkTxHashesRequest(txHashes);
436
- const maxPeers = Math.min(Math.ceil(requests.length / 3), 10);
437
-
438
- const txBatches = await this.p2pService.sendBatchRequest(
439
- ReqRespSubProtocol.TX,
440
- requests,
441
- pinnedPeerId,
442
- timeoutMs,
443
- maxPeers,
444
- maxRetryAttempts,
445
- );
446
-
447
- const txs = txBatches.flat();
448
- if (txs.length > 0) {
449
- await this.txPool.addPendingTxs(txs);
450
- }
451
-
452
- const txHashesStr = txHashes.map(tx => tx.toString()).join(', ');
453
- this.log.debug(`Requested txs ${txHashesStr} (${txs.length} / ${txHashes.length}) from peers`);
454
-
455
- // We return all transactions, even the not found ones to the caller, such they can handle missing items themselves.
456
- return txs;
457
- }
458
-
459
435
  public async getPendingTxs(limit?: number, after?: TxHash): Promise<Tx[]> {
460
436
  if (limit !== undefined && limit <= 0) {
461
437
  throw new TypeError('limit must be greater than 0');
@@ -523,49 +499,6 @@ export class P2PClient<T extends P2PClientType = P2PClientType.Full>
523
499
  return this.txPool.hasTxs(txHashes);
524
500
  }
525
501
 
526
- /**
527
- * Returns transactions in the transaction pool by hash.
528
- * If a transaction is not in the pool, it will be requested from the network.
529
- * @param txHashes - Hashes of the transactions to look for.
530
- * @returns The txs found, or undefined if not found in the order requested.
531
- */
532
- async getTxsByHash(txHashes: TxHash[], pinnedPeerId: PeerId | undefined): Promise<(Tx | undefined)[]> {
533
- const txs = await Promise.all(txHashes.map(txHash => this.txPool.getTxByHash(txHash)));
534
- const missingTxHashes = txs
535
- .map((tx, index) => [tx, index] as const)
536
- .filter(([tx, _index]) => !tx)
537
- .map(([_tx, index]) => txHashes[index]);
538
-
539
- if (missingTxHashes.length === 0) {
540
- return txs as Tx[];
541
- }
542
-
543
- const missingTxs = await this.requestTxsByHash(missingTxHashes, pinnedPeerId);
544
- // TODO: optimize
545
- // Merge the found txs in order
546
- const mergingTxs = txHashes.map(txHash => {
547
- // Is it in the txs list from the mempool?
548
- for (const tx of txs) {
549
- if (tx !== undefined && tx.getTxHash().equals(txHash)) {
550
- return tx;
551
- }
552
- }
553
-
554
- // Is it in the fetched missing txs?
555
- // Note: this is an O(n^2) operation, but we expect the number of missing txs to be small.
556
- for (const tx of missingTxs) {
557
- if (tx.getTxHash().equals(txHash)) {
558
- return tx;
559
- }
560
- }
561
-
562
- // Otherwise return undefined
563
- return undefined;
564
- });
565
-
566
- return mergingTxs;
567
- }
568
-
569
502
  /**
570
503
  * Returns an archived transaction in the transaction pool by its hash.
571
504
  * @param txHash - Hash of the archived transaction to look for.
@@ -582,23 +515,22 @@ export class P2PClient<T extends P2PClientType = P2PClientType.Full>
582
515
  **/
583
516
  public async sendTx(tx: Tx): Promise<void> {
584
517
  this.#assertIsReady();
585
- const result = await this.txPool.addPendingTxs([tx]);
518
+ const result = await this.txPool.addPendingTxs([tx], { feeComparisonOnly: true });
586
519
  if (result.accepted.length === 1) {
587
520
  await this.p2pService.propagate(tx);
588
- } else {
589
- this.log.warn(
590
- `Tx ${tx.getTxHash()} not propagated: accepted=${result.accepted.length} ignored=${result.ignored.length} rejected=${result.rejected.length}`,
591
- );
521
+ return;
592
522
  }
593
- }
594
523
 
595
- /**
596
- * Adds transactions to the pool. Does not send to peers or validate the txs.
597
- * @param txs - The transactions.
598
- **/
599
- public async addTxsToPool(txs: Tx[]): Promise<number> {
600
- this.#assertIsReady();
601
- return (await this.txPool.addPendingTxs(txs)).accepted.length;
524
+ const txHashStr = tx.getTxHash().toString();
525
+ const reason = result.errors?.get(txHashStr);
526
+ if (reason) {
527
+ this.log.warn(`Tx ${txHashStr} not added to pool: ${reason.message}`);
528
+ throw new TxPoolError(reason);
529
+ }
530
+
531
+ this.log.warn(
532
+ `Tx ${txHashStr} not propagated: accepted=${result.accepted.length} ignored=${result.ignored.length} rejected=${result.rejected.length}`,
533
+ );
602
534
  }
603
535
 
604
536
  /**
@@ -759,10 +691,31 @@ export class P2PClient<T extends P2PClientType = P2PClientType.Full>
759
691
 
760
692
  /**
761
693
  * Updates the tx pool after a chain prune.
694
+ * Detects epoch prunes (checkpoint number changed) and deletes all txs in that case.
762
695
  * @param latestBlock - The block ID the chain was pruned to.
696
+ * @param newCheckpoint - The checkpoint ID after the prune.
763
697
  */
764
- private async handlePruneL2Blocks(latestBlock: L2BlockId): Promise<void> {
765
- await this.txPool.handlePrunedBlocks(latestBlock);
698
+ private async handlePruneL2Blocks(latestBlock: L2BlockId, newCheckpoint: CheckpointId): Promise<void> {
699
+ const deleteAllTxs = this.config.txPoolDeleteTxsAfterReorg && (await this.isEpochPrune(newCheckpoint));
700
+ await this.txPool.handlePrunedBlocks(latestBlock, { deleteAllTxs });
701
+ }
702
+
703
+ /**
704
+ * Returns true if the prune crossed a checkpoint boundary.
705
+ * If the old and new checkpoint numbers are the same, the prune is within a single checkpoint.
706
+ * If they differ, the prune spans across checkpoints (epoch prune).
707
+ */
708
+ private async isEpochPrune(newCheckpoint: CheckpointId): Promise<boolean> {
709
+ const tips = await this.l2Tips.getL2Tips();
710
+ const oldCheckpointNumber = tips.checkpointed.checkpoint.number;
711
+ if (oldCheckpointNumber <= CheckpointNumber.ZERO) {
712
+ return false;
713
+ }
714
+ const isEpochPrune = oldCheckpointNumber !== newCheckpoint.number;
715
+ this.log.info(
716
+ `Detected epoch prune: ${isEpochPrune}. Old checkpoint: ${oldCheckpointNumber}, new checkpoint: ${newCheckpoint.number}`,
717
+ );
718
+ return isEpochPrune;
766
719
  }
767
720
 
768
721
  /** Checks if the slot has changed and calls prepareForSlot if so. */
@@ -812,8 +765,8 @@ export class P2PClient<T extends P2PClientType = P2PClientType.Full>
812
765
  this.log.debug(`Moved from state ${P2PClientState[oldState]} to ${P2PClientState[this.currentState]}`);
813
766
  }
814
767
 
815
- public validate(txs: Tx[]): Promise<void> {
816
- return this.p2pService.validate(txs);
768
+ public validateTxsReceivedInBlockProposal(txs: Tx[]): Promise<void> {
769
+ return this.p2pService.validateTxsReceivedInBlockProposal(txs);
817
770
  }
818
771
 
819
772
  /**
@@ -16,14 +16,12 @@ import type { PeerId } from '@libp2p/interface';
16
16
  import { peerIdFromString } from '@libp2p/peer-id';
17
17
 
18
18
  import type { P2PConfig } from '../../../config.js';
19
+ import { BatchTxRequesterCollector, SendBatchRequestCollector } from '../../../services/index.js';
19
20
  import type { IBatchRequestTxValidator } from '../../../services/reqresp/batch-tx-requester/tx_validator.js';
20
21
  import { RateLimitStatus } from '../../../services/reqresp/rate-limiter/rate_limiter.js';
22
+ import { MissingTxsTracker } from '../../../services/tx_collection/missing_txs_tracker.js';
21
23
  import {
22
- BatchTxRequesterCollector,
23
- SendBatchRequestCollector,
24
- } from '../../../services/tx_collection/proposal_tx_collector.js';
25
- import { AlwaysTrueCircuitVerifier } from '../../../test-helpers/reqresp-nodes.js';
26
- import {
24
+ AlwaysTrueCircuitVerifier,
27
25
  BENCHMARK_CONSTANTS,
28
26
  InMemoryAttestationPool,
29
27
  InMemoryTxPool,
@@ -31,7 +29,7 @@ import {
31
29
  calculateInternalTimeout,
32
30
  createMockEpochCache,
33
31
  createMockWorldStateSynchronizer,
34
- } from '../../../test-helpers/testbench-utils.js';
32
+ } from '../../../test-helpers/index.js';
35
33
  import { createP2PClient } from '../../index.js';
36
34
  import type { P2PClient } from '../../p2p_client.js';
37
35
  import {
@@ -214,7 +212,13 @@ async function runCollector(cmd: Extract<WorkerCommand, { type: 'RUN_COLLECTOR'
214
212
  if (collectorType === 'batch-requester') {
215
213
  const collector = new BatchTxRequesterCollector(p2pService, logger, new DateProvider(), noopTxValidator);
216
214
  const fetched = await executeTimeout(
217
- (_signal: AbortSignal) => collector.collectTxs(parsedTxHashes, parsedProposal, pinnedPeer, internalTimeoutMs),
215
+ (_signal: AbortSignal) =>
216
+ collector.collectTxs(
217
+ MissingTxsTracker.fromArray(parsedTxHashes),
218
+ parsedProposal,
219
+ pinnedPeer,
220
+ internalTimeoutMs,
221
+ ),
218
222
  timeoutMs,
219
223
  () => new Error(`Collector timed out after ${timeoutMs}ms`),
220
224
  );
@@ -226,7 +230,13 @@ async function runCollector(cmd: Extract<WorkerCommand, { type: 'RUN_COLLECTOR'
226
230
  BENCHMARK_CONSTANTS.FIXED_MAX_RETRY_ATTEMPTS,
227
231
  );
228
232
  const fetched = await executeTimeout(
229
- (_signal: AbortSignal) => collector.collectTxs(parsedTxHashes, parsedProposal, pinnedPeer, internalTimeoutMs),
233
+ (_signal: AbortSignal) =>
234
+ collector.collectTxs(
235
+ MissingTxsTracker.fromArray(parsedTxHashes),
236
+ parsedProposal,
237
+ pinnedPeer,
238
+ internalTimeoutMs,
239
+ ),
230
240
  timeoutMs,
231
241
  () => new Error(`Collector timed out after ${timeoutMs}ms`),
232
242
  );
package/src/config.ts CHANGED
@@ -38,7 +38,7 @@ export interface P2PConfig
38
38
  ChainConfig,
39
39
  TxCollectionConfig,
40
40
  TxFileStoreConfig,
41
- Pick<SequencerConfig, 'blockDurationMs'> {
41
+ Pick<SequencerConfig, 'blockDurationMs' | 'expectedBlockProposalsPerSlot'> {
42
42
  /** A flag dictating whether the P2P subsystem should be enabled. */
43
43
  p2pEnabled: boolean;
44
44
 
@@ -173,10 +173,7 @@ export interface P2PConfig
173
173
  /** Whether transactions are disabled for this node. This means transactions will be rejected at the RPC and P2P layers. */
174
174
  disableTransactions: boolean;
175
175
 
176
- /** True to simulate discarding transactions. - For testing purposes only*/
177
- dropTransactions: boolean;
178
-
179
- /** The probability that a transaction is discarded. - For testing purposes only */
176
+ /** The probability that a transaction is discarded (0 = disabled). - For testing purposes only */
180
177
  dropTransactionsProbability: number;
181
178
 
182
179
  /** Whether to delete transactions from the pool after a reorg instead of moving them back to pending. */
@@ -430,11 +427,6 @@ export const p2pConfigMappings: ConfigMappingsType<P2PConfig> = {
430
427
  description: 'Number of auth attempts to allow before peer is banned. Number is inclusive',
431
428
  ...numberConfigHelper(3),
432
429
  },
433
- dropTransactions: {
434
- env: 'P2P_DROP_TX',
435
- description: 'True to simulate discarding transactions. - For testing purposes only',
436
- ...booleanConfigHelper(false),
437
- },
438
430
  dropTransactionsProbability: {
439
431
  env: 'P2P_DROP_TX_CHANCE',
440
432
  description: 'The probability that a transaction is discarded (0 - 1). - For testing purposes only',
@@ -0,0 +1,12 @@
1
+ import type { TxPoolRejectionError } from '../mem_pools/tx_pool_v2/eviction/interfaces.js';
2
+
3
+ /** Error thrown when a transaction is not added to the mempool. */
4
+ export class TxPoolError extends Error {
5
+ public readonly data: TxPoolRejectionError;
6
+
7
+ constructor(public readonly reason: TxPoolRejectionError) {
8
+ super(reason.message);
9
+ this.name = 'TxPoolError';
10
+ this.data = reason;
11
+ }
12
+ }
@@ -301,6 +301,17 @@ export class DeletedPool {
301
301
  return this.#state.size;
302
302
  }
303
303
 
304
+ /** Gets the count of soft-deleted transactions (both prune-based and slot-based). */
305
+ getSoftDeletedCount(): number {
306
+ let count = this.#slotDeletedTxs.size;
307
+ for (const state of this.#state.values()) {
308
+ if (state.softDeleted) {
309
+ count++;
310
+ }
311
+ }
312
+ return count;
313
+ }
314
+
304
315
  /**
305
316
  * Gets all transaction hashes from pruned blocks.
306
317
  */