@aztec/p2p 0.0.1-commit.96dac018d → 0.0.1-commit.993d52e

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 (98) hide show
  1. package/dest/client/factory.d.ts +4 -5
  2. package/dest/client/factory.d.ts.map +1 -1
  3. package/dest/client/factory.js +6 -6
  4. package/dest/client/interface.d.ts +4 -4
  5. package/dest/client/interface.d.ts.map +1 -1
  6. package/dest/client/p2p_client.d.ts +4 -4
  7. package/dest/client/p2p_client.d.ts.map +1 -1
  8. package/dest/client/p2p_client.js +1 -1
  9. package/dest/client/test/tx_proposal_collector/proposal_tx_collector_worker.js +1 -2
  10. package/dest/config.d.ts +10 -3
  11. package/dest/config.d.ts.map +1 -1
  12. package/dest/config.js +11 -1
  13. package/dest/mem_pools/tx_pool_v2/eviction/fee_payer_balance_pre_add_rule.d.ts +1 -1
  14. package/dest/mem_pools/tx_pool_v2/eviction/fee_payer_balance_pre_add_rule.d.ts.map +1 -1
  15. package/dest/mem_pools/tx_pool_v2/eviction/fee_payer_balance_pre_add_rule.js +2 -0
  16. package/dest/mem_pools/tx_pool_v2/eviction/interfaces.d.ts +7 -1
  17. package/dest/mem_pools/tx_pool_v2/eviction/interfaces.d.ts.map +1 -1
  18. package/dest/mem_pools/tx_pool_v2/eviction/low_priority_pre_add_rule.d.ts +1 -1
  19. package/dest/mem_pools/tx_pool_v2/eviction/low_priority_pre_add_rule.d.ts.map +1 -1
  20. package/dest/mem_pools/tx_pool_v2/eviction/low_priority_pre_add_rule.js +8 -6
  21. package/dest/mem_pools/tx_pool_v2/eviction/nullifier_conflict_rule.d.ts +2 -2
  22. package/dest/mem_pools/tx_pool_v2/eviction/nullifier_conflict_rule.d.ts.map +1 -1
  23. package/dest/mem_pools/tx_pool_v2/eviction/nullifier_conflict_rule.js +2 -2
  24. package/dest/mem_pools/tx_pool_v2/index.d.ts +2 -2
  25. package/dest/mem_pools/tx_pool_v2/index.d.ts.map +1 -1
  26. package/dest/mem_pools/tx_pool_v2/index.js +1 -1
  27. package/dest/mem_pools/tx_pool_v2/interfaces.d.ts +3 -3
  28. package/dest/mem_pools/tx_pool_v2/interfaces.d.ts.map +1 -1
  29. package/dest/mem_pools/tx_pool_v2/interfaces.js +1 -1
  30. package/dest/mem_pools/tx_pool_v2/tx_metadata.d.ts +30 -7
  31. package/dest/mem_pools/tx_pool_v2/tx_metadata.d.ts.map +1 -1
  32. package/dest/mem_pools/tx_pool_v2/tx_metadata.js +62 -16
  33. package/dest/mem_pools/tx_pool_v2/tx_pool_indices.d.ts +1 -1
  34. package/dest/mem_pools/tx_pool_v2/tx_pool_indices.d.ts.map +1 -1
  35. package/dest/mem_pools/tx_pool_v2/tx_pool_indices.js +9 -10
  36. package/dest/mem_pools/tx_pool_v2/tx_pool_v2_impl.d.ts +1 -1
  37. package/dest/mem_pools/tx_pool_v2/tx_pool_v2_impl.d.ts.map +1 -1
  38. package/dest/mem_pools/tx_pool_v2/tx_pool_v2_impl.js +38 -30
  39. package/dest/msg_validators/proposal_validator/block_proposal_validator.d.ts +2 -1
  40. package/dest/msg_validators/proposal_validator/block_proposal_validator.d.ts.map +1 -1
  41. package/dest/msg_validators/proposal_validator/checkpoint_proposal_validator.d.ts +2 -1
  42. package/dest/msg_validators/proposal_validator/checkpoint_proposal_validator.d.ts.map +1 -1
  43. package/dest/msg_validators/proposal_validator/proposal_validator.d.ts +3 -1
  44. package/dest/msg_validators/proposal_validator/proposal_validator.d.ts.map +1 -1
  45. package/dest/msg_validators/proposal_validator/proposal_validator.js +10 -0
  46. package/dest/msg_validators/proposal_validator/proposal_validator_test_suite.d.ts +2 -1
  47. package/dest/msg_validators/proposal_validator/proposal_validator_test_suite.d.ts.map +1 -1
  48. package/dest/msg_validators/proposal_validator/proposal_validator_test_suite.js +166 -0
  49. package/dest/services/encoding.d.ts +2 -2
  50. package/dest/services/encoding.d.ts.map +1 -1
  51. package/dest/services/encoding.js +7 -7
  52. package/dest/services/libp2p/libp2p_service.d.ts +6 -7
  53. package/dest/services/libp2p/libp2p_service.d.ts.map +1 -1
  54. package/dest/services/libp2p/libp2p_service.js +11 -12
  55. package/dest/services/reqresp/batch-tx-requester/batch_tx_requester.d.ts +1 -1
  56. package/dest/services/reqresp/batch-tx-requester/batch_tx_requester.d.ts.map +1 -1
  57. package/dest/services/reqresp/batch-tx-requester/batch_tx_requester.js +37 -14
  58. package/dest/services/reqresp/batch-tx-requester/peer_collection.d.ts +11 -17
  59. package/dest/services/reqresp/batch-tx-requester/peer_collection.d.ts.map +1 -1
  60. package/dest/services/reqresp/batch-tx-requester/peer_collection.js +15 -49
  61. package/dest/test-helpers/make-test-p2p-clients.d.ts +5 -6
  62. package/dest/test-helpers/make-test-p2p-clients.d.ts.map +1 -1
  63. package/dest/test-helpers/make-test-p2p-clients.js +1 -2
  64. package/dest/test-helpers/mock-pubsub.d.ts +2 -3
  65. package/dest/test-helpers/mock-pubsub.d.ts.map +1 -1
  66. package/dest/test-helpers/mock-pubsub.js +2 -2
  67. package/dest/test-helpers/reqresp-nodes.d.ts +2 -3
  68. package/dest/test-helpers/reqresp-nodes.d.ts.map +1 -1
  69. package/dest/test-helpers/reqresp-nodes.js +2 -2
  70. package/dest/testbench/p2p_client_testbench_worker.js +5 -5
  71. package/package.json +14 -14
  72. package/src/client/factory.ts +9 -14
  73. package/src/client/interface.ts +3 -9
  74. package/src/client/p2p_client.ts +2 -12
  75. package/src/client/test/tx_proposal_collector/proposal_tx_collector_worker.ts +1 -2
  76. package/src/config.ts +20 -2
  77. package/src/mem_pools/tx_pool_v2/README.md +9 -1
  78. package/src/mem_pools/tx_pool_v2/eviction/fee_payer_balance_pre_add_rule.ts +3 -0
  79. package/src/mem_pools/tx_pool_v2/eviction/interfaces.ts +11 -1
  80. package/src/mem_pools/tx_pool_v2/eviction/low_priority_pre_add_rule.ts +15 -6
  81. package/src/mem_pools/tx_pool_v2/eviction/nullifier_conflict_rule.ts +2 -1
  82. package/src/mem_pools/tx_pool_v2/index.ts +1 -1
  83. package/src/mem_pools/tx_pool_v2/interfaces.ts +3 -3
  84. package/src/mem_pools/tx_pool_v2/tx_metadata.ts +89 -17
  85. package/src/mem_pools/tx_pool_v2/tx_pool_indices.ts +11 -11
  86. package/src/mem_pools/tx_pool_v2/tx_pool_v2_impl.ts +43 -27
  87. package/src/msg_validators/proposal_validator/block_proposal_validator.ts +1 -1
  88. package/src/msg_validators/proposal_validator/checkpoint_proposal_validator.ts +1 -1
  89. package/src/msg_validators/proposal_validator/proposal_validator.ts +15 -1
  90. package/src/msg_validators/proposal_validator/proposal_validator_test_suite.ts +144 -1
  91. package/src/services/encoding.ts +5 -6
  92. package/src/services/libp2p/libp2p_service.ts +10 -12
  93. package/src/services/reqresp/batch-tx-requester/batch_tx_requester.ts +42 -14
  94. package/src/services/reqresp/batch-tx-requester/peer_collection.ts +24 -63
  95. package/src/test-helpers/make-test-p2p-clients.ts +0 -2
  96. package/src/test-helpers/mock-pubsub.ts +3 -6
  97. package/src/test-helpers/reqresp-nodes.ts +2 -5
  98. package/src/testbench/p2p_client_testbench_worker.ts +2 -6
@@ -1 +1 @@
1
- {"version":3,"file":"reqresp-nodes.d.ts","sourceRoot":"","sources":["../../src/test-helpers/reqresp-nodes.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAMrD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACzD,OAAO,EAAE,KAAK,WAAW,EAAoB,MAAM,sBAAsB,CAAC;AAC1E,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AACjE,OAAO,KAAK,EACV,6BAA6B,EAC7B,0BAA0B,EAC1B,sBAAsB,EACvB,MAAM,iCAAiC,CAAC;AACzC,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AACvD,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,kBAAkB,CAAC;AAE3C,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gB,yBAAyB,CAAC,UAAU,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,WAAW,EAAE,WAAW,GAAG,cAAc,CAYpH;AAED,wBAAgB,iCAAiC,CAC/C,UAAU,EAAE,MAAM,EAClB,IAAI,EAAE,MAAM,EACZ,SAAS,GAAE,eAAsC,EACjD,WAAW,GAAE,WAA8B,GAC1C,OAAO,CAAC,aAAa,CAAC,CAGxB;AAED;;;;;GAKG;AACH,wBAAsB,mBAAmB,CAAC,UAAU,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,wBAOzE;AAED,wBAAsB,mBAAmB,CACvC,IAAI,EAAE,MAAM,EACZ,SAAS,GAAE,eAAsC,EACjD,WAAW,GAAE,WAA8B,GAC1C,OAAO,CAAC,aAAa,CAAC,CAKxB"}
@@ -80,7 +80,7 @@ import { getVersions } from '../versioning.js';
80
80
  * P2P functionality is operational, however everything else is default
81
81
  *
82
82
  *
83
- */ export async function createTestLibP2PService(clientType, boostrapAddrs = [], archiver, worldStateSynchronizer, epochCache, mempools, telemetry, port = 0, peerId, chainConfig = emptyChainConfig) {
83
+ */ export async function createTestLibP2PService(boostrapAddrs = [], archiver, worldStateSynchronizer, epochCache, mempools, telemetry, port = 0, peerId, chainConfig = emptyChainConfig) {
84
84
  peerId = peerId ?? await createSecp256k1PeerId();
85
85
  const config = {
86
86
  p2pIp: `127.0.0.1`,
@@ -105,7 +105,7 @@ import { getVersions } from '../versioning.js';
105
105
  const peerManager = new PeerManager(p2pNode, discoveryService, config, telemetry, createLogger(`p2p:peer_manager`), peerScoring, reqresp, worldStateSynchronizer, protocolVersion, epochCache);
106
106
  p2pNode.services.pubsub.score.params.appSpecificWeight = APP_SPECIFIC_WEIGHT;
107
107
  p2pNode.services.pubsub.score.params.appSpecificScore = (peerId)=>peerManager.shouldDisableP2PGossip(peerId) ? -Infinity : peerManager.getPeerScore(peerId);
108
- return new LibP2PService(clientType, config, p2pNode, discoveryService, reqresp, peerManager, mempools, archiver, epochCache, proofVerifier, worldStateSynchronizer, telemetry);
108
+ return new LibP2PService(config, p2pNode, discoveryService, reqresp, peerManager, mempools, archiver, epochCache, proofVerifier, worldStateSynchronizer, telemetry);
109
109
  }
110
110
  // Mock sub protocol handlers
111
111
  export const MOCK_SUB_PROTOCOL_HANDLERS = {
@@ -13,7 +13,7 @@ import { DateProvider, Timer } from '@aztec/foundation/timer';
13
13
  import { openTmpStore } from '@aztec/kv-store/lmdb-v2';
14
14
  import { getVKTreeRoot } from '@aztec/noir-protocol-circuits-types/vk-tree';
15
15
  import { protocolContractsHash } from '@aztec/protocol-contracts';
16
- import { P2PClientType, P2PMessage } from '@aztec/stdlib/p2p';
16
+ import { P2PMessage } from '@aztec/stdlib/p2p';
17
17
  import { ChonkProof } from '@aztec/stdlib/proofs';
18
18
  import { makeAztecAddress, makeBlockHeader, makeBlockProposal, mockTx } from '@aztec/stdlib/testing';
19
19
  import { Tx } from '@aztec/stdlib/tx';
@@ -31,8 +31,8 @@ const txCache = new Map();
31
31
  class TestLibP2PService extends LibP2PService {
32
32
  disableTxValidation;
33
33
  gossipMessageCount = 0;
34
- constructor(clientType, config, node, peerDiscoveryService, reqresp, peerManager, mempools, archiver, epochCache, proofVerifier, worldStateSynchronizer, telemetry, logger = createLogger('p2p:test:libp2p_service'), disableTxValidation = true){
35
- super(clientType, config, node, peerDiscoveryService, reqresp, peerManager, mempools, archiver, epochCache, proofVerifier, worldStateSynchronizer, telemetry, logger);
34
+ constructor(config, node, peerDiscoveryService, reqresp, peerManager, mempools, archiver, epochCache, proofVerifier, worldStateSynchronizer, telemetry, logger = createLogger('p2p:test:libp2p_service'), disableTxValidation = true){
35
+ super(config, node, peerDiscoveryService, reqresp, peerManager, mempools, archiver, epochCache, proofVerifier, worldStateSynchronizer, telemetry, logger);
36
36
  this.disableTxValidation = disableTxValidation;
37
37
  }
38
38
  getGossipMessageCount() {
@@ -214,8 +214,8 @@ process.on('message', async (msg)=>{
214
214
  store: kvStore,
215
215
  logger: workerLogger
216
216
  };
217
- const client = await createP2PClient(P2PClientType.Full, config, l2BlockSource, proofVerifier, worldState, epochCache, 'test-p2p-bench-worker', undefined, telemetry, deps);
218
- const testService = new TestLibP2PService(P2PClientType.Full, config, client.p2pService.node, client.p2pService.peerDiscoveryService, client.p2pService.reqresp, client.p2pService.peerManager, client.p2pService.mempools, client.p2pService.archiver, epochCache, proofVerifier, worldState, telemetry, workerLogger, true);
217
+ const client = await createP2PClient(config, l2BlockSource, proofVerifier, worldState, epochCache, 'test-p2p-bench-worker', undefined, telemetry, deps);
218
+ const testService = new TestLibP2PService(config, client.p2pService.node, client.p2pService.peerDiscoveryService, client.p2pService.reqresp, client.p2pService.peerManager, client.p2pService.mempools, client.p2pService.archiver, epochCache, proofVerifier, worldState, telemetry, workerLogger, true);
219
219
  client.p2pService = testService;
220
220
  await client.start();
221
221
  for(let i = 0; i < 100; i++){
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aztec/p2p",
3
- "version": "0.0.1-commit.96dac018d",
3
+ "version": "0.0.1-commit.993d52e",
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.96dac018d",
71
- "@aztec/epoch-cache": "0.0.1-commit.96dac018d",
72
- "@aztec/ethereum": "0.0.1-commit.96dac018d",
73
- "@aztec/foundation": "0.0.1-commit.96dac018d",
74
- "@aztec/kv-store": "0.0.1-commit.96dac018d",
75
- "@aztec/noir-contracts.js": "0.0.1-commit.96dac018d",
76
- "@aztec/noir-protocol-circuits-types": "0.0.1-commit.96dac018d",
77
- "@aztec/protocol-contracts": "0.0.1-commit.96dac018d",
78
- "@aztec/simulator": "0.0.1-commit.96dac018d",
79
- "@aztec/stdlib": "0.0.1-commit.96dac018d",
80
- "@aztec/telemetry-client": "0.0.1-commit.96dac018d",
70
+ "@aztec/constants": "0.0.1-commit.993d52e",
71
+ "@aztec/epoch-cache": "0.0.1-commit.993d52e",
72
+ "@aztec/ethereum": "0.0.1-commit.993d52e",
73
+ "@aztec/foundation": "0.0.1-commit.993d52e",
74
+ "@aztec/kv-store": "0.0.1-commit.993d52e",
75
+ "@aztec/noir-contracts.js": "0.0.1-commit.993d52e",
76
+ "@aztec/noir-protocol-circuits-types": "0.0.1-commit.993d52e",
77
+ "@aztec/protocol-contracts": "0.0.1-commit.993d52e",
78
+ "@aztec/simulator": "0.0.1-commit.993d52e",
79
+ "@aztec/stdlib": "0.0.1-commit.993d52e",
80
+ "@aztec/telemetry-client": "0.0.1-commit.993d52e",
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.96dac018d",
108
- "@aztec/world-state": "0.0.1-commit.96dac018d",
107
+ "@aztec/archiver": "0.0.1-commit.993d52e",
108
+ "@aztec/world-state": "0.0.1-commit.993d52e",
109
109
  "@jest/globals": "^30.0.0",
110
110
  "@types/jest": "^30.0.0",
111
111
  "@types/node": "^22.15.17",
@@ -9,7 +9,6 @@ import type { L2BlockSource } from '@aztec/stdlib/block';
9
9
  import type { ChainConfig } from '@aztec/stdlib/config';
10
10
  import type { ContractDataSource } from '@aztec/stdlib/contract';
11
11
  import type { AztecNode, ClientProtocolCircuitVerifier, WorldStateSynchronizer } from '@aztec/stdlib/interfaces/server';
12
- import { P2PClientType } from '@aztec/stdlib/p2p';
13
12
  import { type TelemetryClient, getTelemetryClient } from '@aztec/telemetry-client';
14
13
 
15
14
  import { P2PClient } from '../client/p2p_client.js';
@@ -27,14 +26,14 @@ import { NodeRpcTxSource, type TxSource, createNodeRpcTxSources } from '../servi
27
26
  import { TxFileStore } from '../services/tx_file_store/tx_file_store.js';
28
27
  import { configureP2PClientAddresses, createLibP2PPeerIdFromPrivateKey, getPeerIdPrivateKey } from '../util.js';
29
28
 
30
- export type P2PClientDeps<T extends P2PClientType> = {
29
+ export type P2PClientDeps = {
31
30
  txPool?: TxPoolV2;
32
31
  store?: AztecAsyncKVStore;
33
32
  attestationPool?: AttestationPoolApi;
34
33
  logger?: Logger;
35
34
  txCollectionNodeSources?: TxSource[];
36
35
  rpcTxProviders?: AztecNode[];
37
- p2pServiceFactory?: (...args: Parameters<(typeof LibP2PService)['new']>) => Promise<LibP2PService<T>>;
36
+ p2pServiceFactory?: (...args: Parameters<(typeof LibP2PService)['new']>) => Promise<LibP2PService>;
38
37
  };
39
38
 
40
39
  export const P2P_STORE_NAME = 'p2p';
@@ -42,8 +41,7 @@ export const P2P_ARCHIVE_STORE_NAME = 'p2p-archive';
42
41
  export const P2P_PEER_STORE_NAME = 'p2p-peers';
43
42
  export const P2P_ATTESTATION_STORE_NAME = 'p2p-attestation';
44
43
 
45
- export async function createP2PClient<T extends P2PClientType>(
46
- clientType: T,
44
+ export async function createP2PClient(
47
45
  inputConfig: P2PConfig & DataStoreConfig & ChainConfig,
48
46
  archiver: L2BlockSource & ContractDataSource,
49
47
  proofVerifier: ClientProtocolCircuitVerifier,
@@ -52,7 +50,7 @@ export async function createP2PClient<T extends P2PClientType>(
52
50
  packageVersion: string,
53
51
  dateProvider: DateProvider = new DateProvider(),
54
52
  telemetry: TelemetryClient = getTelemetryClient(),
55
- deps: P2PClientDeps<T> = {},
53
+ deps: P2PClientDeps = {},
56
54
  ) {
57
55
  const config = await configureP2PClientAddresses({
58
56
  ...inputConfig,
@@ -101,7 +99,7 @@ export async function createP2PClient<T extends P2PClientType>(
101
99
  maxPendingTxCount: config.maxPendingTxCount,
102
100
  archivedTxLimit: config.archivedTxLimit,
103
101
  minTxPoolAgeMs: config.minTxPoolAgeMs,
104
- dropTransactionsProbability: config.dropTransactionsProbability,
102
+ priceBumpPercentage: config.priceBumpPercentage,
105
103
  },
106
104
  dateProvider,
107
105
  );
@@ -111,9 +109,8 @@ export async function createP2PClient<T extends P2PClientType>(
111
109
  attestationPool: deps.attestationPool ?? new AttestationPool(attestationStore, telemetry),
112
110
  };
113
111
 
114
- const p2pService = await createP2PService<T>(
112
+ const p2pService = await createP2PService(
115
113
  config,
116
- clientType,
117
114
  archiver,
118
115
  proofVerifier,
119
116
  worldStateSynchronizer,
@@ -171,7 +168,6 @@ export async function createP2PClient<T extends P2PClientType>(
171
168
  );
172
169
 
173
170
  return new P2PClient(
174
- clientType,
175
171
  store,
176
172
  archiver,
177
173
  mempools,
@@ -185,9 +181,8 @@ export async function createP2PClient<T extends P2PClientType>(
185
181
  );
186
182
  }
187
183
 
188
- async function createP2PService<T extends P2PClientType>(
184
+ async function createP2PService(
189
185
  config: P2PConfig & DataStoreConfig,
190
- clientType: T,
191
186
  archiver: L2BlockSource & ContractDataSource,
192
187
  proofVerifier: ClientProtocolCircuitVerifier,
193
188
  worldStateSynchronizer: WorldStateSynchronizer,
@@ -195,7 +190,7 @@ async function createP2PService<T extends P2PClientType>(
195
190
  store: AztecAsyncKVStore,
196
191
  peerStore: AztecLMDBStoreV2,
197
192
  mempools: MemPools,
198
- p2pServiceFactory: P2PClientDeps<T>['p2pServiceFactory'],
193
+ p2pServiceFactory: P2PClientDeps['p2pServiceFactory'],
199
194
  packageVersion: string,
200
195
  logger: Logger,
201
196
  telemetry: TelemetryClient,
@@ -211,7 +206,7 @@ async function createP2PService<T extends P2PClientType>(
211
206
  const peerIdPrivateKey = await getPeerIdPrivateKey(config, store, logger);
212
207
  const peerId = await createLibP2PPeerIdFromPrivateKey(peerIdPrivateKey.getValue());
213
208
 
214
- const p2pService = await (p2pServiceFactory ?? LibP2PService.new<T>)(clientType, config, peerId, {
209
+ const p2pService = await (p2pServiceFactory ?? LibP2PService.new)(config, peerId, {
215
210
  packageVersion,
216
211
  mempools,
217
212
  l2BlockSource: archiver,
@@ -1,13 +1,7 @@
1
1
  import type { SlotNumber } from '@aztec/foundation/branded-types';
2
2
  import type { EthAddress, L2BlockId } from '@aztec/stdlib/block';
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';
3
+ import type { ITxProvider, P2PClient } from '@aztec/stdlib/interfaces/server';
4
+ import type { BlockProposal, CheckpointAttestation, CheckpointProposal, TopicType } from '@aztec/stdlib/p2p';
11
5
  import type { BlockHeader, Tx, TxHash } from '@aztec/stdlib/tx';
12
6
 
13
7
  import type { PeerId } from '@libp2p/interface';
@@ -54,7 +48,7 @@ export interface P2PSyncState {
54
48
  /**
55
49
  * Interface of a P2P client.
56
50
  **/
57
- export type P2P<T extends P2PClientType = P2PClientType.Full> = P2PApiFull<T> & {
51
+ export type P2P = P2PClient & {
58
52
  /**
59
53
  * Broadcasts a block proposal to other peers.
60
54
  *
@@ -20,13 +20,7 @@ import {
20
20
  import type { ContractDataSource } from '@aztec/stdlib/contract';
21
21
  import { getTimestampForSlot } from '@aztec/stdlib/epoch-helpers';
22
22
  import { type PeerInfo, tryStop } from '@aztec/stdlib/interfaces/server';
23
- import {
24
- type BlockProposal,
25
- CheckpointAttestation,
26
- type CheckpointProposal,
27
- type P2PClientType,
28
- type TopicType,
29
- } from '@aztec/stdlib/p2p';
23
+ import { type BlockProposal, CheckpointAttestation, type CheckpointProposal, type TopicType } from '@aztec/stdlib/p2p';
30
24
  import type { BlockHeader, Tx, TxHash } from '@aztec/stdlib/tx';
31
25
  import { Attributes, type TelemetryClient, WithTracer, getTelemetryClient, trackSpan } from '@aztec/telemetry-client';
32
26
 
@@ -59,10 +53,7 @@ import { type P2P, P2PClientState, type P2PSyncState } from './interface.js';
59
53
  /**
60
54
  * The P2P client implementation.
61
55
  */
62
- export class P2PClient<T extends P2PClientType = P2PClientType.Full>
63
- extends WithTracer
64
- implements P2P, P2P<P2PClientType.Prover>
65
- {
56
+ export class P2PClient extends WithTracer implements P2P {
66
57
  /** The JS promise that will be running to keep the client's data in sync. Can be interrupted if the client is stopped. */
67
58
  private runningPromise!: Promise<void>;
68
59
 
@@ -94,7 +85,6 @@ export class P2PClient<T extends P2PClientType = P2PClientType.Full>
94
85
  private slotMonitor: RunningPromise | undefined;
95
86
 
96
87
  constructor(
97
- _clientType: T,
98
88
  private store: AztecAsyncKVStore,
99
89
  private l2BlockSource: L2BlockSource & ContractDataSource,
100
90
  mempools: MemPools,
@@ -8,7 +8,7 @@ import { openTmpStore } from '@aztec/kv-store/lmdb-v2';
8
8
  import type { L2BlockSource } from '@aztec/stdlib/block';
9
9
  import type { ContractDataSource } from '@aztec/stdlib/contract';
10
10
  import type { ClientProtocolCircuitVerifier } from '@aztec/stdlib/interfaces/server';
11
- import { P2PClientType, PeerErrorSeverity } from '@aztec/stdlib/p2p';
11
+ import { PeerErrorSeverity } from '@aztec/stdlib/p2p';
12
12
  import type { Tx, TxValidationResult } from '@aztec/stdlib/tx';
13
13
  import { type TelemetryClient, getTelemetryClient } from '@aztec/telemetry-client';
14
14
 
@@ -114,7 +114,6 @@ async function startClient(config: P2PConfig, clientIndex: number) {
114
114
  };
115
115
 
116
116
  client = await createP2PClient(
117
- P2PClientType.Full,
118
117
  config as P2PConfig & DataStoreConfig,
119
118
  l2BlockSource as L2BlockSource & ContractDataSource,
120
119
  proofVerifier as ClientProtocolCircuitVerifier,
package/src/config.ts CHANGED
@@ -1,6 +1,7 @@
1
1
  import {
2
2
  type ConfigMappingsType,
3
3
  SecretValue,
4
+ bigintConfigHelper,
4
5
  booleanConfigHelper,
5
6
  getConfigFromMappings,
6
7
  getDefaultConfig,
@@ -38,7 +39,7 @@ export interface P2PConfig
38
39
  ChainConfig,
39
40
  TxCollectionConfig,
40
41
  TxFileStoreConfig,
41
- Pick<SequencerConfig, 'blockDurationMs' | 'expectedBlockProposalsPerSlot'> {
42
+ Pick<SequencerConfig, 'blockDurationMs' | 'expectedBlockProposalsPerSlot' | 'maxTxsPerBlock'> {
42
43
  /** A flag dictating whether the P2P subsystem should be enabled. */
43
44
  p2pEnabled: boolean;
44
45
 
@@ -173,7 +174,10 @@ export interface P2PConfig
173
174
  /** Whether transactions are disabled for this node. This means transactions will be rejected at the RPC and P2P layers. */
174
175
  disableTransactions: boolean;
175
176
 
176
- /** The probability that a transaction is discarded (0 = disabled). - For testing purposes only */
177
+ /** True to simulate discarding transactions. - For testing purposes only*/
178
+ dropTransactions: boolean;
179
+
180
+ /** The probability that a transaction is discarded. - For testing purposes only */
177
181
  dropTransactionsProbability: number;
178
182
 
179
183
  /** Whether to delete transactions from the pool after a reorg instead of moving them back to pending. */
@@ -190,6 +194,9 @@ export interface P2PConfig
190
194
 
191
195
  /** Minimum age (ms) a transaction must have been in the pool before it's eligible for block building. */
192
196
  minTxPoolAgeMs: number;
197
+
198
+ /** Minimum percentage fee increase required to replace an existing tx via RPC (0 = no bump). */
199
+ priceBumpPercentage: bigint;
193
200
  }
194
201
 
195
202
  export const DEFAULT_P2P_PORT = 40400;
@@ -427,6 +434,11 @@ export const p2pConfigMappings: ConfigMappingsType<P2PConfig> = {
427
434
  description: 'Number of auth attempts to allow before peer is banned. Number is inclusive',
428
435
  ...numberConfigHelper(3),
429
436
  },
437
+ dropTransactions: {
438
+ env: 'P2P_DROP_TX',
439
+ description: 'True to simulate discarding transactions. - For testing purposes only',
440
+ ...booleanConfigHelper(false),
441
+ },
430
442
  dropTransactionsProbability: {
431
443
  env: 'P2P_DROP_TX_CHANCE',
432
444
  description: 'The probability that a transaction is discarded (0 - 1). - For testing purposes only',
@@ -464,6 +476,12 @@ export const p2pConfigMappings: ConfigMappingsType<P2PConfig> = {
464
476
  description: 'Minimum age (ms) a transaction must have been in the pool before it is eligible for block building.',
465
477
  ...numberConfigHelper(2_000),
466
478
  },
479
+ priceBumpPercentage: {
480
+ env: 'P2P_RPC_PRICE_BUMP_PERCENTAGE',
481
+ description:
482
+ 'Minimum percentage fee increase required to replace an existing tx via RPC. Even at 0%, replacement still requires paying at least 1 unit more.',
483
+ ...bigintConfigHelper(10n),
484
+ },
467
485
  ...sharedSequencerConfigMappings,
468
486
  ...p2pReqRespConfigMappings,
469
487
  ...batchTxRequesterConfigMappings,
@@ -158,7 +158,7 @@ Checked before adding a transaction to the pending pool:
158
158
 
159
159
  | Rule | Purpose |
160
160
  |------|---------|
161
- | `NullifierConflictRule` | Handles transactions with conflicting nullifiers. Higher priority tx wins. |
161
+ | `NullifierConflictRule` | Handles transactions with conflicting nullifiers. Higher priority tx wins. For RPC submissions, a configurable price bump percentage is required. |
162
162
  | `FeePayerBalancePreAddRule` | Ensures fee payer has sufficient balance for all their pending txs. |
163
163
  | `LowPriorityPreAddRule` | Rejects txs when pool is full and new tx has lowest priority. |
164
164
 
@@ -233,6 +233,14 @@ await pool.updateConfig({
233
233
  });
234
234
  ```
235
235
 
236
+ ### Price Bump (RPC Transaction Replacement)
237
+
238
+ When a transaction is submitted via RPC and clashes on nullifiers with an existing pool transaction, the incoming tx must pay at least `priceBumpPercentage`% more in priority fee (i.e. `>= existingFee + existingFee * bump / 100`) to replace it. This prevents spam via small fee increments. The same bump applies when the pool is full and the incoming tx needs to evict the lowest-priority tx.
239
+
240
+ - **Env var**: `P2P_RPC_PRICE_BUMP_PERCENTAGE` (default: 10)
241
+ - **Scope**: RPC submissions only. P2P gossip uses `comparePriority` (fee + hash tiebreaker) with no bump.
242
+ - Even with a 0% bump, a replacement tx must pay at least 1 unit more than the existing fee.
243
+
236
244
  ## Return Values
237
245
 
238
246
  ### AddTxsResult
@@ -35,6 +35,7 @@ export class FeePayerBalancePreAddRule implements PreAddRule {
35
35
  // Create combined list with incoming tx
36
36
  const allTxs: Array<{
37
37
  txHash: string;
38
+ txHashBigInt: bigint;
38
39
  priorityFee: bigint;
39
40
  feeLimit: bigint;
40
41
  claimAmount: bigint;
@@ -42,6 +43,7 @@ export class FeePayerBalancePreAddRule implements PreAddRule {
42
43
  }> = [
43
44
  ...existingTxs.map(t => ({
44
45
  txHash: t.txHash,
46
+ txHashBigInt: t.txHashBigInt,
45
47
  priorityFee: t.priorityFee,
46
48
  feeLimit: t.feeLimit,
47
49
  claimAmount: t.claimAmount,
@@ -49,6 +51,7 @@ export class FeePayerBalancePreAddRule implements PreAddRule {
49
51
  })),
50
52
  {
51
53
  txHash: incomingMeta.txHash,
54
+ txHashBigInt: incomingMeta.txHashBigInt,
52
55
  priorityFee: incomingMeta.priorityFee,
53
56
  feeLimit: incomingMeta.feeLimit,
54
57
  claimAmount: incomingMeta.claimAmount,
@@ -100,7 +100,15 @@ export type TxPoolRejectionError =
100
100
  availableBalance: bigint;
101
101
  feeLimit: bigint;
102
102
  }
103
- | { code: typeof TxPoolRejectionCode.NULLIFIER_CONFLICT; message: string; conflictingTxHash: string }
103
+ | {
104
+ code: typeof TxPoolRejectionCode.NULLIFIER_CONFLICT;
105
+ message: string;
106
+ conflictingTxHash: string;
107
+ /** Minimum fee needed to replace the conflicting tx (only set when price bump applies). */
108
+ minimumPriceBumpFee?: bigint;
109
+ /** Incoming tx's priority fee. */
110
+ txPriorityFee?: bigint;
111
+ }
104
112
  | { code: typeof TxPoolRejectionCode.INTERNAL_ERROR; message: string };
105
113
 
106
114
  /**
@@ -121,6 +129,8 @@ export interface PreAddResult {
121
129
  export interface PreAddContext {
122
130
  /** If true, compare priority fee only (no tx hash tiebreaker). Used for RPC submissions. */
123
131
  feeComparisonOnly?: boolean;
132
+ /** Percentage-based price bump required for tx replacement. Only set for RPC submissions. */
133
+ priceBumpPercentage?: bigint;
124
134
  }
125
135
 
126
136
  /**
@@ -1,6 +1,6 @@
1
1
  import { createLogger } from '@aztec/foundation/log';
2
2
 
3
- import { type TxMetaData, comparePriority } from '../tx_metadata.js';
3
+ import { type TxMetaData, comparePriority, getMinimumPriceBumpFee } from '../tx_metadata.js';
4
4
  import {
5
5
  type EvictionConfig,
6
6
  type PreAddContext,
@@ -48,10 +48,14 @@ export class LowPriorityPreAddRule implements PreAddRule {
48
48
  }
49
49
 
50
50
  // Compare incoming tx against lowest priority tx.
51
- // feeOnly mode (RPC): use strict fee comparison only — avoids churn from hash ordering
52
- // Default (gossip): use full comparePriority (fee + tx hash tiebreaker) for determinism
51
+ // feeOnly mode (RPC): use strict fee comparison only — avoids churn from hash ordering.
52
+ // When price bump is also set, require the bumped fee threshold.
53
+ // Default (gossip): use full comparePriority (fee + tx hash tiebreaker) for determinism.
53
54
  const isHigherPriority = context?.feeComparisonOnly
54
- ? incomingMeta.priorityFee > lowestPriorityMeta.priorityFee
55
+ ? context.priceBumpPercentage !== undefined
56
+ ? incomingMeta.priorityFee >=
57
+ getMinimumPriceBumpFee(lowestPriorityMeta.priorityFee, context.priceBumpPercentage)
58
+ : incomingMeta.priorityFee > lowestPriorityMeta.priorityFee
55
59
  : comparePriority(incomingMeta, lowestPriorityMeta) > 0;
56
60
 
57
61
  if (isHigherPriority) {
@@ -66,6 +70,11 @@ export class LowPriorityPreAddRule implements PreAddRule {
66
70
  }
67
71
 
68
72
  // Incoming tx has equal or lower priority - ignore it (it would be evicted anyway)
73
+ const minimumFee =
74
+ context?.feeComparisonOnly && context.priceBumpPercentage !== undefined
75
+ ? getMinimumPriceBumpFee(lowestPriorityMeta.priorityFee, context.priceBumpPercentage)
76
+ : lowestPriorityMeta.priorityFee + 1n;
77
+
69
78
  this.log.debug(
70
79
  `Pool at capacity (${currentCount}/${this.maxPoolSize}), ignoring ${incomingMeta.txHash} ` +
71
80
  `(priority ${incomingMeta.priorityFee}) - lower than existing minimum (priority ${lowestPriorityMeta.priorityFee})`,
@@ -75,8 +84,8 @@ export class LowPriorityPreAddRule implements PreAddRule {
75
84
  txHashesToEvict: [],
76
85
  reason: {
77
86
  code: TxPoolRejectionCode.LOW_PRIORITY_FEE,
78
- message: `Tx does not meet minimum priority fee. Required: ${lowestPriorityMeta.priorityFee + 1n}, got: ${incomingMeta.priorityFee}`,
79
- minimumPriorityFee: lowestPriorityMeta.priorityFee + 1n,
87
+ message: `Tx does not meet minimum priority fee. Required: ${minimumFee}, got: ${incomingMeta.priorityFee}`,
88
+ minimumPriorityFee: minimumFee,
80
89
  txPriorityFee: incomingMeta.priorityFee,
81
90
  },
82
91
  });
@@ -15,11 +15,12 @@ export class NullifierConflictRule implements PreAddRule {
15
15
 
16
16
  private log = createLogger('p2p:tx_pool_v2:nullifier_conflict_rule');
17
17
 
18
- check(incomingMeta: TxMetaData, poolAccess: PreAddPoolAccess, _context?: PreAddContext): Promise<PreAddResult> {
18
+ check(incomingMeta: TxMetaData, poolAccess: PreAddPoolAccess, context?: PreAddContext): Promise<PreAddResult> {
19
19
  const result = checkNullifierConflict(
20
20
  incomingMeta,
21
21
  nullifier => poolAccess.getTxHashByNullifier(nullifier),
22
22
  txHash => poolAccess.getMetadata(txHash),
23
+ context?.priceBumpPercentage,
23
24
  );
24
25
 
25
26
  if (result.shouldIgnore) {
@@ -7,6 +7,6 @@ export {
7
7
  type PoolReadAccess,
8
8
  DEFAULT_TX_POOL_V2_CONFIG,
9
9
  } from './interfaces.js';
10
- export { type TxMetaData, type TxState, buildTxMetaData, comparePriority } from './tx_metadata.js';
10
+ export { type TxMetaData, type TxState, buildTxMetaData, comparePriority, stubTxMetaData } from './tx_metadata.js';
11
11
  export { TxArchive } from './archive/index.js';
12
12
  export { DeletedPool } from './deleted_pool.js';
@@ -44,8 +44,8 @@ export type TxPoolV2Config = {
44
44
  minTxPoolAgeMs: number;
45
45
  /** Maximum number of evicted tx hashes to remember for metrics tracking */
46
46
  evictedTxCacheSize: number;
47
- /** The probability (0-1) that a transaction is discarded. 0 disables dropping. For testing purposes only. */
48
- dropTransactionsProbability: number;
47
+ /** Minimum percentage fee increase required to replace an existing tx via RPC (0 = no bump). */
48
+ priceBumpPercentage: bigint;
49
49
  };
50
50
 
51
51
  /**
@@ -56,7 +56,7 @@ export const DEFAULT_TX_POOL_V2_CONFIG: TxPoolV2Config = {
56
56
  archivedTxLimit: 0, // 0 = disabled
57
57
  minTxPoolAgeMs: 2_000,
58
58
  evictedTxCacheSize: 10_000,
59
- dropTransactionsProbability: 0,
59
+ priceBumpPercentage: 10n,
60
60
  };
61
61
 
62
62
  /**