@aztec/p2p 0.0.1-commit.04852196a → 0.0.1-commit.04d373f
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/README.md +129 -3
- 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 +31 -14
- 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 +94 -26
- package/dest/config.d.ts +139 -97
- package/dest/config.d.ts.map +1 -1
- package/dest/config.js +70 -5
- 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 +99 -59
- package/dest/mem_pools/attestation_pool/attestation_pool.d.ts.map +1 -1
- package/dest/mem_pools/attestation_pool/attestation_pool.js +265 -199
- 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 +181 -65
- 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/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 +2 -1
- 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 +10 -5
- package/dest/mem_pools/tx_pool_v2/interfaces.d.ts.map +1 -1
- package/dest/mem_pools/tx_pool_v2/tx_metadata.d.ts +13 -3
- package/dest/mem_pools/tx_pool_v2/tx_metadata.d.ts.map +1 -1
- package/dest/mem_pools/tx_pool_v2/tx_metadata.js +20 -7
- 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 +3 -0
- 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 +92 -87
- 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 +37 -12
- 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 +61 -3
- 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 +46 -12
- 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 +27 -7
- package/dest/msg_validators/tx_validator/factory.d.ts.map +1 -1
- package/dest/msg_validators/tx_validator/factory.js +47 -17
- package/dest/msg_validators/tx_validator/gas_validator.d.ts +48 -7
- package/dest/msg_validators/tx_validator/gas_validator.d.ts.map +1 -1
- package/dest/msg_validators/tx_validator/gas_validator.js +88 -41
- 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.d.ts +21 -1
- package/dest/msg_validators/tx_validator/phases_validator.d.ts.map +1 -1
- package/dest/msg_validators/tx_validator/phases_validator.js +28 -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 +69 -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/encoding.d.ts +5 -1
- package/dest/services/encoding.d.ts.map +1 -1
- package/dest/services/encoding.js +7 -1
- 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 -46
- package/dest/services/libp2p/libp2p_service.d.ts.map +1 -1
- package/dest/services/libp2p/libp2p_service.js +282 -236
- 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 +38 -10
- 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 +11 -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 +84 -71
- package/dest/services/reqresp/batch-tx-requester/interface.d.ts +10 -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 +5 -4
- package/dest/services/reqresp/batch-tx-requester/missing_txs.d.ts.map +1 -1
- package/dest/services/reqresp/batch-tx-requester/missing_txs.js +13 -7
- package/dest/services/reqresp/batch-tx-requester/peer_collection.d.ts +3 -1
- package/dest/services/reqresp/batch-tx-requester/peer_collection.d.ts.map +1 -1
- package/dest/services/reqresp/batch-tx-requester/peer_collection.js +3 -0
- 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/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 +4 -2
- 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 +41 -214
- 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/request_tracker.d.ts +53 -0
- package/dest/services/tx_collection/request_tracker.d.ts.map +1 -0
- package/dest/services/tx_collection/request_tracker.js +84 -0
- package/dest/services/tx_collection/tx_collection.d.ts +36 -55
- 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 +42 -15
- 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 +83 -38
- 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 +55 -7
- package/src/client/interface.ts +15 -11
- package/src/client/p2p_client.ts +107 -49
- package/src/client/test/{tx_proposal_collector/README.md → p2p_client.batch_tx_requester.bench.README.md} +23 -53
- package/src/config.ts +137 -4
- 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 +316 -241
- package/src/mem_pools/attestation_pool/attestation_pool_test_suite.ts +204 -68
- 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/eviction/fee_payer_balance_eviction_rule.ts +2 -1
- 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 +9 -4
- package/src/mem_pools/tx_pool_v2/tx_metadata.ts +31 -9
- package/src/mem_pools/tx_pool_v2/tx_pool_v2.ts +13 -1
- package/src/mem_pools/tx_pool_v2/tx_pool_v2_impl.ts +93 -93
- package/src/msg_validators/attestation_validator/README.md +49 -0
- package/src/msg_validators/attestation_validator/attestation_validator.ts +41 -9
- package/src/msg_validators/attestation_validator/fisherman_attestation_validator.ts +14 -7
- package/src/msg_validators/clock_tolerance.ts +79 -3
- package/src/msg_validators/proposal_validator/README.md +123 -0
- 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 +54 -10
- package/src/msg_validators/tx_validator/README.md +15 -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 +61 -10
- package/src/msg_validators/tx_validator/gas_validator.ts +121 -39
- package/src/msg_validators/tx_validator/index.ts +2 -0
- package/src/msg_validators/tx_validator/phases_validator.ts +31 -1
- package/src/msg_validators/tx_validator/tx_proof_validator.ts +2 -0
- package/src/msg_validators/tx_validator/tx_validation_cache.ts +102 -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/encoding.ts +9 -1
- 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 +308 -272
- package/src/services/peer-manager/peer_manager.ts +44 -10
- package/src/services/peer-manager/peer_scoring.ts +27 -5
- package/src/services/reqresp/README.md +215 -0
- package/src/services/reqresp/batch-tx-requester/README.md +46 -7
- package/src/services/reqresp/batch-tx-requester/batch_tx_requester.ts +83 -77
- package/src/services/reqresp/batch-tx-requester/interface.ts +13 -5
- package/src/services/reqresp/batch-tx-requester/missing_txs.ts +13 -6
- package/src/services/reqresp/batch-tx-requester/peer_collection.ts +5 -0
- 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/block_txs_handler.ts +4 -2
- 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 +45 -260
- 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/request_tracker.ts +127 -0
- package/src/services/tx_collection/tx_collection.ts +331 -176
- 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 +53 -28
- package/src/testbench/p2p_client_testbench_worker.ts +87 -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 -304
- 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 -122
- 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 -400
- 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 -54
- package/dest/services/tx_collection/fast_tx_collection.d.ts.map +0 -1
- package/dest/services/tx_collection/fast_tx_collection.js +0 -327
- package/dest/services/tx_collection/missing_txs_tracker.d.ts +0 -32
- package/dest/services/tx_collection/missing_txs_tracker.d.ts.map +0 -1
- package/dest/services/tx_collection/missing_txs_tracker.js +0 -27
- package/dest/services/tx_collection/proposal_tx_collector.d.ts +0 -49
- 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 -345
- 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 -162
- 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 -319
- 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 -387
- package/src/services/tx_collection/missing_txs_tracker.ts +0 -52
- package/src/services/tx_collection/proposal_tx_collector.ts +0 -113
- package/src/services/tx_collection/slow_tx_collection.ts +0 -266
|
@@ -17,12 +17,13 @@ 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';
|
|
@@ -33,18 +34,17 @@ import type { P2PClient } from '../client/index.js';
|
|
|
33
34
|
import type { P2PConfig } from '../config.js';
|
|
34
35
|
import { createP2PClient } from '../index.js';
|
|
35
36
|
import type { MemPools } from '../mem_pools/index.js';
|
|
36
|
-
import {
|
|
37
|
+
import { LibP2PService } from '../services/index.js';
|
|
37
38
|
import type { PeerManager } from '../services/peer-manager/peer_manager.js';
|
|
39
|
+
import { BatchTxRequester } from '../services/reqresp/batch-tx-requester/batch_tx_requester.js';
|
|
38
40
|
import type { BatchTxRequesterLibP2PService } from '../services/reqresp/batch-tx-requester/interface.js';
|
|
39
|
-
import type { IBatchRequestTxValidator } from '../services/reqresp/batch-tx-requester/tx_validator.js';
|
|
40
41
|
import { RateLimitStatus } from '../services/reqresp/rate-limiter/rate_limiter.js';
|
|
41
42
|
import type { ReqResp } from '../services/reqresp/reqresp.js';
|
|
42
43
|
import type { PeerDiscoveryService } from '../services/service.js';
|
|
43
|
-
import {
|
|
44
|
+
import { RequestTracker } from '../services/tx_collection/request_tracker.js';
|
|
44
45
|
import { AlwaysTrueCircuitVerifier } from '../test-helpers/index.js';
|
|
45
46
|
import {
|
|
46
47
|
BENCHMARK_CONSTANTS,
|
|
47
|
-
type CollectorType,
|
|
48
48
|
type DistributionPattern,
|
|
49
49
|
InMemoryAttestationPool,
|
|
50
50
|
InMemoryTxPool,
|
|
@@ -55,15 +55,13 @@ import {
|
|
|
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,46 +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
|
-
MissingTxsTracker.fromArray(txHashes),
|
|
277
|
-
blockProposal,
|
|
278
|
-
pinnedPeer,
|
|
279
|
-
timeoutMs,
|
|
280
|
-
);
|
|
281
|
-
const durationMs = timer.ms();
|
|
282
|
-
return {
|
|
283
|
-
type: 'BENCH_RESULT',
|
|
284
|
-
durationMs,
|
|
285
|
-
fetchedCount: fetchedTxs.length,
|
|
286
|
-
success: fetchedTxs.length === txHashes.length,
|
|
287
|
-
};
|
|
288
|
-
}
|
|
289
|
-
|
|
290
|
-
const collector = new SendBatchRequestCollector(
|
|
291
|
-
batchTxRequesterService,
|
|
292
|
-
BENCHMARK_CONSTANTS.FIXED_MAX_PEERS,
|
|
293
|
-
BENCHMARK_CONSTANTS.FIXED_MAX_RETRY_ATTEMPTS,
|
|
294
|
-
);
|
|
295
|
-
const fetchedTxs = await collector.collectTxs(
|
|
296
|
-
MissingTxsTracker.fromArray(txHashes),
|
|
283
|
+
const tracker = RequestTracker.create(txHashes, new Date(Date.now() + timeoutMs));
|
|
284
|
+
const batchRequester = new BatchTxRequester(
|
|
285
|
+
tracker,
|
|
297
286
|
blockProposal,
|
|
298
287
|
pinnedPeer,
|
|
299
|
-
|
|
288
|
+
batchTxRequesterService,
|
|
289
|
+
logger,
|
|
290
|
+
new DateProvider(),
|
|
291
|
+
{ txValidator: noopTxValidator },
|
|
300
292
|
);
|
|
293
|
+
const fetchedTxs = await BatchTxRequester.collectAllTxs(batchRequester.run());
|
|
301
294
|
const durationMs = timer.ms();
|
|
302
295
|
return {
|
|
303
296
|
type: 'BENCH_RESULT',
|
|
@@ -323,6 +316,37 @@ let workerConfig: P2PConfig | null = null;
|
|
|
323
316
|
let workerLogger: Logger | null = null;
|
|
324
317
|
let kvStore: Awaited<ReturnType<typeof openTmpStore>> | null = null;
|
|
325
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
|
+
|
|
326
350
|
// eslint-disable-next-line @typescript-eslint/no-misused-promises
|
|
327
351
|
process.on('message', async msg => {
|
|
328
352
|
const {
|
|
@@ -369,10 +393,12 @@ process.on('message', async msg => {
|
|
|
369
393
|
proofVerifier as ClientProtocolCircuitVerifier,
|
|
370
394
|
worldState,
|
|
371
395
|
epochCache,
|
|
396
|
+
{ getCurrentMinFees: () => Promise.resolve(GasFees.empty()) },
|
|
372
397
|
'test-p2p-bench-worker',
|
|
373
398
|
undefined,
|
|
374
399
|
telemetry as TelemetryClient,
|
|
375
400
|
deps,
|
|
401
|
+
await l2BlockSource.getInitialHeader().hash(),
|
|
376
402
|
);
|
|
377
403
|
|
|
378
404
|
const testService = new TestLibP2PService(
|
|
@@ -412,13 +438,8 @@ process.on('message', async msg => {
|
|
|
412
438
|
const cmd = msg as any;
|
|
413
439
|
switch (cmd.type) {
|
|
414
440
|
case 'STOP':
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
}
|
|
418
|
-
if (kvStore?.close) {
|
|
419
|
-
await kvStore.close();
|
|
420
|
-
}
|
|
421
|
-
process.exit(0);
|
|
441
|
+
await stopWorker();
|
|
442
|
+
gracefulExit(0);
|
|
422
443
|
break;
|
|
423
444
|
|
|
424
445
|
case 'SEND_TX':
|
|
@@ -428,6 +449,13 @@ process.on('message', async msg => {
|
|
|
428
449
|
}
|
|
429
450
|
break;
|
|
430
451
|
|
|
452
|
+
case 'GET_PEER_COUNT':
|
|
453
|
+
process.send!({
|
|
454
|
+
type: 'PEER_COUNT',
|
|
455
|
+
count: workerClient ? getConnectedPeerCount(workerClient) : 0,
|
|
456
|
+
});
|
|
457
|
+
break;
|
|
458
|
+
|
|
431
459
|
case 'BENCH_REQRESP': {
|
|
432
460
|
const benchCmd = cmd as BenchReqRespCommand;
|
|
433
461
|
if (!workerClient || !workerTxPool || !workerAttestationPool || !workerConfig || !workerLogger) {
|
|
@@ -444,6 +472,7 @@ process.on('message', async msg => {
|
|
|
444
472
|
// Reset state before each benchmark run to avoid cross-run contamination
|
|
445
473
|
workerTxPool.resetState();
|
|
446
474
|
workerAttestationPool.resetState();
|
|
475
|
+
resetPeerScores(workerClient);
|
|
447
476
|
|
|
448
477
|
installUnlimitedRateLimits(workerClient);
|
|
449
478
|
|
|
@@ -460,13 +489,12 @@ process.on('message', async msg => {
|
|
|
460
489
|
workerTxPool.clearTxs();
|
|
461
490
|
|
|
462
491
|
workerLogger.info(
|
|
463
|
-
`[BENCH] Aggregator starting benchmark: txCount=${benchCmd.txCount},
|
|
492
|
+
`[BENCH] Aggregator starting benchmark: txCount=${benchCmd.txCount}, distribution=${benchCmd.distribution}`,
|
|
464
493
|
);
|
|
465
494
|
|
|
466
495
|
const result = await runAggregatorBenchmark(
|
|
467
496
|
workerClient,
|
|
468
497
|
blockProposal,
|
|
469
|
-
benchCmd.collectorType,
|
|
470
498
|
benchCmd.timeoutMs,
|
|
471
499
|
benchCmd.pinnedPeerId,
|
|
472
500
|
benchCmd.pinnedPeerIndex,
|
|
@@ -495,7 +523,12 @@ process.on('message', async msg => {
|
|
|
495
523
|
}
|
|
496
524
|
}
|
|
497
525
|
} catch (err: any) {
|
|
498
|
-
|
|
499
|
-
|
|
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);
|
|
500
533
|
}
|
|
501
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":""}
|