@aztec/p2p 0.0.1-commit.b655e406 → 0.0.1-commit.c2595eba
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dest/bootstrap/bootstrap.d.ts +4 -3
- package/dest/bootstrap/bootstrap.d.ts.map +1 -1
- package/dest/bootstrap/bootstrap.js +4 -4
- package/dest/client/factory.d.ts +2 -2
- package/dest/client/factory.d.ts.map +1 -1
- package/dest/client/factory.js +8 -8
- package/dest/client/index.d.ts +1 -1
- package/dest/client/interface.d.ts +18 -3
- package/dest/client/interface.d.ts.map +1 -1
- package/dest/client/p2p_client.d.ts +16 -37
- package/dest/client/p2p_client.d.ts.map +1 -1
- package/dest/client/p2p_client.js +464 -126
- package/dest/client/test/tx_proposal_collector/proposal_tx_collector_worker.d.ts +2 -0
- package/dest/client/test/tx_proposal_collector/proposal_tx_collector_worker.d.ts.map +1 -0
- package/dest/client/test/tx_proposal_collector/proposal_tx_collector_worker.js +305 -0
- package/dest/client/test/tx_proposal_collector/proposal_tx_collector_worker_protocol.d.ts +73 -0
- package/dest/client/test/tx_proposal_collector/proposal_tx_collector_worker_protocol.d.ts.map +1 -0
- package/dest/client/test/tx_proposal_collector/proposal_tx_collector_worker_protocol.js +8 -0
- package/dest/config.d.ts +69 -60
- package/dest/config.d.ts.map +1 -1
- package/dest/config.js +23 -14
- package/dest/enr/generate-enr.d.ts +1 -1
- package/dest/enr/index.d.ts +1 -1
- package/dest/errors/attestation-pool.error.d.ts +7 -0
- package/dest/errors/attestation-pool.error.d.ts.map +1 -0
- package/dest/errors/attestation-pool.error.js +12 -0
- package/dest/errors/reqresp.error.d.ts +1 -1
- package/dest/errors/reqresp.error.d.ts.map +1 -1
- package/dest/index.d.ts +1 -1
- package/dest/mem_pools/attestation_pool/attestation_pool.d.ts +77 -36
- package/dest/mem_pools/attestation_pool/attestation_pool.d.ts.map +1 -1
- 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 +241 -266
- package/dest/mem_pools/attestation_pool/index.d.ts +1 -1
- package/dest/mem_pools/attestation_pool/kv_attestation_pool.d.ts +24 -14
- package/dest/mem_pools/attestation_pool/kv_attestation_pool.d.ts.map +1 -1
- package/dest/mem_pools/attestation_pool/kv_attestation_pool.js +123 -95
- package/dest/mem_pools/attestation_pool/memory_attestation_pool.d.ts +18 -12
- package/dest/mem_pools/attestation_pool/memory_attestation_pool.d.ts.map +1 -1
- package/dest/mem_pools/attestation_pool/memory_attestation_pool.js +91 -108
- package/dest/mem_pools/attestation_pool/mocks.d.ts +234 -10
- package/dest/mem_pools/attestation_pool/mocks.d.ts.map +1 -1
- package/dest/mem_pools/attestation_pool/mocks.js +17 -13
- package/dest/mem_pools/index.d.ts +1 -1
- package/dest/mem_pools/instrumentation.d.ts +9 -1
- package/dest/mem_pools/instrumentation.d.ts.map +1 -1
- package/dest/mem_pools/instrumentation.js +37 -10
- package/dest/mem_pools/interface.d.ts +3 -4
- package/dest/mem_pools/interface.d.ts.map +1 -1
- package/dest/mem_pools/tx_pool/aztec_kv_tx_pool.d.ts +33 -58
- package/dest/mem_pools/tx_pool/aztec_kv_tx_pool.d.ts.map +1 -1
- package/dest/mem_pools/tx_pool/aztec_kv_tx_pool.js +314 -335
- package/dest/mem_pools/tx_pool/eviction/eviction_manager.d.ts +32 -0
- package/dest/mem_pools/tx_pool/eviction/eviction_manager.d.ts.map +1 -0
- package/dest/mem_pools/tx_pool/eviction/eviction_manager.js +112 -0
- package/dest/mem_pools/tx_pool/eviction/eviction_strategy.d.ts +157 -0
- package/dest/mem_pools/tx_pool/eviction/eviction_strategy.d.ts.map +1 -0
- package/dest/mem_pools/tx_pool/eviction/eviction_strategy.js +52 -0
- package/dest/mem_pools/tx_pool/eviction/fee_payer_balance_eviction_rule.d.ts +16 -0
- package/dest/mem_pools/tx_pool/eviction/fee_payer_balance_eviction_rule.d.ts.map +1 -0
- package/dest/mem_pools/tx_pool/eviction/fee_payer_balance_eviction_rule.js +122 -0
- package/dest/mem_pools/tx_pool/eviction/invalid_txs_after_mining_rule.d.ts +17 -0
- package/dest/mem_pools/tx_pool/eviction/invalid_txs_after_mining_rule.d.ts.map +1 -0
- package/dest/mem_pools/tx_pool/eviction/invalid_txs_after_mining_rule.js +84 -0
- package/dest/mem_pools/tx_pool/eviction/invalid_txs_after_reorg_rule.d.ts +19 -0
- package/dest/mem_pools/tx_pool/eviction/invalid_txs_after_reorg_rule.d.ts.map +1 -0
- package/dest/mem_pools/tx_pool/eviction/invalid_txs_after_reorg_rule.js +78 -0
- package/dest/mem_pools/tx_pool/eviction/low_priority_eviction_rule.d.ts +26 -0
- package/dest/mem_pools/tx_pool/eviction/low_priority_eviction_rule.d.ts.map +1 -0
- package/dest/mem_pools/tx_pool/eviction/low_priority_eviction_rule.js +84 -0
- package/dest/mem_pools/tx_pool/eviction/nullifier_conflict_pre_add_rule.d.ts +25 -0
- package/dest/mem_pools/tx_pool/eviction/nullifier_conflict_pre_add_rule.d.ts.map +1 -0
- package/dest/mem_pools/tx_pool/eviction/nullifier_conflict_pre_add_rule.js +57 -0
- package/dest/mem_pools/tx_pool/index.d.ts +1 -2
- package/dest/mem_pools/tx_pool/index.d.ts.map +1 -1
- package/dest/mem_pools/tx_pool/index.js +0 -1
- package/dest/mem_pools/tx_pool/priority.d.ts +5 -1
- package/dest/mem_pools/tx_pool/priority.d.ts.map +1 -1
- package/dest/mem_pools/tx_pool/priority.js +6 -1
- package/dest/mem_pools/tx_pool/tx_pool.d.ts +11 -6
- package/dest/mem_pools/tx_pool/tx_pool.d.ts.map +1 -1
- 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 +30 -24
- package/dest/msg_validators/attestation_validator/attestation_validator.d.ts +7 -6
- package/dest/msg_validators/attestation_validator/attestation_validator.d.ts.map +1 -1
- package/dest/msg_validators/attestation_validator/attestation_validator.js +57 -24
- package/dest/msg_validators/attestation_validator/fisherman_attestation_validator.d.ts +20 -0
- package/dest/msg_validators/attestation_validator/fisherman_attestation_validator.d.ts.map +1 -0
- package/dest/msg_validators/attestation_validator/fisherman_attestation_validator.js +76 -0
- package/dest/msg_validators/attestation_validator/index.d.ts +2 -1
- package/dest/msg_validators/attestation_validator/index.d.ts.map +1 -1
- package/dest/msg_validators/attestation_validator/index.js +1 -0
- package/dest/msg_validators/clock_tolerance.d.ts +21 -0
- package/dest/msg_validators/clock_tolerance.d.ts.map +1 -0
- package/dest/msg_validators/clock_tolerance.js +37 -0
- package/dest/msg_validators/index.d.ts +2 -2
- package/dest/msg_validators/index.d.ts.map +1 -1
- package/dest/msg_validators/index.js +1 -1
- package/dest/msg_validators/msg_seen_validator/msg_seen_validator.d.ts +1 -1
- package/dest/msg_validators/msg_seen_validator/msg_seen_validator.d.ts.map +1 -1
- package/dest/msg_validators/proposal_validator/block_proposal_validator.d.ts +9 -0
- package/dest/msg_validators/proposal_validator/block_proposal_validator.d.ts.map +1 -0
- package/dest/msg_validators/proposal_validator/block_proposal_validator.js +6 -0
- package/dest/msg_validators/proposal_validator/checkpoint_proposal_validator.d.ts +9 -0
- package/dest/msg_validators/proposal_validator/checkpoint_proposal_validator.d.ts.map +1 -0
- package/dest/msg_validators/proposal_validator/checkpoint_proposal_validator.js +6 -0
- package/dest/msg_validators/proposal_validator/index.d.ts +4 -0
- package/dest/msg_validators/proposal_validator/index.d.ts.map +1 -0
- package/dest/msg_validators/proposal_validator/index.js +3 -0
- package/dest/msg_validators/proposal_validator/proposal_validator.d.ts +13 -0
- package/dest/msg_validators/proposal_validator/proposal_validator.d.ts.map +1 -0
- package/dest/msg_validators/proposal_validator/proposal_validator.js +104 -0
- package/dest/msg_validators/proposal_validator/proposal_validator_test_suite.d.ts +23 -0
- package/dest/msg_validators/proposal_validator/proposal_validator_test_suite.d.ts.map +1 -0
- package/dest/msg_validators/proposal_validator/proposal_validator_test_suite.js +212 -0
- 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/allowed_public_setup.d.ts +1 -1
- package/dest/msg_validators/tx_validator/archive_cache.d.ts +3 -3
- package/dest/msg_validators/tx_validator/archive_cache.d.ts.map +1 -1
- package/dest/msg_validators/tx_validator/archive_cache.js +1 -1
- package/dest/msg_validators/tx_validator/block_header_validator.d.ts +5 -4
- package/dest/msg_validators/tx_validator/block_header_validator.d.ts.map +1 -1
- package/dest/msg_validators/tx_validator/block_header_validator.js +3 -2
- package/dest/msg_validators/tx_validator/data_validator.d.ts +3 -1
- package/dest/msg_validators/tx_validator/data_validator.d.ts.map +1 -1
- package/dest/msg_validators/tx_validator/data_validator.js +4 -1
- package/dest/msg_validators/tx_validator/double_spend_validator.d.ts +3 -2
- package/dest/msg_validators/tx_validator/double_spend_validator.d.ts.map +1 -1
- package/dest/msg_validators/tx_validator/double_spend_validator.js +3 -2
- package/dest/msg_validators/tx_validator/factory.d.ts +10 -4
- package/dest/msg_validators/tx_validator/factory.d.ts.map +1 -1
- package/dest/msg_validators/tx_validator/factory.js +22 -12
- package/dest/msg_validators/tx_validator/fee_payer_balance.d.ts +10 -0
- package/dest/msg_validators/tx_validator/fee_payer_balance.d.ts.map +1 -0
- package/dest/msg_validators/tx_validator/fee_payer_balance.js +20 -0
- package/dest/msg_validators/tx_validator/gas_validator.d.ts +3 -2
- package/dest/msg_validators/tx_validator/gas_validator.d.ts.map +1 -1
- package/dest/msg_validators/tx_validator/gas_validator.js +11 -16
- package/dest/msg_validators/tx_validator/index.d.ts +2 -1
- package/dest/msg_validators/tx_validator/index.d.ts.map +1 -1
- package/dest/msg_validators/tx_validator/index.js +1 -0
- package/dest/msg_validators/tx_validator/metadata_validator.d.ts +4 -3
- package/dest/msg_validators/tx_validator/metadata_validator.d.ts.map +1 -1
- package/dest/msg_validators/tx_validator/metadata_validator.js +2 -2
- package/dest/msg_validators/tx_validator/phases_validator.d.ts +3 -2
- package/dest/msg_validators/tx_validator/phases_validator.d.ts.map +1 -1
- package/dest/msg_validators/tx_validator/phases_validator.js +6 -4
- package/dest/msg_validators/tx_validator/size_validator.d.ts +8 -0
- package/dest/msg_validators/tx_validator/size_validator.d.ts.map +1 -0
- package/dest/msg_validators/tx_validator/size_validator.js +23 -0
- package/dest/msg_validators/tx_validator/test_utils.d.ts +2 -2
- package/dest/msg_validators/tx_validator/test_utils.d.ts.map +1 -1
- package/dest/msg_validators/tx_validator/timestamp_validator.d.ts +5 -3
- package/dest/msg_validators/tx_validator/timestamp_validator.d.ts.map +1 -1
- package/dest/msg_validators/tx_validator/timestamp_validator.js +2 -2
- package/dest/msg_validators/tx_validator/tx_permitted_validator.d.ts +3 -2
- package/dest/msg_validators/tx_validator/tx_permitted_validator.d.ts.map +1 -1
- package/dest/msg_validators/tx_validator/tx_permitted_validator.js +2 -2
- package/dest/msg_validators/tx_validator/tx_proof_validator.d.ts +3 -2
- 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 -2
- package/dest/services/data_store.d.ts +1 -1
- package/dest/services/data_store.d.ts.map +1 -1
- package/dest/services/discv5/discV5_service.d.ts +1 -1
- package/dest/services/discv5/discV5_service.d.ts.map +1 -1
- package/dest/services/discv5/discV5_service.js +1 -1
- package/dest/services/dummy_service.d.ts +18 -2
- package/dest/services/dummy_service.d.ts.map +1 -1
- package/dest/services/dummy_service.js +42 -0
- package/dest/services/encoding.d.ts +1 -1
- package/dest/services/encoding.d.ts.map +1 -1
- package/dest/services/encoding.js +7 -6
- package/dest/services/gossipsub/scoring.d.ts +1 -1
- package/dest/services/index.d.ts +1 -1
- 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 +36 -71
- package/dest/services/libp2p/libp2p_service.d.ts +48 -81
- package/dest/services/libp2p/libp2p_service.d.ts.map +1 -1
- package/dest/services/libp2p/libp2p_service.js +926 -193
- package/dest/services/peer-manager/interface.d.ts +1 -1
- package/dest/services/peer-manager/metrics.d.ts +9 -2
- package/dest/services/peer-manager/metrics.d.ts.map +1 -1
- package/dest/services/peer-manager/metrics.js +39 -16
- package/dest/services/peer-manager/peer_manager.d.ts +2 -33
- package/dest/services/peer-manager/peer_manager.d.ts.map +1 -1
- package/dest/services/peer-manager/peer_manager.js +6 -12
- 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 +43 -2
- package/dest/services/reqresp/batch-tx-requester/batch_tx_requester.d.ts +47 -0
- package/dest/services/reqresp/batch-tx-requester/batch_tx_requester.d.ts.map +1 -0
- package/dest/services/reqresp/batch-tx-requester/batch_tx_requester.js +566 -0
- package/dest/services/reqresp/batch-tx-requester/config.d.ts +17 -0
- package/dest/services/reqresp/batch-tx-requester/config.d.ts.map +1 -0
- package/dest/services/reqresp/batch-tx-requester/config.js +27 -0
- package/dest/services/reqresp/batch-tx-requester/interface.d.ts +50 -0
- package/dest/services/reqresp/batch-tx-requester/interface.d.ts.map +1 -0
- package/dest/services/reqresp/batch-tx-requester/interface.js +1 -0
- package/dest/services/reqresp/batch-tx-requester/missing_txs.d.ts +37 -0
- package/dest/services/reqresp/batch-tx-requester/missing_txs.d.ts.map +1 -0
- package/dest/services/reqresp/batch-tx-requester/missing_txs.js +151 -0
- package/dest/services/reqresp/batch-tx-requester/peer_collection.d.ts +54 -0
- package/dest/services/reqresp/batch-tx-requester/peer_collection.d.ts.map +1 -0
- package/dest/services/reqresp/batch-tx-requester/peer_collection.js +139 -0
- package/dest/services/reqresp/batch-tx-requester/tx_validator.d.ts +20 -0
- package/dest/services/reqresp/batch-tx-requester/tx_validator.d.ts.map +1 -0
- package/dest/services/reqresp/batch-tx-requester/tx_validator.js +21 -0
- package/dest/services/reqresp/config.d.ts +1 -1
- package/dest/services/reqresp/connection-sampler/batch_connection_sampler.d.ts +22 -3
- package/dest/services/reqresp/connection-sampler/batch_connection_sampler.d.ts.map +1 -1
- package/dest/services/reqresp/connection-sampler/batch_connection_sampler.js +63 -4
- package/dest/services/reqresp/connection-sampler/connection_sampler.d.ts +2 -4
- package/dest/services/reqresp/connection-sampler/connection_sampler.d.ts.map +1 -1
- package/dest/services/reqresp/connection-sampler/connection_sampler.js +12 -0
- package/dest/services/reqresp/constants.d.ts +12 -0
- package/dest/services/reqresp/constants.d.ts.map +1 -0
- package/dest/services/reqresp/constants.js +7 -0
- package/dest/services/reqresp/index.d.ts +1 -1
- package/dest/services/reqresp/interface.d.ts +4 -2
- package/dest/services/reqresp/interface.d.ts.map +1 -1
- package/dest/services/reqresp/interface.js +1 -1
- package/dest/services/reqresp/metrics.d.ts +6 -5
- package/dest/services/reqresp/metrics.d.ts.map +1 -1
- package/dest/services/reqresp/metrics.js +17 -21
- package/dest/services/reqresp/protocols/auth.d.ts +2 -2
- package/dest/services/reqresp/protocols/auth.d.ts.map +1 -1
- package/dest/services/reqresp/protocols/auth.js +2 -2
- package/dest/services/reqresp/protocols/block.d.ts +1 -1
- package/dest/services/reqresp/protocols/block.d.ts.map +1 -1
- package/dest/services/reqresp/protocols/block.js +3 -2
- package/dest/services/reqresp/protocols/block_txs/bitvector.d.ts +5 -1
- package/dest/services/reqresp/protocols/block_txs/bitvector.d.ts.map +1 -1
- package/dest/services/reqresp/protocols/block_txs/bitvector.js +12 -0
- 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 +14 -1
- package/dest/services/reqresp/protocols/block_txs/block_txs_reqresp.d.ts +17 -7
- package/dest/services/reqresp/protocols/block_txs/block_txs_reqresp.d.ts.map +1 -1
- package/dest/services/reqresp/protocols/block_txs/block_txs_reqresp.js +34 -4
- package/dest/services/reqresp/protocols/block_txs/index.d.ts +1 -1
- package/dest/services/reqresp/protocols/goodbye.d.ts +1 -1
- package/dest/services/reqresp/protocols/goodbye.d.ts.map +1 -1
- package/dest/services/reqresp/protocols/index.d.ts +1 -1
- package/dest/services/reqresp/protocols/ping.d.ts +1 -1
- package/dest/services/reqresp/protocols/status.d.ts +6 -5
- package/dest/services/reqresp/protocols/status.d.ts.map +1 -1
- package/dest/services/reqresp/protocols/status.js +7 -3
- package/dest/services/reqresp/protocols/tx.d.ts +2 -3
- package/dest/services/reqresp/protocols/tx.d.ts.map +1 -1
- package/dest/services/reqresp/rate-limiter/index.d.ts +1 -1
- package/dest/services/reqresp/rate-limiter/rate_limiter.d.ts +2 -2
- package/dest/services/reqresp/rate-limiter/rate_limiter.d.ts.map +1 -1
- package/dest/services/reqresp/rate-limiter/rate_limits.d.ts +1 -1
- package/dest/services/reqresp/reqresp.d.ts +6 -41
- package/dest/services/reqresp/reqresp.d.ts.map +1 -1
- package/dest/services/reqresp/reqresp.js +460 -46
- package/dest/services/reqresp/status.d.ts +2 -2
- package/dest/services/reqresp/status.d.ts.map +1 -1
- package/dest/services/service.d.ts +19 -3
- package/dest/services/service.d.ts.map +1 -1
- package/dest/services/tx_collection/config.d.ts +4 -1
- package/dest/services/tx_collection/config.d.ts.map +1 -1
- package/dest/services/tx_collection/config.js +10 -2
- package/dest/services/tx_collection/fast_tx_collection.d.ts +9 -12
- package/dest/services/tx_collection/fast_tx_collection.d.ts.map +1 -1
- package/dest/services/tx_collection/fast_tx_collection.js +16 -5
- package/dest/services/tx_collection/index.d.ts +2 -1
- package/dest/services/tx_collection/index.d.ts.map +1 -1
- package/dest/services/tx_collection/index.js +1 -0
- package/dest/services/tx_collection/instrumentation.d.ts +1 -1
- package/dest/services/tx_collection/instrumentation.d.ts.map +1 -1
- package/dest/services/tx_collection/instrumentation.js +10 -13
- package/dest/services/tx_collection/proposal_tx_collector.d.ts +48 -0
- package/dest/services/tx_collection/proposal_tx_collector.d.ts.map +1 -0
- package/dest/services/tx_collection/proposal_tx_collector.js +50 -0
- package/dest/services/tx_collection/slow_tx_collection.d.ts +4 -5
- package/dest/services/tx_collection/slow_tx_collection.d.ts.map +1 -1
- package/dest/services/tx_collection/slow_tx_collection.js +2 -1
- package/dest/services/tx_collection/tx_collection.d.ts +10 -10
- package/dest/services/tx_collection/tx_collection.d.ts.map +1 -1
- package/dest/services/tx_collection/tx_collection.js +5 -5
- package/dest/services/tx_collection/tx_collection_sink.d.ts +3 -3
- package/dest/services/tx_collection/tx_collection_sink.d.ts.map +1 -1
- package/dest/services/tx_collection/tx_source.d.ts +1 -1
- package/dest/services/tx_collection/tx_source.d.ts.map +1 -1
- package/dest/services/tx_provider.d.ts +4 -2
- package/dest/services/tx_provider.d.ts.map +1 -1
- package/dest/services/tx_provider.js +11 -2
- package/dest/services/tx_provider_instrumentation.d.ts +5 -2
- package/dest/services/tx_provider_instrumentation.d.ts.map +1 -1
- package/dest/services/tx_provider_instrumentation.js +14 -14
- package/dest/test-helpers/generate-peer-id-private-keys.d.ts +1 -1
- package/dest/test-helpers/get-ports.d.ts +1 -1
- package/dest/test-helpers/get-ports.d.ts.map +1 -1
- package/dest/test-helpers/index.d.ts +3 -1
- package/dest/test-helpers/index.d.ts.map +1 -1
- package/dest/test-helpers/index.js +2 -0
- package/dest/test-helpers/make-enrs.d.ts +1 -1
- package/dest/test-helpers/make-test-p2p-clients.d.ts +2 -2
- package/dest/test-helpers/make-test-p2p-clients.d.ts.map +1 -1
- 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-tx-helpers.d.ts +2 -2
- package/dest/test-helpers/mock-tx-helpers.d.ts.map +1 -1
- package/dest/test-helpers/mock-tx-helpers.js +1 -1
- package/dest/test-helpers/reqresp-nodes.d.ts +2 -2
- package/dest/test-helpers/reqresp-nodes.d.ts.map +1 -1
- package/dest/test-helpers/test_tx_provider.d.ts +40 -0
- package/dest/test-helpers/test_tx_provider.d.ts.map +1 -0
- package/dest/test-helpers/test_tx_provider.js +41 -0
- package/dest/test-helpers/testbench-utils.d.ts +158 -0
- package/dest/test-helpers/testbench-utils.d.ts.map +1 -0
- package/dest/test-helpers/testbench-utils.js +297 -0
- package/dest/testbench/p2p_client_testbench_worker.d.ts +28 -2
- package/dest/testbench/p2p_client_testbench_worker.d.ts.map +1 -1
- package/dest/testbench/p2p_client_testbench_worker.js +218 -120
- package/dest/testbench/parse_log_file.d.ts +1 -1
- package/dest/testbench/testbench.d.ts +1 -1
- package/dest/testbench/worker_client_manager.d.ts +51 -6
- package/dest/testbench/worker_client_manager.d.ts.map +1 -1
- package/dest/testbench/worker_client_manager.js +226 -39
- package/dest/types/index.d.ts +1 -1
- package/dest/util.d.ts +2 -1
- package/dest/util.d.ts.map +1 -1
- package/dest/util.js +11 -2
- package/dest/versioning.d.ts +1 -1
- package/package.json +19 -18
- package/src/bootstrap/bootstrap.ts +7 -4
- package/src/client/factory.ts +11 -20
- package/src/client/interface.ts +20 -2
- package/src/client/p2p_client.ts +108 -155
- package/src/client/test/tx_proposal_collector/README.md +227 -0
- package/src/client/test/tx_proposal_collector/proposal_tx_collector_worker.ts +336 -0
- package/src/client/test/tx_proposal_collector/proposal_tx_collector_worker_protocol.ts +43 -0
- package/src/config.ts +36 -20
- package/src/errors/attestation-pool.error.ts +13 -0
- package/src/mem_pools/attestation_pool/attestation_pool.ts +86 -35
- package/src/mem_pools/attestation_pool/attestation_pool_test_suite.ts +243 -278
- package/src/mem_pools/attestation_pool/kv_attestation_pool.ts +175 -111
- package/src/mem_pools/attestation_pool/memory_attestation_pool.ts +147 -136
- package/src/mem_pools/attestation_pool/mocks.ts +21 -15
- package/src/mem_pools/instrumentation.ts +48 -10
- package/src/mem_pools/interface.ts +2 -4
- package/src/mem_pools/tx_pool/README.md +270 -0
- package/src/mem_pools/tx_pool/aztec_kv_tx_pool.ts +367 -371
- package/src/mem_pools/tx_pool/eviction/eviction_manager.ts +132 -0
- package/src/mem_pools/tx_pool/eviction/eviction_strategy.ts +208 -0
- package/src/mem_pools/tx_pool/eviction/fee_payer_balance_eviction_rule.ts +162 -0
- package/src/mem_pools/tx_pool/eviction/invalid_txs_after_mining_rule.ts +104 -0
- package/src/mem_pools/tx_pool/eviction/invalid_txs_after_reorg_rule.ts +93 -0
- package/src/mem_pools/tx_pool/eviction/low_priority_eviction_rule.ts +106 -0
- package/src/mem_pools/tx_pool/eviction/nullifier_conflict_pre_add_rule.ts +75 -0
- package/src/mem_pools/tx_pool/index.ts +0 -1
- package/src/mem_pools/tx_pool/priority.ts +8 -1
- package/src/mem_pools/tx_pool/tx_pool.ts +11 -5
- package/src/mem_pools/tx_pool/tx_pool_test_suite.ts +23 -17
- package/src/msg_validators/attestation_validator/attestation_validator.ts +45 -32
- package/src/msg_validators/attestation_validator/fisherman_attestation_validator.ts +94 -0
- package/src/msg_validators/attestation_validator/index.ts +1 -0
- package/src/msg_validators/clock_tolerance.ts +51 -0
- package/src/msg_validators/index.ts +1 -1
- package/src/msg_validators/proposal_validator/block_proposal_validator.ts +10 -0
- package/src/msg_validators/proposal_validator/checkpoint_proposal_validator.ts +13 -0
- package/src/msg_validators/proposal_validator/index.ts +3 -0
- package/src/msg_validators/proposal_validator/proposal_validator.ts +92 -0
- package/src/msg_validators/proposal_validator/proposal_validator_test_suite.ts +230 -0
- package/src/msg_validators/tx_validator/archive_cache.ts +3 -3
- package/src/msg_validators/tx_validator/block_header_validator.ts +6 -5
- package/src/msg_validators/tx_validator/data_validator.ts +18 -6
- package/src/msg_validators/tx_validator/double_spend_validator.ts +4 -3
- package/src/msg_validators/tx_validator/factory.ts +67 -25
- package/src/msg_validators/tx_validator/fee_payer_balance.ts +40 -0
- package/src/msg_validators/tx_validator/gas_validator.ts +17 -28
- package/src/msg_validators/tx_validator/index.ts +1 -0
- package/src/msg_validators/tx_validator/metadata_validator.ts +19 -8
- package/src/msg_validators/tx_validator/phases_validator.ts +8 -4
- package/src/msg_validators/tx_validator/size_validator.ts +22 -0
- package/src/msg_validators/tx_validator/test_utils.ts +1 -1
- package/src/msg_validators/tx_validator/timestamp_validator.ts +11 -5
- package/src/msg_validators/tx_validator/tx_permitted_validator.ts +8 -3
- package/src/msg_validators/tx_validator/tx_proof_validator.ts +8 -3
- package/src/services/discv5/discV5_service.ts +1 -1
- package/src/services/dummy_service.ts +51 -0
- package/src/services/encoding.ts +6 -5
- package/src/services/libp2p/instrumentation.ts +39 -71
- package/src/services/libp2p/libp2p_service.ts +628 -194
- package/src/services/peer-manager/metrics.ts +44 -16
- package/src/services/peer-manager/peer_manager.ts +7 -4
- package/src/services/peer-manager/peer_scoring.ts +45 -3
- package/src/services/reqresp/batch-tx-requester/README.md +305 -0
- package/src/services/reqresp/batch-tx-requester/batch_tx_requester.ts +706 -0
- package/src/services/reqresp/batch-tx-requester/config.ts +40 -0
- package/src/services/reqresp/batch-tx-requester/interface.ts +57 -0
- package/src/services/reqresp/batch-tx-requester/missing_txs.ts +209 -0
- package/src/services/reqresp/batch-tx-requester/peer_collection.ts +205 -0
- package/src/services/reqresp/batch-tx-requester/tx_validator.ts +37 -0
- package/src/services/reqresp/connection-sampler/batch_connection_sampler.ts +65 -4
- package/src/services/reqresp/connection-sampler/connection_sampler.ts +19 -1
- package/src/services/reqresp/constants.ts +14 -0
- package/src/services/reqresp/interface.ts +4 -1
- package/src/services/reqresp/metrics.ts +36 -27
- package/src/services/reqresp/protocols/auth.ts +2 -2
- package/src/services/reqresp/protocols/block.ts +3 -2
- package/src/services/reqresp/protocols/block_txs/bitvector.ts +16 -0
- package/src/services/reqresp/protocols/block_txs/block_txs_handler.ts +16 -2
- package/src/services/reqresp/protocols/block_txs/block_txs_reqresp.ts +47 -5
- package/src/services/reqresp/protocols/status.ts +16 -12
- package/src/services/reqresp/protocols/tx.ts +1 -2
- package/src/services/reqresp/reqresp.ts +66 -19
- package/src/services/service.ts +23 -4
- package/src/services/tx_collection/config.ts +16 -2
- package/src/services/tx_collection/fast_tx_collection.ts +39 -15
- package/src/services/tx_collection/index.ts +5 -0
- package/src/services/tx_collection/instrumentation.ts +5 -13
- package/src/services/tx_collection/proposal_tx_collector.ts +114 -0
- package/src/services/tx_collection/slow_tx_collection.ts +5 -4
- package/src/services/tx_collection/tx_collection.ts +10 -9
- package/src/services/tx_provider.ts +19 -3
- package/src/services/tx_provider_instrumentation.ts +24 -14
- package/src/test-helpers/index.ts +2 -0
- package/src/test-helpers/mock-pubsub.ts +1 -1
- package/src/test-helpers/mock-tx-helpers.ts +1 -1
- package/src/test-helpers/reqresp-nodes.ts +1 -1
- package/src/test-helpers/test_tx_provider.ts +64 -0
- package/src/test-helpers/testbench-utils.ts +374 -0
- package/src/testbench/p2p_client_testbench_worker.ts +338 -116
- package/src/testbench/worker_client_manager.ts +304 -42
- package/src/util.ts +12 -2
- package/dest/mem_pools/tx_pool/memory_tx_pool.d.ts +0 -80
- package/dest/mem_pools/tx_pool/memory_tx_pool.d.ts.map +0 -1
- package/dest/mem_pools/tx_pool/memory_tx_pool.js +0 -238
- package/dest/msg_validators/block_proposal_validator/block_proposal_validator.d.ts +0 -12
- package/dest/msg_validators/block_proposal_validator/block_proposal_validator.d.ts.map +0 -1
- package/dest/msg_validators/block_proposal_validator/block_proposal_validator.js +0 -70
- package/dest/msg_validators/block_proposal_validator/index.d.ts +0 -2
- package/dest/msg_validators/block_proposal_validator/index.d.ts.map +0 -1
- package/dest/msg_validators/block_proposal_validator/index.js +0 -1
- package/src/mem_pools/tx_pool/memory_tx_pool.ts +0 -283
- package/src/msg_validators/block_proposal_validator/block_proposal_validator.ts +0 -81
- package/src/msg_validators/block_proposal_validator/index.ts +0 -1
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { BlockNumber } from '@aztec/foundation/branded-types';
|
|
1
2
|
import { times } from '@aztec/foundation/collection';
|
|
2
3
|
import { AbortError, TimeoutError } from '@aztec/foundation/error';
|
|
3
4
|
import { type Logger, createLogger } from '@aztec/foundation/log';
|
|
@@ -11,9 +12,16 @@ import { type Tx, TxHash } from '@aztec/stdlib/tx';
|
|
|
11
12
|
|
|
12
13
|
import type { PeerId } from '@libp2p/interface';
|
|
13
14
|
|
|
14
|
-
import
|
|
15
|
+
import type { BatchTxRequesterConfig } from '../reqresp/batch-tx-requester/config.js';
|
|
16
|
+
import type { BatchTxRequesterLibP2PService } from '../reqresp/batch-tx-requester/interface.js';
|
|
17
|
+
import { ReqRespSubProtocol } from '../reqresp/interface.js';
|
|
15
18
|
import { chunkTxHashesRequest } from '../reqresp/protocols/tx.js';
|
|
16
19
|
import type { TxCollectionConfig } from './config.js';
|
|
20
|
+
import {
|
|
21
|
+
BatchTxRequesterCollector,
|
|
22
|
+
type ProposalTxCollector,
|
|
23
|
+
SendBatchRequestCollector,
|
|
24
|
+
} from './proposal_tx_collector.js';
|
|
17
25
|
import type { FastCollectionRequest, FastCollectionRequestInput } from './tx_collection.js';
|
|
18
26
|
import type { TxCollectionSink } from './tx_collection_sink.js';
|
|
19
27
|
import type { TxSource } from './tx_source.js';
|
|
@@ -21,15 +29,25 @@ import type { TxSource } from './tx_source.js';
|
|
|
21
29
|
export class FastTxCollection {
|
|
22
30
|
// eslint-disable-next-line aztec-custom/no-non-primitive-in-collections
|
|
23
31
|
protected requests: Set<FastCollectionRequest> = new Set();
|
|
32
|
+
private proposalTxCollector: ProposalTxCollector;
|
|
24
33
|
|
|
25
34
|
constructor(
|
|
26
|
-
private
|
|
35
|
+
private p2pService: BatchTxRequesterLibP2PService,
|
|
27
36
|
private nodes: TxSource[],
|
|
28
37
|
private txCollectionSink: TxCollectionSink,
|
|
29
38
|
private config: TxCollectionConfig,
|
|
30
39
|
private dateProvider: DateProvider = new DateProvider(),
|
|
31
40
|
private log: Logger = createLogger('p2p:tx_collection_service'),
|
|
32
|
-
|
|
41
|
+
proposalTxCollector?: ProposalTxCollector,
|
|
42
|
+
) {
|
|
43
|
+
const batchTxRequesterConfig = this.config as Partial<BatchTxRequesterConfig>;
|
|
44
|
+
const proposalCollectorType = this.config.txCollectionProposalTxCollectorType;
|
|
45
|
+
this.proposalTxCollector =
|
|
46
|
+
proposalTxCollector ??
|
|
47
|
+
(proposalCollectorType === 'old'
|
|
48
|
+
? new SendBatchRequestCollector(p2pService)
|
|
49
|
+
: new BatchTxRequesterCollector(p2pService, log, dateProvider, undefined, batchTxRequesterConfig));
|
|
50
|
+
}
|
|
33
51
|
|
|
34
52
|
public async stop() {
|
|
35
53
|
this.requests.forEach(request => request.promise.reject(new AbortError(`Stopped collection service`)));
|
|
@@ -260,16 +278,22 @@ export class FastTxCollection {
|
|
|
260
278
|
try {
|
|
261
279
|
await this.txCollectionSink.collect(
|
|
262
280
|
async txHashes => {
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
281
|
+
if (request.type === 'proposal') {
|
|
282
|
+
return await this.proposalTxCollector.collectTxs(txHashes, request.blockProposal, pinnedPeer, timeoutMs);
|
|
283
|
+
} else if (request.type === 'block') {
|
|
284
|
+
const txs = await this.p2pService.reqResp.sendBatchRequest<ReqRespSubProtocol.TX>(
|
|
285
|
+
ReqRespSubProtocol.TX,
|
|
286
|
+
chunkTxHashesRequest(txHashes),
|
|
287
|
+
pinnedPeer,
|
|
288
|
+
timeoutMs,
|
|
289
|
+
maxPeers,
|
|
290
|
+
maxRetryAttempts,
|
|
291
|
+
);
|
|
292
|
+
|
|
293
|
+
return txs.flat();
|
|
294
|
+
} else {
|
|
295
|
+
throw new Error(`Unknown request type: ${(request as any).type}`);
|
|
296
|
+
}
|
|
273
297
|
},
|
|
274
298
|
Array.from(request.missingTxHashes).map(txHash => TxHash.fromString(txHash)),
|
|
275
299
|
{ description: `reqresp for slot ${slotNumber}`, method: 'fast-req-resp', ...opts, ...request.blockInfo },
|
|
@@ -316,7 +340,7 @@ export class FastTxCollection {
|
|
|
316
340
|
* Stop collecting all txs for blocks less than or requal to the block number specified.
|
|
317
341
|
* To be called when we no longer care about gathering txs up to a certain block, eg when they become proven or finalized.
|
|
318
342
|
*/
|
|
319
|
-
public stopCollectingForBlocksUpTo(blockNumber:
|
|
343
|
+
public stopCollectingForBlocksUpTo(blockNumber: BlockNumber): void {
|
|
320
344
|
for (const request of this.requests) {
|
|
321
345
|
if (request.blockInfo.blockNumber <= blockNumber) {
|
|
322
346
|
request.promise.reject(new AbortError(`Stopped collecting txs up to block ${blockNumber}`));
|
|
@@ -329,7 +353,7 @@ export class FastTxCollection {
|
|
|
329
353
|
* Stop collecting all txs for blocks greater than the block number specified.
|
|
330
354
|
* To be called when there is a chain prune and previously mined txs are no longer relevant.
|
|
331
355
|
*/
|
|
332
|
-
public stopCollectingForBlocksAfter(blockNumber:
|
|
356
|
+
public stopCollectingForBlocksAfter(blockNumber: BlockNumber): void {
|
|
333
357
|
for (const request of this.requests) {
|
|
334
358
|
if (request.blockInfo.blockNumber > blockNumber) {
|
|
335
359
|
request.promise.reject(new AbortError(`Stopped collecting txs after block ${blockNumber}`));
|
|
@@ -1,2 +1,7 @@
|
|
|
1
1
|
export { TxCollection, type FastCollectionRequestInput } from './tx_collection.js';
|
|
2
2
|
export { type TxSource, createNodeRpcTxSources, NodeRpcTxSource } from './tx_source.js';
|
|
3
|
+
export {
|
|
4
|
+
type ProposalTxCollector,
|
|
5
|
+
BatchTxRequesterCollector,
|
|
6
|
+
SendBatchRequestCollector,
|
|
7
|
+
} from './proposal_tx_collector.js';
|
|
@@ -4,7 +4,7 @@ import {
|
|
|
4
4
|
Metrics,
|
|
5
5
|
type TelemetryClient,
|
|
6
6
|
type UpDownCounter,
|
|
7
|
-
|
|
7
|
+
createUpDownCounterWithDefault,
|
|
8
8
|
} from '@aztec/telemetry-client';
|
|
9
9
|
|
|
10
10
|
import type { CollectionMethod } from './tx_collection.js';
|
|
@@ -17,21 +17,13 @@ export class TxCollectionInstrumentation {
|
|
|
17
17
|
constructor(client: TelemetryClient, name: string) {
|
|
18
18
|
const meter = client.getMeter(name);
|
|
19
19
|
|
|
20
|
-
this.txsCollected = meter
|
|
21
|
-
|
|
20
|
+
this.txsCollected = createUpDownCounterWithDefault(meter, Metrics.TX_COLLECTOR_COUNT, {
|
|
21
|
+
[Attributes.TX_COLLECTION_METHOD]: ['fast-req-resp', 'fast-node-rpc', 'slow-req-resp', 'slow-node-rpc'],
|
|
22
22
|
});
|
|
23
23
|
|
|
24
|
-
this.collectionDurationPerTx = meter.createHistogram(Metrics.TX_COLLECTOR_DURATION_PER_TX
|
|
25
|
-
unit: 'ms',
|
|
26
|
-
description: 'Average duration per tx of an individual tx collection request',
|
|
27
|
-
valueType: ValueType.INT,
|
|
28
|
-
});
|
|
24
|
+
this.collectionDurationPerTx = meter.createHistogram(Metrics.TX_COLLECTOR_DURATION_PER_TX);
|
|
29
25
|
|
|
30
|
-
this.collectionDurationPerRequest = meter.createHistogram(Metrics.TX_COLLECTOR_DURATION_PER_REQUEST
|
|
31
|
-
unit: 'ms',
|
|
32
|
-
description: 'Total duration of an individual tx collection request',
|
|
33
|
-
valueType: ValueType.INT,
|
|
34
|
-
});
|
|
26
|
+
this.collectionDurationPerRequest = meter.createHistogram(Metrics.TX_COLLECTOR_DURATION_PER_REQUEST);
|
|
35
27
|
}
|
|
36
28
|
|
|
37
29
|
increaseTxsFor(what: CollectionMethod, count: number, duration: number) {
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
import type { Logger } from '@aztec/foundation/log';
|
|
2
|
+
import type { DateProvider } from '@aztec/foundation/timer';
|
|
3
|
+
import type { BlockProposal } from '@aztec/stdlib/p2p';
|
|
4
|
+
import type { Tx, TxHash } from '@aztec/stdlib/tx';
|
|
5
|
+
|
|
6
|
+
import type { PeerId } from '@libp2p/interface';
|
|
7
|
+
|
|
8
|
+
import { BatchTxRequester } from '../reqresp/batch-tx-requester/batch_tx_requester.js';
|
|
9
|
+
import type { BatchTxRequesterConfig } from '../reqresp/batch-tx-requester/config.js';
|
|
10
|
+
import type { BatchTxRequesterLibP2PService } from '../reqresp/batch-tx-requester/interface.js';
|
|
11
|
+
import type { IBatchRequestTxValidator } from '../reqresp/batch-tx-requester/tx_validator.js';
|
|
12
|
+
import { ReqRespSubProtocol } from '../reqresp/interface.js';
|
|
13
|
+
import { chunkTxHashesRequest } from '../reqresp/protocols/tx.js';
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Strategy interface for collecting transactions for block proposals.
|
|
17
|
+
* Allows swapping between different tx collection implementations for benchmarking.
|
|
18
|
+
*/
|
|
19
|
+
export interface ProposalTxCollector {
|
|
20
|
+
/**
|
|
21
|
+
* Collect transactions for a block proposal.
|
|
22
|
+
* @param txHashes - The transaction hashes to collect
|
|
23
|
+
* @param blockProposal - The block proposal containing the transactions
|
|
24
|
+
* @param pinnedPeer - Optional peer that sent the proposal (expected to have all txs)
|
|
25
|
+
* @param timeoutMs - Timeout in milliseconds
|
|
26
|
+
* @returns The collected transactions
|
|
27
|
+
*/
|
|
28
|
+
collectTxs(
|
|
29
|
+
txHashes: TxHash[],
|
|
30
|
+
blockProposal: BlockProposal,
|
|
31
|
+
pinnedPeer: PeerId | undefined,
|
|
32
|
+
timeoutMs: number,
|
|
33
|
+
): Promise<Tx[]>;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* Collects transactions using the BatchTxRequester implementation.
|
|
38
|
+
* This uses a smart/dumb peer strategy with parallel workers.
|
|
39
|
+
*/
|
|
40
|
+
export class BatchTxRequesterCollector implements ProposalTxCollector {
|
|
41
|
+
constructor(
|
|
42
|
+
private p2pService: BatchTxRequesterLibP2PService,
|
|
43
|
+
private log: Logger,
|
|
44
|
+
private dateProvider: DateProvider,
|
|
45
|
+
private txValidator?: IBatchRequestTxValidator,
|
|
46
|
+
private batchTxRequesterConfig?: Partial<BatchTxRequesterConfig>,
|
|
47
|
+
) {}
|
|
48
|
+
|
|
49
|
+
async collectTxs(
|
|
50
|
+
txHashes: TxHash[],
|
|
51
|
+
blockProposal: BlockProposal,
|
|
52
|
+
pinnedPeer: PeerId | undefined,
|
|
53
|
+
timeoutMs: number,
|
|
54
|
+
): Promise<Tx[]> {
|
|
55
|
+
const {
|
|
56
|
+
batchTxRequesterSmartParallelWorkerCount: smartParallelWorkerCount,
|
|
57
|
+
batchTxRequesterDumbParallelWorkerCount: dumbParallelWorkerCount,
|
|
58
|
+
batchTxRequesterTxBatchSize: txBatchSize,
|
|
59
|
+
batchTxRequesterBadPeerThreshold: badPeerThreshold,
|
|
60
|
+
} = this.batchTxRequesterConfig ?? {};
|
|
61
|
+
|
|
62
|
+
const batchRequester = new BatchTxRequester(
|
|
63
|
+
txHashes,
|
|
64
|
+
blockProposal,
|
|
65
|
+
pinnedPeer,
|
|
66
|
+
timeoutMs,
|
|
67
|
+
this.p2pService,
|
|
68
|
+
this.log,
|
|
69
|
+
this.dateProvider,
|
|
70
|
+
{
|
|
71
|
+
smartParallelWorkerCount,
|
|
72
|
+
dumbParallelWorkerCount,
|
|
73
|
+
txBatchSize,
|
|
74
|
+
badPeerThreshold,
|
|
75
|
+
txValidator: this.txValidator,
|
|
76
|
+
},
|
|
77
|
+
);
|
|
78
|
+
|
|
79
|
+
return await BatchTxRequester.collectAllTxs(batchRequester.run());
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
const DEFAULT_MAX_PEERS = 10;
|
|
84
|
+
const DEFAULT_MAX_RETRY_ATTEMPTS = 3;
|
|
85
|
+
|
|
86
|
+
/**
|
|
87
|
+
* Collects transactions using the sendBatchRequest implementation from ReqResp.
|
|
88
|
+
* This is the original implementation that balances requests across peers.
|
|
89
|
+
*/
|
|
90
|
+
export class SendBatchRequestCollector implements ProposalTxCollector {
|
|
91
|
+
constructor(
|
|
92
|
+
private p2pService: BatchTxRequesterLibP2PService,
|
|
93
|
+
private maxPeers: number = DEFAULT_MAX_PEERS,
|
|
94
|
+
private maxRetryAttempts: number = DEFAULT_MAX_RETRY_ATTEMPTS,
|
|
95
|
+
) {}
|
|
96
|
+
|
|
97
|
+
async collectTxs(
|
|
98
|
+
txHashes: TxHash[],
|
|
99
|
+
_blockProposal: BlockProposal,
|
|
100
|
+
pinnedPeer: PeerId | undefined,
|
|
101
|
+
timeoutMs: number,
|
|
102
|
+
): Promise<Tx[]> {
|
|
103
|
+
const txs = await this.p2pService.reqResp.sendBatchRequest<ReqRespSubProtocol.TX>(
|
|
104
|
+
ReqRespSubProtocol.TX,
|
|
105
|
+
chunkTxHashesRequest(txHashes),
|
|
106
|
+
pinnedPeer,
|
|
107
|
+
timeoutMs,
|
|
108
|
+
this.maxPeers,
|
|
109
|
+
this.maxRetryAttempts,
|
|
110
|
+
);
|
|
111
|
+
|
|
112
|
+
return txs.flat();
|
|
113
|
+
}
|
|
114
|
+
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { BlockNumber, EpochNumber, SlotNumber } from '@aztec/foundation/branded-types';
|
|
1
2
|
import { chunk } from '@aztec/foundation/collection';
|
|
2
3
|
import { type Logger, createLogger } from '@aztec/foundation/log';
|
|
3
4
|
import { boundInclusive } from '@aztec/foundation/number';
|
|
@@ -202,7 +203,7 @@ export class SlowTxCollection {
|
|
|
202
203
|
* Stop collecting all txs for blocks less than or requal to the block number specified.
|
|
203
204
|
* To be called when we no longer care about gathering txs up to a certain block, eg when they become proven or finalized.
|
|
204
205
|
*/
|
|
205
|
-
public stopCollectingForBlocksUpTo(blockNumber:
|
|
206
|
+
public stopCollectingForBlocksUpTo(blockNumber: BlockNumber): void {
|
|
206
207
|
for (const [txHash, info] of this.missingTxs.entries()) {
|
|
207
208
|
if (info.blockNumber <= blockNumber) {
|
|
208
209
|
this.missingTxs.delete(txHash);
|
|
@@ -214,7 +215,7 @@ export class SlowTxCollection {
|
|
|
214
215
|
* Stop collecting all txs for blocks greater than the block number specified.
|
|
215
216
|
* To be called when there is a chain prune and previously mined txs are no longer relevant.
|
|
216
217
|
*/
|
|
217
|
-
public stopCollectingForBlocksAfter(blockNumber:
|
|
218
|
+
public stopCollectingForBlocksAfter(blockNumber: BlockNumber): void {
|
|
218
219
|
for (const [txHash, info] of this.missingTxs.entries()) {
|
|
219
220
|
if (info.blockNumber > blockNumber) {
|
|
220
221
|
this.missingTxs.delete(txHash);
|
|
@@ -223,9 +224,9 @@ export class SlowTxCollection {
|
|
|
223
224
|
}
|
|
224
225
|
|
|
225
226
|
/** Computes the proof submission deadline for a given slot, a tx mined in this slot is no longer interesting after this deadline */
|
|
226
|
-
private getDeadlineForSlot(slotNumber:
|
|
227
|
+
private getDeadlineForSlot(slotNumber: SlotNumber): Date {
|
|
227
228
|
const epoch = getEpochAtSlot(slotNumber, this.constants);
|
|
228
|
-
const submissionEndEpoch = epoch +
|
|
229
|
+
const submissionEndEpoch = EpochNumber(epoch + this.constants.proofSubmissionEpochs);
|
|
229
230
|
const submissionEndTimestamp = getTimestampRangeForEpoch(submissionEndEpoch, this.constants)[1];
|
|
230
231
|
return new Date(Number(submissionEndTimestamp) * 1000);
|
|
231
232
|
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { BlockNumber } from '@aztec/foundation/branded-types';
|
|
1
2
|
import { compactArray } from '@aztec/foundation/collection';
|
|
2
3
|
import { type Logger, createLogger } from '@aztec/foundation/log';
|
|
3
4
|
import { type PromiseWithResolvers, RunningPromise } from '@aztec/foundation/promise';
|
|
@@ -12,7 +13,7 @@ import type { PeerId } from '@libp2p/interface';
|
|
|
12
13
|
|
|
13
14
|
import type { TxPool } from '../../mem_pools/index.js';
|
|
14
15
|
import type { TxPoolEvents } from '../../mem_pools/tx_pool/tx_pool.js';
|
|
15
|
-
import type {
|
|
16
|
+
import type { BatchTxRequesterLibP2PService } from '../reqresp/batch-tx-requester/interface.js';
|
|
16
17
|
import type { TxCollectionConfig } from './config.js';
|
|
17
18
|
import { FastTxCollection } from './fast_tx_collection.js';
|
|
18
19
|
import { SlowTxCollection } from './slow_tx_collection.js';
|
|
@@ -21,11 +22,11 @@ import type { TxSource } from './tx_source.js';
|
|
|
21
22
|
|
|
22
23
|
export type CollectionMethod = 'fast-req-resp' | 'fast-node-rpc' | 'slow-req-resp' | 'slow-node-rpc';
|
|
23
24
|
|
|
24
|
-
export type MissingTxInfo = { blockNumber:
|
|
25
|
+
export type MissingTxInfo = { blockNumber: BlockNumber; deadline: Date; readyForReqResp: boolean };
|
|
25
26
|
|
|
26
27
|
export type FastCollectionRequestInput =
|
|
27
28
|
| { type: 'block'; block: L2Block }
|
|
28
|
-
| { type: 'proposal'; blockProposal: BlockProposal; blockNumber:
|
|
29
|
+
| { type: 'proposal'; blockProposal: BlockProposal; blockNumber: BlockNumber };
|
|
29
30
|
|
|
30
31
|
export type FastCollectionRequest = FastCollectionRequestInput & {
|
|
31
32
|
missingTxHashes: Set<string>;
|
|
@@ -66,7 +67,7 @@ export class TxCollection {
|
|
|
66
67
|
protected readonly handleTxsFound: TxPoolEvents['txs-added'];
|
|
67
68
|
|
|
68
69
|
constructor(
|
|
69
|
-
private readonly
|
|
70
|
+
private readonly p2pService: BatchTxRequesterLibP2PService,
|
|
70
71
|
private readonly nodes: TxSource[],
|
|
71
72
|
private readonly constants: L1RollupConstants,
|
|
72
73
|
private readonly txPool: TxPool,
|
|
@@ -78,7 +79,7 @@ export class TxCollection {
|
|
|
78
79
|
this.txCollectionSink = new TxCollectionSink(this.txPool, telemetryClient, this.log);
|
|
79
80
|
|
|
80
81
|
this.fastCollection = new FastTxCollection(
|
|
81
|
-
this.
|
|
82
|
+
this.p2pService,
|
|
82
83
|
this.nodes,
|
|
83
84
|
this.txCollectionSink,
|
|
84
85
|
this.config,
|
|
@@ -87,7 +88,7 @@ export class TxCollection {
|
|
|
87
88
|
);
|
|
88
89
|
|
|
89
90
|
this.slowCollection = new SlowTxCollection(
|
|
90
|
-
this.reqResp,
|
|
91
|
+
this.p2pService.reqResp,
|
|
91
92
|
this.nodes,
|
|
92
93
|
this.txCollectionSink,
|
|
93
94
|
this.fastCollection,
|
|
@@ -152,7 +153,7 @@ export class TxCollection {
|
|
|
152
153
|
/** Collects the set of txs for the given block proposal as fast as possible */
|
|
153
154
|
public collectFastForProposal(
|
|
154
155
|
blockProposal: BlockProposal,
|
|
155
|
-
blockNumber:
|
|
156
|
+
blockNumber: BlockNumber,
|
|
156
157
|
txHashes: TxHash[] | string[],
|
|
157
158
|
opts: { deadline: Date; pinnedPeer?: PeerId },
|
|
158
159
|
) {
|
|
@@ -187,7 +188,7 @@ export class TxCollection {
|
|
|
187
188
|
* Stop collecting all txs for blocks less than or requal to the block number specified.
|
|
188
189
|
* To be called when we no longer care about gathering txs up to a certain block, eg when they become proven or finalized.
|
|
189
190
|
*/
|
|
190
|
-
public stopCollectingForBlocksUpTo(blockNumber:
|
|
191
|
+
public stopCollectingForBlocksUpTo(blockNumber: BlockNumber): void {
|
|
191
192
|
this.slowCollection.stopCollectingForBlocksUpTo(blockNumber);
|
|
192
193
|
this.fastCollection.stopCollectingForBlocksUpTo(blockNumber);
|
|
193
194
|
}
|
|
@@ -196,7 +197,7 @@ export class TxCollection {
|
|
|
196
197
|
* Stop collecting all txs for blocks greater than the block number specified.
|
|
197
198
|
* To be called when there is a chain prune and previously mined txs are no longer relevant.
|
|
198
199
|
*/
|
|
199
|
-
public stopCollectingForBlocksAfter(blockNumber:
|
|
200
|
+
public stopCollectingForBlocksAfter(blockNumber: BlockNumber): void {
|
|
200
201
|
this.slowCollection.stopCollectingForBlocksAfter(blockNumber);
|
|
201
202
|
this.fastCollection.stopCollectingForBlocksAfter(blockNumber);
|
|
202
203
|
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { BlockNumber } from '@aztec/foundation/branded-types';
|
|
1
2
|
import { compactArray } from '@aztec/foundation/collection';
|
|
2
3
|
import { type Logger, createLogger } from '@aztec/foundation/log';
|
|
3
4
|
import { elapsed } from '@aztec/foundation/timer';
|
|
@@ -55,7 +56,7 @@ export class TxProvider implements ITxProvider {
|
|
|
55
56
|
/** Gathers txs from the tx pool, proposal body, remote rpc nodes, and reqresp. */
|
|
56
57
|
public getTxsForBlockProposal(
|
|
57
58
|
blockProposal: BlockProposal,
|
|
58
|
-
blockNumber:
|
|
59
|
+
blockNumber: BlockNumber,
|
|
59
60
|
opts: { pinnedPeer: PeerId | undefined; deadline: Date },
|
|
60
61
|
): Promise<{ txs: Tx[]; missingTxs: TxHash[] }> {
|
|
61
62
|
return this.getOrderedTxsFromAllSources(
|
|
@@ -136,6 +137,7 @@ export class TxProvider implements ITxProvider {
|
|
|
136
137
|
);
|
|
137
138
|
|
|
138
139
|
if (missingTxHashes.size === 0) {
|
|
140
|
+
this.instrumentation.incTxsFromP2P(0, txHashes.length);
|
|
139
141
|
return { txsFromMempool };
|
|
140
142
|
}
|
|
141
143
|
|
|
@@ -154,24 +156,26 @@ export class TxProvider implements ITxProvider {
|
|
|
154
156
|
|
|
155
157
|
if (missingTxHashes.size === 0) {
|
|
156
158
|
await this.processProposalTxs(txsFromProposal);
|
|
159
|
+
this.instrumentation.incTxsFromP2P(0, txHashes.length);
|
|
157
160
|
return { txsFromMempool, txsFromProposal };
|
|
158
161
|
}
|
|
159
162
|
|
|
160
163
|
// Start tx collection from the network if needed, while we validate the txs taken from the proposal in parallel
|
|
161
164
|
const [txsFromNetwork] = await Promise.all([
|
|
162
|
-
this.
|
|
165
|
+
this.collectFromP2P(request, [...missingTxHashes], opts),
|
|
163
166
|
this.processProposalTxs(txsFromProposal),
|
|
164
167
|
] as const);
|
|
165
168
|
|
|
166
169
|
if (txsFromNetwork.length > 0) {
|
|
167
170
|
txsFromNetwork.forEach(tx => missingTxHashes.delete(tx.txHash.toString()));
|
|
168
|
-
this.instrumentation.incTxsFromP2P(txsFromNetwork.length);
|
|
169
171
|
this.log.debug(
|
|
170
172
|
`Retrieved ${txsFromNetwork.length} txs from network for block proposal (${missingTxHashes.size} pending)`,
|
|
171
173
|
{ ...blockInfo, missingTxHashes: [...missingTxHashes] },
|
|
172
174
|
);
|
|
173
175
|
}
|
|
174
176
|
|
|
177
|
+
this.instrumentation.incTxsFromP2P(txsFromNetwork.length, txHashes.length);
|
|
178
|
+
|
|
175
179
|
if (missingTxHashes.size === 0) {
|
|
176
180
|
return { txsFromNetwork, txsFromMempool, txsFromProposal };
|
|
177
181
|
}
|
|
@@ -199,6 +203,18 @@ export class TxProvider implements ITxProvider {
|
|
|
199
203
|
};
|
|
200
204
|
}
|
|
201
205
|
|
|
206
|
+
private async collectFromP2P(
|
|
207
|
+
input: FastCollectionRequestInput,
|
|
208
|
+
txHashes: TxHash[] | string[],
|
|
209
|
+
opts: { deadline: Date; pinnedPeer?: PeerId },
|
|
210
|
+
): Promise<Tx[]> {
|
|
211
|
+
const requestedAt = Date.now();
|
|
212
|
+
const result = await this.txCollection.collectFastFor(input, txHashes, opts);
|
|
213
|
+
const requestProcessedAt = Date.now();
|
|
214
|
+
this.instrumentation.recordTxsRequestDelay(requestProcessedAt - requestedAt);
|
|
215
|
+
return result;
|
|
216
|
+
}
|
|
217
|
+
|
|
202
218
|
private extractFromProposal(proposal: BlockProposal | undefined, missingTxHashes: string[]): Tx[] {
|
|
203
219
|
if (!proposal) {
|
|
204
220
|
return [];
|
|
@@ -1,4 +1,10 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {
|
|
2
|
+
type Histogram,
|
|
3
|
+
Metrics,
|
|
4
|
+
type TelemetryClient,
|
|
5
|
+
type UpDownCounter,
|
|
6
|
+
createUpDownCounterWithDefault,
|
|
7
|
+
} from '@aztec/telemetry-client';
|
|
2
8
|
|
|
3
9
|
export class TxProviderInstrumentation {
|
|
4
10
|
private txFromProposalCount: UpDownCounter;
|
|
@@ -6,24 +12,23 @@ export class TxProviderInstrumentation {
|
|
|
6
12
|
private txFromP2PCount: UpDownCounter;
|
|
7
13
|
private missingTxsCount: UpDownCounter;
|
|
8
14
|
|
|
15
|
+
private fractionOfTxsRequestedFromP2P: Histogram;
|
|
16
|
+
private txsRequestDelay: Histogram;
|
|
17
|
+
|
|
9
18
|
constructor(client: TelemetryClient, name: string) {
|
|
10
19
|
const meter = client.getMeter(name);
|
|
11
20
|
|
|
12
|
-
this.txFromProposalCount = meter
|
|
13
|
-
|
|
14
|
-
|
|
21
|
+
this.txFromProposalCount = createUpDownCounterWithDefault(meter, Metrics.TX_PROVIDER_TXS_FROM_PROPOSALS_COUNT);
|
|
22
|
+
|
|
23
|
+
this.txFromMempoolCount = createUpDownCounterWithDefault(meter, Metrics.TX_PROVIDER_TXS_FROM_MEMPOOL_COUNT);
|
|
24
|
+
|
|
25
|
+
this.txFromP2PCount = createUpDownCounterWithDefault(meter, Metrics.TX_PROVIDER_TXS_FROM_P2P_COUNT);
|
|
15
26
|
|
|
16
|
-
this.
|
|
17
|
-
description: 'The number of txs taken from the local mempool',
|
|
18
|
-
});
|
|
27
|
+
this.missingTxsCount = createUpDownCounterWithDefault(meter, Metrics.TX_PROVIDER_MISSING_TXS_COUNT);
|
|
19
28
|
|
|
20
|
-
this.
|
|
21
|
-
description: 'The number of txs taken from the p2p network',
|
|
22
|
-
});
|
|
29
|
+
this.fractionOfTxsRequestedFromP2P = meter.createHistogram(Metrics.TX_PROVIDER_P2P_TXS_REQUESTED_FRACTION);
|
|
23
30
|
|
|
24
|
-
this.
|
|
25
|
-
description: 'The number of txs not found anywhere',
|
|
26
|
-
});
|
|
31
|
+
this.txsRequestDelay = meter.createHistogram(Metrics.TX_PROVIDER_P2P_TXS_REQUEST_DELAY);
|
|
27
32
|
}
|
|
28
33
|
|
|
29
34
|
incTxsFromProposals(count: number) {
|
|
@@ -34,8 +39,13 @@ export class TxProviderInstrumentation {
|
|
|
34
39
|
this.txFromMempoolCount.add(count);
|
|
35
40
|
}
|
|
36
41
|
|
|
37
|
-
incTxsFromP2P(count: number) {
|
|
42
|
+
incTxsFromP2P(count: number, total: number) {
|
|
38
43
|
this.txFromP2PCount.add(count);
|
|
44
|
+
this.fractionOfTxsRequestedFromP2P.record(count / total);
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
recordTxsRequestDelay(delay: number) {
|
|
48
|
+
this.txsRequestDelay.record(delay);
|
|
39
49
|
}
|
|
40
50
|
|
|
41
51
|
incMissingTxs(count: number) {
|
|
@@ -39,7 +39,7 @@ export function getMockPubSubP2PServiceFactory<T extends P2PClientType>(
|
|
|
39
39
|
peerId: PeerId,
|
|
40
40
|
deps: {
|
|
41
41
|
packageVersion: string;
|
|
42
|
-
mempools: MemPools
|
|
42
|
+
mempools: MemPools;
|
|
43
43
|
l2BlockSource: L2BlockSource & ContractDataSource;
|
|
44
44
|
epochCache: EpochCacheInterface;
|
|
45
45
|
proofVerifier: ClientProtocolCircuitVerifier;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Fr } from '@aztec/foundation/
|
|
1
|
+
import { Fr } from '@aztec/foundation/curves/bn254';
|
|
2
2
|
import { getVKTreeRoot } from '@aztec/noir-protocol-circuits-types/vk-tree';
|
|
3
3
|
import { protocolContractsHash } from '@aztec/protocol-contracts';
|
|
4
4
|
import { mockTx } from '@aztec/stdlib/testing';
|
|
@@ -112,7 +112,7 @@ export async function createTestLibP2PService<T extends P2PClientType>(
|
|
|
112
112
|
archiver: L2BlockSource & ContractDataSource,
|
|
113
113
|
worldStateSynchronizer: WorldStateSynchronizer,
|
|
114
114
|
epochCache: EpochCache,
|
|
115
|
-
mempools: MemPools
|
|
115
|
+
mempools: MemPools,
|
|
116
116
|
telemetry: TelemetryClient,
|
|
117
117
|
port: number = 0,
|
|
118
118
|
peerId?: PeerId,
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import type { BlockNumber } from '@aztec/foundation/branded-types';
|
|
2
|
+
import type { L2Block } from '@aztec/stdlib/block';
|
|
3
|
+
import type { ITxProvider } from '@aztec/stdlib/interfaces/server';
|
|
4
|
+
import type { BlockProposal } from '@aztec/stdlib/p2p';
|
|
5
|
+
import { type Tx, TxHash } from '@aztec/stdlib/tx';
|
|
6
|
+
|
|
7
|
+
import type { PeerId } from '@libp2p/interface';
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Test transaction provider that can be seeded with transactions.
|
|
11
|
+
* Returns seeded txs when requested by hash, useful for testing block
|
|
12
|
+
* proposal handling without requiring a full P2P network.
|
|
13
|
+
*/
|
|
14
|
+
export class TestTxProvider implements ITxProvider {
|
|
15
|
+
private txs: Map<string, Tx> = new Map();
|
|
16
|
+
|
|
17
|
+
/** Seed transactions that will be returned when requested. */
|
|
18
|
+
seed(txs: Tx[]) {
|
|
19
|
+
for (const tx of txs) {
|
|
20
|
+
this.txs.set(tx.getTxHash().toString(), tx);
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
/** Clear all seeded transactions. */
|
|
25
|
+
clear() {
|
|
26
|
+
this.txs.clear();
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
/** Returns txs from the seeded collection given their hashes. */
|
|
30
|
+
getAvailableTxs(txHashes: TxHash[]): Promise<{ txs: Tx[]; missingTxs: TxHash[] }> {
|
|
31
|
+
return this.getTxsByHashes(txHashes);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
/** Get txs for a block proposal, returning any seeded txs that match the requested hashes. */
|
|
35
|
+
getTxsForBlockProposal(
|
|
36
|
+
blockProposal: BlockProposal,
|
|
37
|
+
_blockNumber: BlockNumber,
|
|
38
|
+
_opts: { pinnedPeer: PeerId | undefined; deadline: Date },
|
|
39
|
+
): Promise<{ txs: Tx[]; missingTxs: TxHash[] }> {
|
|
40
|
+
return this.getTxsByHashes(blockProposal.txHashes);
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
/** Get txs for a block, returning any seeded txs that match the tx effects in the block. */
|
|
44
|
+
getTxsForBlock(block: L2Block, _opts: { deadline: Date }): Promise<{ txs: Tx[]; missingTxs: TxHash[] }> {
|
|
45
|
+
const txHashes = block.body.txEffects.map(txEffect => txEffect.txHash);
|
|
46
|
+
return this.getTxsByHashes(txHashes);
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
private getTxsByHashes(txHashes: TxHash[]): Promise<{ txs: Tx[]; missingTxs: TxHash[] }> {
|
|
50
|
+
const txs: Tx[] = [];
|
|
51
|
+
const missingTxs: TxHash[] = [];
|
|
52
|
+
|
|
53
|
+
for (const txHash of txHashes) {
|
|
54
|
+
const tx = this.txs.get(txHash.toString());
|
|
55
|
+
if (tx) {
|
|
56
|
+
txs.push(tx);
|
|
57
|
+
} else {
|
|
58
|
+
missingTxs.push(txHash);
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
return Promise.resolve({ txs, missingTxs });
|
|
63
|
+
}
|
|
64
|
+
}
|