@aztec/p2p 0.0.1-commit.e61ad554 → 0.0.1-commit.ec5f612
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 +10 -10
- package/dest/client/factory.d.ts.map +1 -1
- package/dest/client/factory.js +45 -18
- package/dest/client/interface.d.ts +46 -33
- package/dest/client/interface.d.ts.map +1 -1
- package/dest/client/p2p_client.d.ts +41 -51
- package/dest/client/p2p_client.d.ts.map +1 -1
- package/dest/client/p2p_client.js +156 -200
- 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 +304 -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 +35 -7
- package/dest/config.d.ts.map +1 -1
- package/dest/config.js +21 -7
- package/dest/errors/tx-pool.error.d.ts +8 -0
- package/dest/errors/tx-pool.error.d.ts.map +1 -0
- package/dest/errors/tx-pool.error.js +9 -0
- package/dest/index.d.ts +2 -1
- package/dest/index.d.ts.map +1 -1
- package/dest/index.js +1 -0
- package/dest/mem_pools/attestation_pool/attestation_pool.d.ts +104 -88
- package/dest/mem_pools/attestation_pool/attestation_pool.d.ts.map +1 -1
- package/dest/mem_pools/attestation_pool/attestation_pool.js +441 -3
- package/dest/mem_pools/attestation_pool/attestation_pool_test_suite.d.ts +2 -2
- package/dest/mem_pools/attestation_pool/attestation_pool_test_suite.d.ts.map +1 -1
- package/dest/mem_pools/attestation_pool/attestation_pool_test_suite.js +353 -87
- package/dest/mem_pools/attestation_pool/index.d.ts +2 -3
- package/dest/mem_pools/attestation_pool/index.d.ts.map +1 -1
- package/dest/mem_pools/attestation_pool/index.js +1 -2
- package/dest/mem_pools/attestation_pool/mocks.d.ts +2 -2
- package/dest/mem_pools/attestation_pool/mocks.d.ts.map +1 -1
- package/dest/mem_pools/attestation_pool/mocks.js +2 -2
- package/dest/mem_pools/index.d.ts +3 -2
- package/dest/mem_pools/index.d.ts.map +1 -1
- package/dest/mem_pools/index.js +1 -1
- package/dest/mem_pools/instrumentation.d.ts +1 -1
- package/dest/mem_pools/instrumentation.d.ts.map +1 -1
- package/dest/mem_pools/instrumentation.js +2 -2
- package/dest/mem_pools/interface.d.ts +5 -5
- package/dest/mem_pools/interface.d.ts.map +1 -1
- package/dest/mem_pools/tx_pool/eviction/invalid_txs_after_mining_rule.js +3 -3
- package/dest/mem_pools/tx_pool_v2/archive/index.d.ts +2 -0
- package/dest/mem_pools/tx_pool_v2/archive/index.d.ts.map +1 -0
- package/dest/mem_pools/tx_pool_v2/archive/index.js +1 -0
- package/dest/mem_pools/tx_pool_v2/archive/tx_archive.d.ts +43 -0
- package/dest/mem_pools/tx_pool_v2/archive/tx_archive.d.ts.map +1 -0
- package/dest/mem_pools/tx_pool_v2/archive/tx_archive.js +103 -0
- package/dest/mem_pools/tx_pool_v2/deleted_pool.d.ts +104 -0
- package/dest/mem_pools/tx_pool_v2/deleted_pool.d.ts.map +1 -0
- package/dest/mem_pools/tx_pool_v2/deleted_pool.js +251 -0
- package/dest/mem_pools/tx_pool_v2/eviction/eviction_manager.d.ts +47 -0
- package/dest/mem_pools/tx_pool_v2/eviction/eviction_manager.d.ts.map +1 -0
- package/dest/mem_pools/tx_pool_v2/eviction/eviction_manager.js +128 -0
- package/dest/mem_pools/tx_pool_v2/eviction/fee_payer_balance_eviction_rule.d.ts +17 -0
- package/dest/mem_pools/tx_pool_v2/eviction/fee_payer_balance_eviction_rule.d.ts.map +1 -0
- package/dest/mem_pools/tx_pool_v2/eviction/fee_payer_balance_eviction_rule.js +93 -0
- package/dest/mem_pools/tx_pool_v2/eviction/fee_payer_balance_pre_add_rule.d.ts +19 -0
- package/dest/mem_pools/tx_pool_v2/eviction/fee_payer_balance_pre_add_rule.d.ts.map +1 -0
- package/dest/mem_pools/tx_pool_v2/eviction/fee_payer_balance_pre_add_rule.js +97 -0
- package/dest/mem_pools/tx_pool_v2/eviction/index.d.ts +10 -0
- package/dest/mem_pools/tx_pool_v2/eviction/index.d.ts.map +1 -0
- package/dest/mem_pools/tx_pool_v2/eviction/index.js +11 -0
- package/dest/mem_pools/tx_pool_v2/eviction/interfaces.d.ts +174 -0
- package/dest/mem_pools/tx_pool_v2/eviction/interfaces.d.ts.map +1 -0
- package/dest/mem_pools/tx_pool_v2/eviction/interfaces.js +25 -0
- package/dest/mem_pools/tx_pool_v2/eviction/invalid_txs_after_mining_rule.d.ts +15 -0
- package/dest/mem_pools/tx_pool_v2/eviction/invalid_txs_after_mining_rule.d.ts.map +1 -0
- package/dest/mem_pools/tx_pool_v2/eviction/invalid_txs_after_mining_rule.js +65 -0
- package/dest/mem_pools/tx_pool_v2/eviction/invalid_txs_after_reorg_rule.d.ts +17 -0
- package/dest/mem_pools/tx_pool_v2/eviction/invalid_txs_after_reorg_rule.d.ts.map +1 -0
- package/dest/mem_pools/tx_pool_v2/eviction/invalid_txs_after_reorg_rule.js +93 -0
- package/dest/mem_pools/tx_pool_v2/eviction/low_priority_eviction_rule.d.ts +16 -0
- package/dest/mem_pools/tx_pool_v2/eviction/low_priority_eviction_rule.d.ts.map +1 -0
- package/dest/mem_pools/tx_pool_v2/eviction/low_priority_eviction_rule.js +78 -0
- package/dest/mem_pools/tx_pool_v2/eviction/low_priority_pre_add_rule.d.ts +20 -0
- package/dest/mem_pools/tx_pool_v2/eviction/low_priority_pre_add_rule.d.ts.map +1 -0
- package/dest/mem_pools/tx_pool_v2/eviction/low_priority_pre_add_rule.js +73 -0
- package/dest/mem_pools/tx_pool_v2/eviction/nullifier_conflict_rule.d.ts +15 -0
- package/dest/mem_pools/tx_pool_v2/eviction/nullifier_conflict_rule.d.ts.map +1 -0
- package/dest/mem_pools/tx_pool_v2/eviction/nullifier_conflict_rule.js +19 -0
- package/dest/mem_pools/tx_pool_v2/index.d.ts +6 -0
- package/dest/mem_pools/tx_pool_v2/index.d.ts.map +1 -0
- package/dest/mem_pools/tx_pool_v2/index.js +5 -0
- package/dest/mem_pools/tx_pool_v2/instrumentation.d.ts +15 -0
- package/dest/mem_pools/tx_pool_v2/instrumentation.d.ts.map +1 -0
- package/dest/mem_pools/tx_pool_v2/instrumentation.js +43 -0
- package/dest/mem_pools/tx_pool_v2/interfaces.d.ts +211 -0
- package/dest/mem_pools/tx_pool_v2/interfaces.d.ts.map +1 -0
- package/dest/mem_pools/tx_pool_v2/interfaces.js +9 -0
- package/dest/mem_pools/tx_pool_v2/tx_metadata.d.ts +119 -0
- package/dest/mem_pools/tx_pool_v2/tx_metadata.d.ts.map +1 -0
- package/dest/mem_pools/tx_pool_v2/tx_metadata.js +193 -0
- package/dest/mem_pools/tx_pool_v2/tx_pool_bench_metrics.d.ts +26 -0
- package/dest/mem_pools/tx_pool_v2/tx_pool_bench_metrics.d.ts.map +1 -0
- package/dest/mem_pools/tx_pool_v2/tx_pool_bench_metrics.js +70 -0
- package/dest/mem_pools/tx_pool_v2/tx_pool_indices.d.ts +108 -0
- package/dest/mem_pools/tx_pool_v2/tx_pool_indices.d.ts.map +1 -0
- package/dest/mem_pools/tx_pool_v2/tx_pool_indices.js +354 -0
- package/dest/mem_pools/tx_pool_v2/tx_pool_v2.d.ts +60 -0
- package/dest/mem_pools/tx_pool_v2/tx_pool_v2.d.ts.map +1 -0
- package/dest/mem_pools/tx_pool_v2/tx_pool_v2.js +161 -0
- package/dest/mem_pools/tx_pool_v2/tx_pool_v2_impl.d.ts +77 -0
- package/dest/mem_pools/tx_pool_v2/tx_pool_v2_impl.d.ts.map +1 -0
- package/dest/mem_pools/tx_pool_v2/tx_pool_v2_impl.js +905 -0
- package/dest/msg_validators/attestation_validator/fisherman_attestation_validator.d.ts +3 -3
- package/dest/msg_validators/attestation_validator/fisherman_attestation_validator.d.ts.map +1 -1
- package/dest/msg_validators/attestation_validator/fisherman_attestation_validator.js +7 -2
- package/dest/msg_validators/proposal_validator/proposal_validator.js +5 -5
- package/dest/msg_validators/tx_validator/aggregate_tx_validator.d.ts +4 -4
- 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/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 +20 -6
- package/dest/msg_validators/tx_validator/block_header_validator.d.ts.map +1 -1
- package/dest/msg_validators/tx_validator/block_header_validator.js +5 -4
- 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 +15 -4
- package/dest/msg_validators/tx_validator/double_spend_validator.d.ts.map +1 -1
- package/dest/msg_validators/tx_validator/double_spend_validator.js +7 -6
- package/dest/msg_validators/tx_validator/factory.d.ts +118 -5
- package/dest/msg_validators/tx_validator/factory.d.ts.map +1 -1
- package/dest/msg_validators/tx_validator/factory.js +228 -57
- package/dest/msg_validators/tx_validator/gas_validator.d.ts +59 -3
- package/dest/msg_validators/tx_validator/gas_validator.d.ts.map +1 -1
- package/dest/msg_validators/tx_validator/gas_validator.js +76 -38
- 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 +3 -2
- 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/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 +3 -2
- package/dest/msg_validators/tx_validator/phases_validator.d.ts.map +1 -1
- package/dest/msg_validators/tx_validator/phases_validator.js +3 -3
- package/dest/msg_validators/tx_validator/size_validator.d.ts +3 -1
- package/dest/msg_validators/tx_validator/size_validator.d.ts.map +1 -1
- package/dest/msg_validators/tx_validator/size_validator.js +4 -1
- package/dest/msg_validators/tx_validator/timestamp_validator.d.ts +22 -5
- package/dest/msg_validators/tx_validator/timestamp_validator.d.ts.map +1 -1
- package/dest/msg_validators/tx_validator/timestamp_validator.js +8 -8
- 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/data_store.js +10 -6
- package/dest/services/discv5/discV5_service.js +1 -1
- package/dest/services/dummy_service.d.ts +24 -4
- package/dest/services/dummy_service.d.ts.map +1 -1
- package/dest/services/dummy_service.js +46 -1
- package/dest/services/encoding.d.ts +3 -3
- package/dest/services/encoding.d.ts.map +1 -1
- package/dest/services/encoding.js +11 -10
- package/dest/services/gossipsub/index.d.ts +3 -0
- package/dest/services/gossipsub/index.d.ts.map +1 -0
- package/dest/services/gossipsub/index.js +2 -0
- package/dest/services/gossipsub/scoring.d.ts +21 -3
- package/dest/services/gossipsub/scoring.d.ts.map +1 -1
- package/dest/services/gossipsub/scoring.js +24 -7
- package/dest/services/gossipsub/topic_score_params.d.ts +173 -0
- package/dest/services/gossipsub/topic_score_params.d.ts.map +1 -0
- package/dest/services/gossipsub/topic_score_params.js +346 -0
- package/dest/services/index.d.ts +2 -1
- package/dest/services/index.d.ts.map +1 -1
- package/dest/services/index.js +1 -0
- package/dest/services/libp2p/instrumentation.d.ts +1 -1
- package/dest/services/libp2p/instrumentation.d.ts.map +1 -1
- package/dest/services/libp2p/instrumentation.js +14 -3
- package/dest/services/libp2p/libp2p_service.d.ts +100 -42
- package/dest/services/libp2p/libp2p_service.d.ts.map +1 -1
- package/dest/services/libp2p/libp2p_service.js +451 -359
- package/dest/services/peer-manager/metrics.d.ts +2 -2
- package/dest/services/peer-manager/metrics.d.ts.map +1 -1
- package/dest/services/peer-manager/metrics.js +20 -5
- package/dest/services/peer-manager/peer_scoring.d.ts +1 -1
- package/dest/services/peer-manager/peer_scoring.d.ts.map +1 -1
- package/dest/services/peer-manager/peer_scoring.js +33 -4
- package/dest/services/reqresp/batch-tx-requester/batch_tx_requester.d.ts +48 -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 +539 -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 +46 -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 +34 -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 +130 -0
- package/dest/services/reqresp/batch-tx-requester/peer_collection.d.ts +60 -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 +173 -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/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 -1
- 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/interface.d.ts +12 -1
- package/dest/services/reqresp/interface.d.ts.map +1 -1
- package/dest/services/reqresp/interface.js +15 -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 -5
- 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 +5 -0
- package/dest/services/reqresp/protocols/block_txs/block_txs_handler.d.ts +7 -5
- package/dest/services/reqresp/protocols/block_txs/block_txs_handler.d.ts.map +1 -1
- package/dest/services/reqresp/protocols/block_txs/block_txs_handler.js +27 -9
- package/dest/services/reqresp/protocols/block_txs/block_txs_reqresp.d.ts +29 -6
- 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 +59 -13
- package/dest/services/reqresp/protocols/tx.d.ts +7 -1
- package/dest/services/reqresp/protocols/tx.d.ts.map +1 -1
- package/dest/services/reqresp/protocols/tx.js +20 -0
- package/dest/services/reqresp/reqresp.d.ts +6 -1
- package/dest/services/reqresp/reqresp.d.ts.map +1 -1
- package/dest/services/reqresp/reqresp.js +71 -27
- package/dest/services/service.d.ts +42 -3
- package/dest/services/service.d.ts.map +1 -1
- package/dest/services/tx_collection/config.d.ts +22 -1
- package/dest/services/tx_collection/config.d.ts.map +1 -1
- package/dest/services/tx_collection/config.js +55 -1
- package/dest/services/tx_collection/fast_tx_collection.d.ts +7 -4
- package/dest/services/tx_collection/fast_tx_collection.d.ts.map +1 -1
- package/dest/services/tx_collection/fast_tx_collection.js +71 -44
- package/dest/services/tx_collection/file_store_tx_collection.d.ts +53 -0
- package/dest/services/tx_collection/file_store_tx_collection.d.ts.map +1 -0
- package/dest/services/tx_collection/file_store_tx_collection.js +167 -0
- package/dest/services/tx_collection/file_store_tx_source.d.ts +37 -0
- package/dest/services/tx_collection/file_store_tx_source.d.ts.map +1 -0
- package/dest/services/tx_collection/file_store_tx_source.js +90 -0
- package/dest/services/tx_collection/index.d.ts +3 -1
- package/dest/services/tx_collection/index.d.ts.map +1 -1
- package/dest/services/tx_collection/index.js +2 -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 -2
- package/dest/services/tx_collection/missing_txs_tracker.d.ts +32 -0
- package/dest/services/tx_collection/missing_txs_tracker.d.ts.map +1 -0
- package/dest/services/tx_collection/missing_txs_tracker.js +27 -0
- package/dest/services/tx_collection/proposal_tx_collector.d.ts +49 -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 +7 -3
- package/dest/services/tx_collection/slow_tx_collection.d.ts.map +1 -1
- package/dest/services/tx_collection/slow_tx_collection.js +60 -26
- package/dest/services/tx_collection/tx_collection.d.ts +25 -12
- package/dest/services/tx_collection/tx_collection.d.ts.map +1 -1
- package/dest/services/tx_collection/tx_collection.js +79 -7
- package/dest/services/tx_collection/tx_collection_sink.d.ts +18 -8
- package/dest/services/tx_collection/tx_collection_sink.d.ts.map +1 -1
- package/dest/services/tx_collection/tx_collection_sink.js +26 -29
- package/dest/services/tx_collection/tx_source.d.ts +8 -3
- package/dest/services/tx_collection/tx_source.d.ts.map +1 -1
- package/dest/services/tx_collection/tx_source.js +19 -2
- package/dest/services/tx_file_store/config.d.ts +16 -0
- package/dest/services/tx_file_store/config.d.ts.map +1 -0
- package/dest/services/tx_file_store/config.js +22 -0
- package/dest/services/tx_file_store/index.d.ts +4 -0
- package/dest/services/tx_file_store/index.d.ts.map +1 -0
- package/dest/services/tx_file_store/index.js +3 -0
- package/dest/services/tx_file_store/instrumentation.d.ts +15 -0
- package/dest/services/tx_file_store/instrumentation.d.ts.map +1 -0
- package/dest/services/tx_file_store/instrumentation.js +29 -0
- package/dest/services/tx_file_store/tx_file_store.d.ts +48 -0
- package/dest/services/tx_file_store/tx_file_store.d.ts.map +1 -0
- package/dest/services/tx_file_store/tx_file_store.js +152 -0
- package/dest/services/tx_provider.d.ts +4 -4
- package/dest/services/tx_provider.d.ts.map +1 -1
- package/dest/services/tx_provider.js +9 -8
- package/dest/services/tx_provider_instrumentation.d.ts +1 -1
- package/dest/services/tx_provider_instrumentation.d.ts.map +1 -1
- package/dest/services/tx_provider_instrumentation.js +5 -5
- 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-test-p2p-clients.d.ts +7 -8
- 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 +30 -4
- package/dest/test-helpers/mock-pubsub.d.ts.map +1 -1
- package/dest/test-helpers/mock-pubsub.js +105 -4
- 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 +4 -3
- 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 +163 -0
- package/dest/test-helpers/testbench-utils.d.ts.map +1 -0
- package/dest/test-helpers/testbench-utils.js +366 -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 +219 -138
- 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 -44
- package/dest/util.d.ts +2 -2
- package/dest/util.d.ts.map +1 -1
- package/package.json +14 -14
- package/src/bootstrap/bootstrap.ts +7 -4
- package/src/client/factory.ts +83 -36
- package/src/client/interface.ts +56 -34
- package/src/client/p2p_client.ts +192 -247
- package/src/client/test/tx_proposal_collector/README.md +227 -0
- package/src/client/test/tx_proposal_collector/proposal_tx_collector_worker.ts +345 -0
- package/src/client/test/tx_proposal_collector/proposal_tx_collector_worker_protocol.ts +43 -0
- package/src/config.ts +47 -11
- package/src/errors/tx-pool.error.ts +12 -0
- package/src/index.ts +1 -0
- package/src/mem_pools/attestation_pool/attestation_pool.ts +496 -91
- package/src/mem_pools/attestation_pool/attestation_pool_test_suite.ts +442 -102
- package/src/mem_pools/attestation_pool/index.ts +9 -2
- package/src/mem_pools/attestation_pool/mocks.ts +2 -1
- package/src/mem_pools/index.ts +4 -1
- package/src/mem_pools/instrumentation.ts +2 -1
- package/src/mem_pools/interface.ts +4 -4
- package/src/mem_pools/tx_pool/README.md +1 -1
- package/src/mem_pools/tx_pool/eviction/invalid_txs_after_mining_rule.ts +3 -3
- package/src/mem_pools/tx_pool_v2/README.md +275 -0
- package/src/mem_pools/tx_pool_v2/archive/index.ts +1 -0
- package/src/mem_pools/tx_pool_v2/archive/tx_archive.ts +120 -0
- package/src/mem_pools/tx_pool_v2/deleted_pool.ts +321 -0
- package/src/mem_pools/tx_pool_v2/eviction/eviction_manager.ts +160 -0
- package/src/mem_pools/tx_pool_v2/eviction/fee_payer_balance_eviction_rule.ts +121 -0
- package/src/mem_pools/tx_pool_v2/eviction/fee_payer_balance_pre_add_rule.ts +125 -0
- package/src/mem_pools/tx_pool_v2/eviction/index.ts +27 -0
- package/src/mem_pools/tx_pool_v2/eviction/interfaces.ts +209 -0
- package/src/mem_pools/tx_pool_v2/eviction/invalid_txs_after_mining_rule.ts +74 -0
- package/src/mem_pools/tx_pool_v2/eviction/invalid_txs_after_reorg_rule.ts +101 -0
- package/src/mem_pools/tx_pool_v2/eviction/low_priority_eviction_rule.ts +91 -0
- package/src/mem_pools/tx_pool_v2/eviction/low_priority_pre_add_rule.ts +90 -0
- package/src/mem_pools/tx_pool_v2/eviction/nullifier_conflict_rule.ts +31 -0
- package/src/mem_pools/tx_pool_v2/index.ts +12 -0
- package/src/mem_pools/tx_pool_v2/instrumentation.ts +69 -0
- package/src/mem_pools/tx_pool_v2/interfaces.ts +242 -0
- package/src/mem_pools/tx_pool_v2/tx_metadata.ts +297 -0
- package/src/mem_pools/tx_pool_v2/tx_pool_bench_metrics.ts +77 -0
- package/src/mem_pools/tx_pool_v2/tx_pool_indices.ts +444 -0
- package/src/mem_pools/tx_pool_v2/tx_pool_v2.ts +223 -0
- package/src/mem_pools/tx_pool_v2/tx_pool_v2_impl.ts +1083 -0
- package/src/msg_validators/attestation_validator/fisherman_attestation_validator.ts +10 -4
- package/src/msg_validators/proposal_validator/proposal_validator.ts +5 -5
- package/src/msg_validators/tx_validator/README.md +115 -0
- package/src/msg_validators/tx_validator/aggregate_tx_validator.ts +5 -5
- package/src/msg_validators/tx_validator/archive_cache.ts +3 -3
- package/src/msg_validators/tx_validator/block_header_validator.ts +22 -11
- package/src/msg_validators/tx_validator/data_validator.ts +6 -2
- package/src/msg_validators/tx_validator/double_spend_validator.ts +15 -9
- package/src/msg_validators/tx_validator/factory.ts +372 -55
- package/src/msg_validators/tx_validator/gas_validator.ts +98 -29
- package/src/msg_validators/tx_validator/index.ts +1 -0
- package/src/msg_validators/tx_validator/metadata_validator.ts +6 -3
- package/src/msg_validators/tx_validator/nullifier_cache.ts +30 -0
- package/src/msg_validators/tx_validator/phases_validator.ts +5 -3
- package/src/msg_validators/tx_validator/size_validator.ts +6 -2
- package/src/msg_validators/tx_validator/timestamp_validator.ts +29 -21
- 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/data_store.ts +10 -7
- package/src/services/discv5/discV5_service.ts +1 -1
- package/src/services/dummy_service.ts +59 -2
- package/src/services/encoding.ts +9 -9
- package/src/services/gossipsub/README.md +641 -0
- package/src/services/gossipsub/index.ts +2 -0
- package/src/services/gossipsub/scoring.ts +29 -5
- package/src/services/gossipsub/topic_score_params.ts +487 -0
- package/src/services/index.ts +1 -0
- package/src/services/libp2p/instrumentation.ts +15 -2
- package/src/services/libp2p/libp2p_service.ts +496 -397
- package/src/services/peer-manager/metrics.ts +21 -4
- package/src/services/peer-manager/peer_scoring.ts +29 -1
- package/src/services/reqresp/batch-tx-requester/README.md +305 -0
- package/src/services/reqresp/batch-tx-requester/batch_tx_requester.ts +678 -0
- package/src/services/reqresp/batch-tx-requester/config.ts +40 -0
- package/src/services/reqresp/batch-tx-requester/interface.ts +53 -0
- package/src/services/reqresp/batch-tx-requester/missing_txs.ts +161 -0
- package/src/services/reqresp/batch-tx-requester/peer_collection.ts +244 -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 +16 -0
- package/src/services/reqresp/interface.ts +29 -1
- package/src/services/reqresp/metrics.ts +34 -9
- package/src/services/reqresp/protocols/block_txs/bitvector.ts +7 -0
- package/src/services/reqresp/protocols/block_txs/block_txs_handler.ts +35 -12
- package/src/services/reqresp/protocols/block_txs/block_txs_reqresp.ts +74 -9
- package/src/services/reqresp/protocols/tx.ts +22 -0
- package/src/services/reqresp/reqresp.ts +82 -23
- package/src/services/service.ts +55 -2
- package/src/services/tx_collection/config.ts +83 -1
- package/src/services/tx_collection/fast_tx_collection.ts +93 -47
- package/src/services/tx_collection/file_store_tx_collection.ts +202 -0
- package/src/services/tx_collection/file_store_tx_source.ts +117 -0
- package/src/services/tx_collection/index.ts +6 -0
- package/src/services/tx_collection/instrumentation.ts +17 -2
- package/src/services/tx_collection/missing_txs_tracker.ts +52 -0
- package/src/services/tx_collection/proposal_tx_collector.ts +113 -0
- package/src/services/tx_collection/slow_tx_collection.ts +66 -33
- package/src/services/tx_collection/tx_collection.ts +117 -20
- package/src/services/tx_collection/tx_collection_sink.ts +30 -34
- package/src/services/tx_collection/tx_source.ts +22 -3
- package/src/services/tx_file_store/config.ts +37 -0
- package/src/services/tx_file_store/index.ts +3 -0
- package/src/services/tx_file_store/instrumentation.ts +36 -0
- package/src/services/tx_file_store/tx_file_store.ts +175 -0
- package/src/services/tx_provider.ts +10 -9
- package/src/services/tx_provider_instrumentation.ts +11 -5
- package/src/test-helpers/index.ts +2 -0
- package/src/test-helpers/make-test-p2p-clients.ts +3 -5
- package/src/test-helpers/mock-pubsub.ts +146 -9
- package/src/test-helpers/reqresp-nodes.ts +4 -6
- package/src/test-helpers/test_tx_provider.ts +64 -0
- package/src/test-helpers/testbench-utils.ts +430 -0
- package/src/testbench/p2p_client_testbench_worker.ts +333 -131
- package/src/testbench/worker_client_manager.ts +304 -47
- package/src/util.ts +7 -1
- package/dest/mem_pools/attestation_pool/kv_attestation_pool.d.ts +0 -40
- package/dest/mem_pools/attestation_pool/kv_attestation_pool.d.ts.map +0 -1
- package/dest/mem_pools/attestation_pool/kv_attestation_pool.js +0 -218
- package/dest/mem_pools/attestation_pool/memory_attestation_pool.d.ts +0 -31
- package/dest/mem_pools/attestation_pool/memory_attestation_pool.d.ts.map +0 -1
- package/dest/mem_pools/attestation_pool/memory_attestation_pool.js +0 -180
- package/src/mem_pools/attestation_pool/kv_attestation_pool.ts +0 -320
- package/src/mem_pools/attestation_pool/memory_attestation_pool.ts +0 -264
|
@@ -0,0 +1,175 @@
|
|
|
1
|
+
import { type Logger, createLogger } from '@aztec/foundation/log';
|
|
2
|
+
import { RunningPromise } from '@aztec/foundation/promise';
|
|
3
|
+
import { makeBackoff, retry } from '@aztec/foundation/retry';
|
|
4
|
+
import { Timer } from '@aztec/foundation/timer';
|
|
5
|
+
import { type FileStore, createFileStore } from '@aztec/stdlib/file-store';
|
|
6
|
+
import type { Tx } from '@aztec/stdlib/tx';
|
|
7
|
+
import { type TelemetryClient, getTelemetryClient } from '@aztec/telemetry-client';
|
|
8
|
+
|
|
9
|
+
import type { TxPoolV2 } from '../../mem_pools/index.js';
|
|
10
|
+
import type { TxFileStoreConfig } from './config.js';
|
|
11
|
+
import { TxFileStoreInstrumentation } from './instrumentation.js';
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Uploads validated transactions to a file store as a fallback retrieval mechanism.
|
|
15
|
+
* Listens to TxPool txs-added events and uploads txs asynchronously with bounded concurrency.
|
|
16
|
+
*/
|
|
17
|
+
export class TxFileStore {
|
|
18
|
+
private uploadQueue: Tx[] = [];
|
|
19
|
+
private activeUploads = 0;
|
|
20
|
+
private readonly queueProcessor: RunningPromise;
|
|
21
|
+
private readonly handleTxsAdded: (args: { txs: Tx[]; source?: string }) => void;
|
|
22
|
+
|
|
23
|
+
/** Recently uploaded tx hashes for deduplication. */
|
|
24
|
+
private recentUploads: Set<string> = new Set();
|
|
25
|
+
private recentUploadsOrder: string[] = [];
|
|
26
|
+
private readonly maxRecentUploads = 1000;
|
|
27
|
+
|
|
28
|
+
private constructor(
|
|
29
|
+
private readonly fileStore: FileStore,
|
|
30
|
+
private readonly txPool: TxPoolV2,
|
|
31
|
+
private readonly config: TxFileStoreConfig,
|
|
32
|
+
private readonly instrumentation: TxFileStoreInstrumentation,
|
|
33
|
+
private readonly log: Logger,
|
|
34
|
+
private readonly basePath: string,
|
|
35
|
+
) {
|
|
36
|
+
this.handleTxsAdded = (args: { txs: Tx[]; source?: string }) => {
|
|
37
|
+
this.enqueueTxs(args.txs);
|
|
38
|
+
};
|
|
39
|
+
this.queueProcessor = new RunningPromise(() => this.processQueueBatch(), this.log, 100);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* Creates and initializes the file store.
|
|
44
|
+
* @param txPool - The transaction pool to listen to.
|
|
45
|
+
* @param config - The file store configuration.
|
|
46
|
+
* @param log - Optional logger.
|
|
47
|
+
* @param telemetry - Optional telemetry client.
|
|
48
|
+
* @param fileStoreOverride - Optional FileStore for testing (bypasses createFileStore).
|
|
49
|
+
* @returns The file store instance, or undefined if not configured/enabled.
|
|
50
|
+
*/
|
|
51
|
+
static async create(
|
|
52
|
+
txPool: TxPoolV2,
|
|
53
|
+
config: TxFileStoreConfig,
|
|
54
|
+
basePath: string,
|
|
55
|
+
log: Logger = createLogger('p2p:tx_file_store'),
|
|
56
|
+
telemetry: TelemetryClient = getTelemetryClient(),
|
|
57
|
+
fileStoreOverride?: FileStore,
|
|
58
|
+
): Promise<TxFileStore | undefined> {
|
|
59
|
+
if (!config.txFileStoreEnabled) {
|
|
60
|
+
log.debug('Tx file store is disabled');
|
|
61
|
+
return undefined;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
if (!config.txFileStoreUrl) {
|
|
65
|
+
log.warn('Tx file store is enabled but URL is not configured');
|
|
66
|
+
return undefined;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
const fileStore = fileStoreOverride ?? (await createFileStore(config.txFileStoreUrl, log));
|
|
70
|
+
if (!fileStore) {
|
|
71
|
+
log.warn('Failed to create file store for tx file store');
|
|
72
|
+
return undefined;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
const instrumentation = new TxFileStoreInstrumentation(telemetry, 'TxFileStore');
|
|
76
|
+
log.info('Created tx file store', { url: config.txFileStoreUrl, basePath });
|
|
77
|
+
return new TxFileStore(fileStore, txPool, config, instrumentation, log, basePath);
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
/** Starts listening to TxPool events and uploading txs. */
|
|
81
|
+
public start(): void {
|
|
82
|
+
this.queueProcessor.start();
|
|
83
|
+
this.txPool.on('txs-added', this.handleTxsAdded);
|
|
84
|
+
this.log.info('Started tx file store', {
|
|
85
|
+
concurrency: this.config.txFileStoreUploadConcurrency,
|
|
86
|
+
maxQueueSize: this.config.txFileStoreMaxQueueSize,
|
|
87
|
+
});
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
/** Stops listening and waits for pending uploads to complete. */
|
|
91
|
+
public async stop(): Promise<void> {
|
|
92
|
+
this.txPool.removeListener('txs-added', this.handleTxsAdded);
|
|
93
|
+
await this.queueProcessor.stop();
|
|
94
|
+
this.log.info('Stopped tx file store');
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
private enqueueTxs(txs: Tx[]): void {
|
|
98
|
+
this.uploadQueue.push(...txs);
|
|
99
|
+
|
|
100
|
+
// Enforce max queue size by dropping oldest entries
|
|
101
|
+
const overflow = this.uploadQueue.length - this.config.txFileStoreMaxQueueSize;
|
|
102
|
+
if (overflow > 0) {
|
|
103
|
+
this.log.warn(`Upload queue overflow, dropping ${overflow} oldest txs`);
|
|
104
|
+
this.uploadQueue.splice(0, overflow);
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
this.instrumentation.recordQueueSize(this.uploadQueue.length);
|
|
108
|
+
|
|
109
|
+
// Immediately start uploading txs
|
|
110
|
+
void this.queueProcessor.trigger();
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
private async processQueueBatch(): Promise<void> {
|
|
114
|
+
const batch = this.uploadQueue.splice(0, this.config.txFileStoreUploadConcurrency);
|
|
115
|
+
this.instrumentation.recordQueueSize(this.uploadQueue.length);
|
|
116
|
+
|
|
117
|
+
this.activeUploads += batch.length;
|
|
118
|
+
try {
|
|
119
|
+
await Promise.all(batch.map(tx => this.uploadTx(tx)));
|
|
120
|
+
} finally {
|
|
121
|
+
this.activeUploads -= batch.length;
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
private async uploadTx(tx: Tx): Promise<void> {
|
|
126
|
+
const txHash = tx.getTxHash().toString();
|
|
127
|
+
const path = `${this.basePath}/txs/${txHash}.bin`;
|
|
128
|
+
const timer = new Timer();
|
|
129
|
+
|
|
130
|
+
if (this.recentUploads.has(txHash)) {
|
|
131
|
+
return;
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
try {
|
|
135
|
+
this.recentUploads.add(txHash);
|
|
136
|
+
this.recentUploadsOrder.push(txHash);
|
|
137
|
+
|
|
138
|
+
if (this.recentUploadsOrder.length > this.maxRecentUploads) {
|
|
139
|
+
// delete old entries in recentUploads
|
|
140
|
+
for (const txHashToRemove of this.recentUploadsOrder.splice(
|
|
141
|
+
0,
|
|
142
|
+
this.recentUploadsOrder.length - this.maxRecentUploads,
|
|
143
|
+
)) {
|
|
144
|
+
this.recentUploads.delete(txHashToRemove);
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
await retry(
|
|
149
|
+
() => this.fileStore.save(path, tx.toBuffer(), { compress: true }),
|
|
150
|
+
`Uploading tx ${txHash}`,
|
|
151
|
+
makeBackoff([0.1, 0.5, 2]),
|
|
152
|
+
this.log,
|
|
153
|
+
true, // failSilently - don't log errors during retries
|
|
154
|
+
);
|
|
155
|
+
const durationMs = Math.trunc(timer.ms());
|
|
156
|
+
this.log.debug(`Uploaded tx to file store`, { txHash, path, durationMs });
|
|
157
|
+
this.instrumentation.recordUploadSuccess(durationMs);
|
|
158
|
+
} catch (err) {
|
|
159
|
+
this.log.warn(`Failed to upload tx to file store after retries`, { txHash, error: err });
|
|
160
|
+
this.instrumentation.recordUploadFailed();
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
/** Waits for all queued and in-flight uploads to complete. For testing. */
|
|
165
|
+
public async flush(): Promise<void> {
|
|
166
|
+
while (this.uploadQueue.length > 0 || this.activeUploads > 0) {
|
|
167
|
+
await this.queueProcessor.trigger();
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
/** Returns the number of pending uploads (queued + in-flight). */
|
|
172
|
+
public getPendingUploadCount(): number {
|
|
173
|
+
return this.uploadQueue.length + this.activeUploads;
|
|
174
|
+
}
|
|
175
|
+
}
|
|
@@ -5,13 +5,13 @@ import { elapsed } from '@aztec/foundation/timer';
|
|
|
5
5
|
import type { L2Block, L2BlockInfo } from '@aztec/stdlib/block';
|
|
6
6
|
import type { ITxProvider } from '@aztec/stdlib/interfaces/server';
|
|
7
7
|
import type { BlockProposal } from '@aztec/stdlib/p2p';
|
|
8
|
-
import { Tx, TxHash } from '@aztec/stdlib/tx';
|
|
8
|
+
import { type BlockHeader, Tx, TxHash } from '@aztec/stdlib/tx';
|
|
9
9
|
import { type TelemetryClient, getTelemetryClient } from '@aztec/telemetry-client';
|
|
10
10
|
|
|
11
11
|
import type { PeerId } from '@libp2p/interface';
|
|
12
12
|
|
|
13
13
|
import type { P2PClient } from '../client/p2p_client.js';
|
|
14
|
-
import type {
|
|
14
|
+
import type { TxPoolV2 } from '../mem_pools/tx_pool_v2/interfaces.js';
|
|
15
15
|
import type { FastCollectionRequestInput, TxCollection } from './tx_collection/tx_collection.js';
|
|
16
16
|
import { TxProviderInstrumentation } from './tx_provider_instrumentation.js';
|
|
17
17
|
|
|
@@ -24,8 +24,8 @@ export class TxProvider implements ITxProvider {
|
|
|
24
24
|
|
|
25
25
|
constructor(
|
|
26
26
|
private txCollection: TxCollection,
|
|
27
|
-
private txPool:
|
|
28
|
-
private
|
|
27
|
+
private txPool: TxPoolV2,
|
|
28
|
+
private blockProposalTransactionValidator: Pick<P2PClient, 'validateTxsReceivedInBlockProposal'>,
|
|
29
29
|
private log: Logger = createLogger('p2p:tx-collector'),
|
|
30
30
|
client: TelemetryClient = getTelemetryClient(),
|
|
31
31
|
) {
|
|
@@ -144,6 +144,7 @@ export class TxProvider implements ITxProvider {
|
|
|
144
144
|
// Take txs from the proposal body if there are any
|
|
145
145
|
// Note that we still have to validate these txs, but we do it in parallel with tx collection
|
|
146
146
|
const proposal = request.type === 'proposal' ? request.blockProposal : undefined;
|
|
147
|
+
const proposalBlockHeader = proposal?.blockHeader;
|
|
147
148
|
const txsFromProposal = this.extractFromProposal(proposal, [...missingTxHashes]);
|
|
148
149
|
if (txsFromProposal.length > 0) {
|
|
149
150
|
this.instrumentation.incTxsFromProposals(txsFromProposal.length);
|
|
@@ -155,7 +156,7 @@ export class TxProvider implements ITxProvider {
|
|
|
155
156
|
}
|
|
156
157
|
|
|
157
158
|
if (missingTxHashes.size === 0) {
|
|
158
|
-
await this.processProposalTxs(txsFromProposal);
|
|
159
|
+
await this.processProposalTxs(txsFromProposal, proposalBlockHeader!);
|
|
159
160
|
this.instrumentation.incTxsFromP2P(0, txHashes.length);
|
|
160
161
|
return { txsFromMempool, txsFromProposal };
|
|
161
162
|
}
|
|
@@ -163,7 +164,7 @@ export class TxProvider implements ITxProvider {
|
|
|
163
164
|
// Start tx collection from the network if needed, while we validate the txs taken from the proposal in parallel
|
|
164
165
|
const [txsFromNetwork] = await Promise.all([
|
|
165
166
|
this.collectFromP2P(request, [...missingTxHashes], opts),
|
|
166
|
-
this.processProposalTxs(txsFromProposal),
|
|
167
|
+
this.processProposalTxs(txsFromProposal, proposalBlockHeader!),
|
|
167
168
|
] as const);
|
|
168
169
|
|
|
169
170
|
if (txsFromNetwork.length > 0) {
|
|
@@ -222,11 +223,11 @@ export class TxProvider implements ITxProvider {
|
|
|
222
223
|
return compactArray(proposal.txs ?? []).filter(tx => missingTxHashes.includes(tx.getTxHash().toString()));
|
|
223
224
|
}
|
|
224
225
|
|
|
225
|
-
private async processProposalTxs(txs: Tx[]): Promise<void> {
|
|
226
|
+
private async processProposalTxs(txs: Tx[], blockHeader: BlockHeader): Promise<void> {
|
|
226
227
|
if (txs.length === 0) {
|
|
227
228
|
return;
|
|
228
229
|
}
|
|
229
|
-
await this.
|
|
230
|
-
await this.txPool.
|
|
230
|
+
await this.blockProposalTransactionValidator.validateTxsReceivedInBlockProposal(txs);
|
|
231
|
+
await this.txPool.addProtectedTxs(txs, blockHeader);
|
|
231
232
|
}
|
|
232
233
|
}
|
|
@@ -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;
|
|
@@ -12,13 +18,13 @@ export class TxProviderInstrumentation {
|
|
|
12
18
|
constructor(client: TelemetryClient, name: string) {
|
|
13
19
|
const meter = client.getMeter(name);
|
|
14
20
|
|
|
15
|
-
this.txFromProposalCount = meter
|
|
21
|
+
this.txFromProposalCount = createUpDownCounterWithDefault(meter, Metrics.TX_PROVIDER_TXS_FROM_PROPOSALS_COUNT);
|
|
16
22
|
|
|
17
|
-
this.txFromMempoolCount = meter
|
|
23
|
+
this.txFromMempoolCount = createUpDownCounterWithDefault(meter, Metrics.TX_PROVIDER_TXS_FROM_MEMPOOL_COUNT);
|
|
18
24
|
|
|
19
|
-
this.txFromP2PCount = meter
|
|
25
|
+
this.txFromP2PCount = createUpDownCounterWithDefault(meter, Metrics.TX_PROVIDER_TXS_FROM_P2P_COUNT);
|
|
20
26
|
|
|
21
|
-
this.missingTxsCount = meter
|
|
27
|
+
this.missingTxsCount = createUpDownCounterWithDefault(meter, Metrics.TX_PROVIDER_MISSING_TXS_COUNT);
|
|
22
28
|
|
|
23
29
|
this.fractionOfTxsRequestedFromP2P = meter.createHistogram(Metrics.TX_PROVIDER_P2P_TXS_REQUESTED_FRACTION);
|
|
24
30
|
|
|
@@ -7,13 +7,12 @@ import { sleep } from '@aztec/foundation/sleep';
|
|
|
7
7
|
import type { DataStoreConfig } from '@aztec/kv-store/config';
|
|
8
8
|
import { openTmpStore } from '@aztec/kv-store/lmdb-v2';
|
|
9
9
|
import type { WorldStateSynchronizer } from '@aztec/stdlib/interfaces/server';
|
|
10
|
-
import { P2PClientType } from '@aztec/stdlib/p2p';
|
|
11
10
|
|
|
12
11
|
import { createP2PClient } from '../client/index.js';
|
|
13
12
|
import type { P2PClient } from '../client/p2p_client.js';
|
|
14
13
|
import type { P2PConfig } from '../config.js';
|
|
15
14
|
import type { AttestationPool } from '../mem_pools/attestation_pool/attestation_pool.js';
|
|
16
|
-
import type {
|
|
15
|
+
import type { TxPoolV2 } from '../mem_pools/tx_pool_v2/interfaces.js';
|
|
17
16
|
import { generatePeerIdPrivateKeys } from '../test-helpers/generate-peer-id-private-keys.js';
|
|
18
17
|
import { getPorts } from './get-ports.js';
|
|
19
18
|
import { makeEnrs } from './make-enrs.js';
|
|
@@ -22,7 +21,7 @@ import { AlwaysFalseCircuitVerifier, AlwaysTrueCircuitVerifier } from './reqresp
|
|
|
22
21
|
|
|
23
22
|
export interface MakeTestP2PClientOptions {
|
|
24
23
|
mockAttestationPool: AttestationPool;
|
|
25
|
-
mockTxPool:
|
|
24
|
+
mockTxPool: TxPoolV2;
|
|
26
25
|
mockEpochCache: EpochCache;
|
|
27
26
|
mockWorldState: WorldStateSynchronizer;
|
|
28
27
|
alwaysTrueVerifier?: boolean;
|
|
@@ -98,7 +97,6 @@ export async function makeTestP2PClient(
|
|
|
98
97
|
const kvStore = await openTmpStore('test');
|
|
99
98
|
|
|
100
99
|
const client = await createP2PClient(
|
|
101
|
-
P2PClientType.Full,
|
|
102
100
|
config,
|
|
103
101
|
l2BlockSource,
|
|
104
102
|
proofVerifier,
|
|
@@ -108,7 +106,7 @@ export async function makeTestP2PClient(
|
|
|
108
106
|
undefined,
|
|
109
107
|
undefined,
|
|
110
108
|
{
|
|
111
|
-
txPool: mockTxPool as unknown as
|
|
109
|
+
txPool: mockTxPool as unknown as TxPoolV2,
|
|
112
110
|
attestationPool: mockAttestationPool as unknown as AttestationPool,
|
|
113
111
|
store: kvStore,
|
|
114
112
|
logger,
|
|
@@ -4,7 +4,6 @@ import type { AztecAsyncKVStore } from '@aztec/kv-store';
|
|
|
4
4
|
import type { L2BlockSource } from '@aztec/stdlib/block';
|
|
5
5
|
import type { ContractDataSource } from '@aztec/stdlib/contract';
|
|
6
6
|
import type { ClientProtocolCircuitVerifier, WorldStateSynchronizer } from '@aztec/stdlib/interfaces/server';
|
|
7
|
-
import { P2PClientType } from '@aztec/stdlib/p2p';
|
|
8
7
|
import type { TelemetryClient } from '@aztec/telemetry-client';
|
|
9
8
|
|
|
10
9
|
import type { GossipsubEvents, GossipsubMessage } from '@chainsafe/libp2p-gossipsub';
|
|
@@ -19,8 +18,20 @@ import {
|
|
|
19
18
|
|
|
20
19
|
import type { P2PConfig } from '../config.js';
|
|
21
20
|
import type { MemPools } from '../mem_pools/interface.js';
|
|
22
|
-
import { DummyPeerDiscoveryService, DummyPeerManager,
|
|
23
|
-
import type {
|
|
21
|
+
import { DummyPeerDiscoveryService, DummyPeerManager, LibP2PService } from '../services/index.js';
|
|
22
|
+
import type { P2PReqRespConfig } from '../services/reqresp/config.js';
|
|
23
|
+
import type { ConnectionSampler } from '../services/reqresp/connection-sampler/connection_sampler.js';
|
|
24
|
+
import {
|
|
25
|
+
type ReqRespInterface,
|
|
26
|
+
type ReqRespResponse,
|
|
27
|
+
type ReqRespSubProtocol,
|
|
28
|
+
type ReqRespSubProtocolHandler,
|
|
29
|
+
type ReqRespSubProtocolHandlers,
|
|
30
|
+
type ReqRespSubProtocolValidators,
|
|
31
|
+
type SubProtocolMap,
|
|
32
|
+
responseFromBuffer,
|
|
33
|
+
} from '../services/reqresp/interface.js';
|
|
34
|
+
import { ReqRespStatus } from '../services/reqresp/status.js';
|
|
24
35
|
import { GossipSubEvent } from '../types/index.js';
|
|
25
36
|
import type { PubSubLibp2p } from '../util.js';
|
|
26
37
|
|
|
@@ -30,11 +41,10 @@ type GossipSubService = PubSubLibp2p['services']['pubsub'];
|
|
|
30
41
|
* Given a mock gossip sub network, returns a factory function that creates an instance LibP2PService connected to it.
|
|
31
42
|
* Designed to be used in tests in P2PClientDeps.p2pServiceFactory.
|
|
32
43
|
*/
|
|
33
|
-
export function getMockPubSubP2PServiceFactory
|
|
44
|
+
export function getMockPubSubP2PServiceFactory(
|
|
34
45
|
network: MockGossipSubNetwork,
|
|
35
|
-
): (...args: Parameters<(typeof LibP2PService
|
|
46
|
+
): (...args: Parameters<(typeof LibP2PService)['new']>) => Promise<LibP2PService> {
|
|
36
47
|
return (
|
|
37
|
-
clientType: P2PClientType,
|
|
38
48
|
config: P2PConfig,
|
|
39
49
|
peerId: PeerId,
|
|
40
50
|
deps: {
|
|
@@ -52,10 +62,9 @@ export function getMockPubSubP2PServiceFactory<T extends P2PClientType>(
|
|
|
52
62
|
deps.logger.verbose('Creating mock PubSub service');
|
|
53
63
|
const libp2p = new MockPubSub(peerId, network);
|
|
54
64
|
const peerManager = new DummyPeerManager(peerId, network);
|
|
55
|
-
const reqresp: ReqRespInterface = new
|
|
65
|
+
const reqresp: ReqRespInterface = new MockReqResp(peerId, network);
|
|
56
66
|
const peerDiscoveryService = new DummyPeerDiscoveryService();
|
|
57
|
-
const service = new LibP2PService
|
|
58
|
-
clientType as T,
|
|
67
|
+
const service = new LibP2PService(
|
|
59
68
|
config,
|
|
60
69
|
libp2p,
|
|
61
70
|
peerDiscoveryService,
|
|
@@ -74,6 +83,115 @@ export function getMockPubSubP2PServiceFactory<T extends P2PClientType>(
|
|
|
74
83
|
};
|
|
75
84
|
}
|
|
76
85
|
|
|
86
|
+
/**
|
|
87
|
+
* Mock implementation of ReqRespInterface that routes requests to other peers' handlers through the mock network.
|
|
88
|
+
* When a peer calls sendBatchRequest, the mock iterates over network peers and invokes their registered handler
|
|
89
|
+
* for the sub-protocol, simulating the request-response protocol without actual libp2p streams.
|
|
90
|
+
*/
|
|
91
|
+
class MockReqResp implements ReqRespInterface {
|
|
92
|
+
private handlers: Partial<ReqRespSubProtocolHandlers> = {};
|
|
93
|
+
private logger = createLogger('p2p:test:mock-reqresp');
|
|
94
|
+
|
|
95
|
+
constructor(
|
|
96
|
+
private peerId: PeerId,
|
|
97
|
+
private network: MockGossipSubNetwork,
|
|
98
|
+
) {
|
|
99
|
+
network.registerReqRespPeer(this);
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
updateConfig(_config: Partial<P2PReqRespConfig>): void {}
|
|
103
|
+
|
|
104
|
+
start(
|
|
105
|
+
subProtocolHandlers: Partial<ReqRespSubProtocolHandlers>,
|
|
106
|
+
_subProtocolValidators: ReqRespSubProtocolValidators,
|
|
107
|
+
): Promise<void> {
|
|
108
|
+
Object.assign(this.handlers, subProtocolHandlers);
|
|
109
|
+
return Promise.resolve();
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
addSubProtocol(
|
|
113
|
+
subProtocol: ReqRespSubProtocol,
|
|
114
|
+
handler: ReqRespSubProtocolHandler,
|
|
115
|
+
_validator?: ReqRespSubProtocolValidators[ReqRespSubProtocol],
|
|
116
|
+
): Promise<void> {
|
|
117
|
+
this.handlers[subProtocol] = handler;
|
|
118
|
+
return Promise.resolve();
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
stop(): Promise<void> {
|
|
122
|
+
this.handlers = {};
|
|
123
|
+
return Promise.resolve();
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
getHandler(subProtocol: ReqRespSubProtocol): ReqRespSubProtocolHandler | undefined {
|
|
127
|
+
return this.handlers[subProtocol];
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
async sendBatchRequest<SubProtocol extends ReqRespSubProtocol>(
|
|
131
|
+
subProtocol: SubProtocol,
|
|
132
|
+
requests: InstanceType<SubProtocolMap[SubProtocol]['request']>[],
|
|
133
|
+
pinnedPeer: PeerId | undefined,
|
|
134
|
+
_timeoutMs?: number,
|
|
135
|
+
_maxPeers?: number,
|
|
136
|
+
_maxRetryAttempts?: number,
|
|
137
|
+
): Promise<InstanceType<SubProtocolMap[SubProtocol]['response']>[]> {
|
|
138
|
+
const responses: InstanceType<SubProtocolMap[SubProtocol]['response']>[] = [];
|
|
139
|
+
const peers = this.network.getReqRespPeers().filter(p => !p.peerId.equals(this.peerId));
|
|
140
|
+
const targetPeers = pinnedPeer ? peers.filter(p => p.peerId.equals(pinnedPeer)) : peers;
|
|
141
|
+
|
|
142
|
+
for (const request of requests) {
|
|
143
|
+
const requestBuffer = request.toBuffer();
|
|
144
|
+
for (const peer of targetPeers) {
|
|
145
|
+
const handler = peer.getHandler(subProtocol);
|
|
146
|
+
if (!handler) {
|
|
147
|
+
continue;
|
|
148
|
+
}
|
|
149
|
+
try {
|
|
150
|
+
const responseBuffer = await handler(this.peerId, requestBuffer);
|
|
151
|
+
if (responseBuffer.length > 0) {
|
|
152
|
+
const response = responseFromBuffer(subProtocol, responseBuffer);
|
|
153
|
+
responses.push(response as InstanceType<SubProtocolMap[SubProtocol]['response']>);
|
|
154
|
+
break;
|
|
155
|
+
}
|
|
156
|
+
} catch (err) {
|
|
157
|
+
this.logger.debug(`Mock reqresp handler error from peer ${peer.peerId}`, { err });
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
return responses;
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
async sendRequestToPeer(
|
|
166
|
+
peerId: PeerId,
|
|
167
|
+
subProtocol: ReqRespSubProtocol,
|
|
168
|
+
payload: Buffer,
|
|
169
|
+
_dialTimeout?: number,
|
|
170
|
+
): Promise<ReqRespResponse> {
|
|
171
|
+
const peer = this.network.getReqRespPeers().find(p => p.peerId.equals(peerId));
|
|
172
|
+
const handler = peer?.getHandler(subProtocol);
|
|
173
|
+
if (!handler) {
|
|
174
|
+
return { status: ReqRespStatus.SUCCESS, data: Buffer.from([]) };
|
|
175
|
+
}
|
|
176
|
+
try {
|
|
177
|
+
const data = await handler(this.peerId, payload);
|
|
178
|
+
return { status: ReqRespStatus.SUCCESS, data };
|
|
179
|
+
} catch {
|
|
180
|
+
return { status: ReqRespStatus.FAILURE };
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
getConnectionSampler(): Pick<ConnectionSampler, 'getPeerListSortedByConnectionCountAsc'> {
|
|
185
|
+
return {
|
|
186
|
+
getPeerListSortedByConnectionCountAsc: () =>
|
|
187
|
+
this.network
|
|
188
|
+
.getReqRespPeers()
|
|
189
|
+
.filter(p => !p.peerId.equals(this.peerId))
|
|
190
|
+
.map(p => p.peerId),
|
|
191
|
+
};
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
|
|
77
195
|
/**
|
|
78
196
|
* Implementation of PubSub services that relies on a mock gossip sub network.
|
|
79
197
|
* This is used in tests to simulate a gossip sub network without needing a real P2P network.
|
|
@@ -149,6 +267,16 @@ class MockGossipSubService extends TypedEventEmitter<GossipsubEvents> implements
|
|
|
149
267
|
{ msgId, propagationSource, acceptance },
|
|
150
268
|
);
|
|
151
269
|
}
|
|
270
|
+
|
|
271
|
+
getMeshPeers(topic?: TopicStr): PeerIdStr[] {
|
|
272
|
+
if (topic && !this.subscribedTopics.has(topic)) {
|
|
273
|
+
return [];
|
|
274
|
+
}
|
|
275
|
+
return this.network
|
|
276
|
+
.getPeers()
|
|
277
|
+
.filter(peer => !this.peerId.equals(peer))
|
|
278
|
+
.map(peer => peer.toString());
|
|
279
|
+
}
|
|
152
280
|
}
|
|
153
281
|
|
|
154
282
|
/**
|
|
@@ -157,6 +285,7 @@ class MockGossipSubService extends TypedEventEmitter<GossipsubEvents> implements
|
|
|
157
285
|
*/
|
|
158
286
|
export class MockGossipSubNetwork {
|
|
159
287
|
private peers: MockGossipSubService[] = [];
|
|
288
|
+
private reqRespPeers: MockReqResp[] = [];
|
|
160
289
|
private nextMsgId = 0;
|
|
161
290
|
|
|
162
291
|
private logger = createLogger('p2p:test:mock-gossipsub-network');
|
|
@@ -169,6 +298,14 @@ export class MockGossipSubNetwork {
|
|
|
169
298
|
this.peers.push(peer);
|
|
170
299
|
}
|
|
171
300
|
|
|
301
|
+
public registerReqRespPeer(peer: MockReqResp): void {
|
|
302
|
+
this.reqRespPeers.push(peer);
|
|
303
|
+
}
|
|
304
|
+
|
|
305
|
+
public getReqRespPeers(): MockReqResp[] {
|
|
306
|
+
return this.reqRespPeers;
|
|
307
|
+
}
|
|
308
|
+
|
|
172
309
|
public publishToPeers(topic: TopicStr, data: Uint8Array, sender: PeerId): void {
|
|
173
310
|
const msgId = (this.nextMsgId++).toString();
|
|
174
311
|
this.logger.debug(`Network is distributing message on topic ${topic}`, {
|
|
@@ -12,7 +12,6 @@ import type {
|
|
|
12
12
|
IVCProofVerificationResult,
|
|
13
13
|
WorldStateSynchronizer,
|
|
14
14
|
} from '@aztec/stdlib/interfaces/server';
|
|
15
|
-
import type { P2PClientType } from '@aztec/stdlib/p2p';
|
|
16
15
|
import type { Tx } from '@aztec/stdlib/tx';
|
|
17
16
|
import { compressComponentVersions } from '@aztec/stdlib/versioning';
|
|
18
17
|
import { type TelemetryClient, getTelemetryClient } from '@aztec/telemetry-client';
|
|
@@ -34,6 +33,7 @@ import { BootstrapNode } from '../bootstrap/bootstrap.js';
|
|
|
34
33
|
import type { BootnodeConfig, P2PConfig } from '../config.js';
|
|
35
34
|
import type { MemPools } from '../mem_pools/interface.js';
|
|
36
35
|
import { DiscV5Service } from '../services/discv5/discV5_service.js';
|
|
36
|
+
import { APP_SPECIFIC_WEIGHT } from '../services/gossipsub/scoring.js';
|
|
37
37
|
import { LibP2PService } from '../services/libp2p/libp2p_service.js';
|
|
38
38
|
import { PeerManager } from '../services/peer-manager/peer_manager.js';
|
|
39
39
|
import { PeerScoring } from '../services/peer-manager/peer_scoring.js';
|
|
@@ -106,8 +106,7 @@ export async function createLibp2pNode(
|
|
|
106
106
|
*
|
|
107
107
|
*
|
|
108
108
|
*/
|
|
109
|
-
export async function createTestLibP2PService
|
|
110
|
-
clientType: T,
|
|
109
|
+
export async function createTestLibP2PService(
|
|
111
110
|
boostrapAddrs: string[] = [],
|
|
112
111
|
archiver: L2BlockSource & ContractDataSource,
|
|
113
112
|
worldStateSynchronizer: WorldStateSynchronizer,
|
|
@@ -154,12 +153,11 @@ export async function createTestLibP2PService<T extends P2PClientType>(
|
|
|
154
153
|
epochCache,
|
|
155
154
|
);
|
|
156
155
|
|
|
157
|
-
p2pNode.services.pubsub.score.params.appSpecificWeight =
|
|
156
|
+
p2pNode.services.pubsub.score.params.appSpecificWeight = APP_SPECIFIC_WEIGHT;
|
|
158
157
|
p2pNode.services.pubsub.score.params.appSpecificScore = (peerId: string) =>
|
|
159
158
|
peerManager.shouldDisableP2PGossip(peerId) ? -Infinity : peerManager.getPeerScore(peerId);
|
|
160
159
|
|
|
161
|
-
return new LibP2PService
|
|
162
|
-
clientType,
|
|
160
|
+
return new LibP2PService(
|
|
163
161
|
config,
|
|
164
162
|
p2pNode as PubSubLibp2p,
|
|
165
163
|
discoveryService,
|
|
@@ -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
|
+
}
|