@aztec/p2p 0.0.1-commit.b6e433891 → 0.0.1-commit.b9865e97
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/bootstrap/bootstrap.d.ts +1 -1
- package/dest/bootstrap/bootstrap.d.ts.map +1 -1
- package/dest/bootstrap/bootstrap.js +9 -1
- package/dest/client/factory.d.ts +4 -3
- package/dest/client/factory.d.ts.map +1 -1
- package/dest/client/factory.js +28 -23
- package/dest/client/interface.d.ts +14 -5
- package/dest/client/interface.d.ts.map +1 -1
- package/dest/client/p2p_client.d.ts +13 -9
- package/dest/client/p2p_client.d.ts.map +1 -1
- package/dest/client/p2p_client.js +78 -22
- package/dest/config.d.ts +131 -101
- package/dest/config.d.ts.map +1 -1
- package/dest/config.js +53 -8
- package/dest/errors/p2p-service.error.d.ts +9 -0
- package/dest/errors/p2p-service.error.d.ts.map +1 -0
- package/dest/errors/p2p-service.error.js +10 -0
- package/dest/errors/reqresp.error.d.ts +1 -20
- package/dest/errors/reqresp.error.d.ts.map +1 -1
- package/dest/errors/reqresp.error.js +0 -21
- package/dest/index.d.ts +1 -2
- package/dest/index.d.ts.map +1 -1
- package/dest/index.js +0 -1
- package/dest/mem_pools/attestation_pool/attestation_pool.d.ts +96 -56
- package/dest/mem_pools/attestation_pool/attestation_pool.d.ts.map +1 -1
- package/dest/mem_pools/attestation_pool/attestation_pool.js +262 -196
- 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 +175 -59
- package/dest/mem_pools/attestation_pool/mocks.d.ts +1 -1
- package/dest/mem_pools/attestation_pool/mocks.d.ts.map +1 -1
- package/dest/mem_pools/attestation_pool/mocks.js +6 -4
- package/dest/mem_pools/index.d.ts +1 -2
- package/dest/mem_pools/index.d.ts.map +1 -1
- package/dest/mem_pools/instrumentation.d.ts +1 -1
- package/dest/mem_pools/instrumentation.d.ts.map +1 -1
- package/dest/mem_pools/instrumentation.js +17 -1
- package/dest/mem_pools/tx_pool_v2/archive/tx_archive.d.ts +1 -5
- package/dest/mem_pools/tx_pool_v2/archive/tx_archive.d.ts.map +1 -1
- package/dest/mem_pools/tx_pool_v2/archive/tx_archive.js +1 -7
- package/dest/mem_pools/tx_pool_v2/eviction/index.d.ts +2 -1
- package/dest/mem_pools/tx_pool_v2/eviction/index.d.ts.map +1 -1
- package/dest/mem_pools/tx_pool_v2/eviction/index.js +1 -0
- package/dest/mem_pools/tx_pool_v2/eviction/insufficient_fee_per_gas_eviction_rule.d.ts +16 -0
- package/dest/mem_pools/tx_pool_v2/eviction/insufficient_fee_per_gas_eviction_rule.d.ts.map +1 -0
- package/dest/mem_pools/tx_pool_v2/eviction/insufficient_fee_per_gas_eviction_rule.js +62 -0
- package/dest/mem_pools/tx_pool_v2/eviction/invalid_txs_after_reorg_rule.js +2 -2
- package/dest/mem_pools/tx_pool_v2/interfaces.d.ts +4 -1
- package/dest/mem_pools/tx_pool_v2/interfaces.d.ts.map +1 -1
- package/dest/mem_pools/tx_pool_v2/tx_metadata.d.ts +5 -2
- package/dest/mem_pools/tx_pool_v2/tx_metadata.d.ts.map +1 -1
- package/dest/mem_pools/tx_pool_v2/tx_metadata.js +13 -6
- package/dest/mem_pools/tx_pool_v2/tx_pool_v2_impl.d.ts +1 -1
- 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 +75 -84
- package/dest/msg_validators/attestation_validator/attestation_validator.d.ts +9 -3
- package/dest/msg_validators/attestation_validator/attestation_validator.d.ts.map +1 -1
- package/dest/msg_validators/attestation_validator/attestation_validator.js +34 -10
- package/dest/msg_validators/attestation_validator/fisherman_attestation_validator.d.ts +7 -3
- package/dest/msg_validators/attestation_validator/fisherman_attestation_validator.d.ts.map +1 -1
- package/dest/msg_validators/attestation_validator/fisherman_attestation_validator.js +4 -5
- package/dest/msg_validators/clock_tolerance.d.ts +12 -1
- package/dest/msg_validators/clock_tolerance.d.ts.map +1 -1
- package/dest/msg_validators/clock_tolerance.js +52 -0
- package/dest/msg_validators/proposal_validator/block_proposal_validator.d.ts +6 -2
- package/dest/msg_validators/proposal_validator/block_proposal_validator.d.ts.map +1 -1
- package/dest/msg_validators/proposal_validator/checkpoint_proposal_validator.d.ts +6 -2
- package/dest/msg_validators/proposal_validator/checkpoint_proposal_validator.d.ts.map +1 -1
- package/dest/msg_validators/proposal_validator/proposal_validator.d.ts +10 -2
- package/dest/msg_validators/proposal_validator/proposal_validator.d.ts.map +1 -1
- package/dest/msg_validators/proposal_validator/proposal_validator.js +44 -10
- package/dest/msg_validators/tx_validator/aggregate_tx_validator.d.ts +1 -1
- package/dest/msg_validators/tx_validator/aggregate_tx_validator.d.ts.map +1 -1
- package/dest/msg_validators/tx_validator/aggregate_tx_validator.js +8 -15
- package/dest/msg_validators/tx_validator/allowed_public_setup.js +3 -3
- package/dest/msg_validators/tx_validator/archive_cache.js +1 -1
- package/dest/msg_validators/tx_validator/cached_tx_validator.d.ts +15 -0
- package/dest/msg_validators/tx_validator/cached_tx_validator.d.ts.map +1 -0
- package/dest/msg_validators/tx_validator/cached_tx_validator.js +19 -0
- package/dest/msg_validators/tx_validator/contract_instance_validator.d.ts +9 -0
- package/dest/msg_validators/tx_validator/contract_instance_validator.d.ts.map +1 -0
- package/dest/msg_validators/tx_validator/contract_instance_validator.js +48 -0
- package/dest/msg_validators/tx_validator/data_validator.d.ts +2 -1
- package/dest/msg_validators/tx_validator/data_validator.d.ts.map +1 -1
- package/dest/msg_validators/tx_validator/data_validator.js +36 -2
- package/dest/msg_validators/tx_validator/factory.d.ts +6 -5
- package/dest/msg_validators/tx_validator/factory.d.ts.map +1 -1
- package/dest/msg_validators/tx_validator/factory.js +21 -11
- package/dest/msg_validators/tx_validator/gas_validator.d.ts +36 -4
- package/dest/msg_validators/tx_validator/gas_validator.d.ts.map +1 -1
- package/dest/msg_validators/tx_validator/gas_validator.js +50 -33
- package/dest/msg_validators/tx_validator/index.d.ts +3 -1
- package/dest/msg_validators/tx_validator/index.d.ts.map +1 -1
- package/dest/msg_validators/tx_validator/index.js +2 -0
- package/dest/msg_validators/tx_validator/phases_validator.js +1 -1
- package/dest/msg_validators/tx_validator/tx_proof_validator.d.ts +2 -1
- package/dest/msg_validators/tx_validator/tx_proof_validator.d.ts.map +1 -1
- package/dest/msg_validators/tx_validator/tx_proof_validator.js +2 -0
- package/dest/msg_validators/tx_validator/tx_validation_cache.d.ts +48 -0
- package/dest/msg_validators/tx_validator/tx_validation_cache.d.ts.map +1 -0
- package/dest/msg_validators/tx_validator/tx_validation_cache.js +68 -0
- 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 +5 -5
- package/dest/services/discv5/discV5_service.d.ts +2 -1
- package/dest/services/discv5/discV5_service.d.ts.map +1 -1
- package/dest/services/discv5/discV5_service.js +35 -8
- package/dest/services/dummy_service.d.ts +11 -15
- package/dest/services/dummy_service.d.ts.map +1 -1
- package/dest/services/dummy_service.js +12 -16
- package/dest/services/gossipsub/topic_score_params.d.ts +13 -2
- package/dest/services/gossipsub/topic_score_params.d.ts.map +1 -1
- package/dest/services/gossipsub/topic_score_params.js +21 -4
- package/dest/services/libp2p/instrumentation.d.ts +3 -1
- package/dest/services/libp2p/instrumentation.d.ts.map +1 -1
- package/dest/services/libp2p/instrumentation.js +14 -0
- package/dest/services/libp2p/libp2p_service.d.ts +36 -39
- package/dest/services/libp2p/libp2p_service.d.ts.map +1 -1
- package/dest/services/libp2p/libp2p_service.js +268 -241
- package/dest/services/peer-manager/peer_manager.d.ts +6 -2
- package/dest/services/peer-manager/peer_manager.d.ts.map +1 -1
- package/dest/services/peer-manager/peer_manager.js +36 -8
- package/dest/services/peer-manager/peer_scoring.d.ts +7 -2
- package/dest/services/peer-manager/peer_scoring.d.ts.map +1 -1
- package/dest/services/peer-manager/peer_scoring.js +32 -10
- package/dest/services/reqresp/batch-tx-requester/batch_tx_requester.d.ts +1 -8
- 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 +38 -44
- package/dest/services/reqresp/batch-tx-requester/interface.d.ts +8 -5
- package/dest/services/reqresp/batch-tx-requester/interface.d.ts.map +1 -1
- package/dest/services/reqresp/batch-tx-requester/tx_validator.d.ts +5 -14
- package/dest/services/reqresp/batch-tx-requester/tx_validator.d.ts.map +1 -1
- package/dest/services/reqresp/batch-tx-requester/tx_validator.js +6 -20
- package/dest/services/reqresp/config.d.ts +3 -3
- package/dest/services/reqresp/config.d.ts.map +1 -1
- package/dest/services/reqresp/interface.d.ts +16 -18
- package/dest/services/reqresp/interface.d.ts.map +1 -1
- package/dest/services/reqresp/interface.js +10 -20
- package/dest/services/reqresp/metrics.d.ts +1 -1
- package/dest/services/reqresp/metrics.d.ts.map +1 -1
- package/dest/services/reqresp/metrics.js +0 -1
- package/dest/services/reqresp/protocols/block_txs/bitvector.d.ts +4 -3
- package/dest/services/reqresp/protocols/block_txs/bitvector.d.ts.map +1 -1
- package/dest/services/reqresp/protocols/block_txs/bitvector.js +3 -2
- package/dest/services/reqresp/protocols/block_txs/block_txs_handler.d.ts +1 -1
- 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 +31 -28
- package/dest/services/reqresp/protocols/block_txs/block_txs_reqresp.d.ts +12 -7
- 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 +42 -24
- package/dest/services/reqresp/protocols/index.d.ts +1 -2
- package/dest/services/reqresp/protocols/index.d.ts.map +1 -1
- package/dest/services/reqresp/protocols/index.js +0 -1
- package/dest/services/reqresp/protocols/tx.d.ts +1 -1
- package/dest/services/reqresp/protocols/tx.d.ts.map +1 -1
- package/dest/services/reqresp/protocols/tx.js +1 -3
- package/dest/services/reqresp/rate-limiter/rate_limiter.d.ts +5 -4
- package/dest/services/reqresp/rate-limiter/rate_limiter.d.ts.map +1 -1
- package/dest/services/reqresp/rate-limiter/rate_limiter.js +10 -8
- package/dest/services/reqresp/rate-limiter/rate_limits.d.ts +1 -1
- package/dest/services/reqresp/rate-limiter/rate_limits.d.ts.map +1 -1
- package/dest/services/reqresp/rate-limiter/rate_limits.js +0 -10
- package/dest/services/reqresp/reqresp.d.ts +7 -29
- package/dest/services/reqresp/reqresp.d.ts.map +1 -1
- package/dest/services/reqresp/reqresp.js +26 -207
- package/dest/services/service.d.ts +9 -12
- package/dest/services/service.d.ts.map +1 -1
- package/dest/services/tx_collection/config.d.ts +2 -23
- package/dest/services/tx_collection/config.d.ts.map +1 -1
- package/dest/services/tx_collection/config.js +2 -55
- package/dest/services/tx_collection/file_store_tx_collection.d.ts +12 -28
- package/dest/services/tx_collection/file_store_tx_collection.d.ts.map +1 -1
- package/dest/services/tx_collection/file_store_tx_collection.js +43 -83
- package/dest/services/tx_collection/file_store_tx_source.d.ts +5 -4
- package/dest/services/tx_collection/file_store_tx_source.d.ts.map +1 -1
- package/dest/services/tx_collection/file_store_tx_source.js +39 -29
- package/dest/services/tx_collection/index.d.ts +2 -3
- package/dest/services/tx_collection/index.d.ts.map +1 -1
- package/dest/services/tx_collection/index.js +0 -1
- 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 +0 -2
- package/dest/services/tx_collection/tx_collection.d.ts +35 -51
- package/dest/services/tx_collection/tx_collection.d.ts.map +1 -1
- package/dest/services/tx_collection/tx_collection.js +275 -119
- package/dest/services/tx_collection/tx_collection_sink.d.ts +1 -1
- package/dest/services/tx_collection/tx_collection_sink.js +2 -2
- package/dest/services/tx_collection/tx_source.d.ts +6 -5
- package/dest/services/tx_collection/tx_source.d.ts.map +1 -1
- package/dest/services/tx_collection/tx_source.js +9 -7
- package/dest/services/tx_file_store/tx_file_store.d.ts +1 -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 +4 -14
- package/dest/services/tx_provider.d.ts +3 -1
- package/dest/services/tx_provider.d.ts.map +1 -1
- package/dest/services/tx_provider.js +3 -0
- package/dest/test-helpers/make-test-p2p-clients.d.ts +1 -1
- package/dest/test-helpers/make-test-p2p-clients.d.ts.map +1 -1
- package/dest/test-helpers/make-test-p2p-clients.js +5 -2
- package/dest/test-helpers/mock-pubsub.d.ts +23 -9
- package/dest/test-helpers/mock-pubsub.d.ts.map +1 -1
- package/dest/test-helpers/mock-pubsub.js +44 -44
- package/dest/test-helpers/reqresp-nodes.d.ts +4 -5
- package/dest/test-helpers/reqresp-nodes.d.ts.map +1 -1
- package/dest/test-helpers/reqresp-nodes.js +16 -18
- package/dest/test-helpers/test_tx_provider.d.ts +3 -1
- package/dest/test-helpers/test_tx_provider.d.ts.map +1 -1
- package/dest/test-helpers/test_tx_provider.js +3 -0
- package/dest/test-helpers/testbench-utils.d.ts +12 -14
- package/dest/test-helpers/testbench-utils.d.ts.map +1 -1
- package/dest/test-helpers/testbench-utils.js +19 -13
- package/dest/testbench/p2p_client_testbench_worker.d.ts +3 -5
- package/dest/testbench/p2p_client_testbench_worker.d.ts.map +1 -1
- package/dest/testbench/p2p_client_testbench_worker.js +84 -40
- package/dest/testbench/worker_client_manager.d.ts +10 -6
- package/dest/testbench/worker_client_manager.d.ts.map +1 -1
- package/dest/testbench/worker_client_manager.js +51 -9
- package/dest/util.d.ts +11 -6
- package/dest/util.d.ts.map +1 -1
- package/dest/util.js +35 -14
- package/dest/versioning.d.ts +3 -6
- package/dest/versioning.d.ts.map +1 -1
- package/dest/versioning.js +3 -24
- package/package.json +15 -14
- package/src/bootstrap/bootstrap.ts +9 -1
- package/src/client/factory.ts +48 -23
- package/src/client/interface.ts +15 -11
- package/src/client/p2p_client.ts +91 -43
- package/src/client/test/{tx_proposal_collector/README.md → p2p_client.batch_tx_requester.bench.README.md} +23 -53
- package/src/config.ts +107 -7
- package/src/errors/p2p-service.error.ts +11 -0
- package/src/errors/reqresp.error.ts +0 -25
- package/src/index.ts +0 -1
- package/src/mem_pools/attestation_pool/attestation_pool.ts +313 -238
- package/src/mem_pools/attestation_pool/attestation_pool_test_suite.ts +198 -62
- package/src/mem_pools/attestation_pool/mocks.ts +13 -8
- package/src/mem_pools/index.ts +0 -3
- package/src/mem_pools/instrumentation.ts +5 -1
- package/src/mem_pools/tx_pool_v2/archive/tx_archive.ts +1 -9
- package/src/mem_pools/tx_pool_v2/eviction/index.ts +1 -0
- package/src/mem_pools/tx_pool_v2/eviction/insufficient_fee_per_gas_eviction_rule.ts +65 -0
- package/src/mem_pools/tx_pool_v2/eviction/invalid_txs_after_reorg_rule.ts +3 -3
- package/src/mem_pools/tx_pool_v2/interfaces.ts +3 -0
- package/src/mem_pools/tx_pool_v2/tx_metadata.ts +20 -8
- package/src/mem_pools/tx_pool_v2/tx_pool_v2_impl.ts +75 -90
- package/src/msg_validators/attestation_validator/attestation_validator.ts +38 -7
- package/src/msg_validators/attestation_validator/fisherman_attestation_validator.ts +14 -7
- package/src/msg_validators/clock_tolerance.ts +69 -0
- package/src/msg_validators/proposal_validator/README.md +1 -1
- package/src/msg_validators/proposal_validator/block_proposal_validator.ts +12 -2
- package/src/msg_validators/proposal_validator/checkpoint_proposal_validator.ts +17 -2
- package/src/msg_validators/proposal_validator/proposal_validator.ts +51 -8
- package/src/msg_validators/tx_validator/README.md +11 -3
- package/src/msg_validators/tx_validator/aggregate_tx_validator.ts +3 -12
- package/src/msg_validators/tx_validator/allowed_public_setup.ts +3 -3
- package/src/msg_validators/tx_validator/archive_cache.ts +1 -1
- package/src/msg_validators/tx_validator/cached_tx_validator.ts +31 -0
- package/src/msg_validators/tx_validator/contract_instance_validator.ts +56 -0
- package/src/msg_validators/tx_validator/data_validator.ts +44 -1
- package/src/msg_validators/tx_validator/factory.ts +25 -7
- package/src/msg_validators/tx_validator/gas_validator.ts +82 -33
- package/src/msg_validators/tx_validator/index.ts +2 -0
- package/src/msg_validators/tx_validator/phases_validator.ts +1 -1
- package/src/msg_validators/tx_validator/tx_proof_validator.ts +2 -0
- package/src/msg_validators/tx_validator/tx_validation_cache.ts +101 -0
- package/src/services/data_store.ts +5 -13
- package/src/services/discv5/discV5_service.ts +38 -5
- package/src/services/dummy_service.ts +14 -39
- package/src/services/gossipsub/topic_score_params.ts +36 -4
- package/src/services/libp2p/instrumentation.ts +14 -0
- package/src/services/libp2p/libp2p_service.ts +297 -274
- package/src/services/peer-manager/peer_manager.ts +41 -8
- package/src/services/peer-manager/peer_scoring.ts +27 -5
- package/src/services/reqresp/README.md +0 -14
- package/src/services/reqresp/batch-tx-requester/batch_tx_requester.ts +42 -52
- package/src/services/reqresp/batch-tx-requester/interface.ts +11 -4
- package/src/services/reqresp/batch-tx-requester/tx_validator.ts +12 -25
- package/src/services/reqresp/config.ts +2 -2
- package/src/services/reqresp/interface.ts +21 -47
- package/src/services/reqresp/metrics.ts +0 -1
- package/src/services/reqresp/protocols/block_txs/bitvector.ts +3 -2
- package/src/services/reqresp/protocols/block_txs/block_txs_handler.ts +34 -30
- package/src/services/reqresp/protocols/block_txs/block_txs_reqresp.ts +47 -20
- package/src/services/reqresp/protocols/index.ts +0 -1
- package/src/services/reqresp/protocols/tx.ts +1 -3
- package/src/services/reqresp/rate-limiter/rate_limiter.ts +13 -9
- package/src/services/reqresp/rate-limiter/rate_limits.ts +0 -10
- package/src/services/reqresp/reqresp.ts +29 -252
- package/src/services/service.ts +12 -28
- package/src/services/tx_collection/config.ts +3 -80
- package/src/services/tx_collection/file_store_tx_collection.ts +54 -103
- package/src/services/tx_collection/file_store_tx_source.ts +43 -31
- package/src/services/tx_collection/index.ts +1 -6
- package/src/services/tx_collection/instrumentation.ts +1 -7
- package/src/services/tx_collection/tx_collection.ts +330 -173
- package/src/services/tx_collection/tx_collection_sink.ts +2 -2
- package/src/services/tx_collection/tx_source.ts +8 -7
- package/src/services/tx_file_store/tx_file_store.ts +5 -17
- package/src/services/tx_provider.ts +5 -0
- package/src/test-helpers/make-test-p2p-clients.ts +3 -0
- package/src/test-helpers/mock-pubsub.ts +46 -60
- package/src/test-helpers/reqresp-nodes.ts +12 -22
- package/src/test-helpers/test_tx_provider.ts +5 -0
- package/src/test-helpers/testbench-utils.ts +23 -26
- package/src/testbench/p2p_client_testbench_worker.ts +89 -54
- package/src/testbench/worker_client_manager.ts +59 -20
- package/src/util.ts +32 -17
- package/src/versioning.ts +3 -33
- package/dest/client/test/tx_proposal_collector/proposal_tx_collector_worker.d.ts +0 -2
- package/dest/client/test/tx_proposal_collector/proposal_tx_collector_worker.d.ts.map +0 -1
- package/dest/client/test/tx_proposal_collector/proposal_tx_collector_worker.js +0 -305
- package/dest/client/test/tx_proposal_collector/proposal_tx_collector_worker_protocol.d.ts +0 -73
- package/dest/client/test/tx_proposal_collector/proposal_tx_collector_worker_protocol.d.ts.map +0 -1
- package/dest/client/test/tx_proposal_collector/proposal_tx_collector_worker_protocol.js +0 -8
- package/dest/mem_pools/tx_pool/aztec_kv_tx_pool.d.ts +0 -125
- package/dest/mem_pools/tx_pool/aztec_kv_tx_pool.d.ts.map +0 -1
- package/dest/mem_pools/tx_pool/aztec_kv_tx_pool.js +0 -596
- package/dest/mem_pools/tx_pool/eviction/eviction_manager.d.ts +0 -32
- package/dest/mem_pools/tx_pool/eviction/eviction_manager.d.ts.map +0 -1
- package/dest/mem_pools/tx_pool/eviction/eviction_manager.js +0 -112
- package/dest/mem_pools/tx_pool/eviction/eviction_strategy.d.ts +0 -157
- package/dest/mem_pools/tx_pool/eviction/eviction_strategy.d.ts.map +0 -1
- package/dest/mem_pools/tx_pool/eviction/eviction_strategy.js +0 -52
- package/dest/mem_pools/tx_pool/eviction/fee_payer_balance_eviction_rule.d.ts +0 -16
- package/dest/mem_pools/tx_pool/eviction/fee_payer_balance_eviction_rule.d.ts.map +0 -1
- package/dest/mem_pools/tx_pool/eviction/fee_payer_balance_eviction_rule.js +0 -123
- package/dest/mem_pools/tx_pool/eviction/invalid_txs_after_mining_rule.d.ts +0 -17
- package/dest/mem_pools/tx_pool/eviction/invalid_txs_after_mining_rule.d.ts.map +0 -1
- package/dest/mem_pools/tx_pool/eviction/invalid_txs_after_mining_rule.js +0 -84
- package/dest/mem_pools/tx_pool/eviction/invalid_txs_after_reorg_rule.d.ts +0 -19
- package/dest/mem_pools/tx_pool/eviction/invalid_txs_after_reorg_rule.d.ts.map +0 -1
- package/dest/mem_pools/tx_pool/eviction/invalid_txs_after_reorg_rule.js +0 -78
- package/dest/mem_pools/tx_pool/eviction/low_priority_eviction_rule.d.ts +0 -26
- package/dest/mem_pools/tx_pool/eviction/low_priority_eviction_rule.d.ts.map +0 -1
- package/dest/mem_pools/tx_pool/eviction/low_priority_eviction_rule.js +0 -84
- package/dest/mem_pools/tx_pool/eviction/nullifier_conflict_pre_add_rule.d.ts +0 -25
- package/dest/mem_pools/tx_pool/eviction/nullifier_conflict_pre_add_rule.d.ts.map +0 -1
- package/dest/mem_pools/tx_pool/eviction/nullifier_conflict_pre_add_rule.js +0 -57
- package/dest/mem_pools/tx_pool/index.d.ts +0 -3
- package/dest/mem_pools/tx_pool/index.d.ts.map +0 -1
- package/dest/mem_pools/tx_pool/index.js +0 -2
- package/dest/mem_pools/tx_pool/priority.d.ts +0 -12
- package/dest/mem_pools/tx_pool/priority.d.ts.map +0 -1
- package/dest/mem_pools/tx_pool/priority.js +0 -15
- package/dest/mem_pools/tx_pool/tx_pool.d.ts +0 -127
- package/dest/mem_pools/tx_pool/tx_pool.d.ts.map +0 -1
- package/dest/mem_pools/tx_pool/tx_pool.js +0 -3
- package/dest/mem_pools/tx_pool/tx_pool_test_suite.d.ts +0 -7
- package/dest/mem_pools/tx_pool/tx_pool_test_suite.d.ts.map +0 -1
- package/dest/mem_pools/tx_pool/tx_pool_test_suite.js +0 -402
- package/dest/services/reqresp/connection-sampler/batch_connection_sampler.d.ts +0 -64
- package/dest/services/reqresp/connection-sampler/batch_connection_sampler.d.ts.map +0 -1
- package/dest/services/reqresp/connection-sampler/batch_connection_sampler.js +0 -151
- package/dest/services/reqresp/protocols/block.d.ts +0 -9
- package/dest/services/reqresp/protocols/block.d.ts.map +0 -1
- package/dest/services/reqresp/protocols/block.js +0 -32
- package/dest/services/tx_collection/fast_tx_collection.d.ts +0 -51
- package/dest/services/tx_collection/fast_tx_collection.d.ts.map +0 -1
- package/dest/services/tx_collection/fast_tx_collection.js +0 -311
- package/dest/services/tx_collection/proposal_tx_collector.d.ts +0 -48
- package/dest/services/tx_collection/proposal_tx_collector.d.ts.map +0 -1
- package/dest/services/tx_collection/proposal_tx_collector.js +0 -50
- package/dest/services/tx_collection/slow_tx_collection.d.ts +0 -57
- package/dest/services/tx_collection/slow_tx_collection.d.ts.map +0 -1
- package/dest/services/tx_collection/slow_tx_collection.js +0 -211
- package/src/client/test/tx_proposal_collector/proposal_tx_collector_worker.ts +0 -344
- package/src/client/test/tx_proposal_collector/proposal_tx_collector_worker_protocol.ts +0 -43
- package/src/mem_pools/tx_pool/README.md +0 -270
- package/src/mem_pools/tx_pool/aztec_kv_tx_pool.ts +0 -746
- package/src/mem_pools/tx_pool/eviction/eviction_manager.ts +0 -132
- package/src/mem_pools/tx_pool/eviction/eviction_strategy.ts +0 -208
- package/src/mem_pools/tx_pool/eviction/fee_payer_balance_eviction_rule.ts +0 -163
- package/src/mem_pools/tx_pool/eviction/invalid_txs_after_mining_rule.ts +0 -104
- package/src/mem_pools/tx_pool/eviction/invalid_txs_after_reorg_rule.ts +0 -93
- package/src/mem_pools/tx_pool/eviction/low_priority_eviction_rule.ts +0 -106
- package/src/mem_pools/tx_pool/eviction/nullifier_conflict_pre_add_rule.ts +0 -75
- package/src/mem_pools/tx_pool/index.ts +0 -2
- package/src/mem_pools/tx_pool/priority.ts +0 -20
- package/src/mem_pools/tx_pool/tx_pool.ts +0 -141
- package/src/mem_pools/tx_pool/tx_pool_test_suite.ts +0 -321
- package/src/services/reqresp/connection-sampler/batch_connection_sampler.ts +0 -161
- package/src/services/reqresp/protocols/block.ts +0 -37
- package/src/services/tx_collection/fast_tx_collection.ts +0 -361
- package/src/services/tx_collection/proposal_tx_collector.ts +0 -108
- package/src/services/tx_collection/slow_tx_collection.ts +0 -266
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* Used when running testbench commands.
|
|
5
5
|
*/
|
|
6
6
|
import { MockL2BlockSource } from '@aztec/archiver/test';
|
|
7
|
-
import type {
|
|
7
|
+
import type { EpochCacheInterface } from '@aztec/epoch-cache';
|
|
8
8
|
import { BlockNumber } from '@aztec/foundation/branded-types';
|
|
9
9
|
import { SecretValue } from '@aztec/foundation/config';
|
|
10
10
|
import { Secp256k1Signer } from '@aztec/foundation/crypto/secp256k1-signer';
|
|
@@ -17,27 +17,27 @@ import { getVKTreeRoot } from '@aztec/noir-protocol-circuits-types/vk-tree';
|
|
|
17
17
|
import { protocolContractsHash } from '@aztec/protocol-contracts';
|
|
18
18
|
import type { L2BlockSource } from '@aztec/stdlib/block';
|
|
19
19
|
import type { ContractDataSource } from '@aztec/stdlib/contract';
|
|
20
|
+
import { GasFees } from '@aztec/stdlib/gas';
|
|
20
21
|
import type { ClientProtocolCircuitVerifier, WorldStateSynchronizer } from '@aztec/stdlib/interfaces/server';
|
|
21
22
|
import type { DataStoreConfig } from '@aztec/stdlib/kv-store';
|
|
22
23
|
import { type BlockProposal, P2PMessage } from '@aztec/stdlib/p2p';
|
|
23
24
|
import { ChonkProof } from '@aztec/stdlib/proofs';
|
|
24
25
|
import { makeAztecAddress, makeBlockHeader, makeBlockProposal, mockTx } from '@aztec/stdlib/testing';
|
|
25
|
-
import { Tx, TxHash, type TxValidationResult } from '@aztec/stdlib/tx';
|
|
26
|
+
import { Tx, TxHash, type TxValidationResult, type TxValidator } from '@aztec/stdlib/tx';
|
|
26
27
|
import { type TelemetryClient, getTelemetryClient } from '@aztec/telemetry-client';
|
|
27
28
|
|
|
28
29
|
import type { Message, PeerId } from '@libp2p/interface';
|
|
29
30
|
import { TopicValidatorResult } from '@libp2p/interface';
|
|
30
31
|
import { peerIdFromString } from '@libp2p/peer-id';
|
|
31
|
-
import { mock } from 'jest-mock-extended';
|
|
32
32
|
|
|
33
33
|
import type { P2PClient } from '../client/index.js';
|
|
34
34
|
import type { P2PConfig } from '../config.js';
|
|
35
35
|
import { createP2PClient } from '../index.js';
|
|
36
36
|
import type { MemPools } from '../mem_pools/index.js';
|
|
37
|
-
import {
|
|
37
|
+
import { LibP2PService } from '../services/index.js';
|
|
38
38
|
import type { PeerManager } from '../services/peer-manager/peer_manager.js';
|
|
39
|
+
import { BatchTxRequester } from '../services/reqresp/batch-tx-requester/batch_tx_requester.js';
|
|
39
40
|
import type { BatchTxRequesterLibP2PService } from '../services/reqresp/batch-tx-requester/interface.js';
|
|
40
|
-
import type { IBatchRequestTxValidator } from '../services/reqresp/batch-tx-requester/tx_validator.js';
|
|
41
41
|
import { RateLimitStatus } from '../services/reqresp/rate-limiter/rate_limiter.js';
|
|
42
42
|
import type { ReqResp } from '../services/reqresp/reqresp.js';
|
|
43
43
|
import type { PeerDiscoveryService } from '../services/service.js';
|
|
@@ -45,25 +45,23 @@ import { RequestTracker } from '../services/tx_collection/request_tracker.js';
|
|
|
45
45
|
import { AlwaysTrueCircuitVerifier } from '../test-helpers/index.js';
|
|
46
46
|
import {
|
|
47
47
|
BENCHMARK_CONSTANTS,
|
|
48
|
-
type CollectorType,
|
|
49
48
|
type DistributionPattern,
|
|
50
49
|
InMemoryAttestationPool,
|
|
51
50
|
InMemoryTxPool,
|
|
52
51
|
UNLIMITED_RATE_LIMIT_QUOTA,
|
|
52
|
+
createMockEpochCache,
|
|
53
53
|
createMockWorldStateSynchronizer,
|
|
54
54
|
filterTxsByDistribution,
|
|
55
55
|
} from '../test-helpers/index.js';
|
|
56
56
|
import type { PubSubLibp2p } from '../util.js';
|
|
57
57
|
|
|
58
|
-
export type { DistributionPattern
|
|
59
|
-
export { COLLECTOR_DISPLAY_NAMES } from '../test-helpers/testbench-utils.js';
|
|
58
|
+
export type { DistributionPattern } from '../test-helpers/testbench-utils.js';
|
|
60
59
|
|
|
61
60
|
export interface BenchReqRespCommand {
|
|
62
61
|
type: 'BENCH_REQRESP';
|
|
63
62
|
txCount: number;
|
|
64
63
|
peerCount: number;
|
|
65
64
|
distribution: DistributionPattern;
|
|
66
|
-
collectorType: CollectorType;
|
|
67
65
|
timeoutMs: number;
|
|
68
66
|
isAggregator: boolean;
|
|
69
67
|
peerIndex: number;
|
|
@@ -116,6 +114,7 @@ class TestLibP2PService extends LibP2PService {
|
|
|
116
114
|
epochCache,
|
|
117
115
|
proofVerifier,
|
|
118
116
|
worldStateSynchronizer,
|
|
117
|
+
{ getCurrentMinFees: () => Promise.resolve(GasFees.empty()) },
|
|
119
118
|
telemetry,
|
|
120
119
|
logger,
|
|
121
120
|
);
|
|
@@ -204,10 +203,28 @@ function installUnlimitedRateLimits(client: P2PClient): void {
|
|
|
204
203
|
rateLimiter.allow = () => RateLimitStatus.Allowed;
|
|
205
204
|
}
|
|
206
205
|
|
|
206
|
+
/** Resets peer scores to prevent cross-case contamination in benchmarks. */
|
|
207
|
+
function resetPeerScores(client: P2PClient): void {
|
|
208
|
+
const peerManager = (client as any).p2pService.peerManager;
|
|
209
|
+
const peerScoring = peerManager?.peerScoring;
|
|
210
|
+
if (peerScoring?.resetAllScores) {
|
|
211
|
+
peerScoring.resetAllScores();
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
/** Returns the number of connected peers for connectivity checks. */
|
|
216
|
+
function getConnectedPeerCount(client: P2PClient): number {
|
|
217
|
+
const p2pService = (client as any).p2pService;
|
|
218
|
+
const connectionSampler = p2pService?.reqresp?.getConnectionSampler?.();
|
|
219
|
+
if (connectionSampler?.getPeerListSortedByConnectionCountAsc) {
|
|
220
|
+
return connectionSampler.getPeerListSortedByConnectionCountAsc().length;
|
|
221
|
+
}
|
|
222
|
+
return 0;
|
|
223
|
+
}
|
|
224
|
+
|
|
207
225
|
async function runAggregatorBenchmark(
|
|
208
226
|
client: P2PClient,
|
|
209
227
|
blockProposal: BlockProposal,
|
|
210
|
-
collectorType: CollectorType,
|
|
211
228
|
timeoutMs: number,
|
|
212
229
|
pinnedPeerId: string | undefined,
|
|
213
230
|
pinnedPeerIndex: number | undefined,
|
|
@@ -258,44 +275,22 @@ async function runAggregatorBenchmark(
|
|
|
258
275
|
}
|
|
259
276
|
}
|
|
260
277
|
|
|
261
|
-
const noopTxValidator:
|
|
262
|
-
|
|
263
|
-
validateRequestedTxs: (txs: Tx[]): Promise<TxValidationResult[]> =>
|
|
264
|
-
Promise.resolve(txs.map(() => ({ result: 'valid' }))),
|
|
278
|
+
const noopTxValidator: TxValidator = {
|
|
279
|
+
validateTx: (_tx: Tx): Promise<TxValidationResult> => Promise.resolve({ result: 'valid' }),
|
|
265
280
|
};
|
|
266
281
|
|
|
267
282
|
timer = new Timer();
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
logger,
|
|
272
|
-
new DateProvider(),
|
|
273
|
-
noopTxValidator,
|
|
274
|
-
);
|
|
275
|
-
const fetchedTxs = await collector.collectTxs(
|
|
276
|
-
RequestTracker.create(txHashes, new Date(Date.now() + timeoutMs)),
|
|
277
|
-
blockProposal,
|
|
278
|
-
pinnedPeer,
|
|
279
|
-
);
|
|
280
|
-
const durationMs = timer.ms();
|
|
281
|
-
return {
|
|
282
|
-
type: 'BENCH_RESULT',
|
|
283
|
-
durationMs,
|
|
284
|
-
fetchedCount: fetchedTxs.length,
|
|
285
|
-
success: fetchedTxs.length === txHashes.length,
|
|
286
|
-
};
|
|
287
|
-
}
|
|
288
|
-
|
|
289
|
-
const collector = new SendBatchRequestCollector(
|
|
290
|
-
batchTxRequesterService,
|
|
291
|
-
BENCHMARK_CONSTANTS.FIXED_MAX_PEERS,
|
|
292
|
-
BENCHMARK_CONSTANTS.FIXED_MAX_RETRY_ATTEMPTS,
|
|
293
|
-
);
|
|
294
|
-
const fetchedTxs = await collector.collectTxs(
|
|
295
|
-
RequestTracker.create(txHashes, new Date(Date.now() + timeoutMs)),
|
|
283
|
+
const tracker = RequestTracker.create(txHashes, new Date(Date.now() + timeoutMs));
|
|
284
|
+
const batchRequester = new BatchTxRequester(
|
|
285
|
+
tracker,
|
|
296
286
|
blockProposal,
|
|
297
287
|
pinnedPeer,
|
|
288
|
+
batchTxRequesterService,
|
|
289
|
+
logger,
|
|
290
|
+
new DateProvider(),
|
|
291
|
+
{ txValidator: noopTxValidator },
|
|
298
292
|
);
|
|
293
|
+
const fetchedTxs = await BatchTxRequester.collectAllTxs(batchRequester.run());
|
|
299
294
|
const durationMs = timer.ms();
|
|
300
295
|
return {
|
|
301
296
|
type: 'BENCH_RESULT',
|
|
@@ -321,6 +316,37 @@ let workerConfig: P2PConfig | null = null;
|
|
|
321
316
|
let workerLogger: Logger | null = null;
|
|
322
317
|
let kvStore: Awaited<ReturnType<typeof openTmpStore>> | null = null;
|
|
323
318
|
|
|
319
|
+
async function stopWorker() {
|
|
320
|
+
try {
|
|
321
|
+
if (workerClient) {
|
|
322
|
+
await workerClient.stop();
|
|
323
|
+
workerClient = null;
|
|
324
|
+
}
|
|
325
|
+
} catch (e) {
|
|
326
|
+
workerLogger?.error('Error stopping worker client', e);
|
|
327
|
+
}
|
|
328
|
+
try {
|
|
329
|
+
if (kvStore?.close) {
|
|
330
|
+
await kvStore.close();
|
|
331
|
+
kvStore = null;
|
|
332
|
+
}
|
|
333
|
+
} catch (e) {
|
|
334
|
+
workerLogger?.error('Error closing kv store', e);
|
|
335
|
+
}
|
|
336
|
+
}
|
|
337
|
+
|
|
338
|
+
function gracefulExit(code: number = 0) {
|
|
339
|
+
try {
|
|
340
|
+
if (process.connected) {
|
|
341
|
+
process.disconnect();
|
|
342
|
+
}
|
|
343
|
+
} catch {
|
|
344
|
+
// IPC channel already closed
|
|
345
|
+
}
|
|
346
|
+
// Safety fallback if lingering handles prevent the event loop from draining
|
|
347
|
+
setTimeout(() => process.exit(code), 5000).unref();
|
|
348
|
+
}
|
|
349
|
+
|
|
324
350
|
// eslint-disable-next-line @typescript-eslint/no-misused-promises
|
|
325
351
|
process.on('message', async msg => {
|
|
326
352
|
const {
|
|
@@ -344,7 +370,7 @@ process.on('message', async msg => {
|
|
|
344
370
|
workerConfig = config;
|
|
345
371
|
workerTxPool = new InMemoryTxPool();
|
|
346
372
|
workerAttestationPool = new InMemoryAttestationPool();
|
|
347
|
-
const epochCache =
|
|
373
|
+
const epochCache = createMockEpochCache();
|
|
348
374
|
const worldState = createMockWorldStateSynchronizer();
|
|
349
375
|
const l2BlockSource = new MockL2BlockSource();
|
|
350
376
|
|
|
@@ -367,10 +393,12 @@ process.on('message', async msg => {
|
|
|
367
393
|
proofVerifier as ClientProtocolCircuitVerifier,
|
|
368
394
|
worldState,
|
|
369
395
|
epochCache,
|
|
396
|
+
{ getCurrentMinFees: () => Promise.resolve(GasFees.empty()) },
|
|
370
397
|
'test-p2p-bench-worker',
|
|
371
398
|
undefined,
|
|
372
399
|
telemetry as TelemetryClient,
|
|
373
400
|
deps,
|
|
401
|
+
await l2BlockSource.getInitialHeader().hash(),
|
|
374
402
|
);
|
|
375
403
|
|
|
376
404
|
const testService = new TestLibP2PService(
|
|
@@ -410,13 +438,8 @@ process.on('message', async msg => {
|
|
|
410
438
|
const cmd = msg as any;
|
|
411
439
|
switch (cmd.type) {
|
|
412
440
|
case 'STOP':
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
}
|
|
416
|
-
if (kvStore?.close) {
|
|
417
|
-
await kvStore.close();
|
|
418
|
-
}
|
|
419
|
-
process.exit(0);
|
|
441
|
+
await stopWorker();
|
|
442
|
+
gracefulExit(0);
|
|
420
443
|
break;
|
|
421
444
|
|
|
422
445
|
case 'SEND_TX':
|
|
@@ -426,6 +449,13 @@ process.on('message', async msg => {
|
|
|
426
449
|
}
|
|
427
450
|
break;
|
|
428
451
|
|
|
452
|
+
case 'GET_PEER_COUNT':
|
|
453
|
+
process.send!({
|
|
454
|
+
type: 'PEER_COUNT',
|
|
455
|
+
count: workerClient ? getConnectedPeerCount(workerClient) : 0,
|
|
456
|
+
});
|
|
457
|
+
break;
|
|
458
|
+
|
|
429
459
|
case 'BENCH_REQRESP': {
|
|
430
460
|
const benchCmd = cmd as BenchReqRespCommand;
|
|
431
461
|
if (!workerClient || !workerTxPool || !workerAttestationPool || !workerConfig || !workerLogger) {
|
|
@@ -442,6 +472,7 @@ process.on('message', async msg => {
|
|
|
442
472
|
// Reset state before each benchmark run to avoid cross-run contamination
|
|
443
473
|
workerTxPool.resetState();
|
|
444
474
|
workerAttestationPool.resetState();
|
|
475
|
+
resetPeerScores(workerClient);
|
|
445
476
|
|
|
446
477
|
installUnlimitedRateLimits(workerClient);
|
|
447
478
|
|
|
@@ -458,13 +489,12 @@ process.on('message', async msg => {
|
|
|
458
489
|
workerTxPool.clearTxs();
|
|
459
490
|
|
|
460
491
|
workerLogger.info(
|
|
461
|
-
`[BENCH] Aggregator starting benchmark: txCount=${benchCmd.txCount},
|
|
492
|
+
`[BENCH] Aggregator starting benchmark: txCount=${benchCmd.txCount}, distribution=${benchCmd.distribution}`,
|
|
462
493
|
);
|
|
463
494
|
|
|
464
495
|
const result = await runAggregatorBenchmark(
|
|
465
496
|
workerClient,
|
|
466
497
|
blockProposal,
|
|
467
|
-
benchCmd.collectorType,
|
|
468
498
|
benchCmd.timeoutMs,
|
|
469
499
|
benchCmd.pinnedPeerId,
|
|
470
500
|
benchCmd.pinnedPeerIndex,
|
|
@@ -493,7 +523,12 @@ process.on('message', async msg => {
|
|
|
493
523
|
}
|
|
494
524
|
}
|
|
495
525
|
} catch (err: any) {
|
|
496
|
-
|
|
497
|
-
|
|
526
|
+
try {
|
|
527
|
+
process.send!({ type: 'ERROR', error: err.message });
|
|
528
|
+
} catch {
|
|
529
|
+
// IPC channel may be closed
|
|
530
|
+
}
|
|
531
|
+
await stopWorker();
|
|
532
|
+
gracefulExit(1);
|
|
498
533
|
}
|
|
499
534
|
});
|
|
@@ -13,12 +13,7 @@ import { generatePeerIdPrivateKeys } from '../test-helpers/generate-peer-id-priv
|
|
|
13
13
|
import { getPorts } from '../test-helpers/get-ports.js';
|
|
14
14
|
import { makeEnr, makeEnrs } from '../test-helpers/make-enrs.js';
|
|
15
15
|
import { BENCHMARK_CONSTANTS } from '../test-helpers/testbench-utils.js';
|
|
16
|
-
import type {
|
|
17
|
-
BenchReqRespCommand,
|
|
18
|
-
BenchResultMessage,
|
|
19
|
-
CollectorType,
|
|
20
|
-
DistributionPattern,
|
|
21
|
-
} from './p2p_client_testbench_worker.js';
|
|
16
|
+
import type { BenchReqRespCommand, BenchResultMessage, DistributionPattern } from './p2p_client_testbench_worker.js';
|
|
22
17
|
|
|
23
18
|
const __dirname = path.dirname(fileURLToPath(import.meta.url));
|
|
24
19
|
const p2pRoot = path.resolve(__dirname, '../..');
|
|
@@ -29,15 +24,12 @@ const tsconfigPath = path.join(p2pRoot, 'tsconfig.json');
|
|
|
29
24
|
const testChainConfig: ChainConfig = {
|
|
30
25
|
l1ChainId: 31337,
|
|
31
26
|
rollupVersion: 1,
|
|
32
|
-
|
|
33
|
-
rollupAddress: EthAddress.random(),
|
|
34
|
-
},
|
|
27
|
+
rollupAddress: EthAddress.random(),
|
|
35
28
|
};
|
|
36
29
|
|
|
37
30
|
export interface ReqRespBenchmarkConfig {
|
|
38
31
|
txCount: number;
|
|
39
32
|
distribution: DistributionPattern;
|
|
40
|
-
collectorType: CollectorType;
|
|
41
33
|
timeoutMs: number;
|
|
42
34
|
pinnedPeerIndex?: number;
|
|
43
35
|
blockNumber?: number;
|
|
@@ -47,7 +39,6 @@ export interface ReqRespBenchmarkConfig {
|
|
|
47
39
|
export interface ReqRespBenchmarkResult {
|
|
48
40
|
txCount: number;
|
|
49
41
|
distribution: DistributionPattern;
|
|
50
|
-
collector: CollectorType;
|
|
51
42
|
durationMs: number;
|
|
52
43
|
fetchedCount: number;
|
|
53
44
|
success: boolean;
|
|
@@ -72,7 +63,6 @@ class WorkerClientManager {
|
|
|
72
63
|
destroy() {
|
|
73
64
|
this.cleanup().catch((error: Error) => {
|
|
74
65
|
this.logger.error('Failed to cleanup worker client manager', error);
|
|
75
|
-
process.exit(1);
|
|
76
66
|
});
|
|
77
67
|
}
|
|
78
68
|
|
|
@@ -425,6 +415,61 @@ class WorkerClientManager {
|
|
|
425
415
|
this.logger.info('All worker processes cleaned up');
|
|
426
416
|
}
|
|
427
417
|
|
|
418
|
+
/**
|
|
419
|
+
* Checks that the aggregator (client 0) has sufficient peer connections before running a benchmark.
|
|
420
|
+
* This prevents benchmark cases from starting with degraded connectivity after a previous case
|
|
421
|
+
* caused connection failures.
|
|
422
|
+
*/
|
|
423
|
+
async waitForConnectivity(minPeers: number, timeoutMs: number = 15_000): Promise<number> {
|
|
424
|
+
const waitInterval = 1000;
|
|
425
|
+
let waited = 0;
|
|
426
|
+
|
|
427
|
+
while (waited < timeoutMs) {
|
|
428
|
+
const count = await this.getPeerCount(0, 5000);
|
|
429
|
+
if (count >= minPeers) {
|
|
430
|
+
this.logger.info(`Connectivity check passed: ${count}/${minPeers} peers connected`);
|
|
431
|
+
return count;
|
|
432
|
+
}
|
|
433
|
+
this.logger.debug(`Waiting for connectivity: ${count}/${minPeers} (waited ${waited}ms)`);
|
|
434
|
+
await sleep(waitInterval);
|
|
435
|
+
waited += waitInterval;
|
|
436
|
+
}
|
|
437
|
+
|
|
438
|
+
const finalCount = await this.getPeerCount(0, 5000);
|
|
439
|
+
this.logger.warn(`Connectivity check: only ${finalCount}/${minPeers} peers after ${timeoutMs}ms`);
|
|
440
|
+
return finalCount;
|
|
441
|
+
}
|
|
442
|
+
|
|
443
|
+
private getPeerCount(clientIndex: number, timeoutMs: number): Promise<number> {
|
|
444
|
+
return new Promise<number>(resolve => {
|
|
445
|
+
let resolved = false;
|
|
446
|
+
|
|
447
|
+
const handler = (msg: any) => {
|
|
448
|
+
if (resolved) {
|
|
449
|
+
return;
|
|
450
|
+
}
|
|
451
|
+
if (msg.type === 'PEER_COUNT') {
|
|
452
|
+
resolved = true;
|
|
453
|
+
clearTimeout(timeout);
|
|
454
|
+
this.processes[clientIndex].off('message', handler);
|
|
455
|
+
resolve(msg.count as number);
|
|
456
|
+
}
|
|
457
|
+
};
|
|
458
|
+
|
|
459
|
+
const timeout = setTimeout(() => {
|
|
460
|
+
if (resolved) {
|
|
461
|
+
return;
|
|
462
|
+
}
|
|
463
|
+
resolved = true;
|
|
464
|
+
this.processes[clientIndex].off('message', handler);
|
|
465
|
+
resolve(0);
|
|
466
|
+
}, timeoutMs);
|
|
467
|
+
|
|
468
|
+
this.processes[clientIndex].on('message', handler);
|
|
469
|
+
this.processes[clientIndex].send({ type: 'GET_PEER_COUNT' });
|
|
470
|
+
});
|
|
471
|
+
}
|
|
472
|
+
|
|
428
473
|
/**
|
|
429
474
|
* Run a req/resp benchmark across all worker clients.
|
|
430
475
|
*
|
|
@@ -445,9 +490,7 @@ class WorkerClientManager {
|
|
|
445
490
|
const blockNumber = config.blockNumber ?? 1;
|
|
446
491
|
const pinnedPeerId = config.pinnedPeerIndex !== undefined ? this.peerIds[config.pinnedPeerIndex] : undefined;
|
|
447
492
|
|
|
448
|
-
this.logger.info(
|
|
449
|
-
`Starting req/resp benchmark: txCount=${config.txCount}, distribution=${config.distribution}, collector=${config.collectorType}`,
|
|
450
|
-
);
|
|
493
|
+
this.logger.info(`Starting req/resp benchmark: txCount=${config.txCount}, distribution=${config.distribution}`);
|
|
451
494
|
|
|
452
495
|
const readyPromises: Promise<void>[] = [];
|
|
453
496
|
|
|
@@ -457,7 +500,6 @@ class WorkerClientManager {
|
|
|
457
500
|
txCount: config.txCount,
|
|
458
501
|
peerCount,
|
|
459
502
|
distribution: config.distribution,
|
|
460
|
-
collectorType: config.collectorType,
|
|
461
503
|
timeoutMs: config.timeoutMs,
|
|
462
504
|
isAggregator: false,
|
|
463
505
|
peerIndex: i,
|
|
@@ -479,7 +521,6 @@ class WorkerClientManager {
|
|
|
479
521
|
txCount: config.txCount,
|
|
480
522
|
peerCount,
|
|
481
523
|
distribution: config.distribution,
|
|
482
|
-
collectorType: config.collectorType,
|
|
483
524
|
timeoutMs: config.timeoutMs,
|
|
484
525
|
isAggregator: true,
|
|
485
526
|
peerIndex: 0,
|
|
@@ -500,7 +541,6 @@ class WorkerClientManager {
|
|
|
500
541
|
return {
|
|
501
542
|
txCount: config.txCount,
|
|
502
543
|
distribution: config.distribution,
|
|
503
|
-
collector: config.collectorType,
|
|
504
544
|
durationMs: result.durationMs,
|
|
505
545
|
fetchedCount: result.fetchedCount,
|
|
506
546
|
success: result.success,
|
|
@@ -578,5 +618,4 @@ class WorkerClientManager {
|
|
|
578
618
|
}
|
|
579
619
|
|
|
580
620
|
export { WorkerClientManager, testChainConfig };
|
|
581
|
-
export type { DistributionPattern
|
|
582
|
-
export { COLLECTOR_DISPLAY_NAMES } from './p2p_client_testbench_worker.js';
|
|
621
|
+
export type { DistributionPattern } from './p2p_client_testbench_worker.js';
|
package/src/util.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { SecretValue } from '@aztec/foundation/config';
|
|
2
|
-
import type
|
|
2
|
+
import { type Logger, createLogger } from '@aztec/foundation/log';
|
|
3
3
|
import type { AztecAsyncKVStore, AztecAsyncSingleton } from '@aztec/kv-store';
|
|
4
4
|
import type { DataStoreConfig } from '@aztec/stdlib/kv-store';
|
|
5
5
|
|
|
@@ -7,7 +7,7 @@ import type { GossipSub } from '@chainsafe/libp2p-gossipsub';
|
|
|
7
7
|
import { generateKeyPair, marshalPrivateKey, unmarshalPrivateKey } from '@libp2p/crypto/keys';
|
|
8
8
|
import type { Identify } from '@libp2p/identify';
|
|
9
9
|
import type { PeerId, PrivateKey } from '@libp2p/interface';
|
|
10
|
-
import type { ConnectionManager } from '@libp2p/interface-internal';
|
|
10
|
+
import type { AddressManager, ConnectionManager } from '@libp2p/interface-internal';
|
|
11
11
|
import { createFromPrivKey } from '@libp2p/peer-id-factory';
|
|
12
12
|
import { resolve } from 'dns/promises';
|
|
13
13
|
import { promises as fs } from 'fs';
|
|
@@ -15,7 +15,7 @@ import type { Libp2p } from 'libp2p';
|
|
|
15
15
|
import net from 'net';
|
|
16
16
|
import path from 'path';
|
|
17
17
|
|
|
18
|
-
import type
|
|
18
|
+
import { DEFAULT_PUBLIC_IP_SERVICES, type P2PConfig } from './config.js';
|
|
19
19
|
|
|
20
20
|
const PEER_ID_DATA_DIR_FILE = 'p2p-private-key';
|
|
21
21
|
|
|
@@ -31,6 +31,9 @@ export interface PubSubLibp2p extends Pick<Libp2p, 'status' | 'start' | 'stop' |
|
|
|
31
31
|
| 'direct'
|
|
32
32
|
| 'getMeshPeers'
|
|
33
33
|
> & { score: Pick<GossipSub['score'], 'score'> };
|
|
34
|
+
components: {
|
|
35
|
+
addressManager: Pick<AddressManager, 'addObservedAddr' | 'confirmObservedAddr' | 'removeObservedAddr'>;
|
|
36
|
+
};
|
|
34
37
|
};
|
|
35
38
|
}
|
|
36
39
|
|
|
@@ -39,6 +42,7 @@ export type FullLibp2p = Libp2p<{
|
|
|
39
42
|
pubsub: GossipSub;
|
|
40
43
|
components: {
|
|
41
44
|
connectionManager: ConnectionManager;
|
|
45
|
+
addressManager: AddressManager;
|
|
42
46
|
};
|
|
43
47
|
}>;
|
|
44
48
|
|
|
@@ -60,16 +64,25 @@ export function convertToMultiaddr(address: string, port: number, protocol: 'tcp
|
|
|
60
64
|
}
|
|
61
65
|
|
|
62
66
|
/**
|
|
63
|
-
* Queries the public IP address of the machine.
|
|
67
|
+
* Queries the public IP address of the machine, trying multiple services in order.
|
|
68
|
+
* @param services - HTTPS URLs to try; defaults to {@link DEFAULT_PUBLIC_IP_SERVICES}.
|
|
64
69
|
*/
|
|
65
|
-
export async function getPublicIp(): Promise<string> {
|
|
66
|
-
const
|
|
67
|
-
const
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
70
|
+
export async function getPublicIp(services: string[] = DEFAULT_PUBLIC_IP_SERVICES): Promise<string> {
|
|
71
|
+
const errors: string[] = [];
|
|
72
|
+
for (const url of services) {
|
|
73
|
+
try {
|
|
74
|
+
const resp = await fetch(url, { signal: AbortSignal.timeout(5000) });
|
|
75
|
+
const text = await resp.text();
|
|
76
|
+
const address = text.trim();
|
|
77
|
+
if (isValidIpAddress(address)) {
|
|
78
|
+
return address;
|
|
79
|
+
}
|
|
80
|
+
errors.push(`${url}: invalid IP "${address}"`);
|
|
81
|
+
} catch (err: any) {
|
|
82
|
+
errors.push(`${url}: ${err.message ?? err}`);
|
|
83
|
+
}
|
|
71
84
|
}
|
|
72
|
-
|
|
85
|
+
throw new Error(`Failed to determine public IP from all services:\n${errors.join('\n')}`);
|
|
73
86
|
}
|
|
74
87
|
|
|
75
88
|
export function isValidIpAddress(address: string): boolean {
|
|
@@ -107,18 +120,20 @@ export async function configureP2PClientAddresses(
|
|
|
107
120
|
): Promise<P2PConfig & DataStoreConfig> {
|
|
108
121
|
const config = { ..._config };
|
|
109
122
|
const { p2pIp, queryForIp, p2pBroadcastPort, p2pPort } = config;
|
|
123
|
+
const logger = createLogger('p2p:config');
|
|
110
124
|
|
|
111
125
|
// If no broadcast port is provided, use the given p2p port as the broadcast port
|
|
112
126
|
if (!p2pBroadcastPort) {
|
|
113
127
|
config.p2pBroadcastPort = p2pPort;
|
|
114
128
|
}
|
|
115
129
|
|
|
116
|
-
//
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
130
|
+
// Resolve the initial public IP so the ENR and announce address are set at startup.
|
|
131
|
+
// If queryForIp is enabled, discv5 will also track IP changes at runtime via enrUpdate.
|
|
132
|
+
if (!p2pIp && queryForIp) {
|
|
133
|
+
config.p2pIp = await getPublicIp(config.publicIpServices);
|
|
134
|
+
logger.info('Resolved initial public IP for P2P', { ip: config.p2pIp, queryForIp });
|
|
135
|
+
} else if (p2pIp) {
|
|
136
|
+
logger.info('Using configured static P2P IP', { ip: p2pIp, queryForIp });
|
|
122
137
|
}
|
|
123
138
|
// TODO(md): guard against setting a local ip address as the announce ip
|
|
124
139
|
|
package/src/versioning.ts
CHANGED
|
@@ -1,33 +1,21 @@
|
|
|
1
|
-
import { toBufferBE } from '@aztec/foundation/bigint-buffer';
|
|
2
1
|
import { getVKTreeRoot } from '@aztec/noir-protocol-circuits-types/vk-tree';
|
|
3
2
|
import { protocolContractsHash } from '@aztec/protocol-contracts';
|
|
4
3
|
import type { ChainConfig } from '@aztec/stdlib/config';
|
|
5
|
-
import {
|
|
6
|
-
type ComponentsVersions,
|
|
7
|
-
checkCompressedComponentVersion,
|
|
8
|
-
compressComponentVersions,
|
|
9
|
-
getComponentsVersionsFromConfig,
|
|
10
|
-
} from '@aztec/stdlib/versioning';
|
|
4
|
+
import { compressComponentVersions, getComponentsVersionsFromConfig } from '@aztec/stdlib/versioning';
|
|
11
5
|
|
|
12
6
|
import type { SignableENR } from '@nethermindeth/enr';
|
|
13
|
-
import xxhashFactory from 'xxhash-wasm';
|
|
14
7
|
|
|
15
8
|
import { AZTEC_ENR_CLIENT_VERSION_KEY, AZTEC_ENR_KEY } from './types/index.js';
|
|
16
9
|
|
|
17
|
-
const USE_XX_HASH = false; // Enable to reduce the size of the ENR record for production
|
|
18
|
-
const XX_HASH_LEN = 8;
|
|
19
|
-
const xxhash = await xxhashFactory();
|
|
20
|
-
|
|
21
10
|
/** Returns the component versions based on config and this build. */
|
|
22
11
|
export function getVersions(config: ChainConfig) {
|
|
23
12
|
return getComponentsVersionsFromConfig(config, protocolContractsHash, getVKTreeRoot());
|
|
24
13
|
}
|
|
25
14
|
|
|
26
15
|
/** Sets the aztec key on the ENR record with versioning info. */
|
|
27
|
-
export function setAztecEnrKey(enr: SignableENR, config: ChainConfig
|
|
16
|
+
export function setAztecEnrKey(enr: SignableENR, config: ChainConfig) {
|
|
28
17
|
const versions = getVersions(config);
|
|
29
|
-
|
|
30
|
-
enr.set(AZTEC_ENR_KEY, value);
|
|
18
|
+
enr.set(AZTEC_ENR_KEY, Buffer.from(compressComponentVersions(versions)));
|
|
31
19
|
return versions;
|
|
32
20
|
}
|
|
33
21
|
|
|
@@ -37,21 +25,3 @@ export function setAztecClientVersionEnrKey(enr: SignableENR, clientVersion: str
|
|
|
37
25
|
enr.set(AZTEC_ENR_CLIENT_VERSION_KEY, Buffer.from(clientVersion));
|
|
38
26
|
}
|
|
39
27
|
}
|
|
40
|
-
|
|
41
|
-
/** Checks the given value from an ENR record against the expected versions. */
|
|
42
|
-
export function checkAztecEnrVersion(enrValue: Buffer, expectedVersions: ComponentsVersions) {
|
|
43
|
-
if (enrValue.length === XX_HASH_LEN) {
|
|
44
|
-
const expected = versionsToEnrValue(expectedVersions, true);
|
|
45
|
-
if (!Buffer.from(enrValue).equals(expected)) {
|
|
46
|
-
throw new Error(`Expected ENR version ${expected.toString('hex')} but received ${enrValue.toString('hex')}`);
|
|
47
|
-
}
|
|
48
|
-
} else {
|
|
49
|
-
const actual = Buffer.from(enrValue).toString();
|
|
50
|
-
checkCompressedComponentVersion(actual, expectedVersions);
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
function versionsToEnrValue(versions: ComponentsVersions, useXxHash: boolean) {
|
|
55
|
-
const compressed = compressComponentVersions(versions);
|
|
56
|
-
return useXxHash ? toBufferBE(xxhash.h64(compressed), XX_HASH_LEN) : Buffer.from(compressed);
|
|
57
|
-
}
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
export {};
|
|
2
|
-
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicHJvcG9zYWxfdHhfY29sbGVjdG9yX3dvcmtlci5kLnRzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vLi4vc3JjL2NsaWVudC90ZXN0L3R4X3Byb3Bvc2FsX2NvbGxlY3Rvci9wcm9wb3NhbF90eF9jb2xsZWN0b3Jfd29ya2VyLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiIifQ==
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"proposal_tx_collector_worker.d.ts","sourceRoot":"","sources":["../../../../src/client/test/tx_proposal_collector/proposal_tx_collector_worker.ts"],"names":[],"mappings":""}
|