@aztec/p2p 0.0.1-commit.c7c42ec → 0.0.1-commit.c80b6263
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 +1 -1
- package/dest/client/factory.d.ts.map +1 -1
- package/dest/client/factory.js +6 -5
- package/dest/client/interface.d.ts +18 -5
- package/dest/client/interface.d.ts.map +1 -1
- package/dest/client/p2p_client.d.ts +10 -13
- package/dest/client/p2p_client.d.ts.map +1 -1
- package/dest/client/p2p_client.js +449 -118
- package/dest/client/test/tx_proposal_collector/proposal_tx_collector_worker.d.ts +2 -0
- package/dest/client/test/tx_proposal_collector/proposal_tx_collector_worker.d.ts.map +1 -0
- package/dest/client/test/tx_proposal_collector/proposal_tx_collector_worker.js +305 -0
- package/dest/client/test/tx_proposal_collector/proposal_tx_collector_worker_protocol.d.ts +73 -0
- package/dest/client/test/tx_proposal_collector/proposal_tx_collector_worker_protocol.d.ts.map +1 -0
- package/dest/client/test/tx_proposal_collector/proposal_tx_collector_worker_protocol.js +8 -0
- package/dest/config.d.ts +8 -2
- package/dest/config.d.ts.map +1 -1
- package/dest/config.js +4 -2
- package/dest/mem_pools/attestation_pool/attestation_pool.d.ts +61 -42
- package/dest/mem_pools/attestation_pool/attestation_pool.d.ts.map +1 -1
- package/dest/mem_pools/attestation_pool/attestation_pool_test_suite.d.ts +1 -1
- package/dest/mem_pools/attestation_pool/attestation_pool_test_suite.d.ts.map +1 -1
- package/dest/mem_pools/attestation_pool/attestation_pool_test_suite.js +237 -263
- package/dest/mem_pools/attestation_pool/kv_attestation_pool.d.ts +21 -18
- package/dest/mem_pools/attestation_pool/kv_attestation_pool.d.ts.map +1 -1
- package/dest/mem_pools/attestation_pool/kv_attestation_pool.js +113 -108
- package/dest/mem_pools/attestation_pool/memory_attestation_pool.d.ts +17 -16
- package/dest/mem_pools/attestation_pool/memory_attestation_pool.d.ts.map +1 -1
- package/dest/mem_pools/attestation_pool/memory_attestation_pool.js +89 -128
- package/dest/mem_pools/attestation_pool/mocks.d.ts +9 -6
- package/dest/mem_pools/attestation_pool/mocks.d.ts.map +1 -1
- package/dest/mem_pools/attestation_pool/mocks.js +16 -12
- 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 +5 -14
- package/dest/mem_pools/tx_pool/aztec_kv_tx_pool.d.ts +15 -10
- package/dest/mem_pools/tx_pool/aztec_kv_tx_pool.d.ts.map +1 -1
- package/dest/mem_pools/tx_pool/aztec_kv_tx_pool.js +91 -50
- package/dest/mem_pools/tx_pool/eviction/eviction_manager.d.ts +19 -5
- package/dest/mem_pools/tx_pool/eviction/eviction_manager.d.ts.map +1 -1
- package/dest/mem_pools/tx_pool/eviction/eviction_manager.js +59 -3
- package/dest/mem_pools/tx_pool/eviction/eviction_strategy.d.ts +79 -5
- package/dest/mem_pools/tx_pool/eviction/eviction_strategy.d.ts.map +1 -1
- package/dest/mem_pools/tx_pool/eviction/eviction_strategy.js +47 -0
- package/dest/mem_pools/tx_pool/eviction/fee_payer_balance_eviction_rule.d.ts +16 -0
- package/dest/mem_pools/tx_pool/eviction/fee_payer_balance_eviction_rule.d.ts.map +1 -0
- package/dest/mem_pools/tx_pool/eviction/fee_payer_balance_eviction_rule.js +122 -0
- package/dest/mem_pools/tx_pool/eviction/invalid_txs_after_mining_rule.d.ts +2 -2
- package/dest/mem_pools/tx_pool/eviction/invalid_txs_after_mining_rule.d.ts.map +1 -1
- package/dest/mem_pools/tx_pool/eviction/invalid_txs_after_reorg_rule.d.ts +4 -4
- package/dest/mem_pools/tx_pool/eviction/invalid_txs_after_reorg_rule.d.ts.map +1 -1
- package/dest/mem_pools/tx_pool/eviction/invalid_txs_after_reorg_rule.js +2 -0
- package/dest/mem_pools/tx_pool/eviction/low_priority_eviction_rule.d.ts +2 -2
- package/dest/mem_pools/tx_pool/eviction/low_priority_eviction_rule.d.ts.map +1 -1
- package/dest/mem_pools/tx_pool/eviction/nullifier_conflict_pre_add_rule.d.ts +25 -0
- package/dest/mem_pools/tx_pool/eviction/nullifier_conflict_pre_add_rule.d.ts.map +1 -0
- package/dest/mem_pools/tx_pool/eviction/nullifier_conflict_pre_add_rule.js +57 -0
- package/dest/msg_validators/attestation_validator/attestation_validator.d.ts +4 -4
- package/dest/msg_validators/attestation_validator/attestation_validator.d.ts.map +1 -1
- package/dest/msg_validators/attestation_validator/attestation_validator.js +51 -18
- package/dest/msg_validators/attestation_validator/fisherman_attestation_validator.d.ts +5 -5
- package/dest/msg_validators/attestation_validator/fisherman_attestation_validator.d.ts.map +1 -1
- package/dest/msg_validators/attestation_validator/fisherman_attestation_validator.js +22 -13
- package/dest/msg_validators/clock_tolerance.d.ts +21 -0
- package/dest/msg_validators/clock_tolerance.d.ts.map +1 -0
- package/dest/msg_validators/clock_tolerance.js +37 -0
- package/dest/msg_validators/index.d.ts +2 -2
- package/dest/msg_validators/index.d.ts.map +1 -1
- package/dest/msg_validators/index.js +1 -1
- package/dest/msg_validators/proposal_validator/block_proposal_validator.d.ts +9 -0
- package/dest/msg_validators/proposal_validator/block_proposal_validator.d.ts.map +1 -0
- package/dest/msg_validators/proposal_validator/block_proposal_validator.js +6 -0
- package/dest/msg_validators/proposal_validator/checkpoint_proposal_validator.d.ts +9 -0
- package/dest/msg_validators/proposal_validator/checkpoint_proposal_validator.d.ts.map +1 -0
- package/dest/msg_validators/proposal_validator/checkpoint_proposal_validator.js +6 -0
- package/dest/msg_validators/proposal_validator/index.d.ts +4 -0
- package/dest/msg_validators/proposal_validator/index.d.ts.map +1 -0
- package/dest/msg_validators/proposal_validator/index.js +3 -0
- package/dest/msg_validators/proposal_validator/proposal_validator.d.ts +13 -0
- package/dest/msg_validators/proposal_validator/proposal_validator.d.ts.map +1 -0
- package/dest/msg_validators/proposal_validator/proposal_validator.js +104 -0
- package/dest/msg_validators/proposal_validator/proposal_validator_test_suite.d.ts +23 -0
- package/dest/msg_validators/proposal_validator/proposal_validator_test_suite.d.ts.map +1 -0
- package/dest/msg_validators/proposal_validator/proposal_validator_test_suite.js +212 -0
- package/dest/msg_validators/tx_validator/block_header_validator.d.ts +3 -2
- package/dest/msg_validators/tx_validator/block_header_validator.d.ts.map +1 -1
- package/dest/msg_validators/tx_validator/block_header_validator.js +4 -3
- package/dest/msg_validators/tx_validator/data_validator.d.ts +3 -1
- package/dest/msg_validators/tx_validator/data_validator.d.ts.map +1 -1
- package/dest/msg_validators/tx_validator/data_validator.js +4 -1
- package/dest/msg_validators/tx_validator/double_spend_validator.d.ts +3 -2
- package/dest/msg_validators/tx_validator/double_spend_validator.d.ts.map +1 -1
- package/dest/msg_validators/tx_validator/double_spend_validator.js +3 -2
- package/dest/msg_validators/tx_validator/factory.d.ts +8 -3
- package/dest/msg_validators/tx_validator/factory.d.ts.map +1 -1
- package/dest/msg_validators/tx_validator/factory.js +21 -11
- package/dest/msg_validators/tx_validator/fee_payer_balance.d.ts +10 -0
- package/dest/msg_validators/tx_validator/fee_payer_balance.d.ts.map +1 -0
- package/dest/msg_validators/tx_validator/fee_payer_balance.js +20 -0
- package/dest/msg_validators/tx_validator/gas_validator.d.ts +3 -2
- package/dest/msg_validators/tx_validator/gas_validator.d.ts.map +1 -1
- package/dest/msg_validators/tx_validator/gas_validator.js +11 -16
- package/dest/msg_validators/tx_validator/index.d.ts +2 -1
- package/dest/msg_validators/tx_validator/index.d.ts.map +1 -1
- package/dest/msg_validators/tx_validator/index.js +1 -0
- package/dest/msg_validators/tx_validator/metadata_validator.d.ts +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/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 +8 -0
- package/dest/msg_validators/tx_validator/size_validator.d.ts.map +1 -0
- package/dest/msg_validators/tx_validator/size_validator.js +23 -0
- package/dest/msg_validators/tx_validator/timestamp_validator.d.ts +3 -2
- package/dest/msg_validators/tx_validator/timestamp_validator.d.ts.map +1 -1
- package/dest/msg_validators/tx_validator/timestamp_validator.js +2 -2
- package/dest/msg_validators/tx_validator/tx_permitted_validator.d.ts +3 -2
- package/dest/msg_validators/tx_validator/tx_permitted_validator.d.ts.map +1 -1
- package/dest/msg_validators/tx_validator/tx_permitted_validator.js +2 -2
- package/dest/msg_validators/tx_validator/tx_proof_validator.d.ts +3 -2
- package/dest/msg_validators/tx_validator/tx_proof_validator.d.ts.map +1 -1
- package/dest/msg_validators/tx_validator/tx_proof_validator.js +2 -2
- package/dest/services/discv5/discV5_service.js +1 -1
- package/dest/services/dummy_service.d.ts +18 -2
- package/dest/services/dummy_service.d.ts.map +1 -1
- package/dest/services/dummy_service.js +42 -0
- package/dest/services/encoding.d.ts +1 -1
- package/dest/services/encoding.d.ts.map +1 -1
- package/dest/services/encoding.js +6 -5
- 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 +30 -72
- package/dest/services/libp2p/libp2p_service.d.ts +36 -13
- package/dest/services/libp2p/libp2p_service.d.ts.map +1 -1
- package/dest/services/libp2p/libp2p_service.js +741 -173
- 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 +21 -26
- package/dest/services/peer-manager/peer_manager.d.ts +2 -2
- package/dest/services/peer-manager/peer_manager.d.ts.map +1 -1
- package/dest/services/peer-manager/peer_manager.js +0 -10
- 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 +7 -4
- package/dest/services/reqresp/batch-tx-requester/batch_tx_requester.d.ts +47 -0
- package/dest/services/reqresp/batch-tx-requester/batch_tx_requester.d.ts.map +1 -0
- package/dest/services/reqresp/batch-tx-requester/batch_tx_requester.js +566 -0
- package/dest/services/reqresp/batch-tx-requester/config.d.ts +17 -0
- package/dest/services/reqresp/batch-tx-requester/config.d.ts.map +1 -0
- package/dest/services/reqresp/batch-tx-requester/config.js +27 -0
- package/dest/services/reqresp/batch-tx-requester/interface.d.ts +50 -0
- package/dest/services/reqresp/batch-tx-requester/interface.d.ts.map +1 -0
- package/dest/services/reqresp/batch-tx-requester/interface.js +1 -0
- package/dest/services/reqresp/batch-tx-requester/missing_txs.d.ts +37 -0
- package/dest/services/reqresp/batch-tx-requester/missing_txs.d.ts.map +1 -0
- package/dest/services/reqresp/batch-tx-requester/missing_txs.js +151 -0
- package/dest/services/reqresp/batch-tx-requester/peer_collection.d.ts +54 -0
- package/dest/services/reqresp/batch-tx-requester/peer_collection.d.ts.map +1 -0
- package/dest/services/reqresp/batch-tx-requester/peer_collection.js +139 -0
- package/dest/services/reqresp/batch-tx-requester/tx_validator.d.ts +20 -0
- package/dest/services/reqresp/batch-tx-requester/tx_validator.d.ts.map +1 -0
- package/dest/services/reqresp/batch-tx-requester/tx_validator.js +21 -0
- package/dest/services/reqresp/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/constants.d.ts +12 -0
- package/dest/services/reqresp/constants.d.ts.map +1 -0
- package/dest/services/reqresp/constants.js +7 -0
- package/dest/services/reqresp/interface.d.ts +3 -1
- package/dest/services/reqresp/interface.d.ts.map +1 -1
- package/dest/services/reqresp/metrics.d.ts +6 -5
- package/dest/services/reqresp/metrics.d.ts.map +1 -1
- package/dest/services/reqresp/metrics.js +17 -21
- package/dest/services/reqresp/protocols/block_txs/bitvector.d.ts +5 -1
- package/dest/services/reqresp/protocols/block_txs/bitvector.d.ts.map +1 -1
- package/dest/services/reqresp/protocols/block_txs/bitvector.js +12 -0
- package/dest/services/reqresp/protocols/block_txs/block_txs_handler.d.ts +1 -1
- package/dest/services/reqresp/protocols/block_txs/block_txs_handler.d.ts.map +1 -1
- package/dest/services/reqresp/protocols/block_txs/block_txs_handler.js +14 -1
- package/dest/services/reqresp/protocols/block_txs/block_txs_reqresp.d.ts +15 -3
- 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 +33 -3
- package/dest/services/reqresp/protocols/status.d.ts +1 -1
- package/dest/services/reqresp/protocols/status.d.ts.map +1 -1
- package/dest/services/reqresp/protocols/status.js +4 -1
- 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 +460 -46
- package/dest/services/service.d.ts +19 -3
- package/dest/services/service.d.ts.map +1 -1
- package/dest/services/tx_collection/config.d.ts +4 -1
- package/dest/services/tx_collection/config.d.ts.map +1 -1
- package/dest/services/tx_collection/config.js +9 -1
- package/dest/services/tx_collection/fast_tx_collection.d.ts +6 -4
- package/dest/services/tx_collection/fast_tx_collection.d.ts.map +1 -1
- package/dest/services/tx_collection/fast_tx_collection.js +16 -5
- package/dest/services/tx_collection/index.d.ts +2 -1
- package/dest/services/tx_collection/index.d.ts.map +1 -1
- package/dest/services/tx_collection/index.js +1 -0
- package/dest/services/tx_collection/instrumentation.d.ts +1 -1
- package/dest/services/tx_collection/instrumentation.d.ts.map +1 -1
- package/dest/services/tx_collection/instrumentation.js +10 -13
- package/dest/services/tx_collection/proposal_tx_collector.d.ts +48 -0
- package/dest/services/tx_collection/proposal_tx_collector.d.ts.map +1 -0
- package/dest/services/tx_collection/proposal_tx_collector.js +50 -0
- package/dest/services/tx_collection/slow_tx_collection.d.ts +3 -3
- package/dest/services/tx_collection/slow_tx_collection.d.ts.map +1 -1
- package/dest/services/tx_collection/tx_collection.d.ts +8 -8
- package/dest/services/tx_collection/tx_collection.d.ts.map +1 -1
- package/dest/services/tx_collection/tx_collection.js +5 -5
- package/dest/services/tx_provider.d.ts +3 -3
- package/dest/services/tx_provider.d.ts.map +1 -1
- 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 +7 -20
- 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/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 +156 -0
- package/dest/test-helpers/testbench-utils.d.ts.map +1 -0
- package/dest/test-helpers/testbench-utils.js +296 -0
- package/dest/testbench/p2p_client_testbench_worker.d.ts +28 -2
- package/dest/testbench/p2p_client_testbench_worker.d.ts.map +1 -1
- package/dest/testbench/p2p_client_testbench_worker.js +218 -124
- package/dest/testbench/worker_client_manager.d.ts +51 -6
- package/dest/testbench/worker_client_manager.d.ts.map +1 -1
- package/dest/testbench/worker_client_manager.js +226 -39
- package/package.json +16 -16
- package/src/bootstrap/bootstrap.ts +7 -4
- package/src/client/factory.ts +6 -10
- package/src/client/interface.ts +19 -4
- package/src/client/p2p_client.ts +82 -132
- package/src/client/test/tx_proposal_collector/README.md +227 -0
- package/src/client/test/tx_proposal_collector/proposal_tx_collector_worker.ts +336 -0
- package/src/client/test/tx_proposal_collector/proposal_tx_collector_worker_protocol.ts +43 -0
- package/src/config.ts +8 -3
- package/src/mem_pools/attestation_pool/attestation_pool.ts +68 -41
- package/src/mem_pools/attestation_pool/attestation_pool_test_suite.ts +239 -287
- package/src/mem_pools/attestation_pool/kv_attestation_pool.ts +162 -140
- package/src/mem_pools/attestation_pool/memory_attestation_pool.ts +141 -164
- package/src/mem_pools/attestation_pool/mocks.ts +19 -13
- package/src/mem_pools/instrumentation.ts +10 -18
- package/src/mem_pools/tx_pool/README.md +28 -13
- package/src/mem_pools/tx_pool/aztec_kv_tx_pool.ts +130 -75
- package/src/mem_pools/tx_pool/eviction/eviction_manager.ts +66 -5
- package/src/mem_pools/tx_pool/eviction/eviction_strategy.ts +119 -4
- package/src/mem_pools/tx_pool/eviction/fee_payer_balance_eviction_rule.ts +162 -0
- package/src/mem_pools/tx_pool/eviction/invalid_txs_after_reorg_rule.ts +4 -2
- package/src/mem_pools/tx_pool/eviction/nullifier_conflict_pre_add_rule.ts +75 -0
- package/src/msg_validators/attestation_validator/attestation_validator.ts +36 -21
- package/src/msg_validators/attestation_validator/fisherman_attestation_validator.ts +19 -16
- package/src/msg_validators/clock_tolerance.ts +51 -0
- package/src/msg_validators/index.ts +1 -1
- package/src/msg_validators/proposal_validator/block_proposal_validator.ts +10 -0
- package/src/msg_validators/proposal_validator/checkpoint_proposal_validator.ts +13 -0
- package/src/msg_validators/proposal_validator/index.ts +3 -0
- package/src/msg_validators/proposal_validator/proposal_validator.ts +92 -0
- package/src/msg_validators/proposal_validator/proposal_validator_test_suite.ts +230 -0
- package/src/msg_validators/tx_validator/block_header_validator.ts +7 -4
- package/src/msg_validators/tx_validator/data_validator.ts +18 -6
- package/src/msg_validators/tx_validator/double_spend_validator.ts +4 -3
- package/src/msg_validators/tx_validator/factory.ts +64 -23
- package/src/msg_validators/tx_validator/fee_payer_balance.ts +40 -0
- package/src/msg_validators/tx_validator/gas_validator.ts +17 -28
- package/src/msg_validators/tx_validator/index.ts +1 -0
- package/src/msg_validators/tx_validator/metadata_validator.ts +18 -7
- package/src/msg_validators/tx_validator/phases_validator.ts +5 -3
- package/src/msg_validators/tx_validator/size_validator.ts +22 -0
- package/src/msg_validators/tx_validator/timestamp_validator.ts +9 -4
- package/src/msg_validators/tx_validator/tx_permitted_validator.ts +8 -3
- package/src/msg_validators/tx_validator/tx_proof_validator.ts +8 -3
- package/src/services/discv5/discV5_service.ts +1 -1
- package/src/services/dummy_service.ts +51 -0
- package/src/services/encoding.ts +5 -4
- package/src/services/libp2p/instrumentation.ts +32 -73
- package/src/services/libp2p/libp2p_service.ts +404 -154
- package/src/services/peer-manager/metrics.ts +22 -26
- package/src/services/peer-manager/peer_manager.ts +1 -2
- package/src/services/peer-manager/peer_scoring.ts +3 -4
- package/src/services/reqresp/batch-tx-requester/README.md +305 -0
- package/src/services/reqresp/batch-tx-requester/batch_tx_requester.ts +706 -0
- package/src/services/reqresp/batch-tx-requester/config.ts +40 -0
- package/src/services/reqresp/batch-tx-requester/interface.ts +57 -0
- package/src/services/reqresp/batch-tx-requester/missing_txs.ts +209 -0
- package/src/services/reqresp/batch-tx-requester/peer_collection.ts +205 -0
- package/src/services/reqresp/batch-tx-requester/tx_validator.ts +37 -0
- package/src/services/reqresp/connection-sampler/batch_connection_sampler.ts +65 -4
- package/src/services/reqresp/connection-sampler/connection_sampler.ts +19 -1
- package/src/services/reqresp/constants.ts +14 -0
- package/src/services/reqresp/interface.ts +3 -0
- package/src/services/reqresp/metrics.ts +36 -27
- package/src/services/reqresp/protocols/block_txs/bitvector.ts +16 -0
- package/src/services/reqresp/protocols/block_txs/block_txs_handler.ts +16 -2
- package/src/services/reqresp/protocols/block_txs/block_txs_reqresp.ts +46 -4
- package/src/services/reqresp/protocols/status.ts +7 -4
- package/src/services/reqresp/reqresp.ts +66 -19
- package/src/services/service.ts +23 -4
- package/src/services/tx_collection/config.ts +15 -1
- package/src/services/tx_collection/fast_tx_collection.ts +36 -13
- package/src/services/tx_collection/index.ts +5 -0
- package/src/services/tx_collection/instrumentation.ts +5 -13
- package/src/services/tx_collection/proposal_tx_collector.ts +114 -0
- package/src/services/tx_collection/slow_tx_collection.ts +2 -2
- package/src/services/tx_collection/tx_collection.ts +8 -8
- package/src/services/tx_provider.ts +2 -2
- package/src/services/tx_provider_instrumentation.ts +13 -20
- package/src/test-helpers/index.ts +2 -0
- package/src/test-helpers/test_tx_provider.ts +64 -0
- package/src/test-helpers/testbench-utils.ts +372 -0
- package/src/testbench/p2p_client_testbench_worker.ts +337 -119
- package/src/testbench/worker_client_manager.ts +304 -42
- package/dest/mem_pools/tx_pool/eviction/insufficient_fee_payer_balance_rule.d.ts +0 -15
- package/dest/mem_pools/tx_pool/eviction/insufficient_fee_payer_balance_rule.d.ts.map +0 -1
- package/dest/mem_pools/tx_pool/eviction/insufficient_fee_payer_balance_rule.js +0 -88
- package/dest/msg_validators/block_proposal_validator/block_proposal_validator.d.ts +0 -12
- package/dest/msg_validators/block_proposal_validator/block_proposal_validator.d.ts.map +0 -1
- package/dest/msg_validators/block_proposal_validator/block_proposal_validator.js +0 -82
- package/dest/msg_validators/block_proposal_validator/index.d.ts +0 -2
- package/dest/msg_validators/block_proposal_validator/index.d.ts.map +0 -1
- package/dest/msg_validators/block_proposal_validator/index.js +0 -1
- package/src/mem_pools/tx_pool/eviction/insufficient_fee_payer_balance_rule.ts +0 -108
- package/src/msg_validators/block_proposal_validator/block_proposal_validator.ts +0 -97
- package/src/msg_validators/block_proposal_validator/index.ts +0 -1
|
@@ -0,0 +1,336 @@
|
|
|
1
|
+
import { MockL2BlockSource } from '@aztec/archiver/test';
|
|
2
|
+
import { SecretValue } from '@aztec/foundation/config';
|
|
3
|
+
import { createLogger } from '@aztec/foundation/log';
|
|
4
|
+
import { sleep } from '@aztec/foundation/sleep';
|
|
5
|
+
import { DateProvider, Timer, executeTimeout } from '@aztec/foundation/timer';
|
|
6
|
+
import type { DataStoreConfig } from '@aztec/kv-store/config';
|
|
7
|
+
import { openTmpStore } from '@aztec/kv-store/lmdb-v2';
|
|
8
|
+
import type { L2BlockSource } from '@aztec/stdlib/block';
|
|
9
|
+
import type { ContractDataSource } from '@aztec/stdlib/contract';
|
|
10
|
+
import type { ClientProtocolCircuitVerifier } from '@aztec/stdlib/interfaces/server';
|
|
11
|
+
import { P2PClientType, PeerErrorSeverity } from '@aztec/stdlib/p2p';
|
|
12
|
+
import type { Tx, TxValidationResult } from '@aztec/stdlib/tx';
|
|
13
|
+
import { type TelemetryClient, getTelemetryClient } from '@aztec/telemetry-client';
|
|
14
|
+
|
|
15
|
+
import type { PeerId } from '@libp2p/interface';
|
|
16
|
+
import { peerIdFromString } from '@libp2p/peer-id';
|
|
17
|
+
|
|
18
|
+
import type { P2PConfig } from '../../../config.js';
|
|
19
|
+
import type { IBatchRequestTxValidator } from '../../../services/reqresp/batch-tx-requester/tx_validator.js';
|
|
20
|
+
import { RateLimitStatus } from '../../../services/reqresp/rate-limiter/rate_limiter.js';
|
|
21
|
+
import {
|
|
22
|
+
BatchTxRequesterCollector,
|
|
23
|
+
SendBatchRequestCollector,
|
|
24
|
+
} from '../../../services/tx_collection/proposal_tx_collector.js';
|
|
25
|
+
import { AlwaysTrueCircuitVerifier } from '../../../test-helpers/reqresp-nodes.js';
|
|
26
|
+
import {
|
|
27
|
+
BENCHMARK_CONSTANTS,
|
|
28
|
+
InMemoryAttestationPool,
|
|
29
|
+
InMemoryTxPool,
|
|
30
|
+
UNLIMITED_RATE_LIMIT_QUOTA,
|
|
31
|
+
calculateInternalTimeout,
|
|
32
|
+
createMockEpochCache,
|
|
33
|
+
createMockWorldStateSynchronizer,
|
|
34
|
+
} from '../../../test-helpers/testbench-utils.js';
|
|
35
|
+
import { createP2PClient } from '../../index.js';
|
|
36
|
+
import type { P2PClient } from '../../p2p_client.js';
|
|
37
|
+
import {
|
|
38
|
+
type WorkerCommand,
|
|
39
|
+
type WorkerResponse,
|
|
40
|
+
deserializeBlockProposal,
|
|
41
|
+
deserializeTx,
|
|
42
|
+
deserializeTxHash,
|
|
43
|
+
} from './proposal_tx_collector_worker_protocol.js';
|
|
44
|
+
|
|
45
|
+
let client: P2PClient | undefined;
|
|
46
|
+
let txPool: InMemoryTxPool | undefined;
|
|
47
|
+
let attestationPool: InMemoryAttestationPool | undefined;
|
|
48
|
+
let logger = createLogger('p2p:proposal-bench');
|
|
49
|
+
let kvStore: Awaited<ReturnType<typeof openTmpStore>> | undefined;
|
|
50
|
+
let ipcDisconnected = false;
|
|
51
|
+
|
|
52
|
+
function ensureClient(): P2PClient {
|
|
53
|
+
if (!client || !txPool) {
|
|
54
|
+
throw new Error('Worker client not started');
|
|
55
|
+
}
|
|
56
|
+
return client;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
function isIpcDisconnectError(err: unknown): boolean {
|
|
60
|
+
const code = (err as NodeJS.ErrnoException | undefined)?.code;
|
|
61
|
+
return code === 'EPIPE' || code === 'ERR_IPC_CHANNEL_CLOSED';
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
function sendMessage(message: WorkerResponse): Promise<void> {
|
|
65
|
+
const send = process.send;
|
|
66
|
+
if (!send || !process.connected || ipcDisconnected) {
|
|
67
|
+
return Promise.resolve();
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
return new Promise(resolve => {
|
|
71
|
+
const fallbackTimeout = setTimeout(() => resolve(), 2000);
|
|
72
|
+
try {
|
|
73
|
+
send.call(process, message, undefined, undefined, err => {
|
|
74
|
+
clearTimeout(fallbackTimeout);
|
|
75
|
+
if (!err) {
|
|
76
|
+
resolve();
|
|
77
|
+
return;
|
|
78
|
+
}
|
|
79
|
+
if (isIpcDisconnectError(err)) {
|
|
80
|
+
ipcDisconnected = true;
|
|
81
|
+
resolve();
|
|
82
|
+
return;
|
|
83
|
+
}
|
|
84
|
+
logger.warn('Failed to send IPC message', { error: err?.message ?? String(err) });
|
|
85
|
+
resolve();
|
|
86
|
+
});
|
|
87
|
+
} catch (err: any) {
|
|
88
|
+
clearTimeout(fallbackTimeout);
|
|
89
|
+
if (isIpcDisconnectError(err)) {
|
|
90
|
+
ipcDisconnected = true;
|
|
91
|
+
resolve();
|
|
92
|
+
return;
|
|
93
|
+
}
|
|
94
|
+
logger.warn('Failed to send IPC message', { error: err?.message ?? String(err) });
|
|
95
|
+
resolve();
|
|
96
|
+
}
|
|
97
|
+
});
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
async function startClient(config: P2PConfig, clientIndex: number) {
|
|
101
|
+
txPool = new InMemoryTxPool();
|
|
102
|
+
attestationPool = new InMemoryAttestationPool();
|
|
103
|
+
const epochCache = createMockEpochCache();
|
|
104
|
+
const worldState = createMockWorldStateSynchronizer();
|
|
105
|
+
const l2BlockSource = new MockL2BlockSource();
|
|
106
|
+
const proofVerifier = new AlwaysTrueCircuitVerifier();
|
|
107
|
+
kvStore = await openTmpStore(`proposal-bench-${clientIndex}`);
|
|
108
|
+
logger = createLogger(`p2p:proposal-bench:${clientIndex}`);
|
|
109
|
+
|
|
110
|
+
const telemetry = getTelemetryClient();
|
|
111
|
+
const deps = {
|
|
112
|
+
txPool,
|
|
113
|
+
attestationPool,
|
|
114
|
+
store: kvStore,
|
|
115
|
+
logger,
|
|
116
|
+
};
|
|
117
|
+
|
|
118
|
+
client = await createP2PClient(
|
|
119
|
+
P2PClientType.Full,
|
|
120
|
+
config as P2PConfig & DataStoreConfig,
|
|
121
|
+
l2BlockSource as L2BlockSource & ContractDataSource,
|
|
122
|
+
proofVerifier as ClientProtocolCircuitVerifier,
|
|
123
|
+
worldState,
|
|
124
|
+
epochCache,
|
|
125
|
+
'proposal-tx-collector-bench-worker',
|
|
126
|
+
new DateProvider(),
|
|
127
|
+
telemetry as TelemetryClient,
|
|
128
|
+
deps,
|
|
129
|
+
);
|
|
130
|
+
|
|
131
|
+
await client.start();
|
|
132
|
+
installUnlimitedRateLimits();
|
|
133
|
+
|
|
134
|
+
for (let i = 0; i < 120; i++) {
|
|
135
|
+
if (client.isReady()) {
|
|
136
|
+
return;
|
|
137
|
+
}
|
|
138
|
+
await sleep(500);
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
throw new Error('Timed out waiting for P2P client readiness');
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
function installSamplerOverrides(peerList: ReturnType<typeof peerIdFromString>[]) {
|
|
145
|
+
const reqResp = (ensureClient() as any).p2pService.reqresp as any;
|
|
146
|
+
const sampler = reqResp.connectionSampler as any;
|
|
147
|
+
|
|
148
|
+
sampler.getPeerListSortedByConnectionCountAsc = (excluding?: Set<string>) => {
|
|
149
|
+
if (!excluding || excluding.size === 0) {
|
|
150
|
+
return peerList;
|
|
151
|
+
}
|
|
152
|
+
return peerList.filter(peerId => !excluding.has(peerId.toString()));
|
|
153
|
+
};
|
|
154
|
+
sampler.samplePeersBatch = (numberToSample: number, excluding?: Map<string, boolean>) => {
|
|
155
|
+
const filtered = peerList.filter(peerId => !excluding?.has(peerId.toString()));
|
|
156
|
+
return filtered.slice(0, Math.min(numberToSample, filtered.length));
|
|
157
|
+
};
|
|
158
|
+
sampler.getPeer = (excluding?: Map<string, boolean>) => {
|
|
159
|
+
const filtered = peerList.filter(peerId => !excluding?.has(peerId.toString()));
|
|
160
|
+
return filtered[0];
|
|
161
|
+
};
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
function installUnlimitedRateLimits() {
|
|
165
|
+
const reqResp = (ensureClient() as any).p2pService.reqresp as any;
|
|
166
|
+
const rateLimiter = reqResp.rateLimiter as any;
|
|
167
|
+
|
|
168
|
+
rateLimiter.getRateLimits = () => UNLIMITED_RATE_LIMIT_QUOTA;
|
|
169
|
+
rateLimiter.allow = () => RateLimitStatus.Allowed;
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
async function runCollector(cmd: Extract<WorkerCommand, { type: 'RUN_COLLECTOR' }>) {
|
|
173
|
+
const { collectorType, txHashes, blockProposal, pinnedPeerId, peerIds, timeoutMs } = cmd;
|
|
174
|
+
const reqResp = (ensureClient() as any).p2pService.reqresp as any;
|
|
175
|
+
const peerList = peerIds.map(peerId => peerIdFromString(peerId));
|
|
176
|
+
|
|
177
|
+
installSamplerOverrides(peerList);
|
|
178
|
+
installUnlimitedRateLimits();
|
|
179
|
+
|
|
180
|
+
const p2pService = {
|
|
181
|
+
reqResp,
|
|
182
|
+
connectionSampler: {
|
|
183
|
+
getPeerListSortedByConnectionCountAsc: () => peerList,
|
|
184
|
+
},
|
|
185
|
+
txValidatorConfig: {
|
|
186
|
+
l1ChainId: 1,
|
|
187
|
+
rollupVersion: 1,
|
|
188
|
+
proofVerifier: {
|
|
189
|
+
verifyProof: () => Promise.resolve({ valid: true, durationMs: 0, totalDurationMs: 0 }),
|
|
190
|
+
stop: () => Promise.resolve(),
|
|
191
|
+
},
|
|
192
|
+
},
|
|
193
|
+
peerScoring: {
|
|
194
|
+
penalizePeer: (_peerId: PeerId, _penalty: PeerErrorSeverity) => {},
|
|
195
|
+
},
|
|
196
|
+
};
|
|
197
|
+
|
|
198
|
+
const parsedTxHashes = txHashes.map(deserializeTxHash);
|
|
199
|
+
const parsedProposal = deserializeBlockProposal(blockProposal);
|
|
200
|
+
const pinnedPeer = pinnedPeerId ? peerIdFromString(pinnedPeerId) : undefined;
|
|
201
|
+
|
|
202
|
+
const timer = new Timer();
|
|
203
|
+
let fetchedCount = 0;
|
|
204
|
+
|
|
205
|
+
const internalTimeoutMs = calculateInternalTimeout(timeoutMs);
|
|
206
|
+
|
|
207
|
+
const noopTxValidator: IBatchRequestTxValidator = {
|
|
208
|
+
validateRequestedTx: (_tx: Tx): Promise<TxValidationResult> => Promise.resolve({ result: 'valid' }),
|
|
209
|
+
validateRequestedTxs: (txs: Tx[]): Promise<TxValidationResult[]> =>
|
|
210
|
+
Promise.resolve(txs.map(() => ({ result: 'valid' }))),
|
|
211
|
+
};
|
|
212
|
+
|
|
213
|
+
try {
|
|
214
|
+
if (collectorType === 'batch-requester') {
|
|
215
|
+
const collector = new BatchTxRequesterCollector(p2pService, logger, new DateProvider(), noopTxValidator);
|
|
216
|
+
const fetched = await executeTimeout(
|
|
217
|
+
(_signal: AbortSignal) => collector.collectTxs(parsedTxHashes, parsedProposal, pinnedPeer, internalTimeoutMs),
|
|
218
|
+
timeoutMs,
|
|
219
|
+
() => new Error(`Collector timed out after ${timeoutMs}ms`),
|
|
220
|
+
);
|
|
221
|
+
fetchedCount = fetched.length;
|
|
222
|
+
} else {
|
|
223
|
+
const collector = new SendBatchRequestCollector(
|
|
224
|
+
p2pService,
|
|
225
|
+
BENCHMARK_CONSTANTS.FIXED_MAX_PEERS,
|
|
226
|
+
BENCHMARK_CONSTANTS.FIXED_MAX_RETRY_ATTEMPTS,
|
|
227
|
+
);
|
|
228
|
+
const fetched = await executeTimeout(
|
|
229
|
+
(_signal: AbortSignal) => collector.collectTxs(parsedTxHashes, parsedProposal, pinnedPeer, internalTimeoutMs),
|
|
230
|
+
timeoutMs,
|
|
231
|
+
() => new Error(`Collector timed out after ${timeoutMs}ms`),
|
|
232
|
+
);
|
|
233
|
+
fetchedCount = fetched.length;
|
|
234
|
+
}
|
|
235
|
+
} catch (err: any) {
|
|
236
|
+
logger.warn(`Collector error: ${err?.message ?? String(err)}`);
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
return { durationMs: timer.ms(), fetchedCount };
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
async function stopClient() {
|
|
243
|
+
if (!client) {
|
|
244
|
+
return;
|
|
245
|
+
}
|
|
246
|
+
await client.stop();
|
|
247
|
+
if (kvStore?.close) {
|
|
248
|
+
await kvStore.close();
|
|
249
|
+
}
|
|
250
|
+
client = undefined;
|
|
251
|
+
txPool = undefined;
|
|
252
|
+
attestationPool = undefined;
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
process.on('disconnect', () => {
|
|
256
|
+
ipcDisconnected = true;
|
|
257
|
+
void stopClient().finally(() => process.exit(0));
|
|
258
|
+
});
|
|
259
|
+
|
|
260
|
+
process.on('error', err => {
|
|
261
|
+
if (isIpcDisconnectError(err)) {
|
|
262
|
+
ipcDisconnected = true;
|
|
263
|
+
return;
|
|
264
|
+
}
|
|
265
|
+
logger.warn('Worker process error', { error: err?.message ?? String(err) });
|
|
266
|
+
});
|
|
267
|
+
|
|
268
|
+
process.on('message', (msg: WorkerCommand) => {
|
|
269
|
+
void (async () => {
|
|
270
|
+
if (!msg || typeof msg !== 'object') {
|
|
271
|
+
return;
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
const requestId = msg.requestId;
|
|
275
|
+
|
|
276
|
+
try {
|
|
277
|
+
switch (msg.type) {
|
|
278
|
+
case 'START': {
|
|
279
|
+
const rawConfig = msg.config;
|
|
280
|
+
const config: P2PConfig = {
|
|
281
|
+
...rawConfig,
|
|
282
|
+
peerIdPrivateKey: rawConfig.peerIdPrivateKey ? new SecretValue(rawConfig.peerIdPrivateKey) : undefined,
|
|
283
|
+
} as P2PConfig;
|
|
284
|
+
|
|
285
|
+
await startClient(config, msg.clientIndex);
|
|
286
|
+
const peerId = (ensureClient() as any).p2pService.node.peerId.toString();
|
|
287
|
+
await sendMessage({ type: 'READY', requestId, peerId });
|
|
288
|
+
break;
|
|
289
|
+
}
|
|
290
|
+
case 'SET_TXS': {
|
|
291
|
+
if (!txPool) {
|
|
292
|
+
throw new Error('Tx pool not initialized');
|
|
293
|
+
}
|
|
294
|
+
const txs = msg.txs.map(deserializeTx);
|
|
295
|
+
const count = msg.mode === 'append' ? txPool.appendTxs(txs) : txPool.setTxs(txs);
|
|
296
|
+
await sendMessage({ type: 'TXS_SET', requestId, count });
|
|
297
|
+
break;
|
|
298
|
+
}
|
|
299
|
+
case 'SET_BLOCK_PROPOSAL': {
|
|
300
|
+
if (!attestationPool) {
|
|
301
|
+
throw new Error('Attestation pool not initialized');
|
|
302
|
+
}
|
|
303
|
+
const proposal = deserializeBlockProposal(msg.blockProposal);
|
|
304
|
+
await attestationPool.addBlockProposal(proposal);
|
|
305
|
+
await sendMessage({ type: 'BLOCK_PROPOSAL_SET', requestId, archiveRoot: proposal.archive.toString() });
|
|
306
|
+
break;
|
|
307
|
+
}
|
|
308
|
+
case 'RUN_COLLECTOR': {
|
|
309
|
+
const { durationMs, fetchedCount } = await runCollector(msg);
|
|
310
|
+
await sendMessage({ type: 'COLLECTOR_RESULT', requestId, durationMs, fetchedCount });
|
|
311
|
+
break;
|
|
312
|
+
}
|
|
313
|
+
case 'GET_PEER_COUNT': {
|
|
314
|
+
const peers = await ensureClient().getPeers();
|
|
315
|
+
await sendMessage({ type: 'PEER_COUNT', requestId, count: peers.length });
|
|
316
|
+
break;
|
|
317
|
+
}
|
|
318
|
+
case 'STOP': {
|
|
319
|
+
await stopClient();
|
|
320
|
+
await sendMessage({ type: 'STOPPED', requestId });
|
|
321
|
+
process.exit(0);
|
|
322
|
+
break;
|
|
323
|
+
}
|
|
324
|
+
default: {
|
|
325
|
+
const _exhaustive: never = msg;
|
|
326
|
+
throw new Error(`Unknown command: ${(msg as { type?: string }).type}`);
|
|
327
|
+
}
|
|
328
|
+
}
|
|
329
|
+
} catch (err: any) {
|
|
330
|
+
await sendMessage({ type: 'ERROR', requestId, error: err?.message ?? String(err) });
|
|
331
|
+
if (msg.type === 'START') {
|
|
332
|
+
process.exit(1);
|
|
333
|
+
}
|
|
334
|
+
}
|
|
335
|
+
})();
|
|
336
|
+
});
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { BlockProposal } from '@aztec/stdlib/p2p';
|
|
2
|
+
import { Tx, TxHash } from '@aztec/stdlib/tx';
|
|
3
|
+
|
|
4
|
+
import type { P2PConfig } from '../../../config.js';
|
|
5
|
+
|
|
6
|
+
export type SerializedP2PConfig = Omit<P2PConfig, 'peerIdPrivateKey'> & { peerIdPrivateKey?: string };
|
|
7
|
+
|
|
8
|
+
export type CollectorType = 'batch-requester' | 'send-batch-request';
|
|
9
|
+
|
|
10
|
+
export type WorkerCommand =
|
|
11
|
+
| { type: 'START'; requestId: string; clientIndex: number; config: SerializedP2PConfig }
|
|
12
|
+
| { type: 'SET_TXS'; requestId: string; txs: string[]; mode?: 'replace' | 'append' }
|
|
13
|
+
| { type: 'SET_BLOCK_PROPOSAL'; requestId: string; blockProposal: string }
|
|
14
|
+
| {
|
|
15
|
+
type: 'RUN_COLLECTOR';
|
|
16
|
+
requestId: string;
|
|
17
|
+
collectorType: CollectorType;
|
|
18
|
+
txHashes: string[];
|
|
19
|
+
blockProposal: string;
|
|
20
|
+
pinnedPeerId?: string;
|
|
21
|
+
peerIds: string[];
|
|
22
|
+
timeoutMs: number;
|
|
23
|
+
}
|
|
24
|
+
| { type: 'GET_PEER_COUNT'; requestId: string }
|
|
25
|
+
| { type: 'STOP'; requestId: string };
|
|
26
|
+
|
|
27
|
+
export type WorkerResponse =
|
|
28
|
+
| { type: 'READY'; requestId: string; peerId: string }
|
|
29
|
+
| { type: 'TXS_SET'; requestId: string; count: number }
|
|
30
|
+
| { type: 'BLOCK_PROPOSAL_SET'; requestId: string; archiveRoot: string }
|
|
31
|
+
| { type: 'COLLECTOR_RESULT'; requestId: string; durationMs: number; fetchedCount: number }
|
|
32
|
+
| { type: 'PEER_COUNT'; requestId: string; count: number }
|
|
33
|
+
| { type: 'STOPPED'; requestId: string }
|
|
34
|
+
| { type: 'ERROR'; requestId: string; error: string };
|
|
35
|
+
|
|
36
|
+
export const serializeTx = (tx: Tx) => tx.toBuffer().toString('hex');
|
|
37
|
+
export const deserializeTx = (hex: string) => Tx.fromBuffer(Buffer.from(hex, 'hex'));
|
|
38
|
+
|
|
39
|
+
export const serializeTxHash = (txHash: TxHash) => txHash.toString();
|
|
40
|
+
export const deserializeTxHash = (hex: string) => TxHash.fromString(hex);
|
|
41
|
+
|
|
42
|
+
export const serializeBlockProposal = (proposal: BlockProposal) => proposal.toBuffer().toString('hex');
|
|
43
|
+
export const deserializeBlockProposal = (hex: string) => BlockProposal.fromBuffer(Buffer.from(hex, 'hex'));
|
package/src/config.ts
CHANGED
|
@@ -2,10 +2,10 @@ import {
|
|
|
2
2
|
type ConfigMappingsType,
|
|
3
3
|
SecretValue,
|
|
4
4
|
booleanConfigHelper,
|
|
5
|
-
floatConfigHelper,
|
|
6
5
|
getConfigFromMappings,
|
|
7
6
|
getDefaultConfig,
|
|
8
7
|
numberConfigHelper,
|
|
8
|
+
percentageConfigHelper,
|
|
9
9
|
pickConfigMappings,
|
|
10
10
|
secretStringConfigHelper,
|
|
11
11
|
} from '@aztec/foundation/config';
|
|
@@ -15,13 +15,17 @@ import { FunctionSelector } from '@aztec/stdlib/abi/function-selector';
|
|
|
15
15
|
import { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
16
16
|
import { type AllowedElement, type ChainConfig, chainConfigMappings } from '@aztec/stdlib/config';
|
|
17
17
|
|
|
18
|
+
import {
|
|
19
|
+
type BatchTxRequesterConfig,
|
|
20
|
+
batchTxRequesterConfigMappings,
|
|
21
|
+
} from './services/reqresp/batch-tx-requester/config.js';
|
|
18
22
|
import { type P2PReqRespConfig, p2pReqRespConfigMappings } from './services/reqresp/config.js';
|
|
19
23
|
import { type TxCollectionConfig, txCollectionConfigMappings } from './services/tx_collection/config.js';
|
|
20
24
|
|
|
21
25
|
/**
|
|
22
26
|
* P2P client configuration values.
|
|
23
27
|
*/
|
|
24
|
-
export interface P2PConfig extends P2PReqRespConfig, ChainConfig, TxCollectionConfig {
|
|
28
|
+
export interface P2PConfig extends P2PReqRespConfig, BatchTxRequesterConfig, ChainConfig, TxCollectionConfig {
|
|
25
29
|
/** A flag dictating whether the P2P subsystem should be enabled. */
|
|
26
30
|
p2pEnabled: boolean;
|
|
27
31
|
|
|
@@ -407,7 +411,7 @@ export const p2pConfigMappings: ConfigMappingsType<P2PConfig> = {
|
|
|
407
411
|
dropTransactionsProbability: {
|
|
408
412
|
env: 'P2P_DROP_TX_CHANCE',
|
|
409
413
|
description: 'The probability that a transaction is discarded (0 - 1). - For testing purposes only',
|
|
410
|
-
...
|
|
414
|
+
...percentageConfigHelper(0),
|
|
411
415
|
},
|
|
412
416
|
disableTransactions: {
|
|
413
417
|
env: 'TRANSACTIONS_DISABLED',
|
|
@@ -432,6 +436,7 @@ export const p2pConfigMappings: ConfigMappingsType<P2PConfig> = {
|
|
|
432
436
|
...booleanConfigHelper(false),
|
|
433
437
|
},
|
|
434
438
|
...p2pReqRespConfigMappings,
|
|
439
|
+
...batchTxRequesterConfigMappings,
|
|
435
440
|
...chainConfigMappings,
|
|
436
441
|
...txCollectionConfigMappings,
|
|
437
442
|
};
|
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
import type { SlotNumber } from '@aztec/foundation/branded-types';
|
|
2
|
-
import type {
|
|
2
|
+
import type {
|
|
3
|
+
BlockProposal,
|
|
4
|
+
CheckpointAttestation,
|
|
5
|
+
CheckpointProposal,
|
|
6
|
+
CheckpointProposalCore,
|
|
7
|
+
} from '@aztec/stdlib/p2p';
|
|
3
8
|
|
|
4
9
|
/**
|
|
5
10
|
* An Attestation Pool contains attestations collected by a validator
|
|
@@ -32,75 +37,74 @@ export interface AttestationPool {
|
|
|
32
37
|
hasBlockProposal(idOrProposal: string | BlockProposal): Promise<boolean>;
|
|
33
38
|
|
|
34
39
|
/**
|
|
35
|
-
*
|
|
40
|
+
* Adds a checkpoint proposal to the pool.
|
|
36
41
|
*
|
|
37
|
-
*
|
|
42
|
+
* If the proposal contains a lastBlock, the BlockProposal is automatically extracted
|
|
43
|
+
* and stored separately via addBlockProposal. The checkpoint proposal is then stored
|
|
44
|
+
* without the lastBlock info (as CheckpointProposalCore).
|
|
45
|
+
*
|
|
46
|
+
* @param proposal - The checkpoint proposal to add
|
|
47
|
+
* @throws ProposalSlotCapExceededError if the slot has reached the maximum number of proposals
|
|
38
48
|
*/
|
|
39
|
-
|
|
49
|
+
addCheckpointProposal(proposal: CheckpointProposal): Promise<void>;
|
|
40
50
|
|
|
41
51
|
/**
|
|
42
|
-
*
|
|
52
|
+
* Get checkpoint proposal by its ID.
|
|
53
|
+
*
|
|
54
|
+
* Returns a CheckpointProposalCore (without lastBlock info) since the lastBlock
|
|
55
|
+
* is extracted and stored separately as a BlockProposal when added.
|
|
43
56
|
*
|
|
44
|
-
* @param
|
|
57
|
+
* @param id - The ID of the checkpoint proposal to retrieve (proposal.archive)
|
|
58
|
+
* @return The checkpoint proposal core if it exists, otherwise undefined.
|
|
45
59
|
*/
|
|
46
|
-
|
|
60
|
+
getCheckpointProposal(id: string): Promise<CheckpointProposalCore | undefined>;
|
|
47
61
|
|
|
48
62
|
/**
|
|
49
|
-
*
|
|
50
|
-
*
|
|
51
|
-
* Removes all attestations associated with a slot
|
|
63
|
+
* Check if a checkpoint proposal exists in the pool
|
|
52
64
|
*
|
|
53
|
-
* @param
|
|
65
|
+
* @param idOrProposal - The ID of the checkpoint proposal or the proposal itself
|
|
66
|
+
* @return True if the proposal exists, false otherwise.
|
|
54
67
|
*/
|
|
55
|
-
|
|
68
|
+
hasCheckpointProposal(idOrProposal: string | CheckpointProposal): Promise<boolean>;
|
|
56
69
|
|
|
57
70
|
/**
|
|
58
|
-
*
|
|
59
|
-
*
|
|
60
|
-
* Removes all attestations associated with a slot
|
|
71
|
+
* Add checkpoint attestations to the pool
|
|
61
72
|
*
|
|
62
|
-
* @param
|
|
73
|
+
* @param attestations - Checkpoint attestations to add into the pool
|
|
63
74
|
*/
|
|
64
|
-
|
|
75
|
+
addCheckpointAttestations(attestations: CheckpointAttestation[]): Promise<void>;
|
|
65
76
|
|
|
66
77
|
/**
|
|
67
|
-
* Delete
|
|
68
|
-
*
|
|
69
|
-
* Removes all attestations associated with a slot and proposal
|
|
78
|
+
* Delete checkpoint attestations older than the given slot
|
|
70
79
|
*
|
|
71
|
-
* @param slot - The slot to
|
|
72
|
-
* @param proposalId - The proposal to delete.
|
|
80
|
+
* @param slot - The oldest slot to keep.
|
|
73
81
|
*/
|
|
74
|
-
|
|
82
|
+
deleteCheckpointAttestationsOlderThan(slot: SlotNumber): Promise<void>;
|
|
75
83
|
|
|
76
84
|
/**
|
|
77
|
-
* Get all
|
|
78
|
-
*
|
|
79
|
-
* Retrieve all of the attestations observed pertaining to a given slot
|
|
85
|
+
* Get all checkpoint attestations for a given slot
|
|
80
86
|
*
|
|
81
87
|
* @param slot - The slot to query
|
|
82
|
-
* @return
|
|
88
|
+
* @return CheckpointAttestations
|
|
83
89
|
*/
|
|
84
|
-
|
|
90
|
+
getCheckpointAttestationsForSlot(slot: SlotNumber): Promise<CheckpointAttestation[]>;
|
|
85
91
|
|
|
86
92
|
/**
|
|
87
|
-
* Get
|
|
88
|
-
*
|
|
89
|
-
* Retrieve all of the attestations observed pertaining to a given slot
|
|
93
|
+
* Get checkpoint attestations for slot and given proposal
|
|
90
94
|
*
|
|
91
95
|
* @param slot - The slot to query
|
|
92
96
|
* @param proposalId - The proposal to query
|
|
93
|
-
* @return
|
|
97
|
+
* @return CheckpointAttestations
|
|
94
98
|
*/
|
|
95
|
-
|
|
99
|
+
getCheckpointAttestationsForSlotAndProposal(slot: SlotNumber, proposalId: string): Promise<CheckpointAttestation[]>;
|
|
96
100
|
|
|
97
101
|
/**
|
|
98
|
-
* Check if a specific attestation exists in the pool
|
|
102
|
+
* Check if a specific checkpoint attestation exists in the pool
|
|
99
103
|
*
|
|
100
104
|
* @param attestation - The attestation to check
|
|
101
105
|
* @return True if the attestation exists, false otherwise
|
|
102
106
|
*/
|
|
103
|
-
|
|
107
|
+
hasCheckpointAttestation(attestation: CheckpointAttestation): Promise<boolean>;
|
|
104
108
|
|
|
105
109
|
/**
|
|
106
110
|
* Returns whether adding this proposal is permitted at current capacity:
|
|
@@ -114,16 +118,39 @@ export interface AttestationPool {
|
|
|
114
118
|
canAddProposal(block: BlockProposal): Promise<boolean>;
|
|
115
119
|
|
|
116
120
|
/**
|
|
117
|
-
* Returns whether
|
|
118
|
-
*
|
|
119
|
-
*
|
|
120
|
-
*
|
|
121
|
+
* Returns whether adding this checkpoint proposal is permitted at current capacity.
|
|
122
|
+
*
|
|
123
|
+
* @param proposal - The checkpoint proposal to check
|
|
124
|
+
* @returns True if the proposal can be added, false otherwise.
|
|
125
|
+
*/
|
|
126
|
+
canAddCheckpointProposal(proposal: CheckpointProposal): Promise<boolean>;
|
|
127
|
+
|
|
128
|
+
/**
|
|
129
|
+
* Returns whether a checkpoint attestation would be accepted for (slot, proposalId).
|
|
121
130
|
*
|
|
122
131
|
* @param attestation - The attestation to check
|
|
123
|
-
* @param committeeSize - Committee size for the attestation's slot
|
|
132
|
+
* @param committeeSize - Committee size for the attestation's slot
|
|
124
133
|
* @returns True if the attestation can be added, false otherwise.
|
|
125
134
|
*/
|
|
126
|
-
|
|
135
|
+
canAddCheckpointAttestation(attestation: CheckpointAttestation, committeeSize: number): Promise<boolean>;
|
|
136
|
+
|
|
137
|
+
/**
|
|
138
|
+
* Returns whether the checkpoint proposal cap for the given slot has been reached.
|
|
139
|
+
*
|
|
140
|
+
* @param slot - The slot to check
|
|
141
|
+
* @returns True if the cap has been reached, false otherwise.
|
|
142
|
+
*/
|
|
143
|
+
hasReachedCheckpointProposalCap(slot: SlotNumber): Promise<boolean>;
|
|
144
|
+
|
|
145
|
+
/**
|
|
146
|
+
* Returns whether the checkpoint attestation cap for the given slot and proposal has been reached.
|
|
147
|
+
*
|
|
148
|
+
* @param slot - The slot to check
|
|
149
|
+
* @param proposalId - The proposal to check
|
|
150
|
+
* @param committeeSize - Committee size for the slot
|
|
151
|
+
* @returns True if the cap has been reached, false otherwise.
|
|
152
|
+
*/
|
|
153
|
+
hasReachedCheckpointAttestationCap(slot: SlotNumber, proposalId: string, committeeSize: number): Promise<boolean>;
|
|
127
154
|
|
|
128
155
|
/** Returns whether the pool is empty. */
|
|
129
156
|
isEmpty(): Promise<boolean>;
|