@aztec/p2p 0.0.1-commit.87a0206 → 0.0.1-commit.8f9871590
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.
- package/dest/client/factory.d.ts +3 -3
- package/dest/client/factory.d.ts.map +1 -1
- package/dest/client/factory.js +42 -8
- package/dest/client/interface.d.ts +30 -15
- package/dest/client/interface.d.ts.map +1 -1
- package/dest/client/p2p_client.d.ts +33 -35
- package/dest/client/p2p_client.d.ts.map +1 -1
- package/dest/client/p2p_client.js +107 -137
- package/dest/config.d.ts +22 -4
- package/dest/config.d.ts.map +1 -1
- package/dest/config.js +16 -1
- package/dest/index.d.ts +2 -1
- package/dest/index.d.ts.map +1 -1
- package/dest/index.js +1 -0
- package/dest/mem_pools/attestation_pool/attestation_pool.d.ts +21 -12
- package/dest/mem_pools/attestation_pool/attestation_pool.d.ts.map +1 -1
- package/dest/mem_pools/attestation_pool/attestation_pool.js +67 -37
- package/dest/mem_pools/attestation_pool/attestation_pool_test_suite.d.ts +1 -1
- package/dest/mem_pools/attestation_pool/attestation_pool_test_suite.d.ts.map +1 -1
- package/dest/mem_pools/attestation_pool/attestation_pool_test_suite.js +53 -53
- package/dest/mem_pools/attestation_pool/index.d.ts +2 -2
- package/dest/mem_pools/attestation_pool/index.d.ts.map +1 -1
- package/dest/mem_pools/attestation_pool/index.js +1 -1
- package/dest/mem_pools/attestation_pool/mocks.d.ts +2 -2
- package/dest/mem_pools/attestation_pool/mocks.d.ts.map +1 -1
- package/dest/mem_pools/attestation_pool/mocks.js +2 -2
- package/dest/mem_pools/index.d.ts +2 -1
- package/dest/mem_pools/index.d.ts.map +1 -1
- package/dest/mem_pools/interface.d.ts +3 -3
- package/dest/mem_pools/interface.d.ts.map +1 -1
- package/dest/mem_pools/tx_pool/eviction/invalid_txs_after_mining_rule.js +3 -3
- package/dest/mem_pools/tx_pool_v2/deleted_pool.d.ts +102 -0
- package/dest/mem_pools/tx_pool_v2/deleted_pool.d.ts.map +1 -0
- package/dest/mem_pools/tx_pool_v2/deleted_pool.js +242 -0
- package/dest/mem_pools/tx_pool_v2/eviction/fee_payer_balance_eviction_rule.d.ts +1 -1
- package/dest/mem_pools/tx_pool_v2/eviction/fee_payer_balance_eviction_rule.d.ts.map +1 -1
- package/dest/mem_pools/tx_pool_v2/eviction/fee_payer_balance_eviction_rule.js +3 -0
- package/dest/mem_pools/tx_pool_v2/eviction/invalid_txs_after_mining_rule.js +5 -3
- package/dest/mem_pools/tx_pool_v2/eviction/invalid_txs_after_reorg_rule.js +3 -1
- package/dest/mem_pools/tx_pool_v2/eviction/low_priority_eviction_rule.d.ts +1 -1
- package/dest/mem_pools/tx_pool_v2/eviction/low_priority_eviction_rule.d.ts.map +1 -1
- package/dest/mem_pools/tx_pool_v2/eviction/low_priority_eviction_rule.js +3 -1
- package/dest/mem_pools/tx_pool_v2/index.d.ts +2 -1
- package/dest/mem_pools/tx_pool_v2/index.d.ts.map +1 -1
- package/dest/mem_pools/tx_pool_v2/index.js +1 -0
- package/dest/mem_pools/tx_pool_v2/interfaces.d.ts +7 -3
- package/dest/mem_pools/tx_pool_v2/interfaces.d.ts.map +1 -1
- package/dest/mem_pools/tx_pool_v2/interfaces.js +2 -1
- package/dest/mem_pools/tx_pool_v2/tx_metadata.d.ts +28 -4
- package/dest/mem_pools/tx_pool_v2/tx_metadata.d.ts.map +1 -1
- package/dest/mem_pools/tx_pool_v2/tx_metadata.js +37 -4
- package/dest/mem_pools/tx_pool_v2/tx_pool_indices.d.ts +8 -2
- package/dest/mem_pools/tx_pool_v2/tx_pool_indices.d.ts.map +1 -1
- package/dest/mem_pools/tx_pool_v2/tx_pool_indices.js +15 -2
- package/dest/mem_pools/tx_pool_v2/tx_pool_v2.d.ts +4 -2
- package/dest/mem_pools/tx_pool_v2/tx_pool_v2.d.ts.map +1 -1
- package/dest/mem_pools/tx_pool_v2/tx_pool_v2.js +6 -2
- package/dest/mem_pools/tx_pool_v2/tx_pool_v2_impl.d.ts +4 -2
- package/dest/mem_pools/tx_pool_v2/tx_pool_v2_impl.d.ts.map +1 -1
- package/dest/mem_pools/tx_pool_v2/tx_pool_v2_impl.js +110 -78
- package/dest/msg_validators/tx_validator/aggregate_tx_validator.d.ts +3 -3
- package/dest/msg_validators/tx_validator/aggregate_tx_validator.d.ts.map +1 -1
- package/dest/msg_validators/tx_validator/block_header_validator.d.ts +16 -3
- package/dest/msg_validators/tx_validator/block_header_validator.d.ts.map +1 -1
- package/dest/msg_validators/tx_validator/block_header_validator.js +1 -1
- package/dest/msg_validators/tx_validator/double_spend_validator.d.ts +13 -3
- package/dest/msg_validators/tx_validator/double_spend_validator.d.ts.map +1 -1
- package/dest/msg_validators/tx_validator/double_spend_validator.js +4 -4
- package/dest/msg_validators/tx_validator/timestamp_validator.d.ts +20 -4
- package/dest/msg_validators/tx_validator/timestamp_validator.d.ts.map +1 -1
- package/dest/msg_validators/tx_validator/timestamp_validator.js +6 -6
- package/dest/services/dummy_service.d.ts +6 -2
- package/dest/services/dummy_service.d.ts.map +1 -1
- package/dest/services/dummy_service.js +3 -0
- package/dest/services/encoding.d.ts +2 -2
- package/dest/services/encoding.d.ts.map +1 -1
- package/dest/services/encoding.js +2 -2
- package/dest/services/gossipsub/index.d.ts +3 -0
- package/dest/services/gossipsub/index.d.ts.map +1 -0
- package/dest/services/gossipsub/index.js +2 -0
- package/dest/services/gossipsub/scoring.d.ts +21 -3
- package/dest/services/gossipsub/scoring.d.ts.map +1 -1
- package/dest/services/gossipsub/scoring.js +24 -7
- package/dest/services/gossipsub/topic_score_params.d.ts +161 -0
- package/dest/services/gossipsub/topic_score_params.d.ts.map +1 -0
- package/dest/services/gossipsub/topic_score_params.js +324 -0
- package/dest/services/libp2p/libp2p_service.d.ts +11 -3
- package/dest/services/libp2p/libp2p_service.d.ts.map +1 -1
- package/dest/services/libp2p/libp2p_service.js +91 -67
- package/dest/services/peer-manager/peer_scoring.d.ts +1 -1
- package/dest/services/peer-manager/peer_scoring.d.ts.map +1 -1
- package/dest/services/peer-manager/peer_scoring.js +25 -2
- package/dest/services/reqresp/interface.d.ts +10 -1
- package/dest/services/reqresp/interface.d.ts.map +1 -1
- package/dest/services/reqresp/interface.js +15 -1
- package/dest/services/reqresp/protocols/block_txs/block_txs_handler.d.ts +3 -3
- package/dest/services/reqresp/protocols/block_txs/block_txs_handler.d.ts.map +1 -1
- package/dest/services/reqresp/protocols/block_txs/block_txs_reqresp.d.ts +7 -1
- package/dest/services/reqresp/protocols/block_txs/block_txs_reqresp.d.ts.map +1 -1
- package/dest/services/reqresp/protocols/block_txs/block_txs_reqresp.js +15 -0
- package/dest/services/reqresp/protocols/tx.d.ts +7 -1
- package/dest/services/reqresp/protocols/tx.d.ts.map +1 -1
- package/dest/services/reqresp/protocols/tx.js +20 -0
- package/dest/services/reqresp/reqresp.d.ts +1 -1
- package/dest/services/reqresp/reqresp.d.ts.map +1 -1
- package/dest/services/reqresp/reqresp.js +11 -4
- package/dest/services/service.d.ts +18 -1
- package/dest/services/service.d.ts.map +1 -1
- package/dest/services/tx_collection/config.d.ts +19 -1
- package/dest/services/tx_collection/config.d.ts.map +1 -1
- package/dest/services/tx_collection/config.js +46 -0
- package/dest/services/tx_collection/fast_tx_collection.d.ts +3 -1
- package/dest/services/tx_collection/fast_tx_collection.d.ts.map +1 -1
- package/dest/services/tx_collection/fast_tx_collection.js +17 -3
- package/dest/services/tx_collection/file_store_tx_collection.d.ts +53 -0
- package/dest/services/tx_collection/file_store_tx_collection.d.ts.map +1 -0
- package/dest/services/tx_collection/file_store_tx_collection.js +165 -0
- package/dest/services/tx_collection/file_store_tx_source.d.ts +28 -0
- package/dest/services/tx_collection/file_store_tx_source.d.ts.map +1 -0
- package/dest/services/tx_collection/file_store_tx_source.js +59 -0
- package/dest/services/tx_collection/index.d.ts +2 -1
- package/dest/services/tx_collection/index.d.ts.map +1 -1
- package/dest/services/tx_collection/index.js +1 -0
- package/dest/services/tx_collection/slow_tx_collection.d.ts +6 -2
- package/dest/services/tx_collection/slow_tx_collection.d.ts.map +1 -1
- package/dest/services/tx_collection/slow_tx_collection.js +55 -23
- package/dest/services/tx_collection/tx_collection.d.ts +19 -7
- package/dest/services/tx_collection/tx_collection.d.ts.map +1 -1
- package/dest/services/tx_collection/tx_collection.js +75 -3
- package/dest/services/tx_collection/tx_collection_sink.d.ts +15 -6
- package/dest/services/tx_collection/tx_collection_sink.d.ts.map +1 -1
- package/dest/services/tx_collection/tx_collection_sink.js +13 -7
- package/dest/services/tx_file_store/config.d.ts +1 -3
- package/dest/services/tx_file_store/config.d.ts.map +1 -1
- package/dest/services/tx_file_store/config.js +0 -4
- package/dest/services/tx_file_store/tx_file_store.d.ts +4 -3
- package/dest/services/tx_file_store/tx_file_store.d.ts.map +1 -1
- package/dest/services/tx_file_store/tx_file_store.js +8 -5
- package/dest/services/tx_provider.d.ts +3 -3
- package/dest/services/tx_provider.d.ts.map +1 -1
- package/dest/services/tx_provider.js +5 -4
- package/dest/test-helpers/make-test-p2p-clients.d.ts +3 -3
- package/dest/test-helpers/make-test-p2p-clients.d.ts.map +1 -1
- package/dest/test-helpers/mock-pubsub.d.ts +27 -1
- package/dest/test-helpers/mock-pubsub.d.ts.map +1 -1
- package/dest/test-helpers/mock-pubsub.js +97 -2
- package/dest/test-helpers/reqresp-nodes.d.ts +1 -1
- package/dest/test-helpers/reqresp-nodes.d.ts.map +1 -1
- package/dest/test-helpers/reqresp-nodes.js +2 -1
- package/dest/test-helpers/testbench-utils.d.ts +32 -24
- package/dest/test-helpers/testbench-utils.d.ts.map +1 -1
- package/dest/test-helpers/testbench-utils.js +103 -36
- package/dest/testbench/p2p_client_testbench_worker.js +3 -3
- package/package.json +14 -14
- package/src/client/factory.ts +78 -9
- package/src/client/interface.ts +32 -13
- package/src/client/p2p_client.ts +135 -157
- package/src/config.ts +34 -2
- package/src/index.ts +1 -0
- package/src/mem_pools/attestation_pool/attestation_pool.ts +95 -44
- package/src/mem_pools/attestation_pool/attestation_pool_test_suite.ts +57 -53
- package/src/mem_pools/attestation_pool/index.ts +3 -3
- package/src/mem_pools/attestation_pool/mocks.ts +2 -1
- package/src/mem_pools/index.ts +3 -0
- package/src/mem_pools/interface.ts +2 -2
- package/src/mem_pools/tx_pool/README.md +1 -1
- package/src/mem_pools/tx_pool/eviction/invalid_txs_after_mining_rule.ts +3 -3
- package/src/mem_pools/tx_pool_v2/README.md +76 -10
- package/src/mem_pools/tx_pool_v2/deleted_pool.ts +310 -0
- package/src/mem_pools/tx_pool_v2/eviction/fee_payer_balance_eviction_rule.ts +3 -0
- package/src/mem_pools/tx_pool_v2/eviction/invalid_txs_after_mining_rule.ts +3 -3
- package/src/mem_pools/tx_pool_v2/eviction/invalid_txs_after_reorg_rule.ts +1 -1
- package/src/mem_pools/tx_pool_v2/eviction/low_priority_eviction_rule.ts +3 -1
- package/src/mem_pools/tx_pool_v2/index.ts +1 -0
- package/src/mem_pools/tx_pool_v2/interfaces.ts +8 -2
- package/src/mem_pools/tx_pool_v2/tx_metadata.ts +57 -7
- package/src/mem_pools/tx_pool_v2/tx_pool_indices.ts +18 -2
- package/src/mem_pools/tx_pool_v2/tx_pool_v2.ts +7 -1
- package/src/mem_pools/tx_pool_v2/tx_pool_v2_impl.ts +122 -80
- package/src/msg_validators/tx_validator/aggregate_tx_validator.ts +2 -2
- package/src/msg_validators/tx_validator/block_header_validator.ts +15 -3
- package/src/msg_validators/tx_validator/double_spend_validator.ts +11 -6
- package/src/msg_validators/tx_validator/timestamp_validator.ts +23 -18
- package/src/services/dummy_service.ts +6 -0
- package/src/services/encoding.ts +2 -2
- package/src/services/gossipsub/README.md +626 -0
- package/src/services/gossipsub/index.ts +2 -0
- package/src/services/gossipsub/scoring.ts +29 -5
- package/src/services/gossipsub/topic_score_params.ts +451 -0
- package/src/services/libp2p/libp2p_service.ts +91 -70
- package/src/services/peer-manager/peer_scoring.ts +25 -0
- package/src/services/reqresp/interface.ts +26 -1
- package/src/services/reqresp/protocols/block_txs/block_txs_handler.ts +2 -2
- package/src/services/reqresp/protocols/block_txs/block_txs_reqresp.ts +17 -0
- package/src/services/reqresp/protocols/tx.ts +22 -0
- package/src/services/reqresp/reqresp.ts +13 -3
- package/src/services/service.ts +20 -0
- package/src/services/tx_collection/config.ts +68 -0
- package/src/services/tx_collection/fast_tx_collection.ts +14 -2
- package/src/services/tx_collection/file_store_tx_collection.ts +198 -0
- package/src/services/tx_collection/file_store_tx_source.ts +73 -0
- package/src/services/tx_collection/index.ts +1 -0
- package/src/services/tx_collection/slow_tx_collection.ts +64 -30
- package/src/services/tx_collection/tx_collection.ts +109 -13
- package/src/services/tx_collection/tx_collection_sink.ts +17 -7
- package/src/services/tx_file_store/config.ts +0 -6
- package/src/services/tx_file_store/tx_file_store.ts +9 -7
- package/src/services/tx_provider.ts +8 -7
- package/src/test-helpers/make-test-p2p-clients.ts +3 -3
- package/src/test-helpers/mock-pubsub.ts +133 -3
- package/src/test-helpers/reqresp-nodes.ts +2 -1
- package/src/test-helpers/testbench-utils.ts +117 -40
- package/src/testbench/p2p_client_testbench_worker.ts +3 -3
|
@@ -10,7 +10,11 @@ import {
|
|
|
10
10
|
makeCheckpointProposal,
|
|
11
11
|
} from '@aztec/stdlib/testing';
|
|
12
12
|
|
|
13
|
-
import {
|
|
13
|
+
import {
|
|
14
|
+
type AttestationPool,
|
|
15
|
+
MAX_BLOCK_PROPOSALS_PER_POSITION,
|
|
16
|
+
MAX_CHECKPOINT_PROPOSALS_PER_SLOT,
|
|
17
|
+
} from './attestation_pool.js';
|
|
14
18
|
import { mockCheckpointAttestation } from './mocks.js';
|
|
15
19
|
|
|
16
20
|
const NUMBER_OF_SIGNERS_PER_TEST = 4;
|
|
@@ -191,7 +195,7 @@ export function describeAttestationPool(getAttestationPool: () => AttestationPoo
|
|
|
191
195
|
|
|
192
196
|
expect(result.added).toBe(true);
|
|
193
197
|
expect(result.alreadyExists).toBe(false);
|
|
194
|
-
expect(result.
|
|
198
|
+
expect(result.count).toBe(1);
|
|
195
199
|
|
|
196
200
|
const retrievedProposal = await ap.getBlockProposal(proposalId);
|
|
197
201
|
|
|
@@ -258,7 +262,7 @@ export function describeAttestationPool(getAttestationPool: () => AttestationPoo
|
|
|
258
262
|
|
|
259
263
|
expect(result.added).toBe(true);
|
|
260
264
|
expect(result.alreadyExists).toBe(false);
|
|
261
|
-
expect(result.
|
|
265
|
+
expect(result.count).toBe(1);
|
|
262
266
|
|
|
263
267
|
const retrievedProposal = await ap.getCheckpointProposal(proposalId);
|
|
264
268
|
|
|
@@ -324,12 +328,12 @@ export function describeAttestationPool(getAttestationPool: () => AttestationPoo
|
|
|
324
328
|
it('should return added=false when exceeding capacity', async () => {
|
|
325
329
|
const slotNumber = 420;
|
|
326
330
|
|
|
327
|
-
// Add
|
|
328
|
-
for (let i = 0; i <
|
|
331
|
+
// Add MAX_CHECKPOINT_PROPOSALS_PER_SLOT proposals
|
|
332
|
+
for (let i = 0; i < MAX_CHECKPOINT_PROPOSALS_PER_SLOT; i++) {
|
|
329
333
|
const proposal = await mockCheckpointProposalForPool(signers[i % NUMBER_OF_SIGNERS_PER_TEST], slotNumber);
|
|
330
334
|
const result = await ap.tryAddCheckpointProposal(proposal);
|
|
331
335
|
expect(result.added).toBe(true);
|
|
332
|
-
expect(result.
|
|
336
|
+
expect(result.count).toBe(i + 1);
|
|
333
337
|
}
|
|
334
338
|
|
|
335
339
|
// The next proposal should not be added
|
|
@@ -337,7 +341,7 @@ export function describeAttestationPool(getAttestationPool: () => AttestationPoo
|
|
|
337
341
|
const result = await ap.tryAddCheckpointProposal(extraProposal);
|
|
338
342
|
expect(result.added).toBe(false);
|
|
339
343
|
expect(result.alreadyExists).toBe(false);
|
|
340
|
-
expect(result.
|
|
344
|
+
expect(result.count).toBe(MAX_CHECKPOINT_PROPOSALS_PER_SLOT);
|
|
341
345
|
});
|
|
342
346
|
});
|
|
343
347
|
|
|
@@ -358,13 +362,13 @@ export function describeAttestationPool(getAttestationPool: () => AttestationPoo
|
|
|
358
362
|
};
|
|
359
363
|
|
|
360
364
|
describe('tryAddBlockProposal duplicate detection', () => {
|
|
361
|
-
it('should return
|
|
365
|
+
it('should return count=1 when pool is empty', async () => {
|
|
362
366
|
const proposal = await mockBlockProposalWithIndex(signers[0], 100, 0);
|
|
363
367
|
const result = await ap.tryAddBlockProposal(proposal);
|
|
364
368
|
|
|
365
369
|
expect(result.added).toBe(true);
|
|
366
370
|
expect(result.alreadyExists).toBe(false);
|
|
367
|
-
expect(result.
|
|
371
|
+
expect(result.count).toBe(1);
|
|
368
372
|
});
|
|
369
373
|
|
|
370
374
|
it('should return alreadyExists when same proposal exists', async () => {
|
|
@@ -375,17 +379,17 @@ export function describeAttestationPool(getAttestationPool: () => AttestationPoo
|
|
|
375
379
|
|
|
376
380
|
expect(result.added).toBe(false);
|
|
377
381
|
expect(result.alreadyExists).toBe(true);
|
|
378
|
-
expect(result.
|
|
382
|
+
expect(result.count).toBe(1);
|
|
379
383
|
});
|
|
380
384
|
|
|
381
|
-
it('should detect duplicate via
|
|
385
|
+
it('should detect duplicate via count when different proposal exists at same position', async () => {
|
|
382
386
|
const slotNumber = 100;
|
|
383
387
|
const indexWithinCheckpoint = 2;
|
|
384
388
|
|
|
385
389
|
// Add first proposal
|
|
386
390
|
const proposal1 = await mockBlockProposalWithIndex(signers[0], slotNumber, indexWithinCheckpoint);
|
|
387
391
|
const result1 = await ap.tryAddBlockProposal(proposal1);
|
|
388
|
-
expect(result1.
|
|
392
|
+
expect(result1.count).toBe(1);
|
|
389
393
|
|
|
390
394
|
// Add a different proposal at same position - this is a duplicate (equivocation)
|
|
391
395
|
const proposal2 = await mockBlockProposalWithIndex(signers[1], slotNumber, indexWithinCheckpoint);
|
|
@@ -393,8 +397,8 @@ export function describeAttestationPool(getAttestationPool: () => AttestationPoo
|
|
|
393
397
|
|
|
394
398
|
expect(result2.added).toBe(true);
|
|
395
399
|
expect(result2.alreadyExists).toBe(false);
|
|
396
|
-
//
|
|
397
|
-
expect(result2.
|
|
400
|
+
// count >= 2 indicates duplicate detection
|
|
401
|
+
expect(result2.count).toBe(2);
|
|
398
402
|
});
|
|
399
403
|
|
|
400
404
|
it('should not detect duplicate for different positions in same slot', async () => {
|
|
@@ -409,8 +413,8 @@ export function describeAttestationPool(getAttestationPool: () => AttestationPoo
|
|
|
409
413
|
const result = await ap.tryAddBlockProposal(proposal2);
|
|
410
414
|
|
|
411
415
|
expect(result.added).toBe(true);
|
|
412
|
-
//
|
|
413
|
-
expect(result.
|
|
416
|
+
// count = 1 means no duplicate for this position
|
|
417
|
+
expect(result.count).toBe(1);
|
|
414
418
|
});
|
|
415
419
|
|
|
416
420
|
it('should not detect duplicate for same position in different slots', async () => {
|
|
@@ -425,37 +429,37 @@ export function describeAttestationPool(getAttestationPool: () => AttestationPoo
|
|
|
425
429
|
const result = await ap.tryAddBlockProposal(proposal2);
|
|
426
430
|
|
|
427
431
|
expect(result.added).toBe(true);
|
|
428
|
-
//
|
|
429
|
-
expect(result.
|
|
432
|
+
// count = 1 means no duplicate for this position
|
|
433
|
+
expect(result.count).toBe(1);
|
|
430
434
|
});
|
|
431
435
|
|
|
432
|
-
it('should track multiple duplicates correctly via
|
|
436
|
+
it('should track multiple duplicates correctly via count', async () => {
|
|
433
437
|
const slotNumber = 100;
|
|
434
438
|
const indexWithinCheckpoint = 0;
|
|
435
439
|
|
|
436
440
|
// Add multiple proposals for same position
|
|
437
441
|
const proposal1 = await mockBlockProposalWithIndex(signers[0], slotNumber, indexWithinCheckpoint);
|
|
438
442
|
const result1 = await ap.tryAddBlockProposal(proposal1);
|
|
439
|
-
expect(result1.
|
|
443
|
+
expect(result1.count).toBe(1);
|
|
440
444
|
|
|
441
445
|
const proposal2 = await mockBlockProposalWithIndex(signers[1], slotNumber, indexWithinCheckpoint);
|
|
442
446
|
const result2 = await ap.tryAddBlockProposal(proposal2);
|
|
443
|
-
expect(result2.
|
|
447
|
+
expect(result2.count).toBe(2);
|
|
444
448
|
|
|
445
449
|
// Add a third proposal for same position
|
|
446
450
|
const proposal3 = await mockBlockProposalWithIndex(signers[2], slotNumber, indexWithinCheckpoint);
|
|
447
451
|
const result3 = await ap.tryAddBlockProposal(proposal3);
|
|
448
452
|
|
|
449
453
|
expect(result3.added).toBe(true);
|
|
450
|
-
expect(result3.
|
|
454
|
+
expect(result3.count).toBe(3);
|
|
451
455
|
});
|
|
452
456
|
|
|
453
457
|
it('should return added=false when exceeding capacity', async () => {
|
|
454
458
|
const slotNumber = 100;
|
|
455
459
|
const indexWithinCheckpoint = 0;
|
|
456
460
|
|
|
457
|
-
// Add
|
|
458
|
-
for (let i = 0; i <
|
|
461
|
+
// Add MAX_BLOCK_PROPOSALS_PER_POSITION proposals
|
|
462
|
+
for (let i = 0; i < MAX_BLOCK_PROPOSALS_PER_POSITION; i++) {
|
|
459
463
|
const proposal = await mockBlockProposalWithIndex(
|
|
460
464
|
signers[i % NUMBER_OF_SIGNERS_PER_TEST],
|
|
461
465
|
slotNumber,
|
|
@@ -463,7 +467,7 @@ export function describeAttestationPool(getAttestationPool: () => AttestationPoo
|
|
|
463
467
|
);
|
|
464
468
|
const result = await ap.tryAddBlockProposal(proposal);
|
|
465
469
|
expect(result.added).toBe(true);
|
|
466
|
-
expect(result.
|
|
470
|
+
expect(result.count).toBe(i + 1);
|
|
467
471
|
}
|
|
468
472
|
|
|
469
473
|
// The next proposal should not be added
|
|
@@ -471,7 +475,7 @@ export function describeAttestationPool(getAttestationPool: () => AttestationPoo
|
|
|
471
475
|
const result = await ap.tryAddBlockProposal(extraProposal);
|
|
472
476
|
expect(result.added).toBe(false);
|
|
473
477
|
expect(result.alreadyExists).toBe(false);
|
|
474
|
-
expect(result.
|
|
478
|
+
expect(result.count).toBe(MAX_BLOCK_PROPOSALS_PER_POSITION);
|
|
475
479
|
});
|
|
476
480
|
|
|
477
481
|
it('should clean up block position index when deleting old data', async () => {
|
|
@@ -482,18 +486,18 @@ export function describeAttestationPool(getAttestationPool: () => AttestationPoo
|
|
|
482
486
|
const proposal1 = await mockBlockProposalWithIndex(signers[0], slotNumber, indexWithinCheckpoint);
|
|
483
487
|
await ap.tryAddBlockProposal(proposal1);
|
|
484
488
|
|
|
485
|
-
// Verify it's tracked (adding another should show
|
|
489
|
+
// Verify it's tracked (adding another should show count = 2)
|
|
486
490
|
const proposal2 = await mockBlockProposalWithIndex(signers[1], slotNumber, indexWithinCheckpoint);
|
|
487
491
|
let result = await ap.tryAddBlockProposal(proposal2);
|
|
488
|
-
expect(result.
|
|
492
|
+
expect(result.count).toBe(2);
|
|
489
493
|
|
|
490
494
|
// Delete old data
|
|
491
495
|
await ap.deleteOlderThan(SlotNumber(slotNumber + 1));
|
|
492
496
|
|
|
493
|
-
// Verify position index is cleaned up (
|
|
497
|
+
// Verify position index is cleaned up (count should be 1 now)
|
|
494
498
|
const proposal3 = await mockBlockProposalWithIndex(signers[2], slotNumber, indexWithinCheckpoint);
|
|
495
499
|
result = await ap.tryAddBlockProposal(proposal3);
|
|
496
|
-
expect(result.
|
|
500
|
+
expect(result.count).toBe(1);
|
|
497
501
|
});
|
|
498
502
|
|
|
499
503
|
it('should correctly delete block proposals at slot boundary', async () => {
|
|
@@ -514,16 +518,16 @@ export function describeAttestationPool(getAttestationPool: () => AttestationPoo
|
|
|
514
518
|
// Slot 99 proposals should have their index cleaned up
|
|
515
519
|
const newProposal99 = await mockBlockProposalWithIndex(signers[0], 99, 0);
|
|
516
520
|
const result99 = await ap.tryAddBlockProposal(newProposal99);
|
|
517
|
-
expect(result99.
|
|
521
|
+
expect(result99.count).toBe(1); // Index was cleaned up
|
|
518
522
|
|
|
519
523
|
// Slot 100 and 101 should still be tracked
|
|
520
524
|
const newProposal100 = await mockBlockProposalWithIndex(signers[1], 100, 0);
|
|
521
525
|
const result100 = await ap.tryAddBlockProposal(newProposal100);
|
|
522
|
-
expect(result100.
|
|
526
|
+
expect(result100.count).toBe(2); // Still has the original
|
|
523
527
|
|
|
524
528
|
const newProposal101 = await mockBlockProposalWithIndex(signers[2], 101, 0);
|
|
525
529
|
const result101 = await ap.tryAddBlockProposal(newProposal101);
|
|
526
|
-
expect(result101.
|
|
530
|
+
expect(result101.count).toBe(2); // Still has the original
|
|
527
531
|
});
|
|
528
532
|
|
|
529
533
|
it('should delete all indices for a given slot', async () => {
|
|
@@ -544,15 +548,15 @@ export function describeAttestationPool(getAttestationPool: () => AttestationPoo
|
|
|
544
548
|
// All indices should be cleaned up
|
|
545
549
|
const newProposal0 = await mockBlockProposalWithIndex(signers[0], slotNumber, 0);
|
|
546
550
|
const result0 = await ap.tryAddBlockProposal(newProposal0);
|
|
547
|
-
expect(result0.
|
|
551
|
+
expect(result0.count).toBe(1);
|
|
548
552
|
|
|
549
553
|
const newProposal1 = await mockBlockProposalWithIndex(signers[1], slotNumber, 1);
|
|
550
554
|
const result1 = await ap.tryAddBlockProposal(newProposal1);
|
|
551
|
-
expect(result1.
|
|
555
|
+
expect(result1.count).toBe(1);
|
|
552
556
|
|
|
553
557
|
const newProposal2 = await mockBlockProposalWithIndex(signers[2], slotNumber, 2);
|
|
554
558
|
const result2 = await ap.tryAddBlockProposal(newProposal2);
|
|
555
|
-
expect(result2.
|
|
559
|
+
expect(result2.count).toBe(1);
|
|
556
560
|
});
|
|
557
561
|
|
|
558
562
|
it('should delete block proposals from storage when deleting old data', async () => {
|
|
@@ -598,13 +602,13 @@ export function describeAttestationPool(getAttestationPool: () => AttestationPoo
|
|
|
598
602
|
return proposal.toCore();
|
|
599
603
|
};
|
|
600
604
|
|
|
601
|
-
it('should return
|
|
605
|
+
it('should return count=1 when pool is empty', async () => {
|
|
602
606
|
const proposal = await mockCheckpointProposalCoreForPool(signers[0], 100);
|
|
603
607
|
const result = await ap.tryAddCheckpointProposal(proposal);
|
|
604
608
|
|
|
605
609
|
expect(result.added).toBe(true);
|
|
606
610
|
expect(result.alreadyExists).toBe(false);
|
|
607
|
-
expect(result.
|
|
611
|
+
expect(result.count).toBe(1);
|
|
608
612
|
});
|
|
609
613
|
|
|
610
614
|
it('should return alreadyExists when same proposal exists', async () => {
|
|
@@ -615,16 +619,16 @@ export function describeAttestationPool(getAttestationPool: () => AttestationPoo
|
|
|
615
619
|
|
|
616
620
|
expect(result.added).toBe(false);
|
|
617
621
|
expect(result.alreadyExists).toBe(true);
|
|
618
|
-
expect(result.
|
|
622
|
+
expect(result.count).toBe(1);
|
|
619
623
|
});
|
|
620
624
|
|
|
621
|
-
it('should detect duplicate via
|
|
625
|
+
it('should detect duplicate via count when different proposal exists for same slot', async () => {
|
|
622
626
|
const slotNumber = 100;
|
|
623
627
|
|
|
624
628
|
// Add first proposal
|
|
625
629
|
const proposal1 = await mockCheckpointProposalCoreForPool(signers[0], slotNumber);
|
|
626
630
|
const result1 = await ap.tryAddCheckpointProposal(proposal1);
|
|
627
|
-
expect(result1.
|
|
631
|
+
expect(result1.count).toBe(1);
|
|
628
632
|
|
|
629
633
|
// Add a different proposal for same slot - this is a duplicate (equivocation)
|
|
630
634
|
const proposal2 = await mockCheckpointProposalCoreForPool(signers[1], slotNumber);
|
|
@@ -632,8 +636,8 @@ export function describeAttestationPool(getAttestationPool: () => AttestationPoo
|
|
|
632
636
|
|
|
633
637
|
expect(result2.added).toBe(true);
|
|
634
638
|
expect(result2.alreadyExists).toBe(false);
|
|
635
|
-
//
|
|
636
|
-
expect(result2.
|
|
639
|
+
// count >= 2 indicates duplicate detection
|
|
640
|
+
expect(result2.count).toBe(2);
|
|
637
641
|
});
|
|
638
642
|
|
|
639
643
|
it('should not detect duplicate for different slots', async () => {
|
|
@@ -646,28 +650,28 @@ export function describeAttestationPool(getAttestationPool: () => AttestationPoo
|
|
|
646
650
|
const result = await ap.tryAddCheckpointProposal(proposal2);
|
|
647
651
|
|
|
648
652
|
expect(result.added).toBe(true);
|
|
649
|
-
//
|
|
650
|
-
expect(result.
|
|
653
|
+
// count = 1 means no duplicate for this slot
|
|
654
|
+
expect(result.count).toBe(1);
|
|
651
655
|
});
|
|
652
656
|
|
|
653
|
-
it('should track multiple duplicates correctly via
|
|
657
|
+
it('should track multiple duplicates correctly via count', async () => {
|
|
654
658
|
const slotNumber = 100;
|
|
655
659
|
|
|
656
660
|
// Add multiple proposals for same slot
|
|
657
661
|
const proposal1 = await mockCheckpointProposalCoreForPool(signers[0], slotNumber);
|
|
658
662
|
const result1 = await ap.tryAddCheckpointProposal(proposal1);
|
|
659
|
-
expect(result1.
|
|
663
|
+
expect(result1.count).toBe(1);
|
|
660
664
|
|
|
661
665
|
const proposal2 = await mockCheckpointProposalCoreForPool(signers[1], slotNumber);
|
|
662
666
|
const result2 = await ap.tryAddCheckpointProposal(proposal2);
|
|
663
|
-
expect(result2.
|
|
667
|
+
expect(result2.count).toBe(2);
|
|
664
668
|
|
|
665
669
|
// Add a third proposal for same slot
|
|
666
670
|
const proposal3 = await mockCheckpointProposalCoreForPool(signers[2], slotNumber);
|
|
667
671
|
const result3 = await ap.tryAddCheckpointProposal(proposal3);
|
|
668
672
|
|
|
669
673
|
expect(result3.added).toBe(true);
|
|
670
|
-
expect(result3.
|
|
674
|
+
expect(result3.count).toBe(3);
|
|
671
675
|
});
|
|
672
676
|
|
|
673
677
|
it('should not count attestations as proposals for duplicate detection', async () => {
|
|
@@ -684,8 +688,8 @@ export function describeAttestationPool(getAttestationPool: () => AttestationPoo
|
|
|
684
688
|
|
|
685
689
|
expect(result.added).toBe(true);
|
|
686
690
|
expect(result.alreadyExists).toBe(false);
|
|
687
|
-
//
|
|
688
|
-
expect(result.
|
|
691
|
+
// count should be 1, NOT 2 - attestations should not count as proposals
|
|
692
|
+
expect(result.count).toBe(1);
|
|
689
693
|
});
|
|
690
694
|
|
|
691
695
|
it('should not count attestations for different proposals as duplicates', async () => {
|
|
@@ -703,14 +707,14 @@ export function describeAttestationPool(getAttestationPool: () => AttestationPoo
|
|
|
703
707
|
const result1 = await ap.tryAddCheckpointProposal(proposal1);
|
|
704
708
|
|
|
705
709
|
expect(result1.added).toBe(true);
|
|
706
|
-
expect(result1.
|
|
710
|
+
expect(result1.count).toBe(1);
|
|
707
711
|
|
|
708
712
|
// Add the second checkpoint proposal - this IS a duplicate (different archive, same slot)
|
|
709
713
|
const proposal2 = await mockCheckpointProposalCoreForPool(signers[3], slotNumber, archive2);
|
|
710
714
|
const result2 = await ap.tryAddCheckpointProposal(proposal2);
|
|
711
715
|
|
|
712
716
|
expect(result2.added).toBe(true);
|
|
713
|
-
expect(result2.
|
|
717
|
+
expect(result2.count).toBe(2);
|
|
714
718
|
});
|
|
715
719
|
});
|
|
716
720
|
});
|
|
@@ -3,7 +3,7 @@ export {
|
|
|
3
3
|
type AttestationPoolApi,
|
|
4
4
|
type TryAddResult,
|
|
5
5
|
createTestAttestationPool,
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
6
|
+
MAX_CHECKPOINT_PROPOSALS_PER_SLOT,
|
|
7
|
+
MAX_BLOCK_PROPOSALS_PER_POSITION,
|
|
8
|
+
MAX_ATTESTATIONS_PER_SLOT_AND_SIGNER,
|
|
9
9
|
} from './attestation_pool.js';
|
|
@@ -34,9 +34,10 @@ export const mockCheckpointAttestation = (
|
|
|
34
34
|
slot: number = 0,
|
|
35
35
|
archive: Fr = Fr.random(),
|
|
36
36
|
header?: CheckpointHeader,
|
|
37
|
+
feeAssetPriceModifier: bigint = 0n,
|
|
37
38
|
): CheckpointAttestation => {
|
|
38
39
|
header = header ?? CheckpointHeader.random({ slotNumber: SlotNumber(slot) });
|
|
39
|
-
const payload = new ConsensusPayload(header, archive);
|
|
40
|
+
const payload = new ConsensusPayload(header, archive, feeAssetPriceModifier);
|
|
40
41
|
|
|
41
42
|
const attestationHash = getHashedSignaturePayloadEthSignedMessage(
|
|
42
43
|
payload,
|
package/src/mem_pools/index.ts
CHANGED
|
@@ -1,3 +1,6 @@
|
|
|
1
1
|
export { AttestationPool, type AttestationPoolApi } from './attestation_pool/attestation_pool.js';
|
|
2
2
|
export { type MemPools } from './interface.js';
|
|
3
|
+
// Old TxPool exports - kept temporarily for external consumers
|
|
3
4
|
export { type TxPool } from './tx_pool/tx_pool.js';
|
|
5
|
+
// New TxPoolV2 exports
|
|
6
|
+
export { type TxPoolV2, type TxPoolV2Config, type TxPoolV2Events, type AddTxsResult } from './tx_pool_v2/index.js';
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import type { AttestationPoolApi } from './attestation_pool/attestation_pool.js';
|
|
2
|
-
import type {
|
|
2
|
+
import type { TxPoolV2 } from './tx_pool_v2/interfaces.js';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* A interface the combines all mempools
|
|
6
6
|
*/
|
|
7
7
|
export type MemPools = {
|
|
8
|
-
txPool:
|
|
8
|
+
txPool: TxPoolV2;
|
|
9
9
|
attestationPool: AttestationPoolApi;
|
|
10
10
|
};
|
|
@@ -213,7 +213,7 @@ The [`EvictionManager`](eviction/eviction_manager.ts) coordinates eviction by:
|
|
|
213
213
|
Evicts transactions that become invalid after a block is mined:
|
|
214
214
|
|
|
215
215
|
- Duplicate nullifiers: Txs with nullifiers already included in the mined block
|
|
216
|
-
- Expired transactions: Txs with `
|
|
216
|
+
- Expired transactions: Txs with `expirationTimestamp` ≤ mined block timestamp
|
|
217
217
|
|
|
218
218
|
#### 2. `InvalidTxsAfterReorgRule`
|
|
219
219
|
|
|
@@ -68,10 +68,10 @@ export class InvalidTxsAfterMiningRule implements EvictionRule {
|
|
|
68
68
|
}
|
|
69
69
|
|
|
70
70
|
// Evict pending txs with an expiration timestamp less than or equal to the mined block timestamp
|
|
71
|
-
const
|
|
72
|
-
if (
|
|
71
|
+
const expirationTimestamp = tx.data.expirationTimestamp;
|
|
72
|
+
if (expirationTimestamp <= timestamp) {
|
|
73
73
|
this.log.verbose(
|
|
74
|
-
`Evicting tx ${txHash} from pool due to the tx being expired (
|
|
74
|
+
`Evicting tx ${txHash} from pool due to the tx being expired (expirationTimestamp: ${expirationTimestamp}, mined block timestamp: ${timestamp})`,
|
|
75
75
|
);
|
|
76
76
|
txsToEvict.push(txHash);
|
|
77
77
|
continue;
|
|
@@ -28,13 +28,22 @@ TxPoolV2 manages transactions through a state machine with clear transitions:
|
|
|
28
28
|
│ MINED │───────────────────┘
|
|
29
29
|
│ (included in a block) │ handlePrunedBlocks()
|
|
30
30
|
└─────────────────────────────────────┘ (reorg)
|
|
31
|
-
│
|
|
32
|
-
│ handleFinalizedBlock()
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
│
|
|
37
|
-
|
|
31
|
+
│ │
|
|
32
|
+
│ handleFinalizedBlock() │ eviction after reorg
|
|
33
|
+
│ / eviction / failed exec │ (validation failure)
|
|
34
|
+
▼ ▼
|
|
35
|
+
┌─────────────────────────────────────┐ ┌─────────────────────────────────────┐
|
|
36
|
+
│ SLOT-SOFT-DELETED │ │ PRUNE-SOFT-DELETED │
|
|
37
|
+
│ (kept in DB until next slot) │ │ (kept in DB until finalized) │
|
|
38
|
+
└─────────────────────────────────────┘ └─────────────────────────────────────┘
|
|
39
|
+
│ │
|
|
40
|
+
│ prepareForSlot() │ handleFinalizedBlock()
|
|
41
|
+
│ (slot advanced) │ (mined block finalized)
|
|
42
|
+
▼ ▼
|
|
43
|
+
┌─────────────────────────────────────┐ ┌─────────────────────────────────────┐
|
|
44
|
+
│ HARD-DELETED │ │ HARD-DELETED │
|
|
45
|
+
│ (permanently removed from DB) │ │ (permanently removed from DB) │
|
|
46
|
+
└─────────────────────────────────────┘ └─────────────────────────────────────┘
|
|
38
47
|
```
|
|
39
48
|
|
|
40
49
|
## Key Components
|
|
@@ -52,6 +61,14 @@ Core implementation containing:
|
|
|
52
61
|
- Pre-add rule execution
|
|
53
62
|
- Post-event eviction rule execution
|
|
54
63
|
|
|
64
|
+
### DeletedPool (`deleted_pool.ts`)
|
|
65
|
+
|
|
66
|
+
Manages all transaction deletions in the pool with two soft-deletion mechanisms:
|
|
67
|
+
- **Slot-based**: Non-pruned txs are kept in DB until the next slot, allowing other nodes to fetch them via reqresp
|
|
68
|
+
- **Prune-based**: Txs from pruned blocks are kept in DB until their original mined block is finalized
|
|
69
|
+
|
|
70
|
+
All deletions go through `DeletedPool.deleteTx()`, which routes to the appropriate path based on whether the tx is tracked as being from a pruned block.
|
|
71
|
+
|
|
55
72
|
### TxMetaData (`tx_metadata.ts`)
|
|
56
73
|
|
|
57
74
|
Lightweight metadata stored alongside each transaction:
|
|
@@ -62,14 +79,60 @@ Lightweight metadata stored alongside each transaction:
|
|
|
62
79
|
- `claimAmount`: Fee payer's claim from bridging
|
|
63
80
|
- `feeLimit`: Maximum fee the tx can pay
|
|
64
81
|
- `nullifiers`: For conflict detection
|
|
65
|
-
- `
|
|
82
|
+
- `expirationTimestamp`: Expiration timestamp
|
|
66
83
|
- `minedL2BlockId`: Set when mined (undefined otherwise)
|
|
67
84
|
|
|
68
85
|
State is derived by TxPoolIndices:
|
|
69
86
|
- `mined` if `minedL2BlockId` is set
|
|
70
87
|
- `protected` if in protection map
|
|
88
|
+
- `deleted` if soft-deleted (slot-based or prune-based, evicted but kept in DB)
|
|
71
89
|
- `pending` otherwise
|
|
72
90
|
|
|
91
|
+
## Soft Deletion
|
|
92
|
+
|
|
93
|
+
Deleted transactions are kept in the database for a grace period before being permanently removed. There are two soft-deletion mechanisms:
|
|
94
|
+
|
|
95
|
+
### Slot-Based Soft Deletion
|
|
96
|
+
|
|
97
|
+
When a transaction is deleted from the pool (eviction, validation failure, failed execution) and is **not** from a pruned block, it is "slot-soft-deleted":
|
|
98
|
+
|
|
99
|
+
1. **Soft Delete**: The tx is removed from indices but kept in the database, tagged with the current slot number
|
|
100
|
+
2. **Retrieval**: Slot-soft-deleted txs can still be retrieved via `getTxByHash` and return status `'deleted'` from `getTxStatus`
|
|
101
|
+
3. **Hard Delete**: When `prepareForSlot` advances to a new slot, txs deleted in earlier slots are permanently removed
|
|
102
|
+
4. **Re-addition**: If a slot-soft-deleted tx is re-added to the pool, the slot-deleted tracking is cleared
|
|
103
|
+
|
|
104
|
+
This allows other nodes to still fetch recently-deleted transactions via reqresp during the current slot.
|
|
105
|
+
|
|
106
|
+
### Prune-Based Soft Deletion
|
|
107
|
+
|
|
108
|
+
When a chain reorganization occurs, transactions that were mined in pruned blocks are handled with longer retention:
|
|
109
|
+
|
|
110
|
+
1. **Tracking**: When `handlePrunedBlocks` is called, all un-mined transactions are tracked by their original mined block number
|
|
111
|
+
2. **Soft Delete**: If these transactions are later evicted (failed validation, nullifier conflict, etc.), they are "prune-soft-deleted" - removed from indices but kept in the database
|
|
112
|
+
3. **Retrieval**: Prune-soft-deleted txs can still be retrieved via `getTxByHash` and return status `'deleted'` from `getTxStatus`
|
|
113
|
+
4. **Hard Delete**: When `handleFinalizedBlock` is called and the finalized block number reaches or exceeds the transaction's original mined block, the transaction is permanently removed
|
|
114
|
+
5. **Re-addition**: If a prune-soft-deleted tx is re-added, the `softDeleted` flag is reset to `false` but the prune tracking is preserved, so a subsequent deletion still uses the prune path
|
|
115
|
+
|
|
116
|
+
Prune-soft-deleted transactions are **not** affected by slot cleanup - they survive across slot boundaries until finalized.
|
|
117
|
+
|
|
118
|
+
**Prune example:**
|
|
119
|
+
1. Tx mined at block 10
|
|
120
|
+
2. Chain prunes to block 5 (tx becomes un-mined, tracked as minedAtBlock=10)
|
|
121
|
+
3. Tx fails validation and is prune-soft-deleted
|
|
122
|
+
4. Block 9 finalized → tx still in DB (minedAtBlock=10 > finalized=9)
|
|
123
|
+
5. Block 10 finalized → tx hard-deleted (minedAtBlock=10 ≤ finalized=10)
|
|
124
|
+
|
|
125
|
+
If the tx is re-mined at a higher block before being soft-deleted:
|
|
126
|
+
1. Tx mined at block 10, pruned (tracked as minedAtBlock=10)
|
|
127
|
+
2. Tx re-mined at block 15, pruned again (updated to minedAtBlock=15)
|
|
128
|
+
3. Tx soft-deleted
|
|
129
|
+
4. Block 10 finalized → tx still in DB
|
|
130
|
+
5. Block 15 finalized → tx hard-deleted
|
|
131
|
+
|
|
132
|
+
### Hydration
|
|
133
|
+
|
|
134
|
+
On node restart, slot-soft-deleted transactions are immediately hard-deleted (they are stale by definition). Prune-soft-deleted transactions are loaded from the database and tracked normally.
|
|
135
|
+
|
|
73
136
|
## Architecture: Pre-add vs Post-event Rules
|
|
74
137
|
|
|
75
138
|
**Pre-add rules** (run during `addPendingTxs`):
|
|
@@ -120,7 +183,7 @@ import { AztecKVTxPoolV2 } from './tx_pool_v2.js';
|
|
|
120
183
|
const pool = new AztecKVTxPoolV2(txStore, archiveStore, {
|
|
121
184
|
l2BlockSource: archiver,
|
|
122
185
|
worldStateSynchronizer: worldState,
|
|
123
|
-
|
|
186
|
+
createTxValidator: () => validator,
|
|
124
187
|
});
|
|
125
188
|
|
|
126
189
|
await pool.start();
|
|
@@ -195,9 +258,12 @@ The archive uses FIFO eviction when `archivedTxLimit` is reached.
|
|
|
195
258
|
## Testing
|
|
196
259
|
|
|
197
260
|
```bash
|
|
198
|
-
# Unit tests (
|
|
261
|
+
# Unit tests (177 tests)
|
|
199
262
|
yarn test src/mem_pools/tx_pool_v2/tx_pool_v2.test.ts
|
|
200
263
|
|
|
264
|
+
# Deleted pool tests (17 tests)
|
|
265
|
+
yarn test src/mem_pools/tx_pool_v2/deleted_pool.test.ts
|
|
266
|
+
|
|
201
267
|
# Compatibility tests (25 tests)
|
|
202
268
|
yarn test src/mem_pools/tx_pool_v2/tx_pool_v2.compat.test.ts
|
|
203
269
|
|