@aztec/p2p 0.0.1-commit.3d8f95d → 0.0.1-commit.3fd054f6
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/client/factory.d.ts +7 -7
- package/dest/client/factory.d.ts.map +1 -1
- package/dest/client/factory.js +35 -29
- package/dest/client/interface.d.ts +14 -19
- package/dest/client/interface.d.ts.map +1 -1
- package/dest/client/p2p_client.d.ts +9 -18
- package/dest/client/p2p_client.d.ts.map +1 -1
- package/dest/client/p2p_client.js +68 -100
- package/dest/client/test/tx_proposal_collector/proposal_tx_collector_worker.js +6 -7
- package/dest/config.d.ts +43 -15
- package/dest/config.d.ts.map +1 -1
- package/dest/config.js +91 -37
- package/dest/errors/tx-pool.error.d.ts +8 -0
- package/dest/errors/tx-pool.error.d.ts.map +1 -0
- package/dest/errors/tx-pool.error.js +9 -0
- package/dest/mem_pools/attestation_pool/attestation_pool.d.ts +7 -5
- package/dest/mem_pools/attestation_pool/attestation_pool.d.ts.map +1 -1
- package/dest/mem_pools/attestation_pool/attestation_pool.js +13 -4
- package/dest/mem_pools/attestation_pool/attestation_pool_test_suite.js +6 -6
- package/dest/mem_pools/attestation_pool/mocks.d.ts +2 -2
- package/dest/mem_pools/attestation_pool/mocks.d.ts.map +1 -1
- package/dest/mem_pools/attestation_pool/mocks.js +2 -2
- package/dest/mem_pools/instrumentation.d.ts +4 -2
- package/dest/mem_pools/instrumentation.d.ts.map +1 -1
- package/dest/mem_pools/instrumentation.js +16 -14
- package/dest/mem_pools/tx_pool/eviction/fee_payer_balance_eviction_rule.d.ts +1 -1
- package/dest/mem_pools/tx_pool/eviction/fee_payer_balance_eviction_rule.d.ts.map +1 -1
- package/dest/mem_pools/tx_pool/eviction/fee_payer_balance_eviction_rule.js +2 -1
- package/dest/mem_pools/tx_pool/eviction/invalid_txs_after_mining_rule.js +3 -3
- package/dest/mem_pools/tx_pool/priority.d.ts +2 -2
- package/dest/mem_pools/tx_pool/priority.d.ts.map +1 -1
- package/dest/mem_pools/tx_pool/priority.js +4 -4
- package/dest/mem_pools/tx_pool/tx_pool_test_suite.d.ts +1 -1
- package/dest/mem_pools/tx_pool/tx_pool_test_suite.d.ts.map +1 -1
- package/dest/mem_pools/tx_pool/tx_pool_test_suite.js +3 -1
- package/dest/mem_pools/tx_pool_v2/deleted_pool.d.ts +30 -13
- package/dest/mem_pools/tx_pool_v2/deleted_pool.d.ts.map +1 -1
- package/dest/mem_pools/tx_pool_v2/deleted_pool.js +91 -20
- package/dest/mem_pools/tx_pool_v2/eviction/eviction_manager.d.ts +3 -3
- package/dest/mem_pools/tx_pool_v2/eviction/eviction_manager.d.ts.map +1 -1
- package/dest/mem_pools/tx_pool_v2/eviction/eviction_manager.js +18 -9
- 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 +7 -3
- package/dest/mem_pools/tx_pool_v2/eviction/fee_payer_balance_pre_add_rule.d.ts +3 -3
- package/dest/mem_pools/tx_pool_v2/eviction/fee_payer_balance_pre_add_rule.d.ts.map +1 -1
- package/dest/mem_pools/tx_pool_v2/eviction/fee_payer_balance_pre_add_rule.js +12 -4
- package/dest/mem_pools/tx_pool_v2/eviction/index.d.ts +2 -2
- 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 -1
- package/dest/mem_pools/tx_pool_v2/eviction/interfaces.d.ts +54 -5
- package/dest/mem_pools/tx_pool_v2/eviction/interfaces.d.ts.map +1 -1
- package/dest/mem_pools/tx_pool_v2/eviction/interfaces.js +8 -0
- package/dest/mem_pools/tx_pool_v2/eviction/invalid_txs_after_mining_rule.js +7 -5
- package/dest/mem_pools/tx_pool_v2/eviction/invalid_txs_after_reorg_rule.js +7 -5
- package/dest/mem_pools/tx_pool_v2/eviction/low_priority_eviction_rule.d.ts +2 -2
- package/dest/mem_pools/tx_pool_v2/eviction/low_priority_eviction_rule.d.ts.map +1 -1
- package/dest/mem_pools/tx_pool_v2/eviction/low_priority_eviction_rule.js +14 -6
- package/dest/mem_pools/tx_pool_v2/eviction/low_priority_pre_add_rule.d.ts +4 -4
- package/dest/mem_pools/tx_pool_v2/eviction/low_priority_pre_add_rule.d.ts.map +1 -1
- package/dest/mem_pools/tx_pool_v2/eviction/low_priority_pre_add_rule.js +16 -4
- package/dest/mem_pools/tx_pool_v2/eviction/nullifier_conflict_rule.d.ts +3 -3
- package/dest/mem_pools/tx_pool_v2/eviction/nullifier_conflict_rule.d.ts.map +1 -1
- package/dest/mem_pools/tx_pool_v2/eviction/nullifier_conflict_rule.js +3 -3
- package/dest/mem_pools/tx_pool_v2/index.d.ts +2 -2
- package/dest/mem_pools/tx_pool_v2/index.d.ts.map +1 -1
- package/dest/mem_pools/tx_pool_v2/index.js +1 -1
- package/dest/mem_pools/tx_pool_v2/instrumentation.d.ts +15 -0
- package/dest/mem_pools/tx_pool_v2/instrumentation.d.ts.map +1 -0
- package/dest/mem_pools/tx_pool_v2/instrumentation.js +43 -0
- package/dest/mem_pools/tx_pool_v2/interfaces.d.ts +28 -10
- package/dest/mem_pools/tx_pool_v2/interfaces.d.ts.map +1 -1
- package/dest/mem_pools/tx_pool_v2/interfaces.js +5 -1
- package/dest/mem_pools/tx_pool_v2/tx_metadata.d.ts +56 -15
- package/dest/mem_pools/tx_pool_v2/tx_metadata.d.ts.map +1 -1
- package/dest/mem_pools/tx_pool_v2/tx_metadata.js +107 -18
- package/dest/mem_pools/tx_pool_v2/tx_pool_indices.d.ts +12 -3
- package/dest/mem_pools/tx_pool_v2/tx_pool_indices.d.ts.map +1 -1
- package/dest/mem_pools/tx_pool_v2/tx_pool_indices.js +50 -45
- package/dest/mem_pools/tx_pool_v2/tx_pool_v2.d.ts +12 -5
- 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 +17 -6
- package/dest/mem_pools/tx_pool_v2/tx_pool_v2_impl.d.ts +14 -5
- 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 +319 -147
- package/dest/msg_validators/attestation_validator/attestation_validator.d.ts +1 -1
- package/dest/msg_validators/attestation_validator/attestation_validator.d.ts.map +1 -1
- package/dest/msg_validators/attestation_validator/attestation_validator.js +5 -4
- package/dest/msg_validators/clock_tolerance.d.ts +1 -1
- package/dest/msg_validators/clock_tolerance.d.ts.map +1 -1
- package/dest/msg_validators/clock_tolerance.js +4 -3
- package/dest/msg_validators/proposal_validator/block_proposal_validator.d.ts +6 -4
- package/dest/msg_validators/proposal_validator/block_proposal_validator.d.ts.map +1 -1
- package/dest/msg_validators/proposal_validator/block_proposal_validator.js +10 -2
- package/dest/msg_validators/proposal_validator/checkpoint_proposal_validator.d.ts +6 -4
- package/dest/msg_validators/proposal_validator/checkpoint_proposal_validator.d.ts.map +1 -1
- package/dest/msg_validators/proposal_validator/checkpoint_proposal_validator.js +16 -2
- package/dest/msg_validators/proposal_validator/proposal_validator.d.ts +13 -8
- package/dest/msg_validators/proposal_validator/proposal_validator.d.ts.map +1 -1
- package/dest/msg_validators/proposal_validator/proposal_validator.js +53 -41
- package/dest/msg_validators/tx_validator/aggregate_tx_validator.d.ts +2 -2
- package/dest/msg_validators/tx_validator/aggregate_tx_validator.d.ts.map +1 -1
- package/dest/msg_validators/tx_validator/aggregate_tx_validator.js +3 -3
- package/dest/msg_validators/tx_validator/allowed_public_setup.d.ts +2 -1
- package/dest/msg_validators/tx_validator/allowed_public_setup.d.ts.map +1 -1
- package/dest/msg_validators/tx_validator/allowed_public_setup.js +24 -20
- package/dest/msg_validators/tx_validator/allowed_setup_helpers.d.ts +17 -0
- package/dest/msg_validators/tx_validator/allowed_setup_helpers.d.ts.map +1 -0
- package/dest/msg_validators/tx_validator/allowed_setup_helpers.js +24 -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 +1 -1
- package/dest/msg_validators/tx_validator/data_validator.d.ts.map +1 -1
- package/dest/msg_validators/tx_validator/data_validator.js +35 -2
- package/dest/msg_validators/tx_validator/factory.d.ts +133 -6
- package/dest/msg_validators/tx_validator/factory.d.ts.map +1 -1
- package/dest/msg_validators/tx_validator/factory.js +247 -60
- package/dest/msg_validators/tx_validator/fee_payer_balance.d.ts +1 -1
- package/dest/msg_validators/tx_validator/fee_payer_balance.d.ts.map +1 -1
- package/dest/msg_validators/tx_validator/fee_payer_balance.js +6 -2
- package/dest/msg_validators/tx_validator/gas_validator.d.ts +67 -3
- package/dest/msg_validators/tx_validator/gas_validator.d.ts.map +1 -1
- package/dest/msg_validators/tx_validator/gas_validator.js +104 -37
- 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/metadata_validator.d.ts +1 -1
- package/dest/msg_validators/tx_validator/metadata_validator.d.ts.map +1 -1
- package/dest/msg_validators/tx_validator/metadata_validator.js +4 -4
- package/dest/msg_validators/tx_validator/nullifier_cache.d.ts +14 -0
- package/dest/msg_validators/tx_validator/nullifier_cache.d.ts.map +1 -0
- package/dest/msg_validators/tx_validator/nullifier_cache.js +24 -0
- package/dest/msg_validators/tx_validator/phases_validator.d.ts +22 -2
- package/dest/msg_validators/tx_validator/phases_validator.d.ts.map +1 -1
- package/dest/msg_validators/tx_validator/phases_validator.js +72 -24
- package/dest/msg_validators/tx_validator/timestamp_validator.d.ts +2 -2
- package/dest/msg_validators/tx_validator/timestamp_validator.d.ts.map +1 -1
- package/dest/msg_validators/tx_validator/timestamp_validator.js +6 -6
- package/dest/services/dummy_service.d.ts +4 -4
- package/dest/services/dummy_service.d.ts.map +1 -1
- package/dest/services/dummy_service.js +4 -4
- package/dest/services/encoding.d.ts +6 -2
- package/dest/services/encoding.d.ts.map +1 -1
- package/dest/services/encoding.js +16 -9
- package/dest/services/gossipsub/topic_score_params.d.ts +18 -6
- package/dest/services/gossipsub/topic_score_params.d.ts.map +1 -1
- package/dest/services/gossipsub/topic_score_params.js +32 -10
- package/dest/services/libp2p/libp2p_service.d.ts +18 -20
- package/dest/services/libp2p/libp2p_service.d.ts.map +1 -1
- package/dest/services/libp2p/libp2p_service.js +190 -140
- package/dest/services/peer-manager/metrics.d.ts +3 -1
- package/dest/services/peer-manager/metrics.d.ts.map +1 -1
- package/dest/services/peer-manager/metrics.js +6 -0
- package/dest/services/peer-manager/peer_manager.d.ts +1 -1
- package/dest/services/peer-manager/peer_manager.d.ts.map +1 -1
- package/dest/services/peer-manager/peer_manager.js +6 -3
- package/dest/services/reqresp/batch-tx-requester/batch_tx_requester.d.ts +12 -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 +83 -106
- package/dest/services/reqresp/batch-tx-requester/interface.d.ts +4 -7
- package/dest/services/reqresp/batch-tx-requester/interface.d.ts.map +1 -1
- package/dest/services/reqresp/batch-tx-requester/missing_txs.d.ts +11 -13
- package/dest/services/reqresp/batch-tx-requester/missing_txs.d.ts.map +1 -1
- package/dest/services/reqresp/batch-tx-requester/missing_txs.js +31 -46
- package/dest/services/reqresp/batch-tx-requester/peer_collection.d.ts +19 -11
- package/dest/services/reqresp/batch-tx-requester/peer_collection.d.ts.map +1 -1
- package/dest/services/reqresp/batch-tx-requester/peer_collection.js +52 -15
- package/dest/services/reqresp/batch-tx-requester/tx_validator.js +2 -2
- package/dest/services/reqresp/reqresp.d.ts +1 -1
- package/dest/services/reqresp/reqresp.d.ts.map +1 -1
- package/dest/services/reqresp/reqresp.js +19 -10
- package/dest/services/service.d.ts +5 -3
- package/dest/services/service.d.ts.map +1 -1
- package/dest/services/tx_collection/config.d.ts +13 -1
- package/dest/services/tx_collection/config.d.ts.map +1 -1
- package/dest/services/tx_collection/config.js +30 -0
- package/dest/services/tx_collection/fast_tx_collection.d.ts +1 -4
- package/dest/services/tx_collection/fast_tx_collection.d.ts.map +1 -1
- package/dest/services/tx_collection/fast_tx_collection.js +65 -75
- package/dest/services/tx_collection/file_store_tx_collection.d.ts +38 -29
- package/dest/services/tx_collection/file_store_tx_collection.d.ts.map +1 -1
- package/dest/services/tx_collection/file_store_tx_collection.js +126 -77
- package/dest/services/tx_collection/file_store_tx_source.d.ts +16 -6
- package/dest/services/tx_collection/file_store_tx_source.d.ts.map +1 -1
- package/dest/services/tx_collection/file_store_tx_source.js +49 -16
- package/dest/services/tx_collection/instrumentation.d.ts +1 -1
- package/dest/services/tx_collection/instrumentation.d.ts.map +1 -1
- package/dest/services/tx_collection/instrumentation.js +2 -1
- package/dest/services/tx_collection/proposal_tx_collector.d.ts +7 -7
- package/dest/services/tx_collection/proposal_tx_collector.d.ts.map +1 -1
- package/dest/services/tx_collection/proposal_tx_collector.js +5 -4
- 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/slow_tx_collection.d.ts +5 -3
- package/dest/services/tx_collection/slow_tx_collection.d.ts.map +1 -1
- package/dest/services/tx_collection/slow_tx_collection.js +17 -12
- package/dest/services/tx_collection/tx_collection.d.ts +9 -9
- package/dest/services/tx_collection/tx_collection.d.ts.map +1 -1
- package/dest/services/tx_collection/tx_collection.js +26 -10
- package/dest/services/tx_collection/tx_collection_sink.d.ts +6 -5
- package/dest/services/tx_collection/tx_collection_sink.d.ts.map +1 -1
- package/dest/services/tx_collection/tx_collection_sink.js +13 -22
- package/dest/services/tx_collection/tx_source.d.ts +8 -3
- package/dest/services/tx_collection/tx_source.d.ts.map +1 -1
- package/dest/services/tx_collection/tx_source.js +19 -2
- package/dest/services/tx_file_store/tx_file_store.d.ts +3 -2
- package/dest/services/tx_file_store/tx_file_store.d.ts.map +1 -1
- package/dest/services/tx_file_store/tx_file_store.js +9 -6
- package/dest/services/tx_provider.d.ts +3 -3
- package/dest/services/tx_provider.d.ts.map +1 -1
- package/dest/services/tx_provider.js +4 -4
- package/dest/test-helpers/make-test-p2p-clients.d.ts +5 -6
- package/dest/test-helpers/make-test-p2p-clients.d.ts.map +1 -1
- package/dest/test-helpers/make-test-p2p-clients.js +1 -2
- package/dest/test-helpers/mock-pubsub.d.ts +4 -4
- package/dest/test-helpers/mock-pubsub.d.ts.map +1 -1
- package/dest/test-helpers/mock-pubsub.js +8 -2
- package/dest/test-helpers/reqresp-nodes.d.ts +2 -3
- package/dest/test-helpers/reqresp-nodes.d.ts.map +1 -1
- package/dest/test-helpers/reqresp-nodes.js +2 -2
- package/dest/test-helpers/testbench-utils.d.ts +8 -3
- package/dest/test-helpers/testbench-utils.d.ts.map +1 -1
- package/dest/test-helpers/testbench-utils.js +29 -4
- package/dest/testbench/p2p_client_testbench_worker.d.ts +2 -2
- package/dest/testbench/p2p_client_testbench_worker.d.ts.map +1 -1
- package/dest/testbench/p2p_client_testbench_worker.js +15 -14
- package/dest/testbench/worker_client_manager.d.ts +3 -1
- package/dest/testbench/worker_client_manager.d.ts.map +1 -1
- package/dest/testbench/worker_client_manager.js +6 -2
- package/dest/util.d.ts +3 -3
- package/dest/util.d.ts.map +1 -1
- package/package.json +14 -14
- package/src/client/factory.ts +62 -47
- package/src/client/interface.ts +17 -20
- package/src/client/p2p_client.ts +74 -130
- package/src/client/test/tx_proposal_collector/proposal_tx_collector_worker.ts +18 -11
- package/src/config.ts +133 -43
- package/src/errors/tx-pool.error.ts +12 -0
- package/src/mem_pools/attestation_pool/attestation_pool.ts +16 -7
- package/src/mem_pools/attestation_pool/attestation_pool_test_suite.ts +6 -6
- package/src/mem_pools/attestation_pool/mocks.ts +2 -1
- package/src/mem_pools/instrumentation.ts +17 -13
- package/src/mem_pools/tx_pool/README.md +1 -1
- package/src/mem_pools/tx_pool/eviction/fee_payer_balance_eviction_rule.ts +2 -1
- package/src/mem_pools/tx_pool/eviction/invalid_txs_after_mining_rule.ts +3 -3
- package/src/mem_pools/tx_pool/priority.ts +4 -4
- package/src/mem_pools/tx_pool/tx_pool_test_suite.ts +3 -1
- package/src/mem_pools/tx_pool_v2/README.md +52 -28
- package/src/mem_pools/tx_pool_v2/deleted_pool.ts +109 -22
- package/src/mem_pools/tx_pool_v2/eviction/eviction_manager.ts +21 -8
- package/src/mem_pools/tx_pool_v2/eviction/fee_payer_balance_eviction_rule.ts +7 -3
- package/src/mem_pools/tx_pool_v2/eviction/fee_payer_balance_pre_add_rule.ts +18 -4
- package/src/mem_pools/tx_pool_v2/eviction/index.ts +4 -0
- package/src/mem_pools/tx_pool_v2/eviction/interfaces.ts +59 -4
- package/src/mem_pools/tx_pool_v2/eviction/invalid_txs_after_mining_rule.ts +5 -5
- package/src/mem_pools/tx_pool_v2/eviction/invalid_txs_after_reorg_rule.ts +5 -5
- package/src/mem_pools/tx_pool_v2/eviction/low_priority_eviction_rule.ts +14 -9
- package/src/mem_pools/tx_pool_v2/eviction/low_priority_pre_add_rule.ts +33 -6
- package/src/mem_pools/tx_pool_v2/eviction/nullifier_conflict_rule.ts +4 -3
- package/src/mem_pools/tx_pool_v2/index.ts +1 -1
- package/src/mem_pools/tx_pool_v2/instrumentation.ts +69 -0
- package/src/mem_pools/tx_pool_v2/interfaces.ts +30 -10
- package/src/mem_pools/tx_pool_v2/tx_metadata.ts +156 -26
- package/src/mem_pools/tx_pool_v2/tx_pool_indices.ts +58 -45
- package/src/mem_pools/tx_pool_v2/tx_pool_v2.ts +34 -8
- package/src/mem_pools/tx_pool_v2/tx_pool_v2_impl.ts +353 -143
- package/src/msg_validators/attestation_validator/README.md +49 -0
- package/src/msg_validators/attestation_validator/attestation_validator.ts +5 -4
- package/src/msg_validators/clock_tolerance.ts +4 -3
- package/src/msg_validators/proposal_validator/README.md +123 -0
- package/src/msg_validators/proposal_validator/block_proposal_validator.ts +14 -4
- package/src/msg_validators/proposal_validator/checkpoint_proposal_validator.ts +20 -7
- package/src/msg_validators/proposal_validator/proposal_validator.ts +69 -45
- package/src/msg_validators/tx_validator/README.md +119 -0
- package/src/msg_validators/tx_validator/aggregate_tx_validator.ts +3 -3
- package/src/msg_validators/tx_validator/allowed_public_setup.ts +22 -27
- package/src/msg_validators/tx_validator/allowed_setup_helpers.ts +31 -0
- package/src/msg_validators/tx_validator/contract_instance_validator.ts +56 -0
- package/src/msg_validators/tx_validator/data_validator.ts +42 -1
- package/src/msg_validators/tx_validator/factory.ts +394 -78
- package/src/msg_validators/tx_validator/fee_payer_balance.ts +6 -2
- package/src/msg_validators/tx_validator/gas_validator.ts +123 -27
- package/src/msg_validators/tx_validator/index.ts +2 -0
- package/src/msg_validators/tx_validator/metadata_validator.ts +12 -4
- package/src/msg_validators/tx_validator/nullifier_cache.ts +30 -0
- package/src/msg_validators/tx_validator/phases_validator.ts +82 -27
- package/src/msg_validators/tx_validator/timestamp_validator.ts +7 -7
- package/src/services/dummy_service.ts +6 -6
- package/src/services/encoding.ts +16 -8
- package/src/services/gossipsub/README.md +29 -14
- package/src/services/gossipsub/topic_score_params.ts +49 -13
- package/src/services/libp2p/libp2p_service.ts +198 -161
- package/src/services/peer-manager/metrics.ts +7 -0
- package/src/services/peer-manager/peer_manager.ts +7 -3
- package/src/services/reqresp/README.md +229 -0
- package/src/services/reqresp/batch-tx-requester/README.md +46 -7
- package/src/services/reqresp/batch-tx-requester/batch_tx_requester.ts +79 -112
- package/src/services/reqresp/batch-tx-requester/interface.ts +3 -6
- package/src/services/reqresp/batch-tx-requester/missing_txs.ts +30 -71
- package/src/services/reqresp/batch-tx-requester/peer_collection.ts +68 -24
- package/src/services/reqresp/batch-tx-requester/tx_validator.ts +2 -2
- package/src/services/reqresp/reqresp.ts +22 -12
- package/src/services/service.ts +11 -2
- package/src/services/tx_collection/config.ts +42 -0
- package/src/services/tx_collection/fast_tx_collection.ts +71 -76
- package/src/services/tx_collection/file_store_tx_collection.ts +143 -93
- package/src/services/tx_collection/file_store_tx_source.ts +64 -17
- package/src/services/tx_collection/instrumentation.ts +7 -1
- package/src/services/tx_collection/proposal_tx_collector.ts +9 -13
- package/src/services/tx_collection/request_tracker.ts +127 -0
- package/src/services/tx_collection/slow_tx_collection.ts +17 -13
- package/src/services/tx_collection/tx_collection.ts +46 -17
- package/src/services/tx_collection/tx_collection_sink.ts +15 -29
- package/src/services/tx_collection/tx_source.ts +22 -3
- package/src/services/tx_file_store/tx_file_store.ts +6 -4
- package/src/services/tx_provider.ts +2 -2
- package/src/test-helpers/make-test-p2p-clients.ts +1 -3
- package/src/test-helpers/mock-pubsub.ts +13 -6
- package/src/test-helpers/reqresp-nodes.ts +3 -6
- package/src/test-helpers/testbench-utils.ts +40 -6
- package/src/testbench/p2p_client_testbench_worker.ts +22 -20
- package/src/testbench/worker_client_manager.ts +13 -5
- package/src/util.ts +8 -2
- package/dest/msg_validators/proposal_validator/proposal_validator_test_suite.d.ts +0 -23
- package/dest/msg_validators/proposal_validator/proposal_validator_test_suite.d.ts.map +0 -1
- package/dest/msg_validators/proposal_validator/proposal_validator_test_suite.js +0 -212
- package/src/msg_validators/proposal_validator/proposal_validator_test_suite.ts +0 -230
package/src/client/p2p_client.ts
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import { GENESIS_BLOCK_HEADER_HASH } from '@aztec/constants';
|
|
2
2
|
import type { EpochCacheInterface } from '@aztec/epoch-cache';
|
|
3
|
-
import { BlockNumber, SlotNumber } from '@aztec/foundation/branded-types';
|
|
3
|
+
import { BlockNumber, CheckpointNumber, SlotNumber } from '@aztec/foundation/branded-types';
|
|
4
4
|
import { createLogger } from '@aztec/foundation/log';
|
|
5
5
|
import { RunningPromise } from '@aztec/foundation/promise';
|
|
6
6
|
import { DateProvider } from '@aztec/foundation/timer';
|
|
7
7
|
import type { AztecAsyncKVStore, AztecAsyncSingleton } from '@aztec/kv-store';
|
|
8
8
|
import { L2TipsKVStore } from '@aztec/kv-store/stores';
|
|
9
9
|
import {
|
|
10
|
+
type CheckpointId,
|
|
10
11
|
type EthAddress,
|
|
11
12
|
type L2Block,
|
|
12
13
|
type L2BlockId,
|
|
@@ -17,14 +18,8 @@ import {
|
|
|
17
18
|
type L2TipsStore,
|
|
18
19
|
} from '@aztec/stdlib/block';
|
|
19
20
|
import type { ContractDataSource } from '@aztec/stdlib/contract';
|
|
20
|
-
import { getTimestampForSlot } from '@aztec/stdlib/epoch-helpers';
|
|
21
21
|
import { type PeerInfo, tryStop } from '@aztec/stdlib/interfaces/server';
|
|
22
|
-
import {
|
|
23
|
-
type BlockProposal,
|
|
24
|
-
CheckpointAttestation,
|
|
25
|
-
type CheckpointProposal,
|
|
26
|
-
type P2PClientType,
|
|
27
|
-
} from '@aztec/stdlib/p2p';
|
|
22
|
+
import { type BlockProposal, CheckpointAttestation, type CheckpointProposal, type TopicType } from '@aztec/stdlib/p2p';
|
|
28
23
|
import type { BlockHeader, Tx, TxHash } from '@aztec/stdlib/tx';
|
|
29
24
|
import { Attributes, type TelemetryClient, WithTracer, getTelemetryClient, trackSpan } from '@aztec/telemetry-client';
|
|
30
25
|
|
|
@@ -32,6 +27,7 @@ import type { PeerId } from '@libp2p/interface';
|
|
|
32
27
|
import type { ENR } from '@nethermindeth/enr';
|
|
33
28
|
|
|
34
29
|
import { type P2PConfig, getP2PDefaultConfig } from '../config.js';
|
|
30
|
+
import { TxPoolError } from '../errors/tx-pool.error.js';
|
|
35
31
|
import type { AttestationPoolApi } from '../mem_pools/attestation_pool/attestation_pool.js';
|
|
36
32
|
import type { MemPools } from '../mem_pools/interface.js';
|
|
37
33
|
import type { TxPoolV2 } from '../mem_pools/tx_pool_v2/interfaces.js';
|
|
@@ -41,7 +37,6 @@ import {
|
|
|
41
37
|
type ReqRespSubProtocolHandler,
|
|
42
38
|
type ReqRespSubProtocolValidators,
|
|
43
39
|
} from '../services/reqresp/interface.js';
|
|
44
|
-
import { chunkTxHashesRequest } from '../services/reqresp/protocols/tx.js';
|
|
45
40
|
import type {
|
|
46
41
|
DuplicateAttestationInfo,
|
|
47
42
|
DuplicateProposalInfo,
|
|
@@ -57,10 +52,7 @@ import { type P2P, P2PClientState, type P2PSyncState } from './interface.js';
|
|
|
57
52
|
/**
|
|
58
53
|
* The P2P client implementation.
|
|
59
54
|
*/
|
|
60
|
-
export class P2PClient
|
|
61
|
-
extends WithTracer
|
|
62
|
-
implements P2P, P2P<P2PClientType.Prover>
|
|
63
|
-
{
|
|
55
|
+
export class P2PClient extends WithTracer implements P2P {
|
|
64
56
|
/** The JS promise that will be running to keep the client's data in sync. Can be interrupted if the client is stopped. */
|
|
65
57
|
private runningPromise!: Promise<void>;
|
|
66
58
|
|
|
@@ -92,7 +84,6 @@ export class P2PClient<T extends P2PClientType = P2PClientType.Full>
|
|
|
92
84
|
private slotMonitor: RunningPromise | undefined;
|
|
93
85
|
|
|
94
86
|
constructor(
|
|
95
|
-
_clientType: T,
|
|
96
87
|
private store: AztecAsyncKVStore,
|
|
97
88
|
private l2BlockSource: L2BlockSource & ContractDataSource,
|
|
98
89
|
mempools: MemPools,
|
|
@@ -119,27 +110,6 @@ export class P2PClient<T extends P2PClientType = P2PClientType.Full>
|
|
|
119
110
|
this.telemetry,
|
|
120
111
|
);
|
|
121
112
|
|
|
122
|
-
// Default to collecting all txs when we see a valid proposal
|
|
123
|
-
// This can be overridden by the validator client to validate, and it will call getTxsForBlockProposal on its own
|
|
124
|
-
// Note: Validators do NOT attest to individual blocks - attestations are only for checkpoint proposals.
|
|
125
|
-
// TODO(palla/txs): We should not trigger a request for txs on a proposal before fully validating it. We need to bring
|
|
126
|
-
// validator-client code into here so we can validate a proposal is reasonable.
|
|
127
|
-
this.registerBlockProposalHandler(async (block, sender) => {
|
|
128
|
-
this.log.debug(`Received block proposal from ${sender.toString()}`);
|
|
129
|
-
// TODO(palla/txs): Need to subtract validatorReexecuteDeadlineMs from this deadline (see ValidatorClient.getReexecutionDeadline)
|
|
130
|
-
const constants = this.txCollection.getConstants();
|
|
131
|
-
const nextSlotTimestampSeconds = Number(getTimestampForSlot(SlotNumber(block.slotNumber + 1), constants));
|
|
132
|
-
const deadline = new Date(nextSlotTimestampSeconds * 1000);
|
|
133
|
-
const parentBlock = await this.l2BlockSource.getBlockHeaderByArchive(block.blockHeader.lastArchive.root);
|
|
134
|
-
if (!parentBlock) {
|
|
135
|
-
this.log.debug(`Cannot collect txs for proposal as parent block not found`);
|
|
136
|
-
return false;
|
|
137
|
-
}
|
|
138
|
-
const blockNumber = BlockNumber(parentBlock.getBlockNumber() + 1);
|
|
139
|
-
await this.txProvider.getTxsForBlockProposal(block, blockNumber, { pinnedPeer: sender, deadline });
|
|
140
|
-
return true;
|
|
141
|
-
});
|
|
142
|
-
|
|
143
113
|
this.l2Tips = new L2TipsKVStore(store, 'p2p_client');
|
|
144
114
|
this.synchedLatestSlot = store.openSingleton('p2p_pool_last_l2_slot');
|
|
145
115
|
}
|
|
@@ -165,6 +135,10 @@ export class P2PClient<T extends P2PClientType = P2PClientType.Full>
|
|
|
165
135
|
return Promise.resolve(this.p2pService.getPeers(includePending));
|
|
166
136
|
}
|
|
167
137
|
|
|
138
|
+
public getGossipMeshPeerCount(topicType: TopicType): Promise<number> {
|
|
139
|
+
return Promise.resolve(this.p2pService.getGossipMeshPeerCount(topicType));
|
|
140
|
+
}
|
|
141
|
+
|
|
168
142
|
public getL2BlockHash(number: BlockNumber): Promise<string | undefined> {
|
|
169
143
|
return this.l2Tips.getL2BlockHash(number);
|
|
170
144
|
}
|
|
@@ -200,7 +174,7 @@ export class P2PClient<T extends P2PClientType = P2PClientType.Full>
|
|
|
200
174
|
break;
|
|
201
175
|
case 'chain-pruned':
|
|
202
176
|
this.txCollection.stopCollectingForBlocksAfter(event.block.number);
|
|
203
|
-
await this.handlePruneL2Blocks(event.block);
|
|
177
|
+
await this.handlePruneL2Blocks(event.block, event.checkpoint);
|
|
204
178
|
break;
|
|
205
179
|
case 'chain-checkpointed':
|
|
206
180
|
break;
|
|
@@ -404,6 +378,10 @@ export class P2PClient<T extends P2PClientType = P2PClientType.Full>
|
|
|
404
378
|
return this.attestationPool.addOwnCheckpointAttestations(attestations);
|
|
405
379
|
}
|
|
406
380
|
|
|
381
|
+
public hasBlockProposalsForSlot(slot: SlotNumber): Promise<boolean> {
|
|
382
|
+
return this.attestationPool.hasBlockProposalsForSlot(slot);
|
|
383
|
+
}
|
|
384
|
+
|
|
407
385
|
// REVIEW: https://github.com/AztecProtocol/aztec-packages/issues/7963
|
|
408
386
|
// ^ This pattern is not my favorite (md)
|
|
409
387
|
public registerBlockProposalHandler(handler: P2PBlockReceivedCallback): void {
|
|
@@ -422,36 +400,6 @@ export class P2PClient<T extends P2PClientType = P2PClientType.Full>
|
|
|
422
400
|
this.p2pService.registerDuplicateAttestationCallback(callback);
|
|
423
401
|
}
|
|
424
402
|
|
|
425
|
-
/**
|
|
426
|
-
* Uses the batched Request Response protocol to request a set of transactions from the network.
|
|
427
|
-
*/
|
|
428
|
-
private async requestTxsByHash(txHashes: TxHash[], pinnedPeerId: PeerId | undefined): Promise<Tx[]> {
|
|
429
|
-
const timeoutMs = 8000; // Longer timeout for now
|
|
430
|
-
const maxRetryAttempts = 10; // Keep retrying within the timeout
|
|
431
|
-
const requests = chunkTxHashesRequest(txHashes);
|
|
432
|
-
const maxPeers = Math.min(Math.ceil(requests.length / 3), 10);
|
|
433
|
-
|
|
434
|
-
const txBatches = await this.p2pService.sendBatchRequest(
|
|
435
|
-
ReqRespSubProtocol.TX,
|
|
436
|
-
requests,
|
|
437
|
-
pinnedPeerId,
|
|
438
|
-
timeoutMs,
|
|
439
|
-
maxPeers,
|
|
440
|
-
maxRetryAttempts,
|
|
441
|
-
);
|
|
442
|
-
|
|
443
|
-
const txs = txBatches.flat();
|
|
444
|
-
if (txs.length > 0) {
|
|
445
|
-
await this.txPool.addPendingTxs(txs);
|
|
446
|
-
}
|
|
447
|
-
|
|
448
|
-
const txHashesStr = txHashes.map(tx => tx.toString()).join(', ');
|
|
449
|
-
this.log.debug(`Requested txs ${txHashesStr} (${txs.length} / ${txHashes.length}) from peers`);
|
|
450
|
-
|
|
451
|
-
// We return all transactions, even the not found ones to the caller, such they can handle missing items themselves.
|
|
452
|
-
return txs;
|
|
453
|
-
}
|
|
454
|
-
|
|
455
403
|
public async getPendingTxs(limit?: number, after?: TxHash): Promise<Tx[]> {
|
|
456
404
|
if (limit !== undefined && limit <= 0) {
|
|
457
405
|
throw new TypeError('limit must be greater than 0');
|
|
@@ -488,6 +436,15 @@ export class P2PClient<T extends P2PClientType = P2PClientType.Full>
|
|
|
488
436
|
}
|
|
489
437
|
}
|
|
490
438
|
|
|
439
|
+
public async *iterateEligiblePendingTxs(): AsyncIterableIterator<Tx> {
|
|
440
|
+
for (const txHash of await this.txPool.getEligiblePendingTxHashes()) {
|
|
441
|
+
const tx = await this.txPool.getTxByHash(txHash);
|
|
442
|
+
if (tx) {
|
|
443
|
+
yield tx;
|
|
444
|
+
}
|
|
445
|
+
}
|
|
446
|
+
}
|
|
447
|
+
|
|
491
448
|
/**
|
|
492
449
|
* Returns a transaction in the transaction pool by its hash.
|
|
493
450
|
* @param txHash - Hash of the transaction to look for in the pool.
|
|
@@ -510,49 +467,6 @@ export class P2PClient<T extends P2PClientType = P2PClientType.Full>
|
|
|
510
467
|
return this.txPool.hasTxs(txHashes);
|
|
511
468
|
}
|
|
512
469
|
|
|
513
|
-
/**
|
|
514
|
-
* Returns transactions in the transaction pool by hash.
|
|
515
|
-
* If a transaction is not in the pool, it will be requested from the network.
|
|
516
|
-
* @param txHashes - Hashes of the transactions to look for.
|
|
517
|
-
* @returns The txs found, or undefined if not found in the order requested.
|
|
518
|
-
*/
|
|
519
|
-
async getTxsByHash(txHashes: TxHash[], pinnedPeerId: PeerId | undefined): Promise<(Tx | undefined)[]> {
|
|
520
|
-
const txs = await Promise.all(txHashes.map(txHash => this.txPool.getTxByHash(txHash)));
|
|
521
|
-
const missingTxHashes = txs
|
|
522
|
-
.map((tx, index) => [tx, index] as const)
|
|
523
|
-
.filter(([tx, _index]) => !tx)
|
|
524
|
-
.map(([_tx, index]) => txHashes[index]);
|
|
525
|
-
|
|
526
|
-
if (missingTxHashes.length === 0) {
|
|
527
|
-
return txs as Tx[];
|
|
528
|
-
}
|
|
529
|
-
|
|
530
|
-
const missingTxs = await this.requestTxsByHash(missingTxHashes, pinnedPeerId);
|
|
531
|
-
// TODO: optimize
|
|
532
|
-
// Merge the found txs in order
|
|
533
|
-
const mergingTxs = txHashes.map(txHash => {
|
|
534
|
-
// Is it in the txs list from the mempool?
|
|
535
|
-
for (const tx of txs) {
|
|
536
|
-
if (tx !== undefined && tx.getTxHash().equals(txHash)) {
|
|
537
|
-
return tx;
|
|
538
|
-
}
|
|
539
|
-
}
|
|
540
|
-
|
|
541
|
-
// Is it in the fetched missing txs?
|
|
542
|
-
// Note: this is an O(n^2) operation, but we expect the number of missing txs to be small.
|
|
543
|
-
for (const tx of missingTxs) {
|
|
544
|
-
if (tx.getTxHash().equals(txHash)) {
|
|
545
|
-
return tx;
|
|
546
|
-
}
|
|
547
|
-
}
|
|
548
|
-
|
|
549
|
-
// Otherwise return undefined
|
|
550
|
-
return undefined;
|
|
551
|
-
});
|
|
552
|
-
|
|
553
|
-
return mergingTxs;
|
|
554
|
-
}
|
|
555
|
-
|
|
556
470
|
/**
|
|
557
471
|
* Returns an archived transaction in the transaction pool by its hash.
|
|
558
472
|
* @param txHash - Hash of the archived transaction to look for.
|
|
@@ -569,23 +483,22 @@ export class P2PClient<T extends P2PClientType = P2PClientType.Full>
|
|
|
569
483
|
**/
|
|
570
484
|
public async sendTx(tx: Tx): Promise<void> {
|
|
571
485
|
this.#assertIsReady();
|
|
572
|
-
const result = await this.txPool.addPendingTxs([tx]);
|
|
486
|
+
const result = await this.txPool.addPendingTxs([tx], { feeComparisonOnly: true });
|
|
573
487
|
if (result.accepted.length === 1) {
|
|
574
488
|
await this.p2pService.propagate(tx);
|
|
575
|
-
|
|
576
|
-
this.log.warn(
|
|
577
|
-
`Tx ${tx.getTxHash()} not propagated: accepted=${result.accepted.length} ignored=${result.ignored.length} rejected=${result.rejected.length}`,
|
|
578
|
-
);
|
|
489
|
+
return;
|
|
579
490
|
}
|
|
580
|
-
}
|
|
581
491
|
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
492
|
+
const txHashStr = tx.getTxHash().toString();
|
|
493
|
+
const reason = result.errors?.get(txHashStr);
|
|
494
|
+
if (reason) {
|
|
495
|
+
this.log.warn(`Tx ${txHashStr} not added to pool: ${reason.message}`);
|
|
496
|
+
throw new TxPoolError(reason);
|
|
497
|
+
}
|
|
498
|
+
|
|
499
|
+
this.log.warn(
|
|
500
|
+
`Tx ${txHashStr} not propagated: accepted=${result.accepted.length} ignored=${result.ignored.length} rejected=${result.rejected.length}`,
|
|
501
|
+
);
|
|
589
502
|
}
|
|
590
503
|
|
|
591
504
|
/**
|
|
@@ -746,20 +659,51 @@ export class P2PClient<T extends P2PClientType = P2PClientType.Full>
|
|
|
746
659
|
|
|
747
660
|
/**
|
|
748
661
|
* Updates the tx pool after a chain prune.
|
|
662
|
+
* Detects epoch prunes (checkpoint number changed) and deletes all txs in that case.
|
|
749
663
|
* @param latestBlock - The block ID the chain was pruned to.
|
|
664
|
+
* @param newCheckpoint - The checkpoint ID after the prune.
|
|
665
|
+
*/
|
|
666
|
+
private async handlePruneL2Blocks(latestBlock: L2BlockId, newCheckpoint: CheckpointId): Promise<void> {
|
|
667
|
+
const deleteAllTxs = this.config.txPoolDeleteTxsAfterReorg && (await this.isEpochPrune(newCheckpoint));
|
|
668
|
+
await this.txPool.handlePrunedBlocks(latestBlock, { deleteAllTxs });
|
|
669
|
+
}
|
|
670
|
+
|
|
671
|
+
/**
|
|
672
|
+
* Returns true if the prune is an epoch prune (new checkpoint number is less than old).
|
|
673
|
+
* If the checkpoint number stays the same or increases, the prune is within a checkpoint.
|
|
750
674
|
*/
|
|
751
|
-
private async
|
|
752
|
-
await this.
|
|
675
|
+
private async isEpochPrune(newCheckpoint: CheckpointId): Promise<boolean> {
|
|
676
|
+
const tips = await this.l2Tips.getL2Tips();
|
|
677
|
+
const oldCheckpointNumber = tips.checkpointed.checkpoint.number;
|
|
678
|
+
if (oldCheckpointNumber <= CheckpointNumber.INITIAL) {
|
|
679
|
+
return false;
|
|
680
|
+
}
|
|
681
|
+
const newCheckpointNumber = newCheckpoint.number;
|
|
682
|
+
// We check that the new checkpoint number is less than the old checkpoint number in order to consider it an epoch prune.
|
|
683
|
+
// To be more certain that it is an epoch prune, we will check that at least 2 checkpoints were removed.
|
|
684
|
+
// This means we should avoid thinking checkpoints removed by L1 re-orgs are epoch prunes
|
|
685
|
+
const thresholdForEpochPrune = CheckpointNumber(oldCheckpointNumber - 2);
|
|
686
|
+
const isEpochPrune = newCheckpointNumber <= thresholdForEpochPrune;
|
|
687
|
+
if (isEpochPrune) {
|
|
688
|
+
this.log.info(`Detected epoch prune to ${newCheckpointNumber}`, {
|
|
689
|
+
oldCheckpointNumber,
|
|
690
|
+
newCheckpointNumber,
|
|
691
|
+
thresholdForEpochPrune,
|
|
692
|
+
});
|
|
693
|
+
}
|
|
694
|
+
return isEpochPrune;
|
|
753
695
|
}
|
|
754
696
|
|
|
755
697
|
/** Checks if the slot has changed and calls prepareForSlot if so. */
|
|
756
698
|
private async maybeCallPrepareForSlot(): Promise<void> {
|
|
757
|
-
|
|
758
|
-
|
|
699
|
+
// If we have a pending checkpoint available, we want to prepare the target slot - otherwise we prepare the current slot
|
|
700
|
+
// Knowledege of pending checkpoints is in the PR above
|
|
701
|
+
const { targetSlot } = this.epochCache.getTargetAndNextSlot();
|
|
702
|
+
if (targetSlot <= this.lastSlotProcessed) {
|
|
759
703
|
return;
|
|
760
704
|
}
|
|
761
|
-
this.lastSlotProcessed =
|
|
762
|
-
await this.txPool.prepareForSlot(
|
|
705
|
+
this.lastSlotProcessed = targetSlot;
|
|
706
|
+
await this.txPool.prepareForSlot(targetSlot);
|
|
763
707
|
}
|
|
764
708
|
|
|
765
709
|
private async startServiceIfSynched() {
|
|
@@ -799,8 +743,8 @@ export class P2PClient<T extends P2PClientType = P2PClientType.Full>
|
|
|
799
743
|
this.log.debug(`Moved from state ${P2PClientState[oldState]} to ${P2PClientState[this.currentState]}`);
|
|
800
744
|
}
|
|
801
745
|
|
|
802
|
-
public
|
|
803
|
-
return this.p2pService.
|
|
746
|
+
public validateTxsReceivedInBlockProposal(txs: Tx[]): Promise<void> {
|
|
747
|
+
return this.p2pService.validateTxsReceivedInBlockProposal(txs);
|
|
804
748
|
}
|
|
805
749
|
|
|
806
750
|
/**
|
|
@@ -3,12 +3,12 @@ import { SecretValue } from '@aztec/foundation/config';
|
|
|
3
3
|
import { createLogger } from '@aztec/foundation/log';
|
|
4
4
|
import { sleep } from '@aztec/foundation/sleep';
|
|
5
5
|
import { DateProvider, Timer, executeTimeout } from '@aztec/foundation/timer';
|
|
6
|
-
import type { DataStoreConfig } from '@aztec/kv-store/config';
|
|
7
6
|
import { openTmpStore } from '@aztec/kv-store/lmdb-v2';
|
|
8
7
|
import type { L2BlockSource } from '@aztec/stdlib/block';
|
|
9
8
|
import type { ContractDataSource } from '@aztec/stdlib/contract';
|
|
10
9
|
import type { ClientProtocolCircuitVerifier } from '@aztec/stdlib/interfaces/server';
|
|
11
|
-
import {
|
|
10
|
+
import type { DataStoreConfig } from '@aztec/stdlib/kv-store';
|
|
11
|
+
import { PeerErrorSeverity } from '@aztec/stdlib/p2p';
|
|
12
12
|
import type { Tx, TxValidationResult } from '@aztec/stdlib/tx';
|
|
13
13
|
import { type TelemetryClient, getTelemetryClient } from '@aztec/telemetry-client';
|
|
14
14
|
|
|
@@ -16,14 +16,12 @@ import type { PeerId } from '@libp2p/interface';
|
|
|
16
16
|
import { peerIdFromString } from '@libp2p/peer-id';
|
|
17
17
|
|
|
18
18
|
import type { P2PConfig } from '../../../config.js';
|
|
19
|
+
import { BatchTxRequesterCollector, SendBatchRequestCollector } from '../../../services/index.js';
|
|
19
20
|
import type { IBatchRequestTxValidator } from '../../../services/reqresp/batch-tx-requester/tx_validator.js';
|
|
20
21
|
import { RateLimitStatus } from '../../../services/reqresp/rate-limiter/rate_limiter.js';
|
|
22
|
+
import { RequestTracker } from '../../../services/tx_collection/request_tracker.js';
|
|
21
23
|
import {
|
|
22
|
-
|
|
23
|
-
SendBatchRequestCollector,
|
|
24
|
-
} from '../../../services/tx_collection/proposal_tx_collector.js';
|
|
25
|
-
import { AlwaysTrueCircuitVerifier } from '../../../test-helpers/reqresp-nodes.js';
|
|
26
|
-
import {
|
|
24
|
+
AlwaysTrueCircuitVerifier,
|
|
27
25
|
BENCHMARK_CONSTANTS,
|
|
28
26
|
InMemoryAttestationPool,
|
|
29
27
|
InMemoryTxPool,
|
|
@@ -31,7 +29,7 @@ import {
|
|
|
31
29
|
calculateInternalTimeout,
|
|
32
30
|
createMockEpochCache,
|
|
33
31
|
createMockWorldStateSynchronizer,
|
|
34
|
-
} from '../../../test-helpers/
|
|
32
|
+
} from '../../../test-helpers/index.js';
|
|
35
33
|
import { createP2PClient } from '../../index.js';
|
|
36
34
|
import type { P2PClient } from '../../p2p_client.js';
|
|
37
35
|
import {
|
|
@@ -116,7 +114,6 @@ async function startClient(config: P2PConfig, clientIndex: number) {
|
|
|
116
114
|
};
|
|
117
115
|
|
|
118
116
|
client = await createP2PClient(
|
|
119
|
-
P2PClientType.Full,
|
|
120
117
|
config as P2PConfig & DataStoreConfig,
|
|
121
118
|
l2BlockSource as L2BlockSource & ContractDataSource,
|
|
122
119
|
proofVerifier as ClientProtocolCircuitVerifier,
|
|
@@ -214,7 +211,12 @@ async function runCollector(cmd: Extract<WorkerCommand, { type: 'RUN_COLLECTOR'
|
|
|
214
211
|
if (collectorType === 'batch-requester') {
|
|
215
212
|
const collector = new BatchTxRequesterCollector(p2pService, logger, new DateProvider(), noopTxValidator);
|
|
216
213
|
const fetched = await executeTimeout(
|
|
217
|
-
(_signal: AbortSignal) =>
|
|
214
|
+
(_signal: AbortSignal) =>
|
|
215
|
+
collector.collectTxs(
|
|
216
|
+
RequestTracker.create(parsedTxHashes, new Date(Date.now() + internalTimeoutMs)),
|
|
217
|
+
parsedProposal,
|
|
218
|
+
pinnedPeer,
|
|
219
|
+
),
|
|
218
220
|
timeoutMs,
|
|
219
221
|
() => new Error(`Collector timed out after ${timeoutMs}ms`),
|
|
220
222
|
);
|
|
@@ -226,7 +228,12 @@ async function runCollector(cmd: Extract<WorkerCommand, { type: 'RUN_COLLECTOR'
|
|
|
226
228
|
BENCHMARK_CONSTANTS.FIXED_MAX_RETRY_ATTEMPTS,
|
|
227
229
|
);
|
|
228
230
|
const fetched = await executeTimeout(
|
|
229
|
-
(_signal: AbortSignal) =>
|
|
231
|
+
(_signal: AbortSignal) =>
|
|
232
|
+
collector.collectTxs(
|
|
233
|
+
RequestTracker.create(parsedTxHashes, new Date(Date.now() + internalTimeoutMs)),
|
|
234
|
+
parsedProposal,
|
|
235
|
+
pinnedPeer,
|
|
236
|
+
),
|
|
230
237
|
timeoutMs,
|
|
231
238
|
() => new Error(`Collector timed out after ${timeoutMs}ms`),
|
|
232
239
|
);
|