@aztec/p2p 1.0.0-nightly.20250708 → 1.0.0-staging.0

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 (157) hide show
  1. package/dest/bootstrap/bootstrap.js +1 -1
  2. package/dest/client/factory.d.ts +1 -5
  3. package/dest/client/factory.d.ts.map +1 -1
  4. package/dest/client/factory.js +13 -30
  5. package/dest/client/interface.d.ts +11 -0
  6. package/dest/client/interface.d.ts.map +1 -1
  7. package/dest/client/p2p_client.d.ts +20 -10
  8. package/dest/client/p2p_client.d.ts.map +1 -1
  9. package/dest/client/p2p_client.js +53 -51
  10. package/dest/config.d.ts +3 -14
  11. package/dest/config.d.ts.map +1 -1
  12. package/dest/config.js +1 -3
  13. package/dest/mem_pools/attestation_pool/attestation_pool_test_suite.d.ts.map +1 -1
  14. package/dest/mem_pools/attestation_pool/attestation_pool_test_suite.js +11 -1
  15. package/dest/mem_pools/attestation_pool/mocks.d.ts +2 -1
  16. package/dest/mem_pools/attestation_pool/mocks.d.ts.map +1 -1
  17. package/dest/mem_pools/attestation_pool/mocks.js +10 -2
  18. package/dest/mem_pools/tx_pool/aztec_kv_tx_pool.d.ts +7 -19
  19. package/dest/mem_pools/tx_pool/aztec_kv_tx_pool.d.ts.map +1 -1
  20. package/dest/mem_pools/tx_pool/aztec_kv_tx_pool.js +40 -74
  21. package/dest/mem_pools/tx_pool/memory_tx_pool.d.ts +5 -10
  22. package/dest/mem_pools/tx_pool/memory_tx_pool.d.ts.map +1 -1
  23. package/dest/mem_pools/tx_pool/memory_tx_pool.js +10 -18
  24. package/dest/mem_pools/tx_pool/tx_pool.d.ts +4 -14
  25. package/dest/mem_pools/tx_pool/tx_pool.d.ts.map +1 -1
  26. package/dest/mem_pools/tx_pool/tx_pool_test_suite.d.ts.map +1 -1
  27. package/dest/mem_pools/tx_pool/tx_pool_test_suite.js +14 -50
  28. package/dest/msg_validators/attestation_validator/attestation_validator.js +1 -1
  29. package/dest/msg_validators/tx_validator/factory.d.ts +1 -2
  30. package/dest/msg_validators/tx_validator/factory.d.ts.map +1 -1
  31. package/dest/msg_validators/tx_validator/factory.js +2 -3
  32. package/dest/msg_validators/tx_validator/metadata_validator.d.ts +0 -2
  33. package/dest/msg_validators/tx_validator/metadata_validator.d.ts.map +1 -1
  34. package/dest/msg_validators/tx_validator/metadata_validator.js +7 -13
  35. package/dest/msg_validators/tx_validator/phases_validator.d.ts +2 -3
  36. package/dest/msg_validators/tx_validator/phases_validator.d.ts.map +1 -1
  37. package/dest/msg_validators/tx_validator/phases_validator.js +4 -4
  38. package/dest/services/index.d.ts +1 -2
  39. package/dest/services/index.d.ts.map +1 -1
  40. package/dest/services/index.js +1 -2
  41. package/dest/services/libp2p/instrumentation.d.ts +1 -8
  42. package/dest/services/libp2p/instrumentation.d.ts.map +1 -1
  43. package/dest/services/libp2p/instrumentation.js +2 -130
  44. package/dest/services/libp2p/libp2p_service.d.ts +14 -8
  45. package/dest/services/libp2p/libp2p_service.d.ts.map +1 -1
  46. package/dest/services/libp2p/libp2p_service.js +27 -35
  47. package/dest/services/peer-manager/peer_manager.d.ts.map +1 -1
  48. package/dest/services/peer-manager/peer_manager.js +7 -12
  49. package/dest/services/reqresp/connection-sampler/connection_sampler.d.ts +1 -1
  50. package/dest/services/reqresp/connection-sampler/connection_sampler.d.ts.map +1 -1
  51. package/dest/services/reqresp/connection-sampler/connection_sampler.js +38 -26
  52. package/dest/services/reqresp/interface.d.ts +7 -35
  53. package/dest/services/reqresp/interface.d.ts.map +1 -1
  54. package/dest/services/reqresp/interface.js +0 -11
  55. package/dest/services/reqresp/protocols/block.d.ts +0 -5
  56. package/dest/services/reqresp/protocols/block.d.ts.map +1 -1
  57. package/dest/services/reqresp/protocols/block.js +5 -28
  58. package/dest/services/reqresp/protocols/goodbye.js +5 -3
  59. package/dest/services/reqresp/protocols/tx.d.ts +1 -1
  60. package/dest/services/reqresp/protocols/tx.d.ts.map +1 -1
  61. package/dest/services/reqresp/protocols/tx.js +5 -20
  62. package/dest/services/reqresp/reqresp.d.ts +32 -20
  63. package/dest/services/reqresp/reqresp.d.ts.map +1 -1
  64. package/dest/services/reqresp/reqresp.js +151 -114
  65. package/dest/services/reqresp/status.d.ts +3 -7
  66. package/dest/services/reqresp/status.d.ts.map +1 -1
  67. package/dest/services/reqresp/status.js +2 -5
  68. package/dest/services/service.d.ts +8 -0
  69. package/dest/services/service.d.ts.map +1 -1
  70. package/dest/services/{tx_provider_instrumentation.d.ts → tx_collect_instrumentation.d.ts} +2 -2
  71. package/dest/services/tx_collect_instrumentation.d.ts.map +1 -0
  72. package/dest/services/{tx_provider_instrumentation.js → tx_collect_instrumentation.js} +5 -5
  73. package/dest/services/tx_collector.d.ts +23 -0
  74. package/dest/services/tx_collector.d.ts.map +1 -0
  75. package/dest/services/tx_collector.js +95 -0
  76. package/dest/test-helpers/make-test-p2p-clients.d.ts.map +1 -1
  77. package/dest/test-helpers/make-test-p2p-clients.js +2 -3
  78. package/dest/test-helpers/reqresp-nodes.d.ts.map +1 -1
  79. package/dest/test-helpers/reqresp-nodes.js +2 -3
  80. package/dest/testbench/p2p_client_testbench_worker.js +3 -12
  81. package/dest/testbench/worker_client_manager.d.ts.map +1 -1
  82. package/dest/testbench/worker_client_manager.js +1 -2
  83. package/dest/util.d.ts +2 -3
  84. package/dest/util.d.ts.map +1 -1
  85. package/dest/util.js +5 -6
  86. package/package.json +15 -14
  87. package/src/bootstrap/bootstrap.ts +1 -1
  88. package/src/client/factory.ts +13 -88
  89. package/src/client/interface.ts +13 -0
  90. package/src/client/p2p_client.ts +58 -57
  91. package/src/config.ts +2 -5
  92. package/src/mem_pools/attestation_pool/attestation_pool_test_suite.ts +4 -1
  93. package/src/mem_pools/attestation_pool/mocks.ts +3 -1
  94. package/src/mem_pools/tx_pool/aztec_kv_tx_pool.ts +47 -76
  95. package/src/mem_pools/tx_pool/memory_tx_pool.ts +10 -20
  96. package/src/mem_pools/tx_pool/tx_pool.ts +4 -10
  97. package/src/mem_pools/tx_pool/tx_pool_test_suite.ts +15 -42
  98. package/src/msg_validators/attestation_validator/attestation_validator.ts +1 -1
  99. package/src/msg_validators/tx_validator/factory.ts +1 -4
  100. package/src/msg_validators/tx_validator/metadata_validator.ts +9 -20
  101. package/src/msg_validators/tx_validator/phases_validator.ts +2 -3
  102. package/src/services/index.ts +1 -2
  103. package/src/services/libp2p/instrumentation.ts +3 -122
  104. package/src/services/libp2p/libp2p_service.ts +33 -42
  105. package/src/services/peer-manager/peer_manager.ts +7 -8
  106. package/src/services/reqresp/connection-sampler/connection_sampler.ts +41 -24
  107. package/src/services/reqresp/interface.ts +11 -26
  108. package/src/services/reqresp/protocols/block.ts +3 -24
  109. package/src/services/reqresp/protocols/goodbye.ts +3 -3
  110. package/src/services/reqresp/protocols/tx.ts +5 -17
  111. package/src/services/reqresp/reqresp.ts +178 -138
  112. package/src/services/reqresp/status.ts +3 -8
  113. package/src/services/service.ts +12 -0
  114. package/src/services/{tx_provider_instrumentation.ts → tx_collect_instrumentation.ts} +5 -5
  115. package/src/services/tx_collector.ts +134 -0
  116. package/src/test-helpers/make-test-p2p-clients.ts +1 -3
  117. package/src/test-helpers/reqresp-nodes.ts +2 -3
  118. package/src/testbench/p2p_client_testbench_worker.ts +1 -6
  119. package/src/testbench/worker_client_manager.ts +1 -2
  120. package/src/util.ts +7 -8
  121. package/dest/services/tx_collection/config.d.ts +0 -25
  122. package/dest/services/tx_collection/config.d.ts.map +0 -1
  123. package/dest/services/tx_collection/config.js +0 -58
  124. package/dest/services/tx_collection/fast_tx_collection.d.ts +0 -57
  125. package/dest/services/tx_collection/fast_tx_collection.d.ts.map +0 -1
  126. package/dest/services/tx_collection/fast_tx_collection.js +0 -290
  127. package/dest/services/tx_collection/index.d.ts +0 -3
  128. package/dest/services/tx_collection/index.d.ts.map +0 -1
  129. package/dest/services/tx_collection/index.js +0 -2
  130. package/dest/services/tx_collection/instrumentation.d.ts +0 -10
  131. package/dest/services/tx_collection/instrumentation.d.ts.map +0 -1
  132. package/dest/services/tx_collection/instrumentation.js +0 -34
  133. package/dest/services/tx_collection/slow_tx_collection.d.ts +0 -54
  134. package/dest/services/tx_collection/slow_tx_collection.d.ts.map +0 -1
  135. package/dest/services/tx_collection/slow_tx_collection.js +0 -172
  136. package/dest/services/tx_collection/tx_collection.d.ts +0 -109
  137. package/dest/services/tx_collection/tx_collection.d.ts.map +0 -1
  138. package/dest/services/tx_collection/tx_collection.js +0 -128
  139. package/dest/services/tx_collection/tx_collection_sink.d.ts +0 -30
  140. package/dest/services/tx_collection/tx_collection_sink.d.ts.map +0 -1
  141. package/dest/services/tx_collection/tx_collection_sink.js +0 -82
  142. package/dest/services/tx_collection/tx_source.d.ts +0 -18
  143. package/dest/services/tx_collection/tx_source.d.ts.map +0 -1
  144. package/dest/services/tx_collection/tx_source.js +0 -31
  145. package/dest/services/tx_provider.d.ts +0 -49
  146. package/dest/services/tx_provider.d.ts.map +0 -1
  147. package/dest/services/tx_provider.js +0 -206
  148. package/dest/services/tx_provider_instrumentation.d.ts.map +0 -1
  149. package/src/services/tx_collection/config.ts +0 -84
  150. package/src/services/tx_collection/fast_tx_collection.ts +0 -335
  151. package/src/services/tx_collection/index.ts +0 -2
  152. package/src/services/tx_collection/instrumentation.ts +0 -43
  153. package/src/services/tx_collection/slow_tx_collection.ts +0 -229
  154. package/src/services/tx_collection/tx_collection.ts +0 -214
  155. package/src/services/tx_collection/tx_collection_sink.ts +0 -93
  156. package/src/services/tx_collection/tx_source.ts +0 -37
  157. package/src/services/tx_provider.ts +0 -225
@@ -33,7 +33,7 @@ import { convertToMultiaddr, getPeerIdPrivateKey } from '../util.js';
33
33
  }
34
34
  const listenAddrUdp = multiaddr(convertToMultiaddr(listenAddress, config.p2pBroadcastPort, 'udp'));
35
35
  const peerIdPrivateKey = await getPeerIdPrivateKey(config, this.store, this.logger);
36
- const { enr: ourEnr, peerId } = await createBootnodeENRandPeerId(peerIdPrivateKey.getValue(), p2pIp, config.p2pBroadcastPort, config.l1ChainId);
36
+ const { enr: ourEnr, peerId } = await createBootnodeENRandPeerId(peerIdPrivateKey, p2pIp, config.p2pBroadcastPort, config.l1ChainId);
37
37
  this.peerId = peerId;
38
38
  this.logger.debug(`Starting bootstrap node ${peerId} listening on ${listenAddrUdp.toString()}`);
39
39
  const metricsRegistry = new OtelMetricsAdapter(this.telemetry);
@@ -1,10 +1,8 @@
1
1
  import type { EpochCacheInterface } from '@aztec/epoch-cache';
2
2
  import { type Logger } from '@aztec/foundation/log';
3
- import { DateProvider } from '@aztec/foundation/timer';
4
3
  import type { AztecAsyncKVStore } from '@aztec/kv-store';
5
4
  import type { DataStoreConfig } from '@aztec/kv-store/config';
6
5
  import type { L2BlockSource } from '@aztec/stdlib/block';
7
- import type { ChainConfig } from '@aztec/stdlib/config';
8
6
  import type { ContractDataSource } from '@aztec/stdlib/contract';
9
7
  import type { ClientProtocolCircuitVerifier, WorldStateSynchronizer } from '@aztec/stdlib/interfaces/server';
10
8
  import { P2PClientType } from '@aztec/stdlib/p2p';
@@ -14,17 +12,15 @@ import type { P2PConfig } from '../config.js';
14
12
  import type { AttestationPool } from '../mem_pools/attestation_pool/attestation_pool.js';
15
13
  import { type TxPool } from '../mem_pools/tx_pool/index.js';
16
14
  import { LibP2PService } from '../services/index.js';
17
- import { type TxSource } from '../services/tx_collection/tx_source.js';
18
15
  export type P2PClientDeps<T extends P2PClientType> = {
19
16
  txPool?: TxPool;
20
17
  store?: AztecAsyncKVStore;
21
18
  attestationPool?: T extends P2PClientType.Full ? AttestationPool : undefined;
22
19
  logger?: Logger;
23
- txCollectionNodeSources?: TxSource[];
24
20
  p2pServiceFactory?: (...args: Parameters<(typeof LibP2PService)['new']>) => Promise<LibP2PService<T>>;
25
21
  };
26
22
  export declare const P2P_STORE_NAME = "p2p";
27
23
  export declare const P2P_ARCHIVE_STORE_NAME = "p2p-archive";
28
24
  export declare const P2P_PEER_STORE_NAME = "p2p-peers";
29
- export declare function createP2PClient<T extends P2PClientType>(clientType: T, inputConfig: P2PConfig & DataStoreConfig & ChainConfig, archiver: L2BlockSource & ContractDataSource, proofVerifier: ClientProtocolCircuitVerifier, worldStateSynchronizer: WorldStateSynchronizer, epochCache: EpochCacheInterface, packageVersion: string, dateProvider?: DateProvider, telemetry?: TelemetryClient, deps?: P2PClientDeps<T>): Promise<P2PClient<T>>;
25
+ export declare const createP2PClient: <T extends P2PClientType>(clientType: T, _config: P2PConfig & DataStoreConfig, archiver: L2BlockSource & ContractDataSource, proofVerifier: ClientProtocolCircuitVerifier, worldStateSynchronizer: WorldStateSynchronizer, epochCache: EpochCacheInterface, packageVersion: string, telemetry?: TelemetryClient, deps?: P2PClientDeps<T>) => Promise<P2PClient<T>>;
30
26
  //# sourceMappingURL=factory.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"factory.d.ts","sourceRoot":"","sources":["../../src/client/factory.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AAC9D,OAAO,EAAE,KAAK,MAAM,EAAgB,MAAM,uBAAuB,CAAC;AAClE,OAAO,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AACvD,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AACzD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAE9D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACzD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AACxD,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AACjE,OAAO,KAAK,EAAE,6BAA6B,EAAE,sBAAsB,EAAE,MAAM,iCAAiC,CAAC;AAC7G,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAClD,OAAO,EAAE,KAAK,eAAe,EAAsB,MAAM,yBAAyB,CAAC;AAEnF,OAAO,EAAE,SAAS,EAAE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AAC,OAAO,aAAa,CAAC,CAAC,KAAK,CAAC,CAAC,KAAK,OAAO,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC,CAAC;CACvG,CAAC;AAEF,eAAO,MAAM,cAAc,QAAQ,CAAC;AACpC,eAAO,MAAM,sBAAsB,gBAAgB,CAAC;AACpD,eAAO,MAAM,mBAAmB,cAAc,CAAC;AAE/C,eAAO,MAAM,eAAe,GAAU,CAAC,SAAS,aAAa,EAC3D,YAAY,CAAC,EACb,SAAS,SAAS,GAAG,eAAe,EACpC,UAAU,aAAa,GAAG,kBAAkB,EAC5C,eAAe,6BAA6B,EAC5C,wBAAwB,sBAAsB,EAC9C,YAAY,mBAAmB,EAC/B,gBAAgB,MAAM,EACtB,YAAW,eAAsC,EACjD,OAAM,aAAa,CAAC,CAAC,CAAM,0BAgD5B,CAAC"}
@@ -1,5 +1,4 @@
1
1
  import { createLogger } from '@aztec/foundation/log';
2
- import { DateProvider } from '@aztec/foundation/timer';
3
2
  import { createStore } from '@aztec/kv-store/lmdb-v2';
4
3
  import { P2PClientType } from '@aztec/stdlib/p2p';
5
4
  import { getTelemetryClient } from '@aztec/telemetry-client';
@@ -8,22 +7,19 @@ import { InMemoryAttestationPool } from '../mem_pools/attestation_pool/memory_at
8
7
  import { AztecKVTxPool } from '../mem_pools/tx_pool/index.js';
9
8
  import { DummyP2PService } from '../services/dummy_service.js';
10
9
  import { LibP2PService } from '../services/index.js';
11
- import { TxCollection } from '../services/tx_collection/tx_collection.js';
12
- import { createNodeRpcTxSources } from '../services/tx_collection/tx_source.js';
13
10
  import { configureP2PClientAddresses, createLibP2PPeerIdFromPrivateKey, getPeerIdPrivateKey } from '../util.js';
14
11
  export const P2P_STORE_NAME = 'p2p';
15
12
  export const P2P_ARCHIVE_STORE_NAME = 'p2p-archive';
16
13
  export const P2P_PEER_STORE_NAME = 'p2p-peers';
17
- export async function createP2PClient(clientType, inputConfig, archiver, proofVerifier, worldStateSynchronizer, epochCache, packageVersion, dateProvider = new DateProvider(), telemetry = getTelemetryClient(), deps = {}) {
18
- const config = await configureP2PClientAddresses({
19
- ...inputConfig,
20
- dataStoreMapSizeKB: inputConfig.p2pStoreMapSizeKb ?? inputConfig.dataStoreMapSizeKB
21
- });
14
+ export const createP2PClient = async (clientType, _config, archiver, proofVerifier, worldStateSynchronizer, epochCache, packageVersion, telemetry = getTelemetryClient(), deps = {})=>{
15
+ let config = {
16
+ ..._config,
17
+ dataStoreMapSizeKB: _config.p2pStoreMapSizeKb ?? _config.dataStoreMapSizeKB
18
+ };
22
19
  const logger = deps.logger ?? createLogger('p2p');
23
20
  const store = deps.store ?? await createStore(P2P_STORE_NAME, 2, config, createLogger('p2p:lmdb-v2'));
24
21
  const archive = await createStore(P2P_ARCHIVE_STORE_NAME, 1, config, createLogger('p2p-archive:lmdb-v2'));
25
22
  const peerStore = await createStore(P2P_PEER_STORE_NAME, 1, config, createLogger('p2p-peer:lmdb-v2'));
26
- const l1Constants = await archiver.getL1Constants();
27
23
  const mempools = {
28
24
  txPool: deps.txPool ?? new AztecKVTxPool(store, archive, worldStateSynchronizer, telemetry, {
29
25
  maxTxPoolSize: config.maxTxPoolSize,
@@ -31,29 +27,16 @@ export async function createP2PClient(clientType, inputConfig, archiver, proofVe
31
27
  }),
32
28
  attestationPool: clientType === P2PClientType.Full ? deps.attestationPool ?? new InMemoryAttestationPool(telemetry) : undefined
33
29
  };
34
- const p2pService = await createP2PService(config, clientType, archiver, proofVerifier, worldStateSynchronizer, epochCache, store, peerStore, mempools, deps.p2pServiceFactory, packageVersion, logger.createChild('libp2p_service'), telemetry);
35
- const nodeSources = [
36
- ...createNodeRpcTxSources(config.txCollectionNodeRpcUrls, config),
37
- ...deps.txCollectionNodeSources ?? []
38
- ];
39
- if (nodeSources.length > 0) {
40
- logger.info(`Using ${nodeSources.length} node RPC sources for tx collection.`, {
41
- nodes: nodeSources.map((n)=>n.getInfo())
42
- });
43
- }
44
- const txCollection = new TxCollection(p2pService, nodeSources, l1Constants, mempools.txPool, config, dateProvider, telemetry, logger.createChild('tx-collection'));
45
- return new P2PClient(clientType, store, archiver, mempools, p2pService, txCollection, config, dateProvider, telemetry);
46
- }
47
- async function createP2PService(config, clientType, archiver, proofVerifier, worldStateSynchronizer, epochCache, store, peerStore, mempools, p2pServiceFactory, packageVersion, logger, telemetry) {
48
- if (!config.p2pEnabled) {
30
+ if (!_config.p2pEnabled) {
49
31
  logger.verbose('P2P is disabled. Using dummy P2P service.');
50
- return new DummyP2PService();
32
+ return new P2PClient(clientType, store, archiver, mempools, new DummyP2PService(), config, telemetry);
51
33
  }
52
34
  logger.verbose('P2P is enabled. Using LibP2P service.');
35
+ config = await configureP2PClientAddresses(_config);
53
36
  // Create peer discovery service
54
37
  const peerIdPrivateKey = await getPeerIdPrivateKey(config, store, logger);
55
- const peerId = await createLibP2PPeerIdFromPrivateKey(peerIdPrivateKey.getValue());
56
- const p2pService = await (p2pServiceFactory ?? LibP2PService.new)(clientType, config, peerId, {
38
+ const peerId = await createLibP2PPeerIdFromPrivateKey(peerIdPrivateKey);
39
+ const p2pService = await (deps.p2pServiceFactory ?? LibP2PService.new)(clientType, config, peerId, {
57
40
  packageVersion,
58
41
  mempools,
59
42
  l2BlockSource: archiver,
@@ -62,7 +45,7 @@ async function createP2PService(config, clientType, archiver, proofVerifier, wor
62
45
  worldStateSynchronizer,
63
46
  peerStore,
64
47
  telemetry,
65
- logger: logger.createChild(`libp2p_service`)
48
+ logger: createLogger(`${logger.module}:libp2p_service`)
66
49
  });
67
- return p2pService;
68
- }
50
+ return new P2PClient(clientType, store, archiver, mempools, p2pService, config, telemetry);
51
+ };
@@ -52,6 +52,11 @@ export type P2P<T extends P2PClientType = P2PClientType.Full> = P2PApiFull<T> &
52
52
  * @returns A list of transactions or undefined if the transactions are not found.
53
53
  */
54
54
  requestTxsByHash(txHashes: TxHash[], pinnedPeerId: PeerId): Promise<(Tx | undefined)[]>;
55
+ /**
56
+ * Request a transaction from another peer by its tx hash.
57
+ * @param txHash - Hash of the tx to query.
58
+ */
59
+ requestTxByHash(txHash: TxHash): Promise<Tx | undefined>;
55
60
  /**
56
61
  * Verifies the 'tx' and, if valid, adds it to local tx pool and forwards it to other peers.
57
62
  * @param tx - The transaction.
@@ -87,6 +92,12 @@ export type P2P<T extends P2PClientType = P2PClientType.Full> = P2PApiFull<T> &
87
92
  * @returns True or False for each hash
88
93
  */
89
94
  hasTxsInPool(txHashes: TxHash[]): Promise<boolean[]>;
95
+ /**
96
+ * Returns a transaction in the transaction pool by its hash, requesting it from the network if it is not found.
97
+ * @param txHash - Hash of tx to return.
98
+ * @returns A single tx or undefined.
99
+ */
100
+ getTxByHash(txHash: TxHash): Promise<Tx | undefined>;
90
101
  /**
91
102
  * Returns transactions in the transaction pool by hash, requesting from the network if not found.
92
103
  * @param txHashes - Hashes of tx to return.
@@ -1 +1 @@
1
- {"version":3,"file":"interface.d.ts","sourceRoot":"","sources":["../../src/client/interface.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iCAAiC,CAAC;AAClE,OAAO,KAAK,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AACtE,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAEnD,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,gBAAgB,CAAC;AAC1C,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAEhD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAC9C,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,wBAAwB,CAAC;AAEvE;;GAEG;AACH,oBAAY,cAAc;IACxB,IAAI,IAAA;IACJ,QAAQ,IAAA;IACR,OAAO,IAAA;IACP,OAAO,IAAA;CACR;AAED;;GAEG;AACH,MAAM,WAAW,YAAY;IAC3B;;OAEG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AAM,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAEzD;;;OAGG;IACH,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;IAEvB;;;OAGG;IACH,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;IAEtB;;;OAGG;IACH,OAAO,IAAI,OAAO,CAAC;IAEnB;;OAEG;IACH,SAAS,IAAI,OAAO,CAAC,YAAY,CAAC,CAAC;IAEnC;;OAEG;IACH,MAAM,IAAI,GAAG,GAAG,SAAS,CAAC;IAE1B,+BAA+B;IAC/B,WAAW,IAAI,IAAI,CAAC;IAEpB,eAAe,CAAC,MAAM,EAAE,OAAO,CAAC,SAAS,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAE3D,8BAA8B;IAC9B,QAAQ,CAAC,GAAG,EAAE,EAAE,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAEnC,qBAAqB;IACrB,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;CACxB,CAAC"}
@@ -1,8 +1,7 @@
1
- import { DateProvider } from '@aztec/foundation/timer';
2
1
  import type { AztecAsyncKVStore } from '@aztec/kv-store';
3
2
  import type { L2BlockSource, L2BlockStreamEvent, L2Tips } from '@aztec/stdlib/block';
4
3
  import type { ContractDataSource } from '@aztec/stdlib/contract';
5
- import { type PeerInfo } from '@aztec/stdlib/interfaces/server';
4
+ import type { PeerInfo } from '@aztec/stdlib/interfaces/server';
6
5
  import { BlockAttestation, type BlockProposal, type P2PClientType } from '@aztec/stdlib/p2p';
7
6
  import type { Tx, TxHash } from '@aztec/stdlib/tx';
8
7
  import { type TelemetryClient, WithTracer } from '@aztec/telemetry-client';
@@ -11,8 +10,6 @@ import type { PeerId } from '@libp2p/interface';
11
10
  import { type P2PConfig } from '../config.js';
12
11
  import type { MemPools } from '../mem_pools/interface.js';
13
12
  import type { P2PBlockReceivedCallback, P2PService } from '../services/service.js';
14
- import { TxCollection } from '../services/tx_collection/tx_collection.js';
15
- import { TxProvider } from '../services/tx_provider.js';
16
13
  import { type P2P, type P2PSyncState } from './interface.js';
17
14
  /**
18
15
  * The P2P client implementation.
@@ -22,8 +19,6 @@ export declare class P2PClient<T extends P2PClientType = P2PClientType.Full> ext
22
19
  private store;
23
20
  private l2BlockSource;
24
21
  private p2pService;
25
- private txCollection;
26
- private _dateProvider;
27
22
  private telemetry;
28
23
  private log;
29
24
  /** The JS promise that will be running to keep the client's data in sync. Can be interrupted if the client is stopped. */
@@ -43,7 +38,6 @@ export declare class P2PClient<T extends P2PClientType = P2PClientType.Full> ext
43
38
  private attestationPool;
44
39
  private config;
45
40
  private blockStream;
46
- private txProvider;
47
41
  /**
48
42
  * In-memory P2P client constructor.
49
43
  * @param store - The client's instance of the KV store.
@@ -52,10 +46,9 @@ export declare class P2PClient<T extends P2PClientType = P2PClientType.Full> ext
52
46
  * @param p2pService - The concrete instance of p2p networking to use.
53
47
  * @param log - A logger.
54
48
  */
55
- constructor(_clientType: T, store: AztecAsyncKVStore, l2BlockSource: L2BlockSource & ContractDataSource, mempools: MemPools<T>, p2pService: P2PService, txCollection: TxCollection, config?: Partial<P2PConfig>, _dateProvider?: DateProvider, telemetry?: TelemetryClient, log?: import("@aztec/foundation/log").Logger);
49
+ constructor(_clientType: T, store: AztecAsyncKVStore, l2BlockSource: L2BlockSource & ContractDataSource, mempools: MemPools<T>, p2pService: P2PService, config?: Partial<P2PConfig>, telemetry?: TelemetryClient, log?: import("@aztec/foundation/log").Logger);
56
50
  clear(): Promise<void>;
57
51
  isP2PClient(): true;
58
- getTxProvider(): TxProvider;
59
52
  getPeers(includePending?: boolean): Promise<PeerInfo[]>;
60
53
  getL2BlockHash(number: number): Promise<string | undefined>;
61
54
  updateP2PConfig(config: Partial<P2PConfig>): Promise<void>;
@@ -79,6 +72,16 @@ export declare class P2PClient<T extends P2PClientType = P2PClientType.Full> ext
79
72
  getAttestationsForSlot(slot: bigint, proposalId?: string): Promise<BlockAttestation[]>;
80
73
  addAttestations(attestations: BlockAttestation[]): Promise<void>;
81
74
  registerBlockProposalHandler(handler: P2PBlockReceivedCallback): void;
75
+ /**
76
+ * Uses the Request Response protocol to request a transaction from the network.
77
+ *
78
+ * If the underlying request response protocol fails, then we return undefined.
79
+ * If it succeeds then we add the transaction to our transaction pool and return.
80
+ *
81
+ * @param txHash - The hash of the transaction to request.
82
+ * @returns A promise that resolves to a transaction or undefined.
83
+ */
84
+ requestTxByHash(txHash: TxHash): Promise<Tx | undefined>;
82
85
  /**
83
86
  * Uses the batched Request Response protocol to request a set of transactions from the network.
84
87
  */
@@ -107,6 +110,13 @@ export declare class P2PClient<T extends P2PClientType = P2PClientType.Full> ext
107
110
  */
108
111
  getTxsByHashFromPool(txHashes: TxHash[]): Promise<(Tx | undefined)[]>;
109
112
  hasTxsInPool(txHashes: TxHash[]): Promise<boolean[]>;
113
+ /**
114
+ * Returns a transaction in the transaction pool by its hash.
115
+ * If the transaction is not in the pool, it will be requested from the network.
116
+ * @param txHash - Hash of the transaction to look for in the pool.
117
+ * @returns A single tx or undefined.
118
+ */
119
+ getTxByHash(txHash: TxHash): Promise<Tx | undefined>;
110
120
  /**
111
121
  * Returns transactions in the transaction pool by hash.
112
122
  * If a transaction is not in the pool, it will be requested from the network.
@@ -188,7 +198,7 @@ export declare class P2PClient<T extends P2PClientType = P2PClientType.Full> ext
188
198
  */
189
199
  private handleLatestL2Blocks;
190
200
  /** Request txs for unproven blocks so the prover node has more chances to get them. */
191
- private startCollectingMissingTxs;
201
+ private requestMissingTxsFromUnprovenBlocks;
192
202
  /**
193
203
  * Handles new finalized blocks by deleting the txs and attestations in them.
194
204
  * @param blocks - A list of finalized L2 blocks.
@@ -1 +1 @@
1
- {"version":3,"file":"p2p_client.d.ts","sourceRoot":"","sources":["../../src/client/p2p_client.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AACvD,OAAO,KAAK,EAAE,iBAAiB,EAAsC,MAAM,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I;IACS,SAAS,CAAC,QAAQ,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC;IAKzD;;;OAGG;IACI,OAAO;IAId;;;OAGG;IACU,uBAAuB,IAAI,OAAO,CAAC,MAAM,CAAC;IAIvD;;;OAGG;IACU,uBAAuB,IAAI,OAAO,CAAC,MAAM,CAAC;IAI1C,0BAA0B,IAAI,OAAO,CAAC,MAAM,CAAC;IAI1D,iEAAiE;IACpD,mBAAmB,IAAI,OAAO,CAAC,MAAM,CAAC;IAInD;;;OAGG;IACU,SAAS,IAAI,OAAO,CAAC,YAAY,CAAC;IAgB/C;;;;OAIG;YACW,wBAAwB;IAOtC;;;;OAIG;YACW,mBAAmB;IAQjC;;;;OAIG;YACW,oBAAoB;IAyBlC,uFAAuF;YACzE,mCAAmC;IAsBjD;;;;OAIG;YACW,uBAAuB;IAkBrC;;;OAGG;YACW,mBAAmB;YAkDnB,qBAAqB;IA0BnC;;;OAGG;IACH,OAAO,CAAC,eAAe;IAMhB,QAAQ,CAAC,GAAG,EAAE,EAAE,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC;IAIzC;;;OAGG;IACI,qBAAqB,CAAC,QAAQ,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC;CAGhE"}
@@ -6,13 +6,10 @@ function _ts_decorate(decorators, target, key, desc) {
6
6
  }
7
7
  import { INITIAL_L2_BLOCK_NUM } from '@aztec/constants';
8
8
  import { createLogger } from '@aztec/foundation/log';
9
- import { DateProvider } from '@aztec/foundation/timer';
10
- import { getTimestampForSlot } from '@aztec/stdlib/epoch-helpers';
11
- import { tryStop } from '@aztec/stdlib/interfaces/server';
12
9
  import { Attributes, TraceableL2BlockStream, WithTracer, getTelemetryClient, trackSpan } from '@aztec/telemetry-client';
13
10
  import { getP2PDefaultConfig } from '../config.js';
14
11
  import { ReqRespSubProtocol } from '../services/reqresp/interface.js';
15
- import { TxProvider } from '../services/tx_provider.js';
12
+ import { TxCollector } from '../services/tx_collector.js';
16
13
  import { P2PClientState } from './interface.js';
17
14
  /**
18
15
  * The P2P client implementation.
@@ -20,8 +17,6 @@ import { P2PClientState } from './interface.js';
20
17
  store;
21
18
  l2BlockSource;
22
19
  p2pService;
23
- txCollection;
24
- _dateProvider;
25
20
  telemetry;
26
21
  log;
27
22
  /** The JS promise that will be running to keep the client's data in sync. Can be interrupted if the client is stopped. */ runningPromise;
@@ -40,7 +35,6 @@ import { P2PClientState } from './interface.js';
40
35
  attestationPool;
41
36
  config;
42
37
  blockStream;
43
- txProvider;
44
38
  /**
45
39
  * In-memory P2P client constructor.
46
40
  * @param store - The client's instance of the KV store.
@@ -48,29 +42,20 @@ import { P2PClientState } from './interface.js';
48
42
  * @param txPool - The client's instance of a transaction pool. Defaults to in-memory implementation.
49
43
  * @param p2pService - The concrete instance of p2p networking to use.
50
44
  * @param log - A logger.
51
- */ constructor(_clientType, store, l2BlockSource, mempools, p2pService, txCollection, config = {}, _dateProvider = new DateProvider(), telemetry = getTelemetryClient(), log = createLogger('p2p')){
52
- super(telemetry, 'P2PClient'), this.store = store, this.l2BlockSource = l2BlockSource, this.p2pService = p2pService, this.txCollection = txCollection, this._dateProvider = _dateProvider, this.telemetry = telemetry, this.log = log, this.currentState = P2PClientState.IDLE, this.syncPromise = Promise.resolve(), this.syncResolve = undefined, this.latestBlockNumberAtStart = -1, this.provenBlockNumberAtStart = -1, this.finalizedBlockNumberAtStart = -1;
45
+ */ constructor(_clientType, store, l2BlockSource, mempools, p2pService, config = {}, telemetry = getTelemetryClient(), log = createLogger('p2p')){
46
+ super(telemetry, 'P2PClient'), this.store = store, this.l2BlockSource = l2BlockSource, this.p2pService = p2pService, this.telemetry = telemetry, this.log = log, this.currentState = P2PClientState.IDLE, this.syncPromise = Promise.resolve(), this.syncResolve = undefined, this.latestBlockNumberAtStart = -1, this.provenBlockNumberAtStart = -1, this.finalizedBlockNumberAtStart = -1;
53
47
  this.config = {
54
48
  ...getP2PDefaultConfig(),
55
49
  ...config
56
50
  };
57
51
  this.txPool = mempools.txPool;
58
52
  this.attestationPool = mempools.attestationPool;
59
- this.txProvider = new TxProvider(this.txCollection, this.txPool, this, this.log.createChild('tx-provider'), this.telemetry);
60
53
  // Default to collecting all txs when we see a valid proposal
61
- // This can be overridden by the validator client to attest, and it will call getTxsForBlockProposal on its own
62
- // TODO(palla/txs): We should not trigger a request for txs on a proposal before fully validating it. We need to bring
63
- // validator-client code into here so we can validate a proposal is reasonable.
54
+ // This can be overridden by the validator client to attest, and it will call collectForBlockProposal on its own
55
+ const txCollector = new TxCollector(this, this.log);
64
56
  this.registerBlockProposalHandler(async (block, sender)=>{
65
57
  this.log.debug(`Received block proposal from ${sender.toString()}`);
66
- // TODO(palla/txs): Need to subtract validatorReexecuteDeadlineMs from this deadline (see ValidatorClient.getReexecutionDeadline)
67
- const constants = this.txCollection.getConstants();
68
- const nextSlotTimestampSeconds = Number(getTimestampForSlot(block.slotNumber.toBigInt() + 1n, constants));
69
- const deadline = new Date(nextSlotTimestampSeconds * 1000);
70
- await this.txProvider.getTxsForBlockProposal(block, {
71
- pinnedPeer: sender,
72
- deadline
73
- });
58
+ await txCollector.collectForBlockProposal(block, sender);
74
59
  return undefined;
75
60
  });
76
61
  // REFACTOR: Try replacing these with an L2TipsStore
@@ -86,9 +71,6 @@ import { P2PClientState } from './interface.js';
86
71
  isP2PClient() {
87
72
  return true;
88
73
  }
89
- getTxProvider() {
90
- return this.txProvider;
91
- }
92
74
  getPeers(includePending) {
93
75
  return Promise.resolve(this.p2pService.getPeers(includePending));
94
76
  }
@@ -159,13 +141,11 @@ import { P2PClientState } from './interface.js';
159
141
  case 'chain-proven':
160
142
  {
161
143
  await this.setBlockHash(event.block);
162
- this.txCollection.stopCollectingForBlocksUpTo(event.block.number);
163
144
  await this.synchedProvenBlockNumber.set(event.block.number);
164
145
  break;
165
146
  }
166
147
  case 'chain-pruned':
167
148
  await this.setBlockHash(event.block);
168
- this.txCollection.stopCollectingForBlocksAfter(event.block.number);
169
149
  await this.handlePruneL2Blocks(event.block.number);
170
150
  break;
171
151
  default:
@@ -237,7 +217,6 @@ import { P2PClientState } from './interface.js';
237
217
  });
238
218
  }
239
219
  this.blockStream.start();
240
- await this.txCollection.start();
241
220
  return this.syncPromise;
242
221
  }
243
222
  initBlockStream(startingBlock) {
@@ -255,8 +234,6 @@ import { P2PClientState } from './interface.js';
255
234
  * 'ready' will now return 'false' and the running promise that keeps the client synced is interrupted.
256
235
  */ async stop() {
257
236
  this.log.debug('Stopping p2p client...');
258
- await tryStop(this.txCollection);
259
- this.log.debug('Stopped tx collection service');
260
237
  await this.p2pService.stop();
261
238
  this.log.debug('Stopped p2p service');
262
239
  await this.blockStream?.stop();
@@ -285,6 +262,26 @@ import { P2PClientState } from './interface.js';
285
262
  this.p2pService.registerBlockReceivedCallback(handler);
286
263
  }
287
264
  /**
265
+ * Uses the Request Response protocol to request a transaction from the network.
266
+ *
267
+ * If the underlying request response protocol fails, then we return undefined.
268
+ * If it succeeds then we add the transaction to our transaction pool and return.
269
+ *
270
+ * @param txHash - The hash of the transaction to request.
271
+ * @returns A promise that resolves to a transaction or undefined.
272
+ */ async requestTxByHash(txHash) {
273
+ const tx = await this.p2pService.sendRequest(ReqRespSubProtocol.TX, txHash);
274
+ if (tx) {
275
+ this.log.debug(`Received tx ${txHash.toString()} from peer`);
276
+ await this.txPool.addTxs([
277
+ tx
278
+ ]);
279
+ } else {
280
+ this.log.debug(`Failed to receive tx ${txHash.toString()} from peer`);
281
+ }
282
+ return tx;
283
+ }
284
+ /**
288
285
  * Uses the batched Request Response protocol to request a set of transactions from the network.
289
286
  */ async requestTxsByHash(txHashes, pinnedPeerId) {
290
287
  const timeoutMs = 8000; // Longer timeout for now
@@ -380,6 +377,18 @@ import { P2PClientState } from './interface.js';
380
377
  return this.txPool.hasTxs(txHashes);
381
378
  }
382
379
  /**
380
+ * Returns a transaction in the transaction pool by its hash.
381
+ * If the transaction is not in the pool, it will be requested from the network.
382
+ * @param txHash - Hash of the transaction to look for in the pool.
383
+ * @returns A single tx or undefined.
384
+ */ async getTxByHash(txHash) {
385
+ const tx = await this.txPool.getTxByHash(txHash);
386
+ if (tx) {
387
+ return tx;
388
+ }
389
+ return this.requestTxByHash(txHash);
390
+ }
391
+ /**
383
392
  * Returns transactions in the transaction pool by hash.
384
393
  * If a transaction is not in the pool, it will be requested from the network.
385
394
  * @param txHashes - Hashes of the transactions to look for.
@@ -509,7 +518,7 @@ import { P2PClientState } from './interface.js';
509
518
  */ async markTxsAsMinedFromBlocks(blocks) {
510
519
  for (const block of blocks){
511
520
  const txHashes = block.body.txEffects.map((txEffect)=>txEffect.txHash);
512
- await this.txPool.markAsMined(txHashes, block.header);
521
+ await this.txPool.markAsMined(txHashes, block.number);
513
522
  }
514
523
  }
515
524
  /**
@@ -532,7 +541,7 @@ import { P2PClientState } from './interface.js';
532
541
  return Promise.resolve();
533
542
  }
534
543
  await this.markTxsAsMinedFromBlocks(blocks.map((b)=>b.block));
535
- await this.startCollectingMissingTxs(blocks.map((b)=>b.block));
544
+ void this.requestMissingTxsFromUnprovenBlocks(blocks.map((b)=>b.block));
536
545
  const lastBlock = blocks.at(-1).block;
537
546
  await Promise.all(blocks.map(async (block)=>this.setBlockHash({
538
547
  number: block.block.number,
@@ -543,30 +552,23 @@ import { P2PClientState } from './interface.js';
543
552
  this.log.verbose(`Synched to latest block ${lastBlock.number}`);
544
553
  await this.startServiceIfSynched();
545
554
  }
546
- /** Request txs for unproven blocks so the prover node has more chances to get them. */ async startCollectingMissingTxs(blocks) {
555
+ /** Request txs for unproven blocks so the prover node has more chances to get them. */ async requestMissingTxsFromUnprovenBlocks(blocks) {
547
556
  try {
548
- // TODO(#15435): If the archiver has lagged behind L1, the reported proven block number may
549
- // be much lower than the actual one, and it does not update until the pending chain is
550
- // fully synced. This could lead to a ton of tx collection requests for blocks that
551
- // are already proven, but the archiver has not yet updated its state. Until this is properly
552
- // fixed, it is mitigated by the expiration date of collection requests, which depends on
553
- // the slot number of the block.
554
- const provenBlockNumber = await this.l2BlockSource.getProvenBlockNumber();
557
+ const provenBlockNumber = Math.max(await this.getSyncedProvenBlockNum(), this.provenBlockNumberAtStart);
555
558
  const unprovenBlocks = blocks.filter((block)=>block.number > provenBlockNumber);
556
- for (const block of unprovenBlocks){
557
- const txHashes = block.body.txEffects.map((txEffect)=>txEffect.txHash);
558
- const missingTxHashes = await this.txPool.hasTxs(txHashes).then((availability)=>txHashes.filter((_, index)=>!availability[index]));
559
- if (missingTxHashes.length > 0) {
560
- this.log.verbose(`Starting collection of ${missingTxHashes.length} missing txs for unproven mined block ${block.number}`, {
561
- missingTxHashes,
562
- blockNumber: block.number,
563
- blockHash: await block.hash().then((h)=>h.toString())
564
- });
565
- this.txCollection.startCollecting(block, missingTxHashes);
566
- }
559
+ const txHashes = unprovenBlocks.flatMap((block)=>block.body.txEffects.map((txEffect)=>txEffect.txHash));
560
+ const missingTxHashes = await this.txPool.hasTxs(txHashes).then((availability)=>txHashes.filter((_, index)=>!availability[index]));
561
+ if (missingTxHashes.length > 0) {
562
+ this.log.verbose(`Requesting ${missingTxHashes.length} missing txs from peers for ${unprovenBlocks.length} unproven mined blocks`, {
563
+ missingTxHashes,
564
+ unprovenBlockNumbers: unprovenBlocks.map((block)=>block.number)
565
+ });
566
+ await this.requestTxsByHash(missingTxHashes, undefined);
567
567
  }
568
568
  } catch (err) {
569
- this.log.error(`Error while starting collection of missing txs for unproven blocks`, err);
569
+ this.log.error(`Error requesting missing txs from unproven blocks`, err, {
570
+ blocks: blocks.map((block)=>block.number)
571
+ });
570
572
  }
571
573
  }
572
574
  /**
package/dest/config.d.ts CHANGED
@@ -1,12 +1,11 @@
1
- import { type ConfigMappingsType, SecretValue } from '@aztec/foundation/config';
1
+ import { type ConfigMappingsType } from '@aztec/foundation/config';
2
2
  import { type DataStoreConfig } from '@aztec/kv-store/config';
3
3
  import { type AllowedElement, type ChainConfig } from '@aztec/stdlib/config';
4
4
  import { type P2PReqRespConfig } from './services/reqresp/config.js';
5
- import { type TxCollectionConfig } from './services/tx_collection/config.js';
6
5
  /**
7
6
  * P2P client configuration values.
8
7
  */
9
- export interface P2PConfig extends P2PReqRespConfig, ChainConfig, TxCollectionConfig {
8
+ export interface P2PConfig extends P2PReqRespConfig, ChainConfig {
10
9
  /** A flag dictating whether the P2P subsystem should be enabled. */
11
10
  p2pEnabled: boolean;
12
11
  /** The frequency in which to check for new L2 blocks. */
@@ -28,7 +27,7 @@ export interface P2PConfig extends P2PReqRespConfig, ChainConfig, TxCollectionCo
28
27
  /** The listen address. */
29
28
  listenAddress: string;
30
29
  /** An optional peer id private key. If blank, will generate a random key. */
31
- peerIdPrivateKey?: SecretValue<string>;
30
+ peerIdPrivateKey?: string;
32
31
  /** An optional path to store generated peer id private keys. If blank, will default to storing any generated keys in the data directory. */
33
32
  peerIdPrivateKeyPath?: string;
34
33
  /** A list of bootstrap peers to connect to. */
@@ -109,16 +108,6 @@ export declare const bootnodeConfigMappings: ConfigMappingsType<Pick<{
109
108
  overallRequestTimeoutMs: unknown;
110
109
  individualRequestTimeoutMs: unknown;
111
110
  p2pOptimisticNegotiation: unknown;
112
- txCollectionFastNodesTimeoutBeforeReqRespMs: unknown;
113
- txCollectionSlowNodesIntervalMs: unknown;
114
- txCollectionSlowReqRespIntervalMs: unknown;
115
- txCollectionSlowReqRespTimeoutMs: unknown;
116
- txCollectionReconcileIntervalMs: unknown;
117
- txCollectionDisableSlowDuringFastRequests: unknown;
118
- txCollectionFastNodeIntervalMs: unknown;
119
- txCollectionNodeRpcUrls: unknown;
120
- txCollectionFastMaxParallelRequestsPerNode: unknown;
121
- txCollectionNodeRpcMaxBatchSize: unknown;
122
111
  p2pEnabled: unknown;
123
112
  blockCheckIntervalMS: unknown;
124
113
  blockRequestBatchSize: unknown;
@@ -1 +1 @@
1
- {"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,kBAAkB,EACvB,WAAW,EAQZ,MA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AAE,CAqC9D"}
package/dest/config.js CHANGED
@@ -5,7 +5,6 @@ import { FunctionSelector } from '@aztec/stdlib/abi';
5
5
  import { AztecAddress } from '@aztec/stdlib/aztec-address';
6
6
  import { chainConfigMappings } from '@aztec/stdlib/config';
7
7
  import { p2pReqRespConfigMappings } from './services/reqresp/config.js';
8
- import { txCollectionConfigMappings } from './services/tx_collection/config.js';
9
8
  export const DEFAULT_P2P_PORT = 40400;
10
9
  export const p2pConfigMappings = {
11
10
  p2pEnabled: {
@@ -215,8 +214,7 @@ export const p2pConfigMappings = {
215
214
  ...booleanConfigHelper(false)
216
215
  },
217
216
  ...p2pReqRespConfigMappings,
218
- ...chainConfigMappings,
219
- ...txCollectionConfigMappings
217
+ ...chainConfigMappings
220
218
  };
221
219
  /**
222
220
  * Gets the config values for p2p client from environment variables.
@@ -1 +1 @@
1
- {"version":3,"file":"attestation_pool_test_suite.d.ts","sourceRoot":"","sources":["../../../src/mem_pools/attestation_pool/attestation_pool_test_suite.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAK7D,wBAAgB,uBAAuB,CAAC,kBAAkB,EAAE,MAAM,eAAe,QA4NhF"}
1
+ {"version":3,"file":"attestation_pool_test_suite.d.ts","sourceRoot":"","sources":["../../../src/mem_pools/attestation_pool/attestation_pool_test_suite.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAK7D,wBAAgB,uBAAuB,CAAC,kBAAkB,EAAE,MAAM,eAAe,QA8NhF"}
@@ -1,5 +1,6 @@
1
1
  import { Secp256k1Signer } from '@aztec/foundation/crypto';
2
2
  import { Fr } from '@aztec/foundation/fields';
3
+ import { TxHash } from '@aztec/stdlib/tx';
3
4
  import { jest } from '@jest/globals';
4
5
  import { mock } from 'jest-mock-extended';
5
6
  import { mockAttestation } from './mocks.js';
@@ -66,17 +67,26 @@ export function describeAttestationPool(getAttestationPool) {
66
67
  it('should handle duplicate proposals in a slot', async ()=>{
67
68
  const slotNumber = 420;
68
69
  const archive = Fr.random();
70
+ const txs = [
71
+ 0,
72
+ 1,
73
+ 2,
74
+ 3,
75
+ 4,
76
+ 5
77
+ ].map(()=>TxHash.random());
69
78
  // Use the same signer for all attestations
70
79
  const attestations = [];
71
80
  const signer = signers[0];
72
81
  for(let i = 0; i < NUMBER_OF_SIGNERS_PER_TEST; i++){
73
- attestations.push(mockAttestation(signer, slotNumber, archive));
82
+ attestations.push(mockAttestation(signer, slotNumber, archive, txs));
74
83
  }
75
84
  // Add them to store and check we end up with only one
76
85
  await ap.addAttestations(attestations);
77
86
  const retreivedAttestations = await ap.getAttestationsForSlotAndProposal(BigInt(slotNumber), archive.toString());
78
87
  expect(retreivedAttestations.length).toBe(1);
79
88
  expect(retreivedAttestations[0].toBuffer()).toEqual(attestations[0].toBuffer());
89
+ expect(retreivedAttestations[0].payload.txHashes).toEqual(txs);
80
90
  expect(retreivedAttestations[0].getSender().toString()).toEqual(signer.address.toString());
81
91
  // Try adding them on another operation and check they are still not duplicated
82
92
  await ap.addAttestations([
@@ -1,6 +1,7 @@
1
1
  import type { Secp256k1Signer } from '@aztec/foundation/crypto';
2
2
  import { Fr } from '@aztec/foundation/fields';
3
3
  import { BlockAttestation } from '@aztec/stdlib/p2p';
4
+ import { TxHash } from '@aztec/stdlib/tx';
4
5
  import { type LocalAccount } from 'viem/accounts';
5
6
  /** Generate Account
6
7
  *
@@ -14,5 +15,5 @@ export declare const generateAccount: () => LocalAccount;
14
15
  * @param slot The slot number the attestation is for
15
16
  * @returns A Block Attestation
16
17
  */
17
- export declare const mockAttestation: (signer: Secp256k1Signer, slot?: number, archive?: Fr) => BlockAttestation;
18
+ export declare const mockAttestation: (signer: Secp256k1Signer, slot?: number, archive?: Fr, txs?: TxHash[]) => BlockAttestation;
18
19
  //# sourceMappingURL=mocks.d.ts.map