@aztec/p2p 0.0.1-commit.f2ce05ee → 0.0.1-commit.f81dbcf
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/client/factory.d.ts +8 -8
- package/dest/client/factory.d.ts.map +1 -1
- package/dest/client/factory.js +42 -13
- package/dest/client/interface.d.ts +39 -33
- package/dest/client/interface.d.ts.map +1 -1
- package/dest/client/p2p_client.d.ts +37 -50
- package/dest/client/p2p_client.d.ts.map +1 -1
- package/dest/client/p2p_client.js +144 -223
- package/dest/client/test/tx_proposal_collector/proposal_tx_collector_worker.js +6 -7
- package/dest/config.d.ts +47 -11
- package/dest/config.d.ts.map +1 -1
- package/dest/config.js +94 -31
- 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 +21 -12
- package/dest/mem_pools/attestation_pool/attestation_pool.d.ts.map +1 -1
- package/dest/mem_pools/attestation_pool/attestation_pool.js +67 -37
- 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 +53 -53
- package/dest/mem_pools/attestation_pool/index.d.ts +2 -2
- package/dest/mem_pools/attestation_pool/index.d.ts.map +1 -1
- package/dest/mem_pools/attestation_pool/index.js +1 -1
- 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 +2 -1
- package/dest/mem_pools/index.d.ts.map +1 -1
- package/dest/mem_pools/interface.d.ts +3 -3
- 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/priority.d.ts +2 -2
- package/dest/mem_pools/tx_pool/priority.d.ts.map +1 -1
- package/dest/mem_pools/tx_pool/priority.js +4 -4
- package/dest/mem_pools/tx_pool/tx_pool_test_suite.d.ts +1 -1
- package/dest/mem_pools/tx_pool/tx_pool_test_suite.d.ts.map +1 -1
- package/dest/mem_pools/tx_pool/tx_pool_test_suite.js +3 -1
- package/dest/mem_pools/tx_pool_v2/deleted_pool.d.ts +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 +3 -3
- package/dest/mem_pools/tx_pool_v2/eviction/eviction_manager.d.ts.map +1 -1
- package/dest/mem_pools/tx_pool_v2/eviction/eviction_manager.js +18 -9
- package/dest/mem_pools/tx_pool_v2/eviction/fee_payer_balance_eviction_rule.d.ts +1 -1
- package/dest/mem_pools/tx_pool_v2/eviction/fee_payer_balance_eviction_rule.d.ts.map +1 -1
- package/dest/mem_pools/tx_pool_v2/eviction/fee_payer_balance_eviction_rule.js +5 -2
- package/dest/mem_pools/tx_pool_v2/eviction/fee_payer_balance_pre_add_rule.d.ts +3 -3
- package/dest/mem_pools/tx_pool_v2/eviction/fee_payer_balance_pre_add_rule.d.ts.map +1 -1
- package/dest/mem_pools/tx_pool_v2/eviction/fee_payer_balance_pre_add_rule.js +12 -4
- package/dest/mem_pools/tx_pool_v2/eviction/index.d.ts +2 -2
- package/dest/mem_pools/tx_pool_v2/eviction/index.d.ts.map +1 -1
- package/dest/mem_pools/tx_pool_v2/eviction/index.js +1 -1
- package/dest/mem_pools/tx_pool_v2/eviction/interfaces.d.ts +54 -5
- package/dest/mem_pools/tx_pool_v2/eviction/interfaces.d.ts.map +1 -1
- package/dest/mem_pools/tx_pool_v2/eviction/interfaces.js +8 -0
- package/dest/mem_pools/tx_pool_v2/eviction/invalid_txs_after_mining_rule.js +7 -5
- package/dest/mem_pools/tx_pool_v2/eviction/invalid_txs_after_reorg_rule.js +7 -5
- package/dest/mem_pools/tx_pool_v2/eviction/low_priority_eviction_rule.d.ts +2 -2
- package/dest/mem_pools/tx_pool_v2/eviction/low_priority_eviction_rule.d.ts.map +1 -1
- package/dest/mem_pools/tx_pool_v2/eviction/low_priority_eviction_rule.js +14 -6
- package/dest/mem_pools/tx_pool_v2/eviction/low_priority_pre_add_rule.d.ts +4 -4
- package/dest/mem_pools/tx_pool_v2/eviction/low_priority_pre_add_rule.d.ts.map +1 -1
- package/dest/mem_pools/tx_pool_v2/eviction/low_priority_pre_add_rule.js +16 -4
- package/dest/mem_pools/tx_pool_v2/eviction/nullifier_conflict_rule.d.ts +3 -3
- package/dest/mem_pools/tx_pool_v2/eviction/nullifier_conflict_rule.d.ts.map +1 -1
- package/dest/mem_pools/tx_pool_v2/eviction/nullifier_conflict_rule.js +3 -3
- package/dest/mem_pools/tx_pool_v2/index.d.ts +3 -2
- package/dest/mem_pools/tx_pool_v2/index.d.ts.map +1 -1
- package/dest/mem_pools/tx_pool_v2/index.js +2 -1
- package/dest/mem_pools/tx_pool_v2/instrumentation.d.ts +15 -0
- package/dest/mem_pools/tx_pool_v2/instrumentation.d.ts.map +1 -0
- package/dest/mem_pools/tx_pool_v2/instrumentation.js +43 -0
- package/dest/mem_pools/tx_pool_v2/interfaces.d.ts +22 -8
- package/dest/mem_pools/tx_pool_v2/interfaces.d.ts.map +1 -1
- package/dest/mem_pools/tx_pool_v2/interfaces.js +4 -1
- package/dest/mem_pools/tx_pool_v2/tx_metadata.d.ts +68 -11
- package/dest/mem_pools/tx_pool_v2/tx_metadata.d.ts.map +1 -1
- package/dest/mem_pools/tx_pool_v2/tx_metadata.js +132 -17
- package/dest/mem_pools/tx_pool_v2/tx_pool_indices.d.ts +12 -3
- package/dest/mem_pools/tx_pool_v2/tx_pool_indices.d.ts.map +1 -1
- package/dest/mem_pools/tx_pool_v2/tx_pool_indices.js +36 -14
- package/dest/mem_pools/tx_pool_v2/tx_pool_v2.d.ts +9 -4
- package/dest/mem_pools/tx_pool_v2/tx_pool_v2.d.ts.map +1 -1
- package/dest/mem_pools/tx_pool_v2/tx_pool_v2.js +11 -6
- package/dest/mem_pools/tx_pool_v2/tx_pool_v2_impl.d.ts +13 -5
- package/dest/mem_pools/tx_pool_v2/tx_pool_v2_impl.d.ts.map +1 -1
- package/dest/mem_pools/tx_pool_v2/tx_pool_v2_impl.js +336 -185
- package/dest/msg_validators/proposal_validator/block_proposal_validator.d.ts +6 -4
- package/dest/msg_validators/proposal_validator/block_proposal_validator.d.ts.map +1 -1
- package/dest/msg_validators/proposal_validator/block_proposal_validator.js +10 -2
- package/dest/msg_validators/proposal_validator/checkpoint_proposal_validator.d.ts +6 -4
- package/dest/msg_validators/proposal_validator/checkpoint_proposal_validator.d.ts.map +1 -1
- package/dest/msg_validators/proposal_validator/checkpoint_proposal_validator.js +16 -2
- package/dest/msg_validators/proposal_validator/proposal_validator.d.ts +13 -8
- package/dest/msg_validators/proposal_validator/proposal_validator.d.ts.map +1 -1
- package/dest/msg_validators/proposal_validator/proposal_validator.js +48 -36
- 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/allowed_public_setup.d.ts +2 -1
- package/dest/msg_validators/tx_validator/allowed_public_setup.d.ts.map +1 -1
- package/dest/msg_validators/tx_validator/allowed_public_setup.js +24 -20
- package/dest/msg_validators/tx_validator/allowed_setup_helpers.d.ts +17 -0
- package/dest/msg_validators/tx_validator/allowed_setup_helpers.d.ts.map +1 -0
- package/dest/msg_validators/tx_validator/allowed_setup_helpers.js +24 -0
- package/dest/msg_validators/tx_validator/block_header_validator.d.ts +16 -3
- package/dest/msg_validators/tx_validator/block_header_validator.d.ts.map +1 -1
- package/dest/msg_validators/tx_validator/block_header_validator.js +1 -1
- package/dest/msg_validators/tx_validator/contract_instance_validator.d.ts +9 -0
- package/dest/msg_validators/tx_validator/contract_instance_validator.d.ts.map +1 -0
- package/dest/msg_validators/tx_validator/contract_instance_validator.js +48 -0
- package/dest/msg_validators/tx_validator/double_spend_validator.d.ts +13 -3
- package/dest/msg_validators/tx_validator/double_spend_validator.d.ts.map +1 -1
- package/dest/msg_validators/tx_validator/double_spend_validator.js +4 -4
- package/dest/msg_validators/tx_validator/factory.d.ts +125 -6
- package/dest/msg_validators/tx_validator/factory.d.ts.map +1 -1
- package/dest/msg_validators/tx_validator/factory.js +233 -59
- package/dest/msg_validators/tx_validator/fee_payer_balance.d.ts +1 -1
- package/dest/msg_validators/tx_validator/fee_payer_balance.d.ts.map +1 -1
- package/dest/msg_validators/tx_validator/fee_payer_balance.js +6 -2
- package/dest/msg_validators/tx_validator/gas_validator.d.ts +67 -3
- package/dest/msg_validators/tx_validator/gas_validator.d.ts.map +1 -1
- package/dest/msg_validators/tx_validator/gas_validator.js +104 -37
- package/dest/msg_validators/tx_validator/index.d.ts +3 -1
- package/dest/msg_validators/tx_validator/index.d.ts.map +1 -1
- package/dest/msg_validators/tx_validator/index.js +2 -0
- package/dest/msg_validators/tx_validator/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 +2 -2
- package/dest/msg_validators/tx_validator/phases_validator.d.ts.map +1 -1
- package/dest/msg_validators/tx_validator/phases_validator.js +44 -23
- package/dest/msg_validators/tx_validator/timestamp_validator.d.ts +20 -4
- package/dest/msg_validators/tx_validator/timestamp_validator.d.ts.map +1 -1
- package/dest/msg_validators/tx_validator/timestamp_validator.js +6 -6
- package/dest/services/dummy_service.d.ts +9 -5
- package/dest/services/dummy_service.d.ts.map +1 -1
- package/dest/services/dummy_service.js +7 -4
- 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/topic_score_params.d.ts +18 -6
- package/dest/services/gossipsub/topic_score_params.d.ts.map +1 -1
- package/dest/services/gossipsub/topic_score_params.js +32 -10
- package/dest/services/libp2p/libp2p_service.d.ts +25 -14
- package/dest/services/libp2p/libp2p_service.d.ts.map +1 -1
- package/dest/services/libp2p/libp2p_service.js +158 -123
- package/dest/services/reqresp/batch-tx-requester/batch_tx_requester.d.ts +4 -3
- package/dest/services/reqresp/batch-tx-requester/batch_tx_requester.d.ts.map +1 -1
- package/dest/services/reqresp/batch-tx-requester/batch_tx_requester.js +5 -9
- package/dest/services/reqresp/batch-tx-requester/interface.d.ts +2 -6
- package/dest/services/reqresp/batch-tx-requester/interface.d.ts.map +1 -1
- package/dest/services/reqresp/batch-tx-requester/missing_txs.d.ts +10 -13
- package/dest/services/reqresp/batch-tx-requester/missing_txs.d.ts.map +1 -1
- package/dest/services/reqresp/batch-tx-requester/missing_txs.js +25 -46
- package/dest/services/reqresp/batch-tx-requester/tx_validator.js +2 -2
- package/dest/services/reqresp/interface.d.ts +10 -1
- package/dest/services/reqresp/interface.d.ts.map +1 -1
- package/dest/services/reqresp/interface.js +15 -1
- package/dest/services/reqresp/protocols/block_txs/block_txs_handler.d.ts +3 -3
- package/dest/services/reqresp/protocols/block_txs/block_txs_handler.d.ts.map +1 -1
- package/dest/services/reqresp/protocols/block_txs/block_txs_reqresp.d.ts +7 -1
- 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 +15 -0
- 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 +1 -1
- package/dest/services/reqresp/reqresp.d.ts.map +1 -1
- package/dest/services/reqresp/reqresp.js +11 -4
- package/dest/services/service.d.ts +22 -3
- package/dest/services/service.d.ts.map +1 -1
- package/dest/services/tx_collection/config.d.ts +19 -1
- package/dest/services/tx_collection/config.d.ts.map +1 -1
- package/dest/services/tx_collection/config.js +46 -0
- package/dest/services/tx_collection/fast_tx_collection.d.ts +3 -1
- package/dest/services/tx_collection/fast_tx_collection.d.ts.map +1 -1
- package/dest/services/tx_collection/fast_tx_collection.js +56 -36
- 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 +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 +2 -1
- 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 +7 -6
- package/dest/services/tx_collection/proposal_tx_collector.d.ts.map +1 -1
- package/dest/services/tx_collection/proposal_tx_collector.js +5 -4
- package/dest/services/tx_collection/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 +23 -10
- package/dest/services/tx_collection/tx_collection.d.ts.map +1 -1
- package/dest/services/tx_collection/tx_collection.js +75 -3
- 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 +1 -3
- package/dest/services/tx_file_store/config.d.ts.map +1 -1
- package/dest/services/tx_file_store/config.js +0 -4
- package/dest/services/tx_file_store/tx_file_store.d.ts +4 -3
- package/dest/services/tx_file_store/tx_file_store.d.ts.map +1 -1
- package/dest/services/tx_file_store/tx_file_store.js +9 -6
- 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/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 +2 -2
- package/dest/test-helpers/testbench-utils.d.ts +35 -24
- package/dest/test-helpers/testbench-utils.d.ts.map +1 -1
- package/dest/test-helpers/testbench-utils.js +95 -36
- package/dest/testbench/p2p_client_testbench_worker.d.ts +2 -2
- package/dest/testbench/p2p_client_testbench_worker.d.ts.map +1 -1
- package/dest/testbench/p2p_client_testbench_worker.js +16 -15
- package/dest/testbench/worker_client_manager.d.ts +3 -1
- package/dest/testbench/worker_client_manager.d.ts.map +1 -1
- package/dest/testbench/worker_client_manager.js +4 -1
- package/dest/util.d.ts +2 -2
- package/dest/util.d.ts.map +1 -1
- package/package.json +14 -14
- package/src/client/factory.ts +77 -23
- package/src/client/interface.ts +43 -33
- package/src/client/p2p_client.ts +165 -265
- package/src/client/test/tx_proposal_collector/proposal_tx_collector_worker.ts +19 -10
- package/src/config.ts +139 -33
- package/src/errors/tx-pool.error.ts +12 -0
- package/src/index.ts +1 -0
- package/src/mem_pools/attestation_pool/attestation_pool.ts +95 -44
- package/src/mem_pools/attestation_pool/attestation_pool_test_suite.ts +57 -53
- package/src/mem_pools/attestation_pool/index.ts +3 -3
- package/src/mem_pools/attestation_pool/mocks.ts +2 -1
- package/src/mem_pools/index.ts +3 -0
- package/src/mem_pools/interface.ts +2 -2
- 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/priority.ts +4 -4
- package/src/mem_pools/tx_pool/tx_pool_test_suite.ts +3 -1
- package/src/mem_pools/tx_pool_v2/README.md +85 -11
- package/src/mem_pools/tx_pool_v2/deleted_pool.ts +321 -0
- package/src/mem_pools/tx_pool_v2/eviction/eviction_manager.ts +21 -8
- package/src/mem_pools/tx_pool_v2/eviction/fee_payer_balance_eviction_rule.ts +5 -2
- package/src/mem_pools/tx_pool_v2/eviction/fee_payer_balance_pre_add_rule.ts +18 -4
- package/src/mem_pools/tx_pool_v2/eviction/index.ts +4 -0
- package/src/mem_pools/tx_pool_v2/eviction/interfaces.ts +59 -4
- package/src/mem_pools/tx_pool_v2/eviction/invalid_txs_after_mining_rule.ts +5 -5
- package/src/mem_pools/tx_pool_v2/eviction/invalid_txs_after_reorg_rule.ts +5 -5
- package/src/mem_pools/tx_pool_v2/eviction/low_priority_eviction_rule.ts +14 -9
- package/src/mem_pools/tx_pool_v2/eviction/low_priority_pre_add_rule.ts +33 -6
- package/src/mem_pools/tx_pool_v2/eviction/nullifier_conflict_rule.ts +4 -3
- package/src/mem_pools/tx_pool_v2/index.ts +2 -1
- package/src/mem_pools/tx_pool_v2/instrumentation.ts +69 -0
- package/src/mem_pools/tx_pool_v2/interfaces.ts +23 -8
- package/src/mem_pools/tx_pool_v2/tx_metadata.ts +189 -23
- package/src/mem_pools/tx_pool_v2/tx_pool_indices.ts +43 -16
- package/src/mem_pools/tx_pool_v2/tx_pool_v2.ts +18 -7
- package/src/mem_pools/tx_pool_v2/tx_pool_v2_impl.ts +379 -182
- package/src/msg_validators/proposal_validator/block_proposal_validator.ts +14 -4
- package/src/msg_validators/proposal_validator/checkpoint_proposal_validator.ts +20 -7
- package/src/msg_validators/proposal_validator/proposal_validator.ts +63 -40
- 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/allowed_public_setup.ts +22 -27
- package/src/msg_validators/tx_validator/allowed_setup_helpers.ts +31 -0
- package/src/msg_validators/tx_validator/block_header_validator.ts +15 -3
- package/src/msg_validators/tx_validator/contract_instance_validator.ts +56 -0
- package/src/msg_validators/tx_validator/double_spend_validator.ts +11 -6
- package/src/msg_validators/tx_validator/factory.ts +373 -77
- package/src/msg_validators/tx_validator/fee_payer_balance.ts +6 -2
- package/src/msg_validators/tx_validator/gas_validator.ts +123 -27
- package/src/msg_validators/tx_validator/index.ts +2 -0
- package/src/msg_validators/tx_validator/nullifier_cache.ts +30 -0
- package/src/msg_validators/tx_validator/phases_validator.ts +51 -26
- package/src/msg_validators/tx_validator/timestamp_validator.ts +23 -18
- package/src/services/dummy_service.ts +12 -6
- package/src/services/encoding.ts +9 -9
- package/src/services/gossipsub/README.md +29 -14
- package/src/services/gossipsub/topic_score_params.ts +49 -13
- package/src/services/libp2p/libp2p_service.ts +170 -132
- package/src/services/reqresp/batch-tx-requester/batch_tx_requester.ts +6 -6
- package/src/services/reqresp/batch-tx-requester/interface.ts +1 -5
- package/src/services/reqresp/batch-tx-requester/missing_txs.ts +23 -71
- package/src/services/reqresp/batch-tx-requester/tx_validator.ts +2 -2
- package/src/services/reqresp/interface.ts +26 -1
- package/src/services/reqresp/protocols/block_txs/block_txs_handler.ts +2 -2
- package/src/services/reqresp/protocols/block_txs/block_txs_reqresp.ts +17 -0
- package/src/services/reqresp/protocols/tx.ts +22 -0
- package/src/services/reqresp/reqresp.ts +13 -3
- package/src/services/service.ts +31 -2
- package/src/services/tx_collection/config.ts +68 -0
- package/src/services/tx_collection/fast_tx_collection.ts +65 -32
- 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 +1 -0
- package/src/services/tx_collection/instrumentation.ts +7 -1
- package/src/services/tx_collection/missing_txs_tracker.ts +52 -0
- package/src/services/tx_collection/proposal_tx_collector.ts +8 -7
- package/src/services/tx_collection/slow_tx_collection.ts +66 -33
- package/src/services/tx_collection/tx_collection.ts +113 -16
- 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 +0 -6
- package/src/services/tx_file_store/tx_file_store.ts +10 -8
- package/src/services/tx_provider.ts +10 -9
- 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 +2 -5
- package/src/test-helpers/testbench-utils.ts +109 -40
- package/src/testbench/p2p_client_testbench_worker.ts +24 -20
- package/src/testbench/worker_client_manager.ts +11 -4
- package/src/util.ts +7 -1
- package/dest/msg_validators/proposal_validator/proposal_validator_test_suite.d.ts +0 -23
- package/dest/msg_validators/proposal_validator/proposal_validator_test_suite.d.ts.map +0 -1
- package/dest/msg_validators/proposal_validator/proposal_validator_test_suite.js +0 -212
- package/src/msg_validators/proposal_validator/proposal_validator_test_suite.ts +0 -230
package/dest/util.d.ts
CHANGED
|
@@ -10,7 +10,7 @@ import type { Libp2p } from 'libp2p';
|
|
|
10
10
|
import type { P2PConfig } from './config.js';
|
|
11
11
|
export interface PubSubLibp2p extends Pick<Libp2p, 'status' | 'start' | 'stop' | 'peerId'> {
|
|
12
12
|
services: {
|
|
13
|
-
pubsub: Pick<GossipSub, 'addEventListener' | 'removeEventListener' | 'publish' | 'subscribe' | 'reportMessageValidationResult' | 'direct'> & {
|
|
13
|
+
pubsub: Pick<GossipSub, 'addEventListener' | 'removeEventListener' | 'publish' | 'subscribe' | 'reportMessageValidationResult' | 'direct' | 'getMeshPeers'> & {
|
|
14
14
|
score: Pick<GossipSub['score'], 'score'>;
|
|
15
15
|
};
|
|
16
16
|
};
|
|
@@ -58,4 +58,4 @@ export declare function getPeerIdPrivateKey(config: {
|
|
|
58
58
|
* @returns The peer ID.
|
|
59
59
|
*/
|
|
60
60
|
export declare function createLibP2PPeerIdFromPrivateKey(privateKey: string): Promise<PeerId>;
|
|
61
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
61
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidXRpbC5kLnRzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vc3JjL3V0aWwudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsT0FBTyxFQUFFLFdBQVcsRUFBRSxNQUFNLDBCQUEwQixDQUFDO0FBQ3ZELE9BQU8sS0FBSyxFQUFFLE1BQU0sRUFBRSxNQUFNLHVCQUF1QixDQUFDO0FBQ3BELE9BQU8sS0FBSyxFQUFFLGlCQUFpQixFQUF1QixNQUFNLGlCQUFpQixDQUFDO0FBQzlFLE9BQU8sS0FBSyxFQUFFLGVBQWUsRUFBRSxNQUFNLHdCQUF3QixDQUFDO0FBRTlELE9BQU8sS0FBSyxFQUFFLFNBQVMsRUFBRSxNQUFNLDZCQUE2QixDQUFDO0FBRTdELE9BQU8sS0FBSyxFQUFFLFFBQVEsRUFBRSxNQUFNLGtCQUFrQixDQUFDO0FBQ2pELE9BQU8sS0FBSyxFQUFFLE1BQU0sRUFBYyxNQUFNLG1CQUFtQixDQUFDO0FBQzVELE9BQU8sS0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,iBAAiB,EACxB,MAAM,EAAE,MAAM,GACb,OAAO,CAAC,WAAW,CAAC,MAAM,CAAC,CAAC,CA2D9B;AAED;;;;GAIG;AACH,wBAAsB,gCAAgC,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAS1F"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aztec/p2p",
|
|
3
|
-
"version": "0.0.1-commit.
|
|
3
|
+
"version": "0.0.1-commit.f81dbcf",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"exports": {
|
|
6
6
|
".": "./dest/index.js",
|
|
@@ -67,17 +67,17 @@
|
|
|
67
67
|
]
|
|
68
68
|
},
|
|
69
69
|
"dependencies": {
|
|
70
|
-
"@aztec/constants": "0.0.1-commit.
|
|
71
|
-
"@aztec/epoch-cache": "0.0.1-commit.
|
|
72
|
-
"@aztec/ethereum": "0.0.1-commit.
|
|
73
|
-
"@aztec/foundation": "0.0.1-commit.
|
|
74
|
-
"@aztec/kv-store": "0.0.1-commit.
|
|
75
|
-
"@aztec/noir-contracts.js": "0.0.1-commit.
|
|
76
|
-
"@aztec/noir-protocol-circuits-types": "0.0.1-commit.
|
|
77
|
-
"@aztec/protocol-contracts": "0.0.1-commit.
|
|
78
|
-
"@aztec/simulator": "0.0.1-commit.
|
|
79
|
-
"@aztec/stdlib": "0.0.1-commit.
|
|
80
|
-
"@aztec/telemetry-client": "0.0.1-commit.
|
|
70
|
+
"@aztec/constants": "0.0.1-commit.f81dbcf",
|
|
71
|
+
"@aztec/epoch-cache": "0.0.1-commit.f81dbcf",
|
|
72
|
+
"@aztec/ethereum": "0.0.1-commit.f81dbcf",
|
|
73
|
+
"@aztec/foundation": "0.0.1-commit.f81dbcf",
|
|
74
|
+
"@aztec/kv-store": "0.0.1-commit.f81dbcf",
|
|
75
|
+
"@aztec/noir-contracts.js": "0.0.1-commit.f81dbcf",
|
|
76
|
+
"@aztec/noir-protocol-circuits-types": "0.0.1-commit.f81dbcf",
|
|
77
|
+
"@aztec/protocol-contracts": "0.0.1-commit.f81dbcf",
|
|
78
|
+
"@aztec/simulator": "0.0.1-commit.f81dbcf",
|
|
79
|
+
"@aztec/stdlib": "0.0.1-commit.f81dbcf",
|
|
80
|
+
"@aztec/telemetry-client": "0.0.1-commit.f81dbcf",
|
|
81
81
|
"@chainsafe/libp2p-gossipsub": "13.0.0",
|
|
82
82
|
"@chainsafe/libp2p-noise": "^15.0.0",
|
|
83
83
|
"@chainsafe/libp2p-yamux": "^6.0.2",
|
|
@@ -104,8 +104,8 @@
|
|
|
104
104
|
"xxhash-wasm": "^1.1.0"
|
|
105
105
|
},
|
|
106
106
|
"devDependencies": {
|
|
107
|
-
"@aztec/archiver": "0.0.1-commit.
|
|
108
|
-
"@aztec/world-state": "0.0.1-commit.
|
|
107
|
+
"@aztec/archiver": "0.0.1-commit.f81dbcf",
|
|
108
|
+
"@aztec/world-state": "0.0.1-commit.f81dbcf",
|
|
109
109
|
"@jest/globals": "^30.0.0",
|
|
110
110
|
"@types/jest": "^30.0.0",
|
|
111
111
|
"@types/node": "^22.15.17",
|
package/src/client/factory.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { EpochCacheInterface } from '@aztec/epoch-cache';
|
|
2
|
+
import { BlockNumber } from '@aztec/foundation/branded-types';
|
|
2
3
|
import { type Logger, createLogger } from '@aztec/foundation/log';
|
|
3
4
|
import { DateProvider } from '@aztec/foundation/timer';
|
|
4
5
|
import type { AztecAsyncKVStore } from '@aztec/kv-store';
|
|
@@ -7,29 +8,32 @@ import { AztecLMDBStoreV2, createStore } from '@aztec/kv-store/lmdb-v2';
|
|
|
7
8
|
import type { L2BlockSource } from '@aztec/stdlib/block';
|
|
8
9
|
import type { ChainConfig } from '@aztec/stdlib/config';
|
|
9
10
|
import type { ContractDataSource } from '@aztec/stdlib/contract';
|
|
10
|
-
import type { ClientProtocolCircuitVerifier, WorldStateSynchronizer } from '@aztec/stdlib/interfaces/server';
|
|
11
|
-
import { P2PClientType } from '@aztec/stdlib/p2p';
|
|
11
|
+
import type { AztecNode, ClientProtocolCircuitVerifier, WorldStateSynchronizer } from '@aztec/stdlib/interfaces/server';
|
|
12
12
|
import { type TelemetryClient, getTelemetryClient } from '@aztec/telemetry-client';
|
|
13
13
|
|
|
14
14
|
import { P2PClient } from '../client/p2p_client.js';
|
|
15
15
|
import type { P2PConfig } from '../config.js';
|
|
16
16
|
import { AttestationPool, type AttestationPoolApi } from '../mem_pools/attestation_pool/attestation_pool.js';
|
|
17
17
|
import type { MemPools } from '../mem_pools/interface.js';
|
|
18
|
-
import {
|
|
18
|
+
import type { TxPoolV2 } from '../mem_pools/tx_pool_v2/interfaces.js';
|
|
19
|
+
import { AztecKVTxPoolV2 } from '../mem_pools/tx_pool_v2/tx_pool_v2.js';
|
|
20
|
+
import { createTxValidatorForTransactionsEnteringPendingTxPool } from '../msg_validators/index.js';
|
|
19
21
|
import { DummyP2PService } from '../services/dummy_service.js';
|
|
20
22
|
import { LibP2PService } from '../services/index.js';
|
|
23
|
+
import { createFileStoreTxSources } from '../services/tx_collection/file_store_tx_source.js';
|
|
21
24
|
import { TxCollection } from '../services/tx_collection/tx_collection.js';
|
|
22
|
-
import { type TxSource, createNodeRpcTxSources } from '../services/tx_collection/tx_source.js';
|
|
25
|
+
import { NodeRpcTxSource, type TxSource, createNodeRpcTxSources } from '../services/tx_collection/tx_source.js';
|
|
23
26
|
import { TxFileStore } from '../services/tx_file_store/tx_file_store.js';
|
|
24
27
|
import { configureP2PClientAddresses, createLibP2PPeerIdFromPrivateKey, getPeerIdPrivateKey } from '../util.js';
|
|
25
28
|
|
|
26
|
-
export type P2PClientDeps
|
|
27
|
-
txPool?:
|
|
29
|
+
export type P2PClientDeps = {
|
|
30
|
+
txPool?: TxPoolV2;
|
|
28
31
|
store?: AztecAsyncKVStore;
|
|
29
32
|
attestationPool?: AttestationPoolApi;
|
|
30
33
|
logger?: Logger;
|
|
31
34
|
txCollectionNodeSources?: TxSource[];
|
|
32
|
-
|
|
35
|
+
rpcTxProviders?: AztecNode[];
|
|
36
|
+
p2pServiceFactory?: (...args: Parameters<(typeof LibP2PService)['new']>) => Promise<LibP2PService>;
|
|
33
37
|
};
|
|
34
38
|
|
|
35
39
|
export const P2P_STORE_NAME = 'p2p';
|
|
@@ -37,8 +41,7 @@ export const P2P_ARCHIVE_STORE_NAME = 'p2p-archive';
|
|
|
37
41
|
export const P2P_PEER_STORE_NAME = 'p2p-peers';
|
|
38
42
|
export const P2P_ATTESTATION_STORE_NAME = 'p2p-attestation';
|
|
39
43
|
|
|
40
|
-
export async function createP2PClient
|
|
41
|
-
clientType: T,
|
|
44
|
+
export async function createP2PClient(
|
|
42
45
|
inputConfig: P2PConfig & DataStoreConfig & ChainConfig,
|
|
43
46
|
archiver: L2BlockSource & ContractDataSource,
|
|
44
47
|
proofVerifier: ClientProtocolCircuitVerifier,
|
|
@@ -47,7 +50,7 @@ export async function createP2PClient<T extends P2PClientType>(
|
|
|
47
50
|
packageVersion: string,
|
|
48
51
|
dateProvider: DateProvider = new DateProvider(),
|
|
49
52
|
telemetry: TelemetryClient = getTelemetryClient(),
|
|
50
|
-
deps: P2PClientDeps
|
|
53
|
+
deps: P2PClientDeps = {},
|
|
51
54
|
) {
|
|
52
55
|
const config = await configureP2PClientAddresses({
|
|
53
56
|
...inputConfig,
|
|
@@ -69,19 +72,51 @@ export async function createP2PClient<T extends P2PClientType>(
|
|
|
69
72
|
const attestationStore = await createStore(P2P_ATTESTATION_STORE_NAME, 1, config, bindings);
|
|
70
73
|
const l1Constants = await archiver.getL1Constants();
|
|
71
74
|
|
|
72
|
-
const
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
75
|
+
const rollupAddress = inputConfig.l1Contracts.rollupAddress.toString().toLowerCase().replace(/^0x/, '');
|
|
76
|
+
const txFileStoreBasePath = `aztec-${inputConfig.l1ChainId}-${inputConfig.rollupVersion}-0x${rollupAddress}`;
|
|
77
|
+
|
|
78
|
+
const txPool =
|
|
79
|
+
deps.txPool ??
|
|
80
|
+
new AztecKVTxPoolV2(
|
|
81
|
+
store,
|
|
82
|
+
archive,
|
|
83
|
+
{
|
|
84
|
+
l2BlockSource: archiver,
|
|
85
|
+
worldStateSynchronizer,
|
|
86
|
+
createTxValidator: async () => {
|
|
87
|
+
// We accept transactions if they are not expired by the next slot and block number (checked based on the ExpirationTimestamp field)
|
|
88
|
+
const currentBlockNumber = await archiver.getBlockNumber();
|
|
89
|
+
const { ts: nextSlotTimestamp } = epochCache.getEpochAndSlotInNextL1Slot();
|
|
90
|
+
const l1Constants = await archiver.getL1Constants();
|
|
91
|
+
return createTxValidatorForTransactionsEnteringPendingTxPool(
|
|
92
|
+
worldStateSynchronizer,
|
|
93
|
+
nextSlotTimestamp,
|
|
94
|
+
BlockNumber(currentBlockNumber + 1),
|
|
95
|
+
{
|
|
96
|
+
rollupManaLimit: l1Constants.rollupManaLimit,
|
|
97
|
+
maxBlockL2Gas: config.validateMaxL2BlockGas,
|
|
98
|
+
maxBlockDAGas: config.validateMaxDABlockGas,
|
|
99
|
+
},
|
|
100
|
+
);
|
|
101
|
+
},
|
|
102
|
+
},
|
|
103
|
+
telemetry,
|
|
104
|
+
{
|
|
76
105
|
maxPendingTxCount: config.maxPendingTxCount,
|
|
77
106
|
archivedTxLimit: config.archivedTxLimit,
|
|
78
|
-
|
|
107
|
+
minTxPoolAgeMs: config.minTxPoolAgeMs,
|
|
108
|
+
priceBumpPercentage: config.priceBumpPercentage,
|
|
109
|
+
},
|
|
110
|
+
dateProvider,
|
|
111
|
+
);
|
|
112
|
+
|
|
113
|
+
const mempools: MemPools = {
|
|
114
|
+
txPool,
|
|
79
115
|
attestationPool: deps.attestationPool ?? new AttestationPool(attestationStore, telemetry),
|
|
80
116
|
};
|
|
81
117
|
|
|
82
|
-
const p2pService = await createP2PService
|
|
118
|
+
const p2pService = await createP2PService(
|
|
83
119
|
config,
|
|
84
|
-
clientType,
|
|
85
120
|
archiver,
|
|
86
121
|
proofVerifier,
|
|
87
122
|
worldStateSynchronizer,
|
|
@@ -97,6 +132,7 @@ export async function createP2PClient<T extends P2PClientType>(
|
|
|
97
132
|
|
|
98
133
|
const nodeSources = [
|
|
99
134
|
...createNodeRpcTxSources(config.txCollectionNodeRpcUrls, config),
|
|
135
|
+
...(deps.rpcTxProviders ?? []).map((node, i) => new NodeRpcTxSource(node, `node-rpc-provider-${i}`)),
|
|
100
136
|
...(deps.txCollectionNodeSources ?? []),
|
|
101
137
|
];
|
|
102
138
|
if (nodeSources.length > 0) {
|
|
@@ -105,36 +141,54 @@ export async function createP2PClient<T extends P2PClientType>(
|
|
|
105
141
|
});
|
|
106
142
|
}
|
|
107
143
|
|
|
144
|
+
const fileStoreSources = await createFileStoreTxSources(
|
|
145
|
+
config.txCollectionFileStoreUrls,
|
|
146
|
+
txFileStoreBasePath,
|
|
147
|
+
logger.createChild('file-store-tx-source'),
|
|
148
|
+
telemetry,
|
|
149
|
+
);
|
|
150
|
+
if (fileStoreSources.length > 0) {
|
|
151
|
+
logger.info(`Using ${fileStoreSources.length} file store sources for tx collection.`, {
|
|
152
|
+
stores: fileStoreSources.map(s => s.getInfo()),
|
|
153
|
+
});
|
|
154
|
+
}
|
|
155
|
+
|
|
108
156
|
const txCollection = new TxCollection(
|
|
109
157
|
p2pService.getBatchTxRequesterService(),
|
|
110
158
|
nodeSources,
|
|
111
159
|
l1Constants,
|
|
112
160
|
mempools.txPool,
|
|
113
161
|
config,
|
|
162
|
+
fileStoreSources,
|
|
114
163
|
dateProvider,
|
|
115
164
|
telemetry,
|
|
116
165
|
logger.createChild('tx-collection'),
|
|
117
166
|
);
|
|
118
167
|
|
|
119
|
-
const txFileStore = await TxFileStore.create(
|
|
168
|
+
const txFileStore = await TxFileStore.create(
|
|
169
|
+
mempools.txPool,
|
|
170
|
+
config,
|
|
171
|
+
txFileStoreBasePath,
|
|
172
|
+
logger.createChild('tx-file-store'),
|
|
173
|
+
telemetry,
|
|
174
|
+
);
|
|
120
175
|
|
|
121
176
|
return new P2PClient(
|
|
122
|
-
clientType,
|
|
123
177
|
store,
|
|
124
178
|
archiver,
|
|
125
179
|
mempools,
|
|
126
180
|
p2pService,
|
|
127
181
|
txCollection,
|
|
128
182
|
txFileStore,
|
|
183
|
+
epochCache,
|
|
129
184
|
config,
|
|
130
185
|
dateProvider,
|
|
131
186
|
telemetry,
|
|
132
187
|
);
|
|
133
188
|
}
|
|
134
189
|
|
|
135
|
-
async function createP2PService
|
|
190
|
+
async function createP2PService(
|
|
136
191
|
config: P2PConfig & DataStoreConfig,
|
|
137
|
-
clientType: T,
|
|
138
192
|
archiver: L2BlockSource & ContractDataSource,
|
|
139
193
|
proofVerifier: ClientProtocolCircuitVerifier,
|
|
140
194
|
worldStateSynchronizer: WorldStateSynchronizer,
|
|
@@ -142,7 +196,7 @@ async function createP2PService<T extends P2PClientType>(
|
|
|
142
196
|
store: AztecAsyncKVStore,
|
|
143
197
|
peerStore: AztecLMDBStoreV2,
|
|
144
198
|
mempools: MemPools,
|
|
145
|
-
p2pServiceFactory: P2PClientDeps
|
|
199
|
+
p2pServiceFactory: P2PClientDeps['p2pServiceFactory'],
|
|
146
200
|
packageVersion: string,
|
|
147
201
|
logger: Logger,
|
|
148
202
|
telemetry: TelemetryClient,
|
|
@@ -158,7 +212,7 @@ async function createP2PService<T extends P2PClientType>(
|
|
|
158
212
|
const peerIdPrivateKey = await getPeerIdPrivateKey(config, store, logger);
|
|
159
213
|
const peerId = await createLibP2PPeerIdFromPrivateKey(peerIdPrivateKey.getValue());
|
|
160
214
|
|
|
161
|
-
const p2pService = await (p2pServiceFactory ?? LibP2PService.new
|
|
215
|
+
const p2pService = await (p2pServiceFactory ?? LibP2PService.new)(config, peerId, {
|
|
162
216
|
packageVersion,
|
|
163
217
|
mempools,
|
|
164
218
|
l2BlockSource: archiver,
|
package/src/client/interface.ts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
|
+
import type { SlotNumber } from '@aztec/foundation/branded-types';
|
|
1
2
|
import type { EthAddress, L2BlockId } from '@aztec/stdlib/block';
|
|
2
|
-
import type {
|
|
3
|
-
import type { BlockProposal, CheckpointAttestation, CheckpointProposal,
|
|
4
|
-
import type { Tx, TxHash } from '@aztec/stdlib/tx';
|
|
3
|
+
import type { ITxProvider, P2PClient } from '@aztec/stdlib/interfaces/server';
|
|
4
|
+
import type { BlockProposal, CheckpointAttestation, CheckpointProposal, TopicType } from '@aztec/stdlib/p2p';
|
|
5
|
+
import type { BlockHeader, Tx, TxHash } from '@aztec/stdlib/tx';
|
|
5
6
|
|
|
6
7
|
import type { PeerId } from '@libp2p/interface';
|
|
7
8
|
import type { ENR } from '@nethermindeth/enr';
|
|
@@ -14,6 +15,7 @@ import type {
|
|
|
14
15
|
ReqRespSubProtocolValidators,
|
|
15
16
|
} from '../services/reqresp/interface.js';
|
|
16
17
|
import type {
|
|
18
|
+
DuplicateAttestationInfo,
|
|
17
19
|
DuplicateProposalInfo,
|
|
18
20
|
P2PBlockReceivedCallback,
|
|
19
21
|
P2PCheckpointReceivedCallback,
|
|
@@ -46,7 +48,7 @@ export interface P2PSyncState {
|
|
|
46
48
|
/**
|
|
47
49
|
* Interface of a P2P client.
|
|
48
50
|
**/
|
|
49
|
-
export type P2P
|
|
51
|
+
export type P2P = P2PClient & {
|
|
50
52
|
/**
|
|
51
53
|
* Broadcasts a block proposal to other peers.
|
|
52
54
|
*
|
|
@@ -91,12 +93,13 @@ export type P2P<T extends P2PClientType = P2PClientType.Full> = P2PApiFull<T> &
|
|
|
91
93
|
registerDuplicateProposalCallback(callback: (info: DuplicateProposalInfo) => void): void;
|
|
92
94
|
|
|
93
95
|
/**
|
|
94
|
-
*
|
|
95
|
-
*
|
|
96
|
-
*
|
|
97
|
-
*
|
|
96
|
+
* Registers a callback invoked when a duplicate attestation is detected (equivocation).
|
|
97
|
+
* A validator signing attestations for different proposals at the same slot.
|
|
98
|
+
* The callback is triggered on the first duplicate (when count goes from 1 to 2).
|
|
99
|
+
*
|
|
100
|
+
* @param callback - Function called with info about the duplicate attestation
|
|
98
101
|
*/
|
|
99
|
-
|
|
102
|
+
registerDuplicateAttestationCallback(callback: (info: DuplicateAttestationInfo) => void): void;
|
|
100
103
|
|
|
101
104
|
/**
|
|
102
105
|
* Verifies the 'tx' and, if valid, adds it to local tx pool and forwards it to other peers.
|
|
@@ -105,18 +108,10 @@ export type P2P<T extends P2PClientType = P2PClientType.Full> = P2PApiFull<T> &
|
|
|
105
108
|
sendTx(tx: Tx): Promise<void>;
|
|
106
109
|
|
|
107
110
|
/**
|
|
108
|
-
*
|
|
109
|
-
* @param
|
|
110
|
-
* @returns The number of txs added to the pool. Note if the transaction already exists, it will not be added again.
|
|
111
|
-
**/
|
|
112
|
-
addTxsToPool(txs: Tx[]): Promise<number>;
|
|
113
|
-
|
|
114
|
-
/**
|
|
115
|
-
* Deletes 'txs' from the pool, given hashes.
|
|
116
|
-
* NOT used if we use sendTx as reconcileTxPool will handle this.
|
|
117
|
-
* @param txHashes - Hashes to check.
|
|
111
|
+
* Handles failed transaction execution by removing txs from the pool.
|
|
112
|
+
* @param txHashes - Hashes of the transactions that failed execution.
|
|
118
113
|
**/
|
|
119
|
-
|
|
114
|
+
handleFailedExecution(txHashes: TxHash[]): Promise<void>;
|
|
120
115
|
|
|
121
116
|
/**
|
|
122
117
|
* Returns a transaction in the transaction pool by its hash.
|
|
@@ -139,14 +134,6 @@ export type P2P<T extends P2PClientType = P2PClientType.Full> = P2PApiFull<T> &
|
|
|
139
134
|
*/
|
|
140
135
|
hasTxsInPool(txHashes: TxHash[]): Promise<boolean[]>;
|
|
141
136
|
|
|
142
|
-
/**
|
|
143
|
-
* Returns transactions in the transaction pool by hash, requesting from the network if not found.
|
|
144
|
-
* @param txHashes - Hashes of tx to return.
|
|
145
|
-
* @param pinnedPeerId - An optional peer id that will be used to request the tx from (in addition to other random peers).
|
|
146
|
-
* @returns An array of tx or undefined.
|
|
147
|
-
*/
|
|
148
|
-
getTxsByHash(txHashes: TxHash[], pinnedPeerId: PeerId | undefined): Promise<(Tx | undefined)[]>;
|
|
149
|
-
|
|
150
137
|
/**
|
|
151
138
|
* Returns an archived transaction from the transaction pool by its hash.
|
|
152
139
|
* @param txHash - Hash of tx to return.
|
|
@@ -164,14 +151,28 @@ export type P2P<T extends P2PClientType = P2PClientType.Full> = P2PApiFull<T> &
|
|
|
164
151
|
/** Returns an iterator over pending txs on the mempool. */
|
|
165
152
|
iteratePendingTxs(): AsyncIterableIterator<Tx>;
|
|
166
153
|
|
|
154
|
+
/** Returns an iterator over pending txs that have been in the pool long enough to be eligible for block building. */
|
|
155
|
+
iterateEligiblePendingTxs(): AsyncIterableIterator<Tx>;
|
|
156
|
+
|
|
167
157
|
/** Returns the number of pending txs in the mempool. */
|
|
168
158
|
getPendingTxCount(): Promise<number>;
|
|
169
159
|
|
|
170
160
|
/**
|
|
171
|
-
*
|
|
172
|
-
*
|
|
161
|
+
* Protects existing transactions by hash for a given slot.
|
|
162
|
+
* Returns hashes of transactions that weren't found in the pool.
|
|
163
|
+
* @param txHashes - Hashes of the transactions to protect.
|
|
164
|
+
* @param blockHeader - The block header providing slot context.
|
|
165
|
+
* @returns Hashes of transactions not found in the pool.
|
|
166
|
+
*/
|
|
167
|
+
protectTxs(txHashes: TxHash[], blockHeader: BlockHeader): Promise<TxHash[]>;
|
|
168
|
+
|
|
169
|
+
/**
|
|
170
|
+
* Prepares the pool for a new slot.
|
|
171
|
+
* Unprotects transactions from earlier slots and validates them before
|
|
172
|
+
* returning to pending state.
|
|
173
|
+
* @param slotNumber - The slot number to prepare for
|
|
173
174
|
*/
|
|
174
|
-
|
|
175
|
+
prepareForSlot(slotNumber: SlotNumber): Promise<void>;
|
|
175
176
|
|
|
176
177
|
/**
|
|
177
178
|
* Starts the p2p client.
|
|
@@ -204,10 +205,13 @@ export type P2P<T extends P2PClientType = P2PClientType.Full> = P2PApiFull<T> &
|
|
|
204
205
|
/** Identifies a p2p client. */
|
|
205
206
|
isP2PClient(): true;
|
|
206
207
|
|
|
208
|
+
/** Returns the tx provider used for fetching transactions. */
|
|
209
|
+
getTxProvider(): ITxProvider;
|
|
210
|
+
|
|
207
211
|
updateP2PConfig(config: Partial<P2PConfig>): Promise<void>;
|
|
208
212
|
|
|
209
|
-
/** Validates a set of txs. */
|
|
210
|
-
|
|
213
|
+
/** Validates a set of txs received in a block proposal. */
|
|
214
|
+
validateTxsReceivedInBlockProposal(txs: Tx[]): Promise<void>;
|
|
211
215
|
|
|
212
216
|
/** Clears the db. */
|
|
213
217
|
clear(): Promise<void>;
|
|
@@ -220,6 +224,12 @@ export type P2P<T extends P2PClientType = P2PClientType.Full> = P2PApiFull<T> &
|
|
|
220
224
|
|
|
221
225
|
handleAuthRequestFromPeer(authRequest: AuthRequest, peerId: PeerId): Promise<StatusMessage>;
|
|
222
226
|
|
|
227
|
+
/** Checks if any block proposals exist for the given slot. */
|
|
228
|
+
hasBlockProposalsForSlot(slot: SlotNumber): Promise<boolean>;
|
|
229
|
+
|
|
223
230
|
/** If node running this P2P stack is validator, passes in validator address to P2P layer */
|
|
224
231
|
registerThisValidatorAddresses(address: EthAddress[]): void;
|
|
232
|
+
|
|
233
|
+
/** Returns the number of peers in the GossipSub mesh for a given topic type. */
|
|
234
|
+
getGossipMeshPeerCount(topicType: TopicType): Promise<number>;
|
|
225
235
|
};
|