@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
@@ -2,18 +2,22 @@ import type { DateProvider } from '@aztec/foundation/timer';
2
2
  import type { PeerErrorSeverity } from '@aztec/stdlib/p2p';
3
3
 
4
4
  import type { PeerId } from '@libp2p/interface';
5
+ import { peerIdFromString } from '@libp2p/peer-id';
5
6
 
7
+ import type { ConnectionSampler } from '../connection-sampler/connection_sampler.js';
6
8
  import { DEFAULT_BATCH_TX_REQUESTER_BAD_PEER_THRESHOLD } from './config.js';
7
9
  import type { IPeerPenalizer } from './interface.js';
8
10
 
9
11
  export const RATE_LIMIT_EXCEEDED_PEER_CACHE_TTL = 1000; // 1s
10
12
 
11
13
  export interface IPeerCollection {
12
- getAllPeers(): Set<string>;
13
- getSmartPeers(): Set<string>;
14
14
  markPeerSmart(peerId: PeerId): void;
15
- getSmartPeersToQuery(): Array<string>;
16
- getDumbPeersToQuery(): Array<string>;
15
+
16
+ /** Sample next peer in round-robin fashion. No smart peers if returns undefined */
17
+ nextSmartPeerToQuery(): PeerId | undefined;
18
+ /** Sample next peer in round-robin fashion. No dumb peers if returns undefined */
19
+ nextDumbPeerToQuery(): PeerId | undefined;
20
+
17
21
  thereAreSomeDumbRatelimitExceededPeers(): boolean;
18
22
  penalisePeer(peerId: PeerId, severity: PeerErrorSeverity): void;
19
23
  unMarkPeerAsBad(peerId: PeerId): void;
@@ -28,8 +32,6 @@ export interface IPeerCollection {
28
32
  }
29
33
 
30
34
  export class PeerCollection implements IPeerCollection {
31
- private readonly peers;
32
-
33
35
  private readonly smartPeers = new Set<string>();
34
36
  private readonly inFlightPeers = new Set<string>();
35
37
  private readonly rateLimitExceededPeers = new Map<string, number>();
@@ -37,46 +39,60 @@ export class PeerCollection implements IPeerCollection {
37
39
  private readonly badPeers = new Set<string>();
38
40
 
39
41
  constructor(
40
- initialPeers: PeerId[],
42
+ private readonly connectionSampler: Pick<ConnectionSampler, 'getPeerListSortedByConnectionCountAsc'>,
41
43
  private readonly pinnedPeerId: PeerId | undefined,
42
44
  private readonly dateProvider: DateProvider,
43
45
  private readonly badPeerThreshold: number = DEFAULT_BATCH_TX_REQUESTER_BAD_PEER_THRESHOLD,
44
46
  private readonly peerPenalizer?: IPeerPenalizer,
45
47
  ) {
46
- this.peers = new Set(initialPeers.map(peer => peer.toString()));
47
-
48
- // Pinned peer is treaded specially, always mark it as in-flight
48
+ // Pinned peer is treated specially, always mark it as in-flight
49
49
  // and never return it as part of smart/dumb peers
50
50
  if (this.pinnedPeerId) {
51
51
  const peerIdStr = this.pinnedPeerId.toString();
52
52
  this.inFlightPeers.add(peerIdStr);
53
- this.peers.delete(peerIdStr);
54
53
  }
55
54
  }
56
55
 
57
- public getAllPeers(): Set<string> {
58
- return this.peers;
56
+ public markPeerSmart(peerId: PeerId): void {
57
+ this.smartPeers.add(peerId.toString());
59
58
  }
60
59
 
61
- public getSmartPeers(): Set<string> {
62
- return this.smartPeers;
60
+ // We keep track of all peers that are queried for peer sampling algorithm
61
+ private queriedSmartPeers: Set<string> = new Set<string>();
62
+ private queriedDumbPeers: Set<string> = new Set<string>();
63
+
64
+ private static nextPeer(allPeers: Set<string>, queried: Set<string>): PeerId | undefined {
65
+ if (allPeers.size === 0) {
66
+ return undefined;
67
+ }
68
+ const availablePeers = allPeers.difference(queried);
69
+ let [first] = availablePeers;
70
+ if (first === undefined) {
71
+ // We queried all peers. Start over
72
+ [first] = allPeers;
73
+ queried.clear();
74
+ }
75
+ queried.add(first);
76
+ return peerIdFromString(first);
63
77
  }
64
78
 
65
- public markPeerSmart(peerId: PeerId): void {
66
- this.smartPeers.add(peerId.toString());
79
+ public nextSmartPeerToQuery(): PeerId | undefined {
80
+ return PeerCollection.nextPeer(this.availableSmartPeers, this.queriedSmartPeers);
81
+ }
82
+
83
+ public nextDumbPeerToQuery(): PeerId | undefined {
84
+ return PeerCollection.nextPeer(this.availableDumbPeers, this.queriedDumbPeers);
67
85
  }
68
86
 
69
- public getSmartPeersToQuery(): Array<string> {
70
- return Array.from(
87
+ private get availableSmartPeers(): Set<string> {
88
+ return this.peers.intersection(
71
89
  this.smartPeers.difference(this.getBadPeers().union(this.inFlightPeers).union(this.getRateLimitExceededPeers())),
72
90
  );
73
91
  }
74
92
 
75
- public getDumbPeersToQuery(): Array<string> {
76
- return Array.from(
77
- this.peers.difference(
78
- this.smartPeers.union(this.getBadPeers()).union(this.inFlightPeers).union(this.getRateLimitExceededPeers()),
79
- ),
93
+ private get availableDumbPeers(): Set<string> {
94
+ return this.peers.difference(
95
+ this.smartPeers.union(this.getBadPeers()).union(this.inFlightPeers).union(this.getRateLimitExceededPeers()),
80
96
  );
81
97
  }
82
98
 
@@ -202,4 +218,27 @@ export class PeerCollection implements IPeerCollection {
202
218
 
203
219
  return minExpiry! - now;
204
220
  }
221
+
222
+ private orderedPeers: Set<string> = new Set();
223
+
224
+ private get peers(): Set<string> {
225
+ const pinnedStr = this.pinnedPeerId?.toString();
226
+ const currentlyConnected = new Set(
227
+ this.connectionSampler
228
+ .getPeerListSortedByConnectionCountAsc()
229
+ .map(p => p.toString())
230
+ .filter(p => p !== pinnedStr),
231
+ );
232
+
233
+ // Remove disconnected peers, preserving order of the rest.
234
+ this.orderedPeers = this.orderedPeers.intersection(currentlyConnected);
235
+
236
+ // Append newly connected peers at the end (lowest priority).
237
+ for (const peer of currentlyConnected) {
238
+ if (!this.orderedPeers.has(peer)) {
239
+ this.orderedPeers.add(peer);
240
+ }
241
+ }
242
+ return this.orderedPeers;
243
+ }
205
244
  }
@@ -1,7 +1,7 @@
1
1
  import type { ClientProtocolCircuitVerifier } from '@aztec/stdlib/interfaces/server';
2
2
  import { Tx, type TxValidationResult, type TxValidator } from '@aztec/stdlib/tx';
3
3
 
4
- import { createTxReqRespValidator } from '../../../msg_validators/tx_validator/factory.js';
4
+ import { createTxValidatorForReqResponseReceivedTxs } from '../../../msg_validators/index.js';
5
5
 
6
6
  export interface BatchRequestTxValidatorConfig {
7
7
  l1ChainId: number;
@@ -29,7 +29,7 @@ export class BatchRequestTxValidator implements IBatchRequestTxValidator {
29
29
  }
30
30
 
31
31
  static createRequestedTxValidator(config: BatchRequestTxValidatorConfig): TxValidator {
32
- return createTxReqRespValidator(config.proofVerifier, {
32
+ return createTxValidatorForReqResponseReceivedTxs(config.proofVerifier, {
33
33
  l1ChainId: config.l1ChainId,
34
34
  rollupVersion: config.rollupVersion,
35
35
  });
@@ -1,7 +1,13 @@
1
1
  import type { SlotNumber } from '@aztec/foundation/branded-types';
2
2
  import type { EthAddress } from '@aztec/foundation/eth-address';
3
3
  import type { PeerInfo } from '@aztec/stdlib/interfaces/server';
4
- import type { BlockProposal, CheckpointAttestation, CheckpointProposalCore, Gossipable } from '@aztec/stdlib/p2p';
4
+ import type {
5
+ BlockProposal,
6
+ CheckpointAttestation,
7
+ CheckpointProposalCore,
8
+ Gossipable,
9
+ TopicType,
10
+ } from '@aztec/stdlib/p2p';
5
11
  import type { Tx } from '@aztec/stdlib/tx';
6
12
 
7
13
  import type { PeerId } from '@libp2p/interface';
@@ -130,7 +136,10 @@ export interface P2PService {
130
136
 
131
137
  getPeers(includePending?: boolean): PeerInfo[];
132
138
 
133
- validate(txs: Tx[]): Promise<void>;
139
+ /** Returns the number of peers in the GossipSub mesh for a given topic type. */
140
+ getGossipMeshPeerCount(topicType: TopicType): number;
141
+
142
+ validateTxsReceivedInBlockProposal(txs: Tx[]): Promise<void>;
134
143
 
135
144
  addReqRespSubProtocol(
136
145
  subProtocol: ReqRespSubProtocol,
@@ -14,6 +14,7 @@ import type { PeerId } from '@libp2p/interface';
14
14
  import type { BatchTxRequesterConfig } from '../reqresp/batch-tx-requester/config.js';
15
15
  import type { BatchTxRequesterLibP2PService } from '../reqresp/batch-tx-requester/interface.js';
16
16
  import type { TxCollectionConfig } from './config.js';
17
+ import { MissingTxsTracker } from './missing_txs_tracker.js';
17
18
  import {
18
19
  BatchTxRequesterCollector,
19
20
  type MissingTxsCollector,
@@ -83,8 +84,7 @@ export class FastTxCollection {
83
84
  ...input,
84
85
  blockInfo,
85
86
  promise,
86
- foundTxs: new Map<string, Tx>(),
87
- missingTxHashes: new Set(txHashes.map(t => t.toString())),
87
+ missingTxTracker: MissingTxsTracker.fromArray(txHashes),
88
88
  deadline: opts.deadline,
89
89
  };
90
90
 
@@ -92,15 +92,15 @@ export class FastTxCollection {
92
92
  clearTimeout(timeoutTimer);
93
93
 
94
94
  this.log.verbose(
95
- `Collected ${request.foundTxs.size} txs out of ${txHashes.length} for ${input.type} at slot ${blockInfo.slotNumber}`,
95
+ `Collected ${request.missingTxTracker.collectedTxs.length} txs out of ${txHashes.length} for ${input.type} at slot ${blockInfo.slotNumber}`,
96
96
  {
97
97
  ...blockInfo,
98
98
  duration,
99
99
  requestType: input.type,
100
- missingTxs: [...request.missingTxHashes],
100
+ missingTxs: [...request.missingTxTracker.missingTxHashes],
101
101
  },
102
102
  );
103
- return [...request.foundTxs.values()];
103
+ return request.missingTxTracker.collectedTxs;
104
104
  }
105
105
 
106
106
  protected async collectFast(
@@ -111,7 +111,7 @@ export class FastTxCollection {
111
111
  const { blockInfo } = request;
112
112
 
113
113
  this.log.debug(
114
- `Starting fast collection of ${request.missingTxHashes.size} txs for ${request.type} at slot ${blockInfo.slotNumber}`,
114
+ `Starting fast collection of ${request.missingTxTracker.numberOfMissingTxs} txs for ${request.type} at slot ${blockInfo.slotNumber}`,
115
115
  { ...blockInfo, requestType: request.type, deadline: opts.deadline },
116
116
  );
117
117
 
@@ -124,7 +124,7 @@ export class FastTxCollection {
124
124
  await Promise.race([request.promise.promise, waitBeforeReqResp]);
125
125
 
126
126
  // If we have collected all txs, we can stop here
127
- if (request.missingTxHashes.size === 0) {
127
+ if (request.missingTxTracker.allFetched()) {
128
128
  this.log.debug(`All txs collected for slot ${blockInfo.slotNumber} without reqresp`, blockInfo);
129
129
  return;
130
130
  }
@@ -138,7 +138,7 @@ export class FastTxCollection {
138
138
  const logCtx = {
139
139
  ...blockInfo,
140
140
  errorMessage: err instanceof Error ? err.message : undefined,
141
- missingTxs: [...request.missingTxHashes].map(txHash => txHash.toString()),
141
+ missingTxs: request.missingTxTracker.missingTxHashes.values().map(txHash => txHash.toString()),
142
142
  };
143
143
  if (err instanceof Error && err.name === 'TimeoutError') {
144
144
  this.log.warn(`Timed out collecting txs for ${request.type} at slot ${blockInfo.slotNumber}`, logCtx);
@@ -166,7 +166,11 @@ export class FastTxCollection {
166
166
  }
167
167
 
168
168
  // Keep a shared priority queue of all txs pending to be requested, sorted by the number of attempts made to collect them.
169
- const attemptsPerTx = [...request.missingTxHashes].map(txHash => ({ txHash, attempts: 0, found: false }));
169
+ const attemptsPerTx = [...request.missingTxTracker.missingTxHashes].map(txHash => ({
170
+ txHash,
171
+ attempts: 0,
172
+ found: false,
173
+ }));
170
174
 
171
175
  // Returns once we have finished all node loops. Each loop finishes when the deadline is hit, or all txs have been collected.
172
176
  await Promise.allSettled(this.nodes.map(node => this.collectFastFromNode(request, node, attemptsPerTx, opts)));
@@ -179,7 +183,7 @@ export class FastTxCollection {
179
183
  opts: { deadline: Date },
180
184
  ) {
181
185
  const notFinished = () =>
182
- this.dateProvider.now() <= +opts.deadline && request.missingTxHashes.size > 0 && this.requests.has(request);
186
+ this.dateProvider.now() <= +opts.deadline && !request.missingTxTracker.allFetched() && this.requests.has(request);
183
187
 
184
188
  const maxParallelRequests = this.config.txCollectionFastMaxParallelRequestsPerNode;
185
189
  const maxBatchSize = this.config.txCollectionNodeRpcMaxBatchSize;
@@ -196,7 +200,7 @@ export class FastTxCollection {
196
200
  if (!txToRequest) {
197
201
  // No more txs to process
198
202
  break;
199
- } else if (!request.missingTxHashes.has(txToRequest.txHash)) {
203
+ } else if (!request.missingTxTracker.isMissing(txToRequest.txHash)) {
200
204
  // Mark as found if it was found somewhere else, we'll then remove it from the array.
201
205
  // We don't delete it now since 'array.splice' is pretty expensive, so we do it after sorting.
202
206
  txToRequest.found = true;
@@ -225,10 +229,17 @@ export class FastTxCollection {
225
229
  return;
226
230
  }
227
231
 
232
+ const txHashes = batch.map(({ txHash }) => txHash);
228
233
  // Collect this batch from the node
229
234
  await this.txCollectionSink.collect(
230
- txHashes => node.getTxsByHash(txHashes),
231
- batch.map(({ txHash }) => TxHash.fromString(txHash)),
235
+ async () => {
236
+ const result = await node.getTxsByHash(txHashes.map(TxHash.fromString));
237
+ for (const tx of result.validTxs) {
238
+ request.missingTxTracker.markFetched(tx);
239
+ }
240
+ return result;
241
+ },
242
+ txHashes,
232
243
  {
233
244
  description: `fast ${node.getInfo()}`,
234
245
  node: node.getInfo(),
@@ -268,32 +279,44 @@ export class FastTxCollection {
268
279
  }
269
280
 
270
281
  this.log.debug(
271
- `Starting fast reqresp for ${request.missingTxHashes.size} txs for ${request.type} at slot ${blockInfo.slotNumber}`,
282
+ `Starting fast reqresp for ${request.missingTxTracker.numberOfMissingTxs} txs for ${request.type} at slot ${blockInfo.slotNumber}`,
272
283
  { ...blockInfo, timeoutMs, pinnedPeer },
273
284
  );
274
285
 
275
286
  try {
276
287
  await this.txCollectionSink.collect(
277
- async txHashes => {
288
+ async () => {
289
+ let result: Tx[];
278
290
  if (request.type === 'proposal') {
279
- return await this.missingTxsCollector.collectTxs(txHashes, request.blockProposal, pinnedPeer, timeoutMs);
291
+ result = await this.missingTxsCollector.collectTxs(
292
+ request.missingTxTracker,
293
+ request.blockProposal,
294
+ pinnedPeer,
295
+ timeoutMs,
296
+ );
280
297
  } else if (request.type === 'block') {
281
298
  const blockTxsSource = {
282
299
  txHashes: request.block.body.txEffects.map(e => e.txHash),
283
300
  archive: request.block.archive.root,
284
301
  };
285
- return await this.missingTxsCollector.collectTxs(txHashes, blockTxsSource, pinnedPeer, timeoutMs);
302
+ result = await this.missingTxsCollector.collectTxs(
303
+ request.missingTxTracker,
304
+ blockTxsSource,
305
+ pinnedPeer,
306
+ timeoutMs,
307
+ );
286
308
  } else {
287
309
  throw new Error(`Unknown request type: ${(request as any).type}`);
288
310
  }
311
+ return { validTxs: result, invalidTxHashes: [] };
289
312
  },
290
- Array.from(request.missingTxHashes).map(txHash => TxHash.fromString(txHash)),
313
+ Array.from(request.missingTxTracker.missingTxHashes),
291
314
  { description: `reqresp for slot ${slotNumber}`, method: 'fast-req-resp', ...opts, ...request.blockInfo },
292
315
  this.getAddContext(request),
293
316
  );
294
317
  } catch (err) {
295
318
  this.log.error(`Error sending fast reqresp request for txs`, err, {
296
- txs: [...request.missingTxHashes],
319
+ txs: [...request.missingTxTracker.missingTxHashes],
297
320
  ...blockInfo,
298
321
  });
299
322
  }
@@ -317,22 +340,20 @@ export class FastTxCollection {
317
340
  for (const tx of txs) {
318
341
  const txHash = tx.txHash.toString();
319
342
  // Remove the tx hash from the missing set, and add it to the found set.
320
- if (request.missingTxHashes.has(txHash)) {
321
- request.missingTxHashes.delete(txHash);
322
- request.foundTxs.set(txHash, tx);
343
+ if (request.missingTxTracker.markFetched(tx)) {
323
344
  this.log.trace(`Found tx ${txHash} for fast collection request`, {
324
345
  ...request.blockInfo,
325
346
  txHash: tx.txHash.toString(),
326
347
  type: request.type,
327
348
  });
328
- // If we found all txs for this request, we resolve the promise
329
- if (request.missingTxHashes.size === 0) {
330
- this.log.trace(`All txs found for fast collection request`, {
331
- ...request.blockInfo,
332
- type: request.type,
333
- });
334
- request.promise.resolve();
335
- }
349
+ }
350
+ // If we found all txs for this request, we resolve the promise
351
+ if (request.missingTxTracker.allFetched()) {
352
+ this.log.trace(`All txs found for fast collection request`, {
353
+ ...request.blockInfo,
354
+ type: request.type,
355
+ });
356
+ request.promise.resolve();
336
357
  }
337
358
  }
338
359
  }
@@ -126,9 +126,13 @@ export class FileStoreTxCollection {
126
126
 
127
127
  try {
128
128
  const result = await this.txCollectionSink.collect(
129
- hashes => source.getTxsByHash(hashes),
130
- [TxHash.fromString(entry.txHash)],
131
- { description: `file-store ${source.getInfo()}`, method: 'file-store', fileStore: source.getInfo() },
129
+ () => source.getTxsByHash([TxHash.fromString(entry.txHash)]),
130
+ [entry.txHash],
131
+ {
132
+ description: `file-store ${source.getInfo()}`,
133
+ method: 'file-store',
134
+ fileStore: source.getInfo(),
135
+ },
132
136
  entry.context,
133
137
  );
134
138
  if (result.txs.length > 0) {
@@ -1,28 +1,51 @@
1
1
  import { type Logger, createLogger } from '@aztec/foundation/log';
2
+ import { Timer } from '@aztec/foundation/timer';
2
3
  import { type ReadOnlyFileStore, createReadOnlyFileStore } from '@aztec/stdlib/file-store';
3
4
  import { Tx, type TxHash } from '@aztec/stdlib/tx';
5
+ import {
6
+ type Histogram,
7
+ Metrics,
8
+ type TelemetryClient,
9
+ type UpDownCounter,
10
+ getTelemetryClient,
11
+ } from '@aztec/telemetry-client';
4
12
 
5
- import type { TxSource } from './tx_source.js';
13
+ import type { TxSource, TxSourceCollectionResult } from './tx_source.js';
6
14
 
7
15
  /** TxSource implementation that downloads txs from a file store. */
8
16
  export class FileStoreTxSource implements TxSource {
17
+ private downloadsSuccess: UpDownCounter;
18
+ private downloadsFailed: UpDownCounter;
19
+ private downloadDuration: Histogram;
20
+ private downloadSize: Histogram;
21
+
9
22
  private constructor(
10
23
  private readonly fileStore: ReadOnlyFileStore,
11
24
  private readonly baseUrl: string,
12
25
  private readonly basePath: string,
13
26
  private readonly log: Logger,
14
- ) {}
27
+ telemetry: TelemetryClient,
28
+ ) {
29
+ const meter = telemetry.getMeter('file-store-tx-source');
30
+ this.downloadsSuccess = meter.createUpDownCounter(Metrics.TX_FILE_STORE_DOWNLOADS_SUCCESS);
31
+ this.downloadsFailed = meter.createUpDownCounter(Metrics.TX_FILE_STORE_DOWNLOADS_FAILED);
32
+ this.downloadDuration = meter.createHistogram(Metrics.TX_FILE_STORE_DOWNLOAD_DURATION);
33
+ this.downloadSize = meter.createHistogram(Metrics.TX_FILE_STORE_DOWNLOAD_SIZE);
34
+ }
15
35
 
16
36
  /**
17
37
  * Creates a FileStoreTxSource from a URL.
18
38
  * @param url - The file store URL (s3://, gs://, file://, http://, https://).
39
+ * @param basePath - Base path for tx files within the store.
19
40
  * @param log - Optional logger.
41
+ * @param telemetry - Optional telemetry client.
20
42
  * @returns The FileStoreTxSource instance, or undefined if creation fails.
21
43
  */
22
44
  public static async create(
23
45
  url: string,
24
46
  basePath: string,
25
47
  log: Logger = createLogger('p2p:file_store_tx_source'),
48
+ telemetry: TelemetryClient = getTelemetryClient(),
26
49
  ): Promise<FileStoreTxSource | undefined> {
27
50
  try {
28
51
  const fileStore = await createReadOnlyFileStore(url, log);
@@ -30,7 +53,7 @@ export class FileStoreTxSource implements TxSource {
30
53
  log.warn(`Failed to create file store for URL: ${url}`);
31
54
  return undefined;
32
55
  }
33
- return new FileStoreTxSource(fileStore, url, basePath, log);
56
+ return new FileStoreTxSource(fileStore, url, basePath, log, telemetry);
34
57
  } catch (err) {
35
58
  log.warn(`Error creating file store for URL: ${url}`, { error: err });
36
59
  return undefined;
@@ -41,33 +64,54 @@ export class FileStoreTxSource implements TxSource {
41
64
  return `file-store:${this.baseUrl}`;
42
65
  }
43
66
 
44
- public getTxsByHash(txHashes: TxHash[]): Promise<(Tx | undefined)[]> {
45
- return Promise.all(
46
- txHashes.map(async txHash => {
47
- const path = `${this.basePath}/txs/${txHash.toString()}.bin`;
48
- try {
49
- const buffer = await this.fileStore.read(path);
50
- return Tx.fromBuffer(buffer);
51
- } catch {
52
- // Tx not found or error reading - return undefined
53
- return undefined;
54
- }
55
- }),
56
- );
67
+ public async getTxsByHash(txHashes: TxHash[]): Promise<TxSourceCollectionResult> {
68
+ const invalidTxHashes: string[] = [];
69
+ return {
70
+ validTxs: (
71
+ await Promise.all(
72
+ txHashes.map(async txHash => {
73
+ const path = `${this.basePath}/txs/${txHash.toString()}.bin`;
74
+ const timer = new Timer();
75
+ try {
76
+ const buffer = await this.fileStore.read(path);
77
+ const tx = Tx.fromBuffer(buffer);
78
+ if ((await tx.validateTxHash()) && txHash.equals(tx.txHash)) {
79
+ this.downloadsSuccess.add(1);
80
+ this.downloadDuration.record(Math.ceil(timer.ms()));
81
+ this.downloadSize.record(buffer.length);
82
+ return tx;
83
+ } else {
84
+ invalidTxHashes.push(tx.txHash.toString());
85
+ this.downloadsFailed.add(1);
86
+ return undefined;
87
+ }
88
+ } catch {
89
+ // Tx not found or error reading - return undefined
90
+ this.downloadsFailed.add(1);
91
+ return undefined;
92
+ }
93
+ }),
94
+ )
95
+ ).filter(tx => tx !== undefined),
96
+ invalidTxHashes: invalidTxHashes,
97
+ };
57
98
  }
58
99
  }
59
100
 
60
101
  /**
61
102
  * Creates FileStoreTxSource instances from URLs.
62
103
  * @param urls - Array of file store URLs.
104
+ * @param basePath - Base path for tx files within each store.
63
105
  * @param log - Optional logger.
106
+ * @param telemetry - Optional telemetry client.
64
107
  * @returns Array of successfully created FileStoreTxSource instances.
65
108
  */
66
109
  export async function createFileStoreTxSources(
67
110
  urls: string[],
68
111
  basePath: string,
69
112
  log: Logger = createLogger('p2p:file_store_tx_source'),
113
+ telemetry: TelemetryClient = getTelemetryClient(),
70
114
  ): Promise<FileStoreTxSource[]> {
71
- const sources = await Promise.all(urls.map(url => FileStoreTxSource.create(url, basePath, log)));
115
+ const sources = await Promise.all(urls.map(url => FileStoreTxSource.create(url, basePath, log, telemetry)));
72
116
  return sources.filter((s): s is FileStoreTxSource => s !== undefined);
73
117
  }
@@ -18,7 +18,13 @@ export class TxCollectionInstrumentation {
18
18
  const meter = client.getMeter(name);
19
19
 
20
20
  this.txsCollected = createUpDownCounterWithDefault(meter, Metrics.TX_COLLECTOR_COUNT, {
21
- [Attributes.TX_COLLECTION_METHOD]: ['fast-req-resp', 'fast-node-rpc', 'slow-req-resp', 'slow-node-rpc'],
21
+ [Attributes.TX_COLLECTION_METHOD]: [
22
+ 'fast-req-resp',
23
+ 'fast-node-rpc',
24
+ 'slow-req-resp',
25
+ 'slow-node-rpc',
26
+ 'file-store',
27
+ ],
22
28
  });
23
29
 
24
30
  this.collectionDurationPerTx = meter.createHistogram(Metrics.TX_COLLECTOR_DURATION_PER_TX);
@@ -0,0 +1,52 @@
1
+ import { TxHash } from '@aztec/stdlib/tx';
2
+ import type { Tx } from '@aztec/stdlib/tx';
3
+
4
+ /**
5
+ * Tracks which transactions are still missing and need to be fetched.
6
+ * Allows external code to mark transactions as fetched, enabling coordination
7
+ * between multiple fetching mechanisms (e.g., BatchTxRequester and Rpc Node requests).
8
+ */
9
+ export interface IMissingTxsTracker {
10
+ /** Returns the set of transaction hashes that are still missing. */
11
+ get missingTxHashes(): Set<string>;
12
+ /** Size of this.missingTxHashes */
13
+ get numberOfMissingTxs(): number;
14
+ /** Are all requested txs are fetched */
15
+ allFetched(): boolean;
16
+ /** Checks that transaction is still missing */
17
+ isMissing(txHash: string): boolean;
18
+ /** Marks a transaction as fetched. Returns true if it was previously missing. */
19
+ markFetched(tx: Tx): boolean;
20
+ /** Get list of collected txs */
21
+ get collectedTxs(): Tx[];
22
+ }
23
+
24
+ export class MissingTxsTracker implements IMissingTxsTracker {
25
+ public readonly collectedTxs: Tx[] = [];
26
+
27
+ private constructor(public readonly missingTxHashes: Set<string>) {}
28
+
29
+ public static fromArray(hashes: TxHash[] | string[]) {
30
+ return new MissingTxsTracker(new Set(hashes.map(hash => hash.toString())));
31
+ }
32
+
33
+ markFetched(tx: Tx): boolean {
34
+ if (this.missingTxHashes.delete(tx.txHash.toString())) {
35
+ this.collectedTxs.push(tx);
36
+ return true;
37
+ }
38
+ return false;
39
+ }
40
+
41
+ get numberOfMissingTxs(): number {
42
+ return this.missingTxHashes.size;
43
+ }
44
+
45
+ allFetched(): boolean {
46
+ return this.numberOfMissingTxs === 0;
47
+ }
48
+
49
+ isMissing(txHash: string): boolean {
50
+ return this.missingTxHashes.has(txHash.toString());
51
+ }
52
+ }
@@ -1,6 +1,6 @@
1
1
  import type { Logger } from '@aztec/foundation/log';
2
2
  import type { DateProvider } from '@aztec/foundation/timer';
3
- import type { Tx, TxHash } from '@aztec/stdlib/tx';
3
+ import { type Tx, TxHash } from '@aztec/stdlib/tx';
4
4
 
5
5
  import type { PeerId } from '@libp2p/interface';
6
6
 
@@ -9,6 +9,7 @@ import type { BatchTxRequesterConfig } from '../reqresp/batch-tx-requester/confi
9
9
  import type { BatchTxRequesterLibP2PService } from '../reqresp/batch-tx-requester/interface.js';
10
10
  import type { IBatchRequestTxValidator } from '../reqresp/batch-tx-requester/tx_validator.js';
11
11
  import { type BlockTxsSource, ReqRespSubProtocol, chunkTxHashesRequest } from '../reqresp/index.js';
12
+ import type { IMissingTxsTracker } from './missing_txs_tracker.js';
12
13
 
13
14
  /**
14
15
  * Strategy interface for collecting missing transactions for a block or proposal.
@@ -17,14 +18,14 @@ import { type BlockTxsSource, ReqRespSubProtocol, chunkTxHashesRequest } from '.
17
18
  export interface MissingTxsCollector {
18
19
  /**
19
20
  * Collect missing transactions for a block or proposal.
20
- * @param txHashes - The transaction hashes to collect
21
+ * @param missingTxsTracker - The missing transactions tracker
21
22
  * @param blockTxsSource - The block or proposal containing the transactions
22
23
  * @param pinnedPeer - Optional peer expected to have the transactions
23
24
  * @param timeoutMs - Timeout in milliseconds
24
25
  * @returns The collected transactions
25
26
  */
26
27
  collectTxs(
27
- txHashes: TxHash[],
28
+ missingTxsTracker: IMissingTxsTracker,
28
29
  blockTxsSource: BlockTxsSource,
29
30
  pinnedPeer: PeerId | undefined,
30
31
  timeoutMs: number,
@@ -45,7 +46,7 @@ export class BatchTxRequesterCollector implements MissingTxsCollector {
45
46
  ) {}
46
47
 
47
48
  async collectTxs(
48
- txHashes: TxHash[],
49
+ missingTxsTracker: IMissingTxsTracker,
49
50
  blockTxsSource: BlockTxsSource,
50
51
  pinnedPeer: PeerId | undefined,
51
52
  timeoutMs: number,
@@ -58,7 +59,7 @@ export class BatchTxRequesterCollector implements MissingTxsCollector {
58
59
  } = this.batchTxRequesterConfig ?? {};
59
60
 
60
61
  const batchRequester = new BatchTxRequester(
61
- txHashes,
62
+ missingTxsTracker,
62
63
  blockTxsSource,
63
64
  pinnedPeer,
64
65
  timeoutMs,
@@ -93,14 +94,14 @@ export class SendBatchRequestCollector implements MissingTxsCollector {
93
94
  ) {}
94
95
 
95
96
  async collectTxs(
96
- txHashes: TxHash[],
97
+ missingTxsTracker: IMissingTxsTracker,
97
98
  _blockTxsSource: BlockTxsSource,
98
99
  pinnedPeer: PeerId | undefined,
99
100
  timeoutMs: number,
100
101
  ): Promise<Tx[]> {
101
102
  const txs = await this.p2pService.reqResp.sendBatchRequest<ReqRespSubProtocol.TX>(
102
103
  ReqRespSubProtocol.TX,
103
- chunkTxHashesRequest(txHashes),
104
+ chunkTxHashesRequest(Array.from(missingTxsTracker.missingTxHashes).map(TxHash.fromString)),
104
105
  pinnedPeer,
105
106
  timeoutMs,
106
107
  this.maxPeers,