@aztec/p2p 0.0.1-commit.c80b6263 → 0.0.1-commit.cd76b27
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 +7 -6
- package/dest/client/factory.d.ts.map +1 -1
- package/dest/client/factory.js +47 -10
- package/dest/client/interface.d.ts +43 -23
- package/dest/client/interface.d.ts.map +1 -1
- package/dest/client/p2p_client.d.ts +40 -42
- package/dest/client/p2p_client.d.ts.map +1 -1
- package/dest/client/p2p_client.js +156 -145
- package/dest/client/test/tx_proposal_collector/proposal_tx_collector_worker.js +7 -7
- package/dest/config.d.ts +29 -4
- package/dest/config.d.ts.map +1 -1
- package/dest/config.js +19 -2
- package/dest/errors/tx-pool.error.d.ts +8 -0
- package/dest/errors/tx-pool.error.d.ts.map +1 -0
- package/dest/errors/tx-pool.error.js +9 -0
- 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 +104 -88
- package/dest/mem_pools/attestation_pool/attestation_pool.d.ts.map +1 -1
- package/dest/mem_pools/attestation_pool/attestation_pool.js +441 -3
- package/dest/mem_pools/attestation_pool/attestation_pool_test_suite.d.ts +2 -2
- 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 +353 -87
- package/dest/mem_pools/attestation_pool/index.d.ts +2 -3
- package/dest/mem_pools/attestation_pool/index.d.ts.map +1 -1
- package/dest/mem_pools/attestation_pool/index.js +1 -2
- 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 +3 -2
- package/dest/mem_pools/index.d.ts.map +1 -1
- package/dest/mem_pools/index.js +1 -1
- package/dest/mem_pools/interface.d.ts +5 -5
- 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/archive/index.d.ts +2 -0
- package/dest/mem_pools/tx_pool_v2/archive/index.d.ts.map +1 -0
- package/dest/mem_pools/tx_pool_v2/archive/index.js +1 -0
- package/dest/mem_pools/tx_pool_v2/archive/tx_archive.d.ts +43 -0
- package/dest/mem_pools/tx_pool_v2/archive/tx_archive.d.ts.map +1 -0
- package/dest/mem_pools/tx_pool_v2/archive/tx_archive.js +103 -0
- package/dest/mem_pools/tx_pool_v2/deleted_pool.d.ts +104 -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 +251 -0
- package/dest/mem_pools/tx_pool_v2/eviction/eviction_manager.d.ts +47 -0
- package/dest/mem_pools/tx_pool_v2/eviction/eviction_manager.d.ts.map +1 -0
- package/dest/mem_pools/tx_pool_v2/eviction/eviction_manager.js +128 -0
- package/dest/mem_pools/tx_pool_v2/eviction/fee_payer_balance_eviction_rule.d.ts +17 -0
- package/dest/mem_pools/tx_pool_v2/eviction/fee_payer_balance_eviction_rule.d.ts.map +1 -0
- package/dest/mem_pools/tx_pool_v2/eviction/fee_payer_balance_eviction_rule.js +93 -0
- package/dest/mem_pools/tx_pool_v2/eviction/fee_payer_balance_pre_add_rule.d.ts +19 -0
- package/dest/mem_pools/tx_pool_v2/eviction/fee_payer_balance_pre_add_rule.d.ts.map +1 -0
- package/dest/mem_pools/tx_pool_v2/eviction/fee_payer_balance_pre_add_rule.js +95 -0
- package/dest/mem_pools/tx_pool_v2/eviction/index.d.ts +10 -0
- package/dest/mem_pools/tx_pool_v2/eviction/index.d.ts.map +1 -0
- package/dest/mem_pools/tx_pool_v2/eviction/index.js +11 -0
- package/dest/mem_pools/tx_pool_v2/eviction/interfaces.d.ts +174 -0
- package/dest/mem_pools/tx_pool_v2/eviction/interfaces.d.ts.map +1 -0
- package/dest/mem_pools/tx_pool_v2/eviction/interfaces.js +25 -0
- package/dest/mem_pools/tx_pool_v2/eviction/invalid_txs_after_mining_rule.d.ts +15 -0
- package/dest/mem_pools/tx_pool_v2/eviction/invalid_txs_after_mining_rule.d.ts.map +1 -0
- package/dest/mem_pools/tx_pool_v2/eviction/invalid_txs_after_mining_rule.js +65 -0
- package/dest/mem_pools/tx_pool_v2/eviction/invalid_txs_after_reorg_rule.d.ts +17 -0
- package/dest/mem_pools/tx_pool_v2/eviction/invalid_txs_after_reorg_rule.d.ts.map +1 -0
- package/dest/mem_pools/tx_pool_v2/eviction/invalid_txs_after_reorg_rule.js +93 -0
- package/dest/mem_pools/tx_pool_v2/eviction/low_priority_eviction_rule.d.ts +16 -0
- package/dest/mem_pools/tx_pool_v2/eviction/low_priority_eviction_rule.d.ts.map +1 -0
- package/dest/mem_pools/tx_pool_v2/eviction/low_priority_eviction_rule.js +74 -0
- package/dest/mem_pools/tx_pool_v2/eviction/low_priority_pre_add_rule.d.ts +20 -0
- package/dest/mem_pools/tx_pool_v2/eviction/low_priority_pre_add_rule.d.ts.map +1 -0
- package/dest/mem_pools/tx_pool_v2/eviction/low_priority_pre_add_rule.js +73 -0
- package/dest/mem_pools/tx_pool_v2/eviction/nullifier_conflict_rule.d.ts +15 -0
- package/dest/mem_pools/tx_pool_v2/eviction/nullifier_conflict_rule.d.ts.map +1 -0
- package/dest/mem_pools/tx_pool_v2/eviction/nullifier_conflict_rule.js +19 -0
- package/dest/mem_pools/tx_pool_v2/index.d.ts +6 -0
- package/dest/mem_pools/tx_pool_v2/index.d.ts.map +1 -0
- package/dest/mem_pools/tx_pool_v2/index.js +5 -0
- package/dest/mem_pools/tx_pool_v2/instrumentation.d.ts +15 -0
- package/dest/mem_pools/tx_pool_v2/instrumentation.d.ts.map +1 -0
- package/dest/mem_pools/tx_pool_v2/instrumentation.js +43 -0
- package/dest/mem_pools/tx_pool_v2/interfaces.d.ts +209 -0
- package/dest/mem_pools/tx_pool_v2/interfaces.d.ts.map +1 -0
- package/dest/mem_pools/tx_pool_v2/interfaces.js +8 -0
- package/dest/mem_pools/tx_pool_v2/tx_metadata.d.ts +97 -0
- package/dest/mem_pools/tx_pool_v2/tx_metadata.d.ts.map +1 -0
- package/dest/mem_pools/tx_pool_v2/tx_metadata.js +152 -0
- package/dest/mem_pools/tx_pool_v2/tx_pool_bench_metrics.d.ts +26 -0
- package/dest/mem_pools/tx_pool_v2/tx_pool_bench_metrics.d.ts.map +1 -0
- package/dest/mem_pools/tx_pool_v2/tx_pool_bench_metrics.js +70 -0
- package/dest/mem_pools/tx_pool_v2/tx_pool_indices.d.ts +108 -0
- package/dest/mem_pools/tx_pool_v2/tx_pool_indices.d.ts.map +1 -0
- package/dest/mem_pools/tx_pool_v2/tx_pool_indices.js +355 -0
- package/dest/mem_pools/tx_pool_v2/tx_pool_v2.d.ts +60 -0
- package/dest/mem_pools/tx_pool_v2/tx_pool_v2.d.ts.map +1 -0
- package/dest/mem_pools/tx_pool_v2/tx_pool_v2.js +161 -0
- package/dest/mem_pools/tx_pool_v2/tx_pool_v2_impl.d.ts +77 -0
- package/dest/mem_pools/tx_pool_v2/tx_pool_v2_impl.d.ts.map +1 -0
- package/dest/mem_pools/tx_pool_v2/tx_pool_v2_impl.js +878 -0
- package/dest/msg_validators/attestation_validator/fisherman_attestation_validator.d.ts +3 -3
- package/dest/msg_validators/attestation_validator/fisherman_attestation_validator.d.ts.map +1 -1
- 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/archive_cache.d.ts +3 -3
- package/dest/msg_validators/tx_validator/archive_cache.d.ts.map +1 -1
- package/dest/msg_validators/tx_validator/archive_cache.js +1 -1
- package/dest/msg_validators/tx_validator/block_header_validator.d.ts +18 -5
- package/dest/msg_validators/tx_validator/block_header_validator.d.ts.map +1 -1
- package/dest/msg_validators/tx_validator/block_header_validator.js +2 -2
- 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/data_store.d.ts +1 -1
- package/dest/services/data_store.d.ts.map +1 -1
- package/dest/services/data_store.js +10 -6
- package/dest/services/dummy_service.d.ts +12 -3
- package/dest/services/dummy_service.d.ts.map +1 -1
- package/dest/services/dummy_service.js +9 -0
- package/dest/services/encoding.d.ts +2 -2
- package/dest/services/encoding.d.ts.map +1 -1
- package/dest/services/encoding.js +4 -3
- 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 +173 -0
- package/dest/services/gossipsub/topic_score_params.d.ts.map +1 -0
- package/dest/services/gossipsub/topic_score_params.js +346 -0
- package/dest/services/index.d.ts +2 -1
- package/dest/services/index.d.ts.map +1 -1
- package/dest/services/index.js +1 -0
- package/dest/services/libp2p/libp2p_service.d.ts +85 -35
- package/dest/services/libp2p/libp2p_service.d.ts.map +1 -1
- package/dest/services/libp2p/libp2p_service.js +379 -280
- 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/batch-tx-requester/batch_tx_requester.d.ts +6 -5
- package/dest/services/reqresp/batch-tx-requester/batch_tx_requester.d.ts.map +1 -1
- package/dest/services/reqresp/batch-tx-requester/batch_tx_requester.js +13 -17
- package/dest/services/reqresp/batch-tx-requester/interface.d.ts +2 -6
- package/dest/services/reqresp/batch-tx-requester/interface.d.ts.map +1 -1
- package/dest/services/reqresp/batch-tx-requester/missing_txs.d.ts +10 -13
- package/dest/services/reqresp/batch-tx-requester/missing_txs.d.ts.map +1 -1
- package/dest/services/reqresp/batch-tx-requester/missing_txs.js +25 -46
- 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 +7 -5
- package/dest/services/reqresp/protocols/block_txs/block_txs_handler.d.ts.map +1 -1
- package/dest/services/reqresp/protocols/block_txs/block_txs_handler.js +17 -12
- package/dest/services/reqresp/protocols/block_txs/block_txs_reqresp.d.ts +25 -14
- 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 +40 -24
- 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 +38 -2
- package/dest/services/service.d.ts.map +1 -1
- package/dest/services/tx_collection/config.d.ts +22 -4
- package/dest/services/tx_collection/config.d.ts.map +1 -1
- package/dest/services/tx_collection/config.js +49 -3
- package/dest/services/tx_collection/fast_tx_collection.d.ts +6 -5
- package/dest/services/tx_collection/fast_tx_collection.d.ts.map +1 -1
- package/dest/services/tx_collection/fast_tx_collection.js +64 -48
- 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 +167 -0
- package/dest/services/tx_collection/file_store_tx_source.d.ts +37 -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 +90 -0
- package/dest/services/tx_collection/index.d.ts +3 -2
- 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/instrumentation.d.ts +1 -1
- package/dest/services/tx_collection/instrumentation.d.ts.map +1 -1
- package/dest/services/tx_collection/instrumentation.js +2 -1
- package/dest/services/tx_collection/missing_txs_tracker.d.ts +32 -0
- package/dest/services/tx_collection/missing_txs_tracker.d.ts.map +1 -0
- package/dest/services/tx_collection/missing_txs_tracker.js +27 -0
- package/dest/services/tx_collection/proposal_tx_collector.d.ts +15 -14
- package/dest/services/tx_collection/proposal_tx_collector.d.ts.map +1 -1
- package/dest/services/tx_collection/proposal_tx_collector.js +6 -6
- package/dest/services/tx_collection/slow_tx_collection.d.ts +7 -3
- package/dest/services/tx_collection/slow_tx_collection.d.ts.map +1 -1
- package/dest/services/tx_collection/slow_tx_collection.js +60 -26
- package/dest/services/tx_collection/tx_collection.d.ts +23 -10
- 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 +18 -8
- package/dest/services/tx_collection/tx_collection_sink.d.ts.map +1 -1
- package/dest/services/tx_collection/tx_collection_sink.js +26 -29
- package/dest/services/tx_collection/tx_source.d.ts +8 -3
- package/dest/services/tx_collection/tx_source.d.ts.map +1 -1
- package/dest/services/tx_collection/tx_source.js +19 -2
- package/dest/services/tx_file_store/config.d.ts +16 -0
- package/dest/services/tx_file_store/config.d.ts.map +1 -0
- package/dest/services/tx_file_store/config.js +22 -0
- package/dest/services/tx_file_store/index.d.ts +4 -0
- package/dest/services/tx_file_store/index.d.ts.map +1 -0
- package/dest/services/tx_file_store/index.js +3 -0
- package/dest/services/tx_file_store/instrumentation.d.ts +15 -0
- package/dest/services/tx_file_store/instrumentation.d.ts.map +1 -0
- package/dest/services/tx_file_store/instrumentation.js +29 -0
- package/dest/services/tx_file_store/tx_file_store.d.ts +48 -0
- package/dest/services/tx_file_store/tx_file_store.d.ts.map +1 -0
- package/dest/services/tx_file_store/tx_file_store.js +152 -0
- 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 +29 -2
- package/dest/test-helpers/mock-pubsub.d.ts.map +1 -1
- package/dest/test-helpers/mock-pubsub.js +103 -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 +45 -38
- package/dest/test-helpers/testbench-utils.d.ts.map +1 -1
- package/dest/test-helpers/testbench-utils.js +130 -60
- package/dest/testbench/p2p_client_testbench_worker.d.ts +2 -2
- package/dest/testbench/p2p_client_testbench_worker.d.ts.map +1 -1
- package/dest/testbench/p2p_client_testbench_worker.js +11 -11
- package/dest/util.d.ts +2 -2
- package/dest/util.d.ts.map +1 -1
- package/package.json +14 -14
- package/src/client/factory.ts +89 -14
- package/src/client/interface.ts +59 -23
- package/src/client/p2p_client.ts +196 -167
- package/src/client/test/tx_proposal_collector/README.md +4 -4
- package/src/client/test/tx_proposal_collector/proposal_tx_collector_worker.ts +20 -10
- package/src/config.ts +41 -2
- package/src/errors/tx-pool.error.ts +12 -0
- package/src/index.ts +1 -0
- package/src/mem_pools/attestation_pool/attestation_pool.ts +496 -91
- package/src/mem_pools/attestation_pool/attestation_pool_test_suite.ts +442 -102
- package/src/mem_pools/attestation_pool/index.ts +9 -2
- package/src/mem_pools/attestation_pool/mocks.ts +2 -1
- package/src/mem_pools/index.ts +4 -1
- package/src/mem_pools/interface.ts +4 -4
- 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 +275 -0
- package/src/mem_pools/tx_pool_v2/archive/index.ts +1 -0
- package/src/mem_pools/tx_pool_v2/archive/tx_archive.ts +120 -0
- package/src/mem_pools/tx_pool_v2/deleted_pool.ts +321 -0
- package/src/mem_pools/tx_pool_v2/eviction/eviction_manager.ts +160 -0
- package/src/mem_pools/tx_pool_v2/eviction/fee_payer_balance_eviction_rule.ts +121 -0
- package/src/mem_pools/tx_pool_v2/eviction/fee_payer_balance_pre_add_rule.ts +122 -0
- package/src/mem_pools/tx_pool_v2/eviction/index.ts +27 -0
- package/src/mem_pools/tx_pool_v2/eviction/interfaces.ts +209 -0
- package/src/mem_pools/tx_pool_v2/eviction/invalid_txs_after_mining_rule.ts +74 -0
- package/src/mem_pools/tx_pool_v2/eviction/invalid_txs_after_reorg_rule.ts +101 -0
- package/src/mem_pools/tx_pool_v2/eviction/low_priority_eviction_rule.ts +87 -0
- package/src/mem_pools/tx_pool_v2/eviction/low_priority_pre_add_rule.ts +90 -0
- package/src/mem_pools/tx_pool_v2/eviction/nullifier_conflict_rule.ts +31 -0
- package/src/mem_pools/tx_pool_v2/index.ts +12 -0
- package/src/mem_pools/tx_pool_v2/instrumentation.ts +69 -0
- package/src/mem_pools/tx_pool_v2/interfaces.ts +239 -0
- package/src/mem_pools/tx_pool_v2/tx_metadata.ts +242 -0
- package/src/mem_pools/tx_pool_v2/tx_pool_bench_metrics.ts +77 -0
- package/src/mem_pools/tx_pool_v2/tx_pool_indices.ts +444 -0
- package/src/mem_pools/tx_pool_v2/tx_pool_v2.ts +223 -0
- package/src/mem_pools/tx_pool_v2/tx_pool_v2_impl.ts +1052 -0
- package/src/msg_validators/attestation_validator/fisherman_attestation_validator.ts +2 -2
- package/src/msg_validators/tx_validator/aggregate_tx_validator.ts +2 -2
- package/src/msg_validators/tx_validator/archive_cache.ts +3 -3
- package/src/msg_validators/tx_validator/block_header_validator.ts +18 -8
- 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/data_store.ts +10 -7
- package/src/services/dummy_service.ts +17 -1
- package/src/services/encoding.ts +4 -3
- package/src/services/gossipsub/README.md +641 -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 +487 -0
- package/src/services/index.ts +1 -0
- package/src/services/libp2p/libp2p_service.ts +382 -282
- package/src/services/peer-manager/peer_scoring.ts +25 -0
- package/src/services/reqresp/batch-tx-requester/README.md +14 -14
- package/src/services/reqresp/batch-tx-requester/batch_tx_requester.ts +18 -18
- package/src/services/reqresp/batch-tx-requester/interface.ts +1 -5
- package/src/services/reqresp/batch-tx-requester/missing_txs.ts +23 -71
- package/src/services/reqresp/interface.ts +26 -1
- package/src/services/reqresp/protocols/block_txs/block_txs_handler.ts +24 -15
- package/src/services/reqresp/protocols/block_txs/block_txs_reqresp.ts +47 -24
- package/src/services/reqresp/protocols/tx.ts +22 -0
- package/src/services/reqresp/reqresp.ts +13 -3
- package/src/services/service.ts +50 -1
- package/src/services/tx_collection/config.ts +74 -6
- package/src/services/tx_collection/fast_tx_collection.ts +74 -51
- package/src/services/tx_collection/file_store_tx_collection.ts +202 -0
- package/src/services/tx_collection/file_store_tx_source.ts +117 -0
- package/src/services/tx_collection/index.ts +2 -1
- package/src/services/tx_collection/instrumentation.ts +7 -1
- package/src/services/tx_collection/missing_txs_tracker.ts +52 -0
- package/src/services/tx_collection/proposal_tx_collector.ts +20 -21
- package/src/services/tx_collection/slow_tx_collection.ts +66 -33
- package/src/services/tx_collection/tx_collection.ts +113 -16
- package/src/services/tx_collection/tx_collection_sink.ts +30 -34
- package/src/services/tx_collection/tx_source.ts +22 -3
- package/src/services/tx_file_store/config.ts +37 -0
- package/src/services/tx_file_store/index.ts +3 -0
- package/src/services/tx_file_store/instrumentation.ts +36 -0
- package/src/services/tx_file_store/tx_file_store.ts +175 -0
- 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 +143 -3
- package/src/test-helpers/reqresp-nodes.ts +2 -1
- package/src/test-helpers/testbench-utils.ts +129 -71
- package/src/testbench/p2p_client_testbench_worker.ts +23 -16
- package/src/util.ts +7 -1
- package/dest/mem_pools/attestation_pool/kv_attestation_pool.d.ts +0 -40
- package/dest/mem_pools/attestation_pool/kv_attestation_pool.d.ts.map +0 -1
- package/dest/mem_pools/attestation_pool/kv_attestation_pool.js +0 -218
- package/dest/mem_pools/attestation_pool/memory_attestation_pool.d.ts +0 -31
- package/dest/mem_pools/attestation_pool/memory_attestation_pool.d.ts.map +0 -1
- package/dest/mem_pools/attestation_pool/memory_attestation_pool.js +0 -180
- package/src/mem_pools/attestation_pool/kv_attestation_pool.ts +0 -320
- package/src/mem_pools/attestation_pool/memory_attestation_pool.ts +0 -264
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aztec/p2p",
|
|
3
|
-
"version": "0.0.1-commit.
|
|
3
|
+
"version": "0.0.1-commit.cd76b27",
|
|
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.
|
|
71
|
-
"@aztec/epoch-cache": "0.0.1-commit.
|
|
72
|
-
"@aztec/ethereum": "0.0.1-commit.
|
|
73
|
-
"@aztec/foundation": "0.0.1-commit.
|
|
74
|
-
"@aztec/kv-store": "0.0.1-commit.
|
|
75
|
-
"@aztec/noir-contracts.js": "0.0.1-commit.
|
|
76
|
-
"@aztec/noir-protocol-circuits-types": "0.0.1-commit.
|
|
77
|
-
"@aztec/protocol-contracts": "0.0.1-commit.
|
|
78
|
-
"@aztec/simulator": "0.0.1-commit.
|
|
79
|
-
"@aztec/stdlib": "0.0.1-commit.
|
|
80
|
-
"@aztec/telemetry-client": "0.0.1-commit.
|
|
70
|
+
"@aztec/constants": "0.0.1-commit.cd76b27",
|
|
71
|
+
"@aztec/epoch-cache": "0.0.1-commit.cd76b27",
|
|
72
|
+
"@aztec/ethereum": "0.0.1-commit.cd76b27",
|
|
73
|
+
"@aztec/foundation": "0.0.1-commit.cd76b27",
|
|
74
|
+
"@aztec/kv-store": "0.0.1-commit.cd76b27",
|
|
75
|
+
"@aztec/noir-contracts.js": "0.0.1-commit.cd76b27",
|
|
76
|
+
"@aztec/noir-protocol-circuits-types": "0.0.1-commit.cd76b27",
|
|
77
|
+
"@aztec/protocol-contracts": "0.0.1-commit.cd76b27",
|
|
78
|
+
"@aztec/simulator": "0.0.1-commit.cd76b27",
|
|
79
|
+
"@aztec/stdlib": "0.0.1-commit.cd76b27",
|
|
80
|
+
"@aztec/telemetry-client": "0.0.1-commit.cd76b27",
|
|
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.
|
|
108
|
-
"@aztec/world-state": "0.0.1-commit.
|
|
107
|
+
"@aztec/archiver": "0.0.1-commit.cd76b27",
|
|
108
|
+
"@aztec/world-state": "0.0.1-commit.cd76b27",
|
|
109
109
|
"@jest/globals": "^30.0.0",
|
|
110
110
|
"@types/jest": "^30.0.0",
|
|
111
111
|
"@types/node": "^22.15.17",
|
package/src/client/factory.ts
CHANGED
|
@@ -4,31 +4,39 @@ import { DateProvider } from '@aztec/foundation/timer';
|
|
|
4
4
|
import type { AztecAsyncKVStore } from '@aztec/kv-store';
|
|
5
5
|
import type { DataStoreConfig } from '@aztec/kv-store/config';
|
|
6
6
|
import { AztecLMDBStoreV2, createStore } from '@aztec/kv-store/lmdb-v2';
|
|
7
|
-
import type { L2BlockSource } from '@aztec/stdlib/block';
|
|
7
|
+
import type { BlockHash, L2BlockSource } from '@aztec/stdlib/block';
|
|
8
8
|
import type { ChainConfig } from '@aztec/stdlib/config';
|
|
9
9
|
import type { ContractDataSource } from '@aztec/stdlib/contract';
|
|
10
|
-
import type { ClientProtocolCircuitVerifier, WorldStateSynchronizer } from '@aztec/stdlib/interfaces/server';
|
|
10
|
+
import type { AztecNode, ClientProtocolCircuitVerifier, WorldStateSynchronizer } from '@aztec/stdlib/interfaces/server';
|
|
11
11
|
import { P2PClientType } from '@aztec/stdlib/p2p';
|
|
12
|
+
import { MerkleTreeId } from '@aztec/stdlib/trees';
|
|
12
13
|
import { type TelemetryClient, getTelemetryClient } from '@aztec/telemetry-client';
|
|
13
14
|
|
|
14
15
|
import { P2PClient } from '../client/p2p_client.js';
|
|
15
16
|
import type { P2PConfig } from '../config.js';
|
|
16
|
-
import
|
|
17
|
-
import { KvAttestationPool } from '../mem_pools/attestation_pool/kv_attestation_pool.js';
|
|
17
|
+
import { AttestationPool, type AttestationPoolApi } from '../mem_pools/attestation_pool/attestation_pool.js';
|
|
18
18
|
import type { MemPools } from '../mem_pools/interface.js';
|
|
19
|
-
import {
|
|
19
|
+
import type { TxPoolV2 } from '../mem_pools/tx_pool_v2/interfaces.js';
|
|
20
|
+
import type { TxMetaData } from '../mem_pools/tx_pool_v2/tx_metadata.js';
|
|
21
|
+
import { AztecKVTxPoolV2 } from '../mem_pools/tx_pool_v2/tx_pool_v2.js';
|
|
22
|
+
import { AggregateTxValidator } from '../msg_validators/tx_validator/aggregate_tx_validator.js';
|
|
23
|
+
import { BlockHeaderTxValidator } from '../msg_validators/tx_validator/block_header_validator.js';
|
|
24
|
+
import { DoubleSpendTxValidator } from '../msg_validators/tx_validator/double_spend_validator.js';
|
|
20
25
|
import { DummyP2PService } from '../services/dummy_service.js';
|
|
21
26
|
import { LibP2PService } from '../services/index.js';
|
|
27
|
+
import { createFileStoreTxSources } from '../services/tx_collection/file_store_tx_source.js';
|
|
22
28
|
import { TxCollection } from '../services/tx_collection/tx_collection.js';
|
|
23
|
-
import { type TxSource, createNodeRpcTxSources } from '../services/tx_collection/tx_source.js';
|
|
29
|
+
import { NodeRpcTxSource, type TxSource, createNodeRpcTxSources } from '../services/tx_collection/tx_source.js';
|
|
30
|
+
import { TxFileStore } from '../services/tx_file_store/tx_file_store.js';
|
|
24
31
|
import { configureP2PClientAddresses, createLibP2PPeerIdFromPrivateKey, getPeerIdPrivateKey } from '../util.js';
|
|
25
32
|
|
|
26
33
|
export type P2PClientDeps<T extends P2PClientType> = {
|
|
27
|
-
txPool?:
|
|
34
|
+
txPool?: TxPoolV2;
|
|
28
35
|
store?: AztecAsyncKVStore;
|
|
29
|
-
attestationPool?:
|
|
36
|
+
attestationPool?: AttestationPoolApi;
|
|
30
37
|
logger?: Logger;
|
|
31
38
|
txCollectionNodeSources?: TxSource[];
|
|
39
|
+
rpcTxProviders?: AztecNode[];
|
|
32
40
|
p2pServiceFactory?: (...args: Parameters<(typeof LibP2PService)['new']>) => Promise<LibP2PService<T>>;
|
|
33
41
|
};
|
|
34
42
|
|
|
@@ -69,14 +77,57 @@ export async function createP2PClient<T extends P2PClientType>(
|
|
|
69
77
|
const attestationStore = await createStore(P2P_ATTESTATION_STORE_NAME, 1, config, bindings);
|
|
70
78
|
const l1Constants = await archiver.getL1Constants();
|
|
71
79
|
|
|
72
|
-
const
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
80
|
+
const rollupAddress = inputConfig.l1Contracts.rollupAddress.toString().toLowerCase().replace(/^0x/, '');
|
|
81
|
+
const txFileStoreBasePath = `aztec-${inputConfig.l1ChainId}-${inputConfig.rollupVersion}-0x${rollupAddress}`;
|
|
82
|
+
|
|
83
|
+
/** Validator factory for pool re-validation (double-spend + block header only). */
|
|
84
|
+
const createPoolTxValidator = async () => {
|
|
85
|
+
await worldStateSynchronizer.syncImmediate();
|
|
86
|
+
return new AggregateTxValidator<TxMetaData>(
|
|
87
|
+
new DoubleSpendTxValidator<TxMetaData>(
|
|
88
|
+
{
|
|
89
|
+
nullifiersExist: async (nullifiers: Buffer[]) => {
|
|
90
|
+
const merkleTree = worldStateSynchronizer.getCommitted();
|
|
91
|
+
const indices = await merkleTree.findLeafIndices(MerkleTreeId.NULLIFIER_TREE, nullifiers);
|
|
92
|
+
return indices.map(index => index !== undefined);
|
|
93
|
+
},
|
|
94
|
+
},
|
|
95
|
+
bindings,
|
|
96
|
+
),
|
|
97
|
+
new BlockHeaderTxValidator<TxMetaData>(
|
|
98
|
+
{
|
|
99
|
+
getArchiveIndices: (archives: BlockHash[]) => {
|
|
100
|
+
const merkleTree = worldStateSynchronizer.getCommitted();
|
|
101
|
+
return merkleTree.findLeafIndices(MerkleTreeId.ARCHIVE, archives);
|
|
102
|
+
},
|
|
103
|
+
},
|
|
104
|
+
bindings,
|
|
105
|
+
),
|
|
106
|
+
);
|
|
107
|
+
};
|
|
108
|
+
|
|
109
|
+
const txPool =
|
|
110
|
+
deps.txPool ??
|
|
111
|
+
new AztecKVTxPoolV2(
|
|
112
|
+
store,
|
|
113
|
+
archive,
|
|
114
|
+
{
|
|
115
|
+
l2BlockSource: archiver,
|
|
116
|
+
worldStateSynchronizer,
|
|
117
|
+
createTxValidator: createPoolTxValidator,
|
|
118
|
+
},
|
|
119
|
+
telemetry,
|
|
120
|
+
{
|
|
76
121
|
maxPendingTxCount: config.maxPendingTxCount,
|
|
77
122
|
archivedTxLimit: config.archivedTxLimit,
|
|
78
|
-
|
|
79
|
-
|
|
123
|
+
minTxPoolAgeMs: config.minTxPoolAgeMs,
|
|
124
|
+
},
|
|
125
|
+
dateProvider,
|
|
126
|
+
);
|
|
127
|
+
|
|
128
|
+
const mempools: MemPools = {
|
|
129
|
+
txPool,
|
|
130
|
+
attestationPool: deps.attestationPool ?? new AttestationPool(attestationStore, telemetry),
|
|
80
131
|
};
|
|
81
132
|
|
|
82
133
|
const p2pService = await createP2PService<T>(
|
|
@@ -97,6 +148,7 @@ export async function createP2PClient<T extends P2PClientType>(
|
|
|
97
148
|
|
|
98
149
|
const nodeSources = [
|
|
99
150
|
...createNodeRpcTxSources(config.txCollectionNodeRpcUrls, config),
|
|
151
|
+
...(deps.rpcTxProviders ?? []).map((node, i) => new NodeRpcTxSource(node, `node-rpc-provider-${i}`)),
|
|
100
152
|
...(deps.txCollectionNodeSources ?? []),
|
|
101
153
|
];
|
|
102
154
|
if (nodeSources.length > 0) {
|
|
@@ -105,17 +157,38 @@ export async function createP2PClient<T extends P2PClientType>(
|
|
|
105
157
|
});
|
|
106
158
|
}
|
|
107
159
|
|
|
160
|
+
const fileStoreSources = await createFileStoreTxSources(
|
|
161
|
+
config.txCollectionFileStoreUrls,
|
|
162
|
+
txFileStoreBasePath,
|
|
163
|
+
logger.createChild('file-store-tx-source'),
|
|
164
|
+
telemetry,
|
|
165
|
+
);
|
|
166
|
+
if (fileStoreSources.length > 0) {
|
|
167
|
+
logger.info(`Using ${fileStoreSources.length} file store sources for tx collection.`, {
|
|
168
|
+
stores: fileStoreSources.map(s => s.getInfo()),
|
|
169
|
+
});
|
|
170
|
+
}
|
|
171
|
+
|
|
108
172
|
const txCollection = new TxCollection(
|
|
109
173
|
p2pService.getBatchTxRequesterService(),
|
|
110
174
|
nodeSources,
|
|
111
175
|
l1Constants,
|
|
112
176
|
mempools.txPool,
|
|
113
177
|
config,
|
|
178
|
+
fileStoreSources,
|
|
114
179
|
dateProvider,
|
|
115
180
|
telemetry,
|
|
116
181
|
logger.createChild('tx-collection'),
|
|
117
182
|
);
|
|
118
183
|
|
|
184
|
+
const txFileStore = await TxFileStore.create(
|
|
185
|
+
mempools.txPool,
|
|
186
|
+
config,
|
|
187
|
+
txFileStoreBasePath,
|
|
188
|
+
logger.createChild('tx-file-store'),
|
|
189
|
+
telemetry,
|
|
190
|
+
);
|
|
191
|
+
|
|
119
192
|
return new P2PClient(
|
|
120
193
|
clientType,
|
|
121
194
|
store,
|
|
@@ -123,6 +196,8 @@ export async function createP2PClient<T extends P2PClientType>(
|
|
|
123
196
|
mempools,
|
|
124
197
|
p2pService,
|
|
125
198
|
txCollection,
|
|
199
|
+
txFileStore,
|
|
200
|
+
epochCache,
|
|
126
201
|
config,
|
|
127
202
|
dateProvider,
|
|
128
203
|
telemetry,
|
package/src/client/interface.ts
CHANGED
|
@@ -1,7 +1,14 @@
|
|
|
1
|
+
import type { SlotNumber } from '@aztec/foundation/branded-types';
|
|
1
2
|
import type { EthAddress, L2BlockId } from '@aztec/stdlib/block';
|
|
2
|
-
import type { P2PApiFull } from '@aztec/stdlib/interfaces/server';
|
|
3
|
-
import type {
|
|
4
|
-
|
|
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';
|
|
11
|
+
import type { BlockHeader, Tx, TxHash } from '@aztec/stdlib/tx';
|
|
5
12
|
|
|
6
13
|
import type { PeerId } from '@libp2p/interface';
|
|
7
14
|
import type { ENR } from '@nethermindeth/enr';
|
|
@@ -13,7 +20,12 @@ import type {
|
|
|
13
20
|
ReqRespSubProtocolHandler,
|
|
14
21
|
ReqRespSubProtocolValidators,
|
|
15
22
|
} from '../services/reqresp/interface.js';
|
|
16
|
-
import type {
|
|
23
|
+
import type {
|
|
24
|
+
DuplicateAttestationInfo,
|
|
25
|
+
DuplicateProposalInfo,
|
|
26
|
+
P2PBlockReceivedCallback,
|
|
27
|
+
P2PCheckpointReceivedCallback,
|
|
28
|
+
} from '../services/service.js';
|
|
17
29
|
|
|
18
30
|
/**
|
|
19
31
|
* Enum defining the possible states of the p2p client.
|
|
@@ -79,12 +91,21 @@ export type P2P<T extends P2PClientType = P2PClientType.Full> = P2PApiFull<T> &
|
|
|
79
91
|
registerCheckpointProposalHandler(callback: P2PCheckpointReceivedCallback): void;
|
|
80
92
|
|
|
81
93
|
/**
|
|
82
|
-
*
|
|
83
|
-
*
|
|
84
|
-
*
|
|
85
|
-
* @
|
|
94
|
+
* Registers a callback invoked when a duplicate proposal is detected (equivocation).
|
|
95
|
+
* The callback is triggered on the first duplicate (when count goes from 1 to 2).
|
|
96
|
+
*
|
|
97
|
+
* @param callback - Function called with info about the duplicate proposal
|
|
86
98
|
*/
|
|
87
|
-
|
|
99
|
+
registerDuplicateProposalCallback(callback: (info: DuplicateProposalInfo) => void): void;
|
|
100
|
+
|
|
101
|
+
/**
|
|
102
|
+
* Registers a callback invoked when a duplicate attestation is detected (equivocation).
|
|
103
|
+
* A validator signing attestations for different proposals at the same slot.
|
|
104
|
+
* The callback is triggered on the first duplicate (when count goes from 1 to 2).
|
|
105
|
+
*
|
|
106
|
+
* @param callback - Function called with info about the duplicate attestation
|
|
107
|
+
*/
|
|
108
|
+
registerDuplicateAttestationCallback(callback: (info: DuplicateAttestationInfo) => void): void;
|
|
88
109
|
|
|
89
110
|
/**
|
|
90
111
|
* Verifies the 'tx' and, if valid, adds it to local tx pool and forwards it to other peers.
|
|
@@ -93,18 +114,10 @@ export type P2P<T extends P2PClientType = P2PClientType.Full> = P2PApiFull<T> &
|
|
|
93
114
|
sendTx(tx: Tx): Promise<void>;
|
|
94
115
|
|
|
95
116
|
/**
|
|
96
|
-
*
|
|
97
|
-
* @param
|
|
98
|
-
* @returns The number of txs added to the pool. Note if the transaction already exists, it will not be added again.
|
|
99
|
-
**/
|
|
100
|
-
addTxsToPool(txs: Tx[]): Promise<number>;
|
|
101
|
-
|
|
102
|
-
/**
|
|
103
|
-
* Deletes 'txs' from the pool, given hashes.
|
|
104
|
-
* NOT used if we use sendTx as reconcileTxPool will handle this.
|
|
105
|
-
* @param txHashes - Hashes to check.
|
|
117
|
+
* Handles failed transaction execution by removing txs from the pool.
|
|
118
|
+
* @param txHashes - Hashes of the transactions that failed execution.
|
|
106
119
|
**/
|
|
107
|
-
|
|
120
|
+
handleFailedExecution(txHashes: TxHash[]): Promise<void>;
|
|
108
121
|
|
|
109
122
|
/**
|
|
110
123
|
* Returns a transaction in the transaction pool by its hash.
|
|
@@ -152,14 +165,28 @@ export type P2P<T extends P2PClientType = P2PClientType.Full> = P2PApiFull<T> &
|
|
|
152
165
|
/** Returns an iterator over pending txs on the mempool. */
|
|
153
166
|
iteratePendingTxs(): AsyncIterableIterator<Tx>;
|
|
154
167
|
|
|
168
|
+
/** Returns an iterator over pending txs that have been in the pool long enough to be eligible for block building. */
|
|
169
|
+
iterateEligiblePendingTxs(): AsyncIterableIterator<Tx>;
|
|
170
|
+
|
|
155
171
|
/** Returns the number of pending txs in the mempool. */
|
|
156
172
|
getPendingTxCount(): Promise<number>;
|
|
157
173
|
|
|
158
174
|
/**
|
|
159
|
-
*
|
|
160
|
-
*
|
|
175
|
+
* Protects existing transactions by hash for a given slot.
|
|
176
|
+
* Returns hashes of transactions that weren't found in the pool.
|
|
177
|
+
* @param txHashes - Hashes of the transactions to protect.
|
|
178
|
+
* @param blockHeader - The block header providing slot context.
|
|
179
|
+
* @returns Hashes of transactions not found in the pool.
|
|
161
180
|
*/
|
|
162
|
-
|
|
181
|
+
protectTxs(txHashes: TxHash[], blockHeader: BlockHeader): Promise<TxHash[]>;
|
|
182
|
+
|
|
183
|
+
/**
|
|
184
|
+
* Prepares the pool for a new slot.
|
|
185
|
+
* Unprotects transactions from earlier slots and validates them before
|
|
186
|
+
* returning to pending state.
|
|
187
|
+
* @param slotNumber - The slot number to prepare for
|
|
188
|
+
*/
|
|
189
|
+
prepareForSlot(slotNumber: SlotNumber): Promise<void>;
|
|
163
190
|
|
|
164
191
|
/**
|
|
165
192
|
* Starts the p2p client.
|
|
@@ -192,6 +219,9 @@ export type P2P<T extends P2PClientType = P2PClientType.Full> = P2PApiFull<T> &
|
|
|
192
219
|
/** Identifies a p2p client. */
|
|
193
220
|
isP2PClient(): true;
|
|
194
221
|
|
|
222
|
+
/** Returns the tx provider used for fetching transactions. */
|
|
223
|
+
getTxProvider(): ITxProvider;
|
|
224
|
+
|
|
195
225
|
updateP2PConfig(config: Partial<P2PConfig>): Promise<void>;
|
|
196
226
|
|
|
197
227
|
/** Validates a set of txs. */
|
|
@@ -208,6 +238,12 @@ export type P2P<T extends P2PClientType = P2PClientType.Full> = P2PApiFull<T> &
|
|
|
208
238
|
|
|
209
239
|
handleAuthRequestFromPeer(authRequest: AuthRequest, peerId: PeerId): Promise<StatusMessage>;
|
|
210
240
|
|
|
241
|
+
/** Checks if any block proposals exist for the given slot. */
|
|
242
|
+
hasBlockProposalsForSlot(slot: SlotNumber): Promise<boolean>;
|
|
243
|
+
|
|
211
244
|
/** If node running this P2P stack is validator, passes in validator address to P2P layer */
|
|
212
245
|
registerThisValidatorAddresses(address: EthAddress[]): void;
|
|
246
|
+
|
|
247
|
+
/** Returns the number of peers in the GossipSub mesh for a given topic type. */
|
|
248
|
+
getGossipMeshPeerCount(topicType: TopicType): Promise<number>;
|
|
213
249
|
};
|