@aztec/p2p 0.0.1-commit.2ed92850 → 0.0.1-commit.43597cc1
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 +3 -3
- package/dest/client/factory.d.ts.map +1 -1
- package/dest/client/factory.js +11 -8
- package/dest/client/interface.d.ts +9 -2
- package/dest/client/interface.d.ts.map +1 -1
- package/dest/client/p2p_client.d.ts +7 -4
- package/dest/client/p2p_client.d.ts.map +1 -1
- package/dest/client/p2p_client.js +24 -7
- 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 +16 -3
- package/dest/config.d.ts.map +1 -1
- package/dest/config.js +7 -2
- package/dest/mem_pools/attestation_pool/attestation_pool.d.ts +94 -87
- package/dest/mem_pools/attestation_pool/attestation_pool.d.ts.map +1 -1
- package/dest/mem_pools/attestation_pool/attestation_pool.js +411 -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 +351 -85
- 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/index.d.ts +2 -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 +3 -3
- package/dest/mem_pools/interface.d.ts.map +1 -1
- 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/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 +119 -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 +90 -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 +89 -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 +131 -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 +17 -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 +63 -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 +91 -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 +70 -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 +63 -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 +5 -0
- package/dest/mem_pools/tx_pool_v2/index.d.ts.map +1 -0
- package/dest/mem_pools/tx_pool_v2/index.js +4 -0
- package/dest/mem_pools/tx_pool_v2/interfaces.d.ts +197 -0
- package/dest/mem_pools/tx_pool_v2/interfaces.d.ts.map +1 -0
- package/dest/mem_pools/tx_pool_v2/interfaces.js +6 -0
- package/dest/mem_pools/tx_pool_v2/tx_metadata.d.ts +71 -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 +95 -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 +99 -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 +332 -0
- package/dest/mem_pools/tx_pool_v2/tx_pool_v2.d.ts +55 -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 +156 -0
- package/dest/mem_pools/tx_pool_v2/tx_pool_v2_impl.d.ts +69 -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 +748 -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/archive_cache.d.ts +3 -3
- package/dest/msg_validators/tx_validator/archive_cache.d.ts.map +1 -1
- package/dest/msg_validators/tx_validator/archive_cache.js +1 -1
- package/dest/msg_validators/tx_validator/block_header_validator.d.ts +5 -4
- package/dest/msg_validators/tx_validator/block_header_validator.d.ts.map +1 -1
- package/dest/msg_validators/tx_validator/block_header_validator.js +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/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 +3 -2
- 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 +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 +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/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 +18 -2
- package/dest/services/dummy_service.d.ts.map +1 -1
- package/dest/services/dummy_service.js +42 -0
- 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 +161 -0
- package/dest/services/gossipsub/topic_score_params.d.ts.map +1 -0
- package/dest/services/gossipsub/topic_score_params.js +324 -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 +80 -33
- package/dest/services/libp2p/libp2p_service.d.ts.map +1 -1
- package/dest/services/libp2p/libp2p_service.js +352 -284
- 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 +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/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 -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 +6 -4
- 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 +23 -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 +44 -13
- 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 +58 -22
- package/dest/services/service.d.ts +21 -1
- 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 +5 -4
- package/dest/services/tx_collection/fast_tx_collection.d.ts.map +1 -1
- package/dest/services/tx_collection/fast_tx_collection.js +17 -10
- 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 +9 -2
- 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 +49 -0
- package/dest/services/tx_collection/tx_collection.d.ts +4 -4
- 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_file_store/config.d.ts +18 -0
- package/dest/services/tx_file_store/config.d.ts.map +1 -0
- package/dest/services/tx_file_store/config.js +26 -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 +47 -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 +149 -0
- 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/reqresp-nodes.d.ts +1 -1
- package/dest/test-helpers/reqresp-nodes.d.ts.map +1 -1
- package/dest/test-helpers/reqresp-nodes.js +2 -1
- package/dest/test-helpers/test_tx_provider.d.ts +40 -0
- package/dest/test-helpers/test_tx_provider.d.ts.map +1 -0
- package/dest/test-helpers/test_tx_provider.js +41 -0
- package/dest/test-helpers/testbench-utils.d.ts +152 -0
- package/dest/test-helpers/testbench-utils.d.ts.map +1 -0
- package/dest/test-helpers/testbench-utils.js +308 -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 +212 -131
- 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/package.json +14 -14
- package/src/bootstrap/bootstrap.ts +7 -4
- package/src/client/factory.ts +13 -14
- package/src/client/interface.ts +13 -1
- package/src/client/p2p_client.ts +32 -8
- 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 +22 -2
- package/src/mem_pools/attestation_pool/attestation_pool.ts +444 -90
- package/src/mem_pools/attestation_pool/attestation_pool_test_suite.ts +436 -100
- package/src/mem_pools/attestation_pool/index.ts +9 -2
- package/src/mem_pools/index.ts +1 -1
- package/src/mem_pools/instrumentation.ts +2 -1
- package/src/mem_pools/interface.ts +2 -2
- package/src/mem_pools/tx_pool_v2/README.md +209 -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/eviction/eviction_manager.ts +147 -0
- package/src/mem_pools/tx_pool_v2/eviction/fee_payer_balance_eviction_rule.ts +118 -0
- package/src/mem_pools/tx_pool_v2/eviction/fee_payer_balance_pre_add_rule.ts +111 -0
- package/src/mem_pools/tx_pool_v2/eviction/index.ts +23 -0
- package/src/mem_pools/tx_pool_v2/eviction/interfaces.ts +164 -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 +86 -0
- package/src/mem_pools/tx_pool_v2/eviction/low_priority_pre_add_rule.ts +72 -0
- package/src/mem_pools/tx_pool_v2/eviction/nullifier_conflict_rule.ts +31 -0
- package/src/mem_pools/tx_pool_v2/index.ts +11 -0
- package/src/mem_pools/tx_pool_v2/interfaces.ts +227 -0
- package/src/mem_pools/tx_pool_v2/tx_metadata.ts +161 -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 +417 -0
- package/src/mem_pools/tx_pool_v2/tx_pool_v2.ts +212 -0
- package/src/mem_pools/tx_pool_v2/tx_pool_v2_impl.ts +882 -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/archive_cache.ts +3 -3
- package/src/msg_validators/tx_validator/block_header_validator.ts +7 -8
- package/src/msg_validators/tx_validator/data_validator.ts +6 -2
- 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/gas_validator.ts +9 -3
- package/src/msg_validators/tx_validator/metadata_validator.ts +6 -3
- 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 +6 -3
- 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 +51 -0
- package/src/services/gossipsub/README.md +626 -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 +451 -0
- package/src/services/index.ts +1 -0
- package/src/services/libp2p/instrumentation.ts +15 -2
- package/src/services/libp2p/libp2p_service.ts +381 -305
- 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 +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 +16 -0
- package/src/services/reqresp/interface.ts +3 -0
- 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 +34 -11
- package/src/services/reqresp/protocols/block_txs/block_txs_reqresp.ts +57 -9
- package/src/services/reqresp/reqresp.ts +66 -19
- package/src/services/service.ts +24 -0
- package/src/services/tx_collection/config.ts +15 -1
- package/src/services/tx_collection/fast_tx_collection.ts +30 -17
- package/src/services/tx_collection/index.ts +5 -0
- package/src/services/tx_collection/instrumentation.ts +11 -2
- package/src/services/tx_collection/proposal_tx_collector.ts +112 -0
- package/src/services/tx_collection/tx_collection.ts +4 -4
- package/src/services/tx_file_store/config.ts +43 -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 +173 -0
- package/src/services/tx_provider_instrumentation.ts +11 -5
- package/src/test-helpers/index.ts +2 -0
- package/src/test-helpers/reqresp-nodes.ts +2 -1
- package/src/test-helpers/test_tx_provider.ts +64 -0
- package/src/test-helpers/testbench-utils.ts +362 -0
- package/src/testbench/p2p_client_testbench_worker.ts +321 -122
- package/src/testbench/worker_client_manager.ts +304 -47
- 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
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import type { EpochCacheInterface } from '@aztec/epoch-cache';
|
|
2
2
|
import { type CheckpointAttestation, PeerErrorSeverity, type ValidationResult } from '@aztec/stdlib/p2p';
|
|
3
|
-
import { Attributes, Metrics, type TelemetryClient } from '@aztec/telemetry-client';
|
|
3
|
+
import { Attributes, Metrics, type TelemetryClient, createUpDownCounterWithDefault } from '@aztec/telemetry-client';
|
|
4
4
|
|
|
5
|
-
import type {
|
|
5
|
+
import type { AttestationPoolApi } from '../../mem_pools/attestation_pool/attestation_pool.js';
|
|
6
6
|
import { CheckpointAttestationValidator } from './attestation_validator.js';
|
|
7
7
|
|
|
8
8
|
/**
|
|
@@ -18,14 +18,20 @@ export class FishermanAttestationValidator extends CheckpointAttestationValidato
|
|
|
18
18
|
|
|
19
19
|
constructor(
|
|
20
20
|
epochCache: EpochCacheInterface,
|
|
21
|
-
private attestationPool:
|
|
21
|
+
private attestationPool: AttestationPoolApi,
|
|
22
22
|
telemetryClient: TelemetryClient,
|
|
23
23
|
) {
|
|
24
24
|
super(epochCache);
|
|
25
25
|
this.logger = this.logger.createChild('[FISHERMAN]');
|
|
26
26
|
|
|
27
27
|
const meter = telemetryClient.getMeter('FishermanAttestationValidator');
|
|
28
|
-
this.invalidAttestationCounter =
|
|
28
|
+
this.invalidAttestationCounter = createUpDownCounterWithDefault(
|
|
29
|
+
meter,
|
|
30
|
+
Metrics.VALIDATOR_INVALID_ATTESTATION_RECEIVED_COUNT,
|
|
31
|
+
{
|
|
32
|
+
[Attributes.ERROR_TYPE]: ['base_validation_failed', 'payload_mismatch'],
|
|
33
|
+
},
|
|
34
|
+
);
|
|
29
35
|
}
|
|
30
36
|
|
|
31
37
|
override async validate(message: CheckpointAttestation): Promise<ValidationResult> {
|
|
@@ -24,24 +24,24 @@ export abstract class ProposalValidator<TProposal extends BlockProposal | Checkp
|
|
|
24
24
|
if (slotNumber !== currentSlot && slotNumber !== nextSlot) {
|
|
25
25
|
// Check if message is for previous slot and within clock tolerance
|
|
26
26
|
if (!isWithinClockTolerance(slotNumber, currentSlot, this.epochCache)) {
|
|
27
|
-
this.logger.
|
|
27
|
+
this.logger.warn(`Penalizing peer for invalid slot number ${slotNumber}`, { currentSlot, nextSlot });
|
|
28
28
|
return { result: 'reject', severity: PeerErrorSeverity.HighToleranceError };
|
|
29
29
|
}
|
|
30
|
-
this.logger.
|
|
30
|
+
this.logger.verbose(`Ignoring proposal for previous slot ${slotNumber} within clock tolerance`);
|
|
31
31
|
return { result: 'ignore' };
|
|
32
32
|
}
|
|
33
33
|
|
|
34
34
|
// Signature validity
|
|
35
35
|
const proposer = proposal.getSender();
|
|
36
36
|
if (!proposer) {
|
|
37
|
-
this.logger.
|
|
37
|
+
this.logger.warn(`Penalizing peer for proposal with invalid signature`);
|
|
38
38
|
return { result: 'reject', severity: PeerErrorSeverity.MidToleranceError };
|
|
39
39
|
}
|
|
40
40
|
|
|
41
41
|
// Transactions permitted check
|
|
42
42
|
const embeddedTxCount = proposal.txs?.length ?? 0;
|
|
43
43
|
if (!this.txsPermitted && (proposal.txHashes.length > 0 || embeddedTxCount > 0)) {
|
|
44
|
-
this.logger.
|
|
44
|
+
this.logger.warn(
|
|
45
45
|
`Penalizing peer for proposal with ${proposal.txHashes.length} transaction(s) when transactions are not permitted`,
|
|
46
46
|
);
|
|
47
47
|
return { result: 'reject', severity: PeerErrorSeverity.MidToleranceError };
|
|
@@ -65,7 +65,7 @@ export abstract class ProposalValidator<TProposal extends BlockProposal | Checkp
|
|
|
65
65
|
// Proposer check
|
|
66
66
|
const expectedProposer = await this.epochCache.getProposerAttesterAddressInSlot(slotNumber);
|
|
67
67
|
if (expectedProposer !== undefined && !proposer.equals(expectedProposer)) {
|
|
68
|
-
this.logger.
|
|
68
|
+
this.logger.warn(`Penalizing peer for invalid proposer for current slot ${slotNumber}`, {
|
|
69
69
|
expectedProposer,
|
|
70
70
|
proposer: proposer.toString(),
|
|
71
71
|
});
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { Fr } from '@aztec/foundation/curves/bn254';
|
|
2
1
|
import type { ArchiveSource } from '@aztec/p2p';
|
|
2
|
+
import type { BlockHash } from '@aztec/stdlib/block';
|
|
3
3
|
import type { MerkleTreeReadOperations } from '@aztec/stdlib/interfaces/server';
|
|
4
4
|
import { MerkleTreeId } from '@aztec/stdlib/trees';
|
|
5
5
|
|
|
@@ -14,8 +14,8 @@ export class ArchiveCache implements ArchiveSource {
|
|
|
14
14
|
this.archives = new Map<string, bigint>();
|
|
15
15
|
}
|
|
16
16
|
|
|
17
|
-
public async getArchiveIndices(archives:
|
|
18
|
-
const toCheckDb = archives.filter(n => !this.archives.has(n.toString()));
|
|
17
|
+
public async getArchiveIndices(archives: BlockHash[]): Promise<(bigint | undefined)[]> {
|
|
18
|
+
const toCheckDb = archives.filter(n => !this.archives.has(n.toString())).map(n => n.toFr());
|
|
19
19
|
const dbHits = await this.db.findLeafIndices(MerkleTreeId.ARCHIVE, toCheckDb);
|
|
20
20
|
dbHits.forEach((x, index) => {
|
|
21
21
|
if (x !== undefined) {
|
|
@@ -1,23 +1,22 @@
|
|
|
1
|
-
import type
|
|
2
|
-
import {
|
|
1
|
+
import { type Logger, type LoggerBindings, createLogger } from '@aztec/foundation/log';
|
|
2
|
+
import type { BlockHash } from '@aztec/stdlib/block';
|
|
3
3
|
import { type AnyTx, TX_ERROR_BLOCK_HEADER, type TxValidationResult, type TxValidator } from '@aztec/stdlib/tx';
|
|
4
4
|
|
|
5
5
|
export interface ArchiveSource {
|
|
6
|
-
getArchiveIndices: (archives:
|
|
6
|
+
getArchiveIndices: (archives: BlockHash[]) => Promise<(bigint | undefined)[]>;
|
|
7
7
|
}
|
|
8
8
|
|
|
9
9
|
export class BlockHeaderTxValidator<T extends AnyTx> implements TxValidator<T> {
|
|
10
|
-
#log
|
|
10
|
+
#log: Logger;
|
|
11
11
|
#archiveSource: ArchiveSource;
|
|
12
12
|
|
|
13
|
-
constructor(archiveSource: ArchiveSource) {
|
|
13
|
+
constructor(archiveSource: ArchiveSource, bindings?: LoggerBindings) {
|
|
14
14
|
this.#archiveSource = archiveSource;
|
|
15
|
+
this.#log = createLogger('p2p:tx_validator:tx_block_header', bindings);
|
|
15
16
|
}
|
|
16
17
|
|
|
17
18
|
async validateTx(tx: T): Promise<TxValidationResult> {
|
|
18
|
-
const [index] = await this.#archiveSource.getArchiveIndices([
|
|
19
|
-
(await tx.data.constants.anchorBlockHeader.hash()).toField(),
|
|
20
|
-
]);
|
|
19
|
+
const [index] = await this.#archiveSource.getArchiveIndices([await tx.data.constants.anchorBlockHeader.hash()]);
|
|
21
20
|
if (index === undefined) {
|
|
22
21
|
this.#log.verbose(`Rejecting tx ${'txHash' in tx ? tx.txHash : tx.hash} for referencing an unknown block header`);
|
|
23
22
|
return { result: 'invalid', reason: [TX_ERROR_BLOCK_HEADER] };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { MAX_FR_CALLDATA_TO_ALL_ENQUEUED_CALLS } from '@aztec/constants';
|
|
2
|
-
import { createLogger } from '@aztec/foundation/log';
|
|
2
|
+
import { type Logger, type LoggerBindings, createLogger } from '@aztec/foundation/log';
|
|
3
3
|
import { computeCalldataHash } from '@aztec/stdlib/hash';
|
|
4
4
|
import {
|
|
5
5
|
TX_ERROR_CALLDATA_COUNT_MISMATCH,
|
|
@@ -16,7 +16,11 @@ import {
|
|
|
16
16
|
} from '@aztec/stdlib/tx';
|
|
17
17
|
|
|
18
18
|
export class DataTxValidator implements TxValidator<Tx> {
|
|
19
|
-
#log
|
|
19
|
+
#log: Logger;
|
|
20
|
+
|
|
21
|
+
constructor(bindings?: LoggerBindings) {
|
|
22
|
+
this.#log = createLogger('p2p:tx_validator:tx_data', bindings);
|
|
23
|
+
}
|
|
20
24
|
|
|
21
25
|
async validateTx(tx: Tx): Promise<TxValidationResult> {
|
|
22
26
|
const reason =
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { createLogger } from '@aztec/foundation/log';
|
|
1
|
+
import { type Logger, type LoggerBindings, createLogger } from '@aztec/foundation/log';
|
|
2
2
|
import {
|
|
3
3
|
type AnyTx,
|
|
4
4
|
TX_ERROR_DUPLICATE_NULLIFIER_IN_TX,
|
|
@@ -13,11 +13,12 @@ export interface NullifierSource {
|
|
|
13
13
|
}
|
|
14
14
|
|
|
15
15
|
export class DoubleSpendTxValidator<T extends AnyTx> implements TxValidator<T> {
|
|
16
|
-
#log
|
|
16
|
+
#log: Logger;
|
|
17
17
|
#nullifierSource: NullifierSource;
|
|
18
18
|
|
|
19
|
-
constructor(nullifierSource: NullifierSource) {
|
|
19
|
+
constructor(nullifierSource: NullifierSource, bindings?: LoggerBindings) {
|
|
20
20
|
this.#nullifierSource = nullifierSource;
|
|
21
|
+
this.#log = createLogger('p2p:tx_validator:tx_double_spend', bindings);
|
|
21
22
|
}
|
|
22
23
|
|
|
23
24
|
async validateTx(tx: T): Promise<TxValidationResult> {
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { BlockNumber } from '@aztec/foundation/branded-types';
|
|
2
2
|
import { Fr } from '@aztec/foundation/curves/bn254';
|
|
3
|
+
import type { LoggerBindings } from '@aztec/foundation/log';
|
|
3
4
|
import { getVKTreeRoot } from '@aztec/noir-protocol-circuits-types/vk-tree';
|
|
4
|
-
import { ProtocolContractAddress } from '@aztec/protocol-contracts';
|
|
5
|
+
import { ProtocolContractAddress, protocolContractsHash } from '@aztec/protocol-contracts';
|
|
5
6
|
import type { ContractDataSource } from '@aztec/stdlib/contract';
|
|
6
7
|
import type { GasFees } from '@aztec/stdlib/gas';
|
|
7
8
|
import type {
|
|
@@ -11,9 +12,10 @@ import type {
|
|
|
11
12
|
} from '@aztec/stdlib/interfaces/server';
|
|
12
13
|
import { PeerErrorSeverity } from '@aztec/stdlib/p2p';
|
|
13
14
|
import { DatabasePublicStateSource, MerkleTreeId } from '@aztec/stdlib/trees';
|
|
14
|
-
import type { Tx, TxValidationResult } from '@aztec/stdlib/tx';
|
|
15
|
+
import type { Tx, TxValidationResult, TxValidator } from '@aztec/stdlib/tx';
|
|
15
16
|
import type { UInt64 } from '@aztec/stdlib/types';
|
|
16
17
|
|
|
18
|
+
import { AggregateTxValidator } from './aggregate_tx_validator.js';
|
|
17
19
|
import { ArchiveCache } from './archive_cache.js';
|
|
18
20
|
import { BlockHeaderTxValidator } from './block_header_validator.js';
|
|
19
21
|
import { DataTxValidator } from './data_validator.js';
|
|
@@ -21,6 +23,7 @@ import { DoubleSpendTxValidator } from './double_spend_validator.js';
|
|
|
21
23
|
import { GasTxValidator } from './gas_validator.js';
|
|
22
24
|
import { MetadataTxValidator } from './metadata_validator.js';
|
|
23
25
|
import { PhasesTxValidator } from './phases_validator.js';
|
|
26
|
+
import { SizeTxValidator } from './size_validator.js';
|
|
24
27
|
import { TimestampTxValidator } from './timestamp_validator.js';
|
|
25
28
|
import { TxPermittedValidator } from './tx_permitted_validator.js';
|
|
26
29
|
import { TxProofValidator } from './tx_proof_validator.js';
|
|
@@ -44,43 +47,53 @@ export function createTxMessageValidators(
|
|
|
44
47
|
proofVerifier: ClientProtocolCircuitVerifier,
|
|
45
48
|
txsPermitted: boolean,
|
|
46
49
|
allowedInSetup: AllowedElement[] = [],
|
|
50
|
+
bindings?: LoggerBindings,
|
|
47
51
|
): Record<string, MessageValidator>[] {
|
|
48
52
|
const merkleTree = worldStateSynchronizer.getCommitted();
|
|
49
53
|
|
|
50
54
|
return [
|
|
51
55
|
{
|
|
52
56
|
txsPermittedValidator: {
|
|
53
|
-
validator: new TxPermittedValidator(txsPermitted),
|
|
57
|
+
validator: new TxPermittedValidator(txsPermitted, bindings),
|
|
54
58
|
severity: PeerErrorSeverity.MidToleranceError,
|
|
55
59
|
},
|
|
56
60
|
dataValidator: {
|
|
57
|
-
validator: new DataTxValidator(),
|
|
61
|
+
validator: new DataTxValidator(bindings),
|
|
58
62
|
severity: PeerErrorSeverity.HighToleranceError,
|
|
59
63
|
},
|
|
60
64
|
metadataValidator: {
|
|
61
|
-
validator: new MetadataTxValidator(
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
65
|
+
validator: new MetadataTxValidator(
|
|
66
|
+
{
|
|
67
|
+
l1ChainId: new Fr(l1ChainId),
|
|
68
|
+
rollupVersion: new Fr(rollupVersion),
|
|
69
|
+
protocolContractsHash,
|
|
70
|
+
vkTreeRoot: getVKTreeRoot(),
|
|
71
|
+
},
|
|
72
|
+
bindings,
|
|
73
|
+
),
|
|
67
74
|
severity: PeerErrorSeverity.HighToleranceError,
|
|
68
75
|
},
|
|
69
76
|
timestampValidator: {
|
|
70
|
-
validator: new TimestampTxValidator<Tx>(
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
77
|
+
validator: new TimestampTxValidator<Tx>(
|
|
78
|
+
{
|
|
79
|
+
timestamp,
|
|
80
|
+
blockNumber,
|
|
81
|
+
},
|
|
82
|
+
bindings,
|
|
83
|
+
),
|
|
74
84
|
severity: PeerErrorSeverity.MidToleranceError,
|
|
75
85
|
},
|
|
76
86
|
doubleSpendValidator: {
|
|
77
|
-
validator: new DoubleSpendTxValidator(
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
87
|
+
validator: new DoubleSpendTxValidator(
|
|
88
|
+
{
|
|
89
|
+
nullifiersExist: async (nullifiers: Buffer[]) => {
|
|
90
|
+
const merkleTree = worldStateSynchronizer.getCommitted();
|
|
91
|
+
const indices = await merkleTree.findLeafIndices(MerkleTreeId.NULLIFIER_TREE, nullifiers);
|
|
92
|
+
return indices.map(index => index !== undefined);
|
|
93
|
+
},
|
|
82
94
|
},
|
|
83
|
-
|
|
95
|
+
bindings,
|
|
96
|
+
),
|
|
84
97
|
severity: PeerErrorSeverity.HighToleranceError,
|
|
85
98
|
},
|
|
86
99
|
gasValidator: {
|
|
@@ -88,23 +101,51 @@ export function createTxMessageValidators(
|
|
|
88
101
|
new DatabasePublicStateSource(merkleTree),
|
|
89
102
|
ProtocolContractAddress.FeeJuice,
|
|
90
103
|
gasFees,
|
|
104
|
+
bindings,
|
|
91
105
|
),
|
|
92
106
|
severity: PeerErrorSeverity.HighToleranceError,
|
|
93
107
|
},
|
|
94
108
|
phasesValidator: {
|
|
95
|
-
validator: new PhasesTxValidator(contractDataSource, allowedInSetup, timestamp),
|
|
109
|
+
validator: new PhasesTxValidator(contractDataSource, allowedInSetup, timestamp, bindings),
|
|
96
110
|
severity: PeerErrorSeverity.MidToleranceError,
|
|
97
111
|
},
|
|
98
112
|
blockHeaderValidator: {
|
|
99
|
-
validator: new BlockHeaderTxValidator(new ArchiveCache(merkleTree)),
|
|
113
|
+
validator: new BlockHeaderTxValidator(new ArchiveCache(merkleTree), bindings),
|
|
100
114
|
severity: PeerErrorSeverity.HighToleranceError,
|
|
101
115
|
},
|
|
102
116
|
},
|
|
103
117
|
{
|
|
104
118
|
proofValidator: {
|
|
105
|
-
validator: new TxProofValidator(proofVerifier),
|
|
119
|
+
validator: new TxProofValidator(proofVerifier, bindings),
|
|
106
120
|
severity: PeerErrorSeverity.MidToleranceError,
|
|
107
121
|
},
|
|
108
122
|
},
|
|
109
123
|
];
|
|
110
124
|
}
|
|
125
|
+
|
|
126
|
+
export function createTxReqRespValidator(
|
|
127
|
+
verifier: ClientProtocolCircuitVerifier,
|
|
128
|
+
{
|
|
129
|
+
l1ChainId,
|
|
130
|
+
rollupVersion,
|
|
131
|
+
}: {
|
|
132
|
+
l1ChainId: number;
|
|
133
|
+
rollupVersion: number;
|
|
134
|
+
},
|
|
135
|
+
bindings?: LoggerBindings,
|
|
136
|
+
): TxValidator {
|
|
137
|
+
return new AggregateTxValidator(
|
|
138
|
+
new MetadataTxValidator(
|
|
139
|
+
{
|
|
140
|
+
l1ChainId: new Fr(l1ChainId),
|
|
141
|
+
rollupVersion: new Fr(rollupVersion),
|
|
142
|
+
protocolContractsHash,
|
|
143
|
+
vkTreeRoot: getVKTreeRoot(),
|
|
144
|
+
},
|
|
145
|
+
bindings,
|
|
146
|
+
),
|
|
147
|
+
new SizeTxValidator(bindings),
|
|
148
|
+
new DataTxValidator(bindings),
|
|
149
|
+
new TxProofValidator(verifier, bindings),
|
|
150
|
+
);
|
|
151
|
+
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { AVM_MAX_PROCESSABLE_L2_GAS, FIXED_DA_GAS, FIXED_L2_GAS } from '@aztec/constants';
|
|
2
|
-
import { createLogger } from '@aztec/foundation/log';
|
|
2
|
+
import { type Logger, type LoggerBindings, createLogger } from '@aztec/foundation/log';
|
|
3
3
|
import { computeFeePayerBalanceStorageSlot } from '@aztec/protocol-contracts/fee-juice';
|
|
4
4
|
import type { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
5
5
|
import { Gas, GasFees } from '@aztec/stdlib/gas';
|
|
@@ -17,12 +17,18 @@ import {
|
|
|
17
17
|
import { getFeePayerClaimAmount, getTxFeeLimit } from './fee_payer_balance.js';
|
|
18
18
|
|
|
19
19
|
export class GasTxValidator implements TxValidator<Tx> {
|
|
20
|
-
#log
|
|
20
|
+
#log: Logger;
|
|
21
21
|
#publicDataSource: PublicStateSource;
|
|
22
22
|
#feeJuiceAddress: AztecAddress;
|
|
23
23
|
#gasFees: GasFees;
|
|
24
24
|
|
|
25
|
-
constructor(
|
|
25
|
+
constructor(
|
|
26
|
+
publicDataSource: PublicStateSource,
|
|
27
|
+
feeJuiceAddress: AztecAddress,
|
|
28
|
+
gasFees: GasFees,
|
|
29
|
+
bindings?: LoggerBindings,
|
|
30
|
+
) {
|
|
31
|
+
this.#log = createLogger('sequencer:tx_validator:tx_gas', bindings);
|
|
26
32
|
this.#publicDataSource = publicDataSource;
|
|
27
33
|
this.#feeJuiceAddress = feeJuiceAddress;
|
|
28
34
|
this.#gasFees = gasFees;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { Fr } from '@aztec/foundation/curves/bn254';
|
|
2
|
-
import { createLogger } from '@aztec/foundation/log';
|
|
2
|
+
import { type Logger, type LoggerBindings, createLogger } from '@aztec/foundation/log';
|
|
3
3
|
import {
|
|
4
4
|
type AnyTx,
|
|
5
5
|
TX_ERROR_INCORRECT_L1_CHAIN_ID,
|
|
@@ -11,7 +11,7 @@ import {
|
|
|
11
11
|
} from '@aztec/stdlib/tx';
|
|
12
12
|
|
|
13
13
|
export class MetadataTxValidator<T extends AnyTx> implements TxValidator<T> {
|
|
14
|
-
#log
|
|
14
|
+
#log: Logger;
|
|
15
15
|
|
|
16
16
|
constructor(
|
|
17
17
|
private values: {
|
|
@@ -20,7 +20,10 @@ export class MetadataTxValidator<T extends AnyTx> implements TxValidator<T> {
|
|
|
20
20
|
vkTreeRoot: Fr;
|
|
21
21
|
protocolContractsHash: Fr;
|
|
22
22
|
},
|
|
23
|
-
|
|
23
|
+
bindings?: LoggerBindings,
|
|
24
|
+
) {
|
|
25
|
+
this.#log = createLogger('p2p:tx_validator:tx_metadata', bindings);
|
|
26
|
+
}
|
|
24
27
|
|
|
25
28
|
validateTx(tx: T): Promise<TxValidationResult> {
|
|
26
29
|
const errors = [];
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { createLogger } from '@aztec/foundation/log';
|
|
1
|
+
import { type Logger, type LoggerBindings, createLogger } from '@aztec/foundation/log';
|
|
2
2
|
import { PublicContractsDB, getCallRequestsWithCalldataByPhase } from '@aztec/simulator/server';
|
|
3
3
|
import type { ContractDataSource } from '@aztec/stdlib/contract';
|
|
4
4
|
import type { AllowedElement } from '@aztec/stdlib/interfaces/server';
|
|
@@ -14,15 +14,17 @@ import {
|
|
|
14
14
|
import type { UInt64 } from '@aztec/stdlib/types';
|
|
15
15
|
|
|
16
16
|
export class PhasesTxValidator implements TxValidator<Tx> {
|
|
17
|
-
#log
|
|
17
|
+
#log: Logger;
|
|
18
18
|
private contractsDB: PublicContractsDB;
|
|
19
19
|
|
|
20
20
|
constructor(
|
|
21
21
|
contracts: ContractDataSource,
|
|
22
22
|
private setupAllowList: AllowedElement[],
|
|
23
23
|
private timestamp: UInt64,
|
|
24
|
+
bindings?: LoggerBindings,
|
|
24
25
|
) {
|
|
25
|
-
this
|
|
26
|
+
this.#log = createLogger('sequencer:tx_validator:tx_phases', bindings);
|
|
27
|
+
this.contractsDB = new PublicContractsDB(contracts, bindings);
|
|
26
28
|
}
|
|
27
29
|
|
|
28
30
|
async validateTx(tx: Tx): Promise<TxValidationResult> {
|
|
@@ -1,9 +1,13 @@
|
|
|
1
|
-
import { createLogger } from '@aztec/foundation/log';
|
|
1
|
+
import { type Logger, type LoggerBindings, createLogger } from '@aztec/foundation/log';
|
|
2
2
|
import { MAX_TX_SIZE_KB } from '@aztec/stdlib/p2p';
|
|
3
3
|
import { Tx, type TxValidationResult, type TxValidator } from '@aztec/stdlib/tx';
|
|
4
4
|
|
|
5
5
|
export class SizeTxValidator implements TxValidator<Tx> {
|
|
6
|
-
#log
|
|
6
|
+
#log: Logger;
|
|
7
|
+
|
|
8
|
+
constructor(bindings?: LoggerBindings) {
|
|
9
|
+
this.#log = createLogger('p2p:tx_validator:tx_size', bindings);
|
|
10
|
+
}
|
|
7
11
|
|
|
8
12
|
validateTx(tx: Tx): Promise<TxValidationResult> {
|
|
9
13
|
const txSize = tx.getSize();
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { BlockNumber } from '@aztec/foundation/branded-types';
|
|
2
|
-
import { createLogger } from '@aztec/foundation/log';
|
|
2
|
+
import { type Logger, type LoggerBindings, createLogger } from '@aztec/foundation/log';
|
|
3
3
|
import {
|
|
4
4
|
type AnyTx,
|
|
5
5
|
TX_ERROR_INVALID_INCLUDE_BY_TIMESTAMP,
|
|
@@ -10,7 +10,7 @@ import {
|
|
|
10
10
|
import type { UInt64 } from '@aztec/stdlib/types';
|
|
11
11
|
|
|
12
12
|
export class TimestampTxValidator<T extends AnyTx> implements TxValidator<T> {
|
|
13
|
-
#log
|
|
13
|
+
#log: Logger;
|
|
14
14
|
|
|
15
15
|
constructor(
|
|
16
16
|
private values: {
|
|
@@ -20,7 +20,10 @@ export class TimestampTxValidator<T extends AnyTx> implements TxValidator<T> {
|
|
|
20
20
|
// Block number in which the tx is considered to be included.
|
|
21
21
|
blockNumber: BlockNumber;
|
|
22
22
|
},
|
|
23
|
-
|
|
23
|
+
bindings?: LoggerBindings,
|
|
24
|
+
) {
|
|
25
|
+
this.#log = createLogger('p2p:tx_validator:timestamp', bindings);
|
|
26
|
+
}
|
|
24
27
|
|
|
25
28
|
validateTx(tx: T): Promise<TxValidationResult> {
|
|
26
29
|
const includeByTimestamp = tx.data.includeByTimestamp;
|
|
@@ -1,10 +1,15 @@
|
|
|
1
|
-
import { createLogger } from '@aztec/foundation/log';
|
|
1
|
+
import { type Logger, type LoggerBindings, createLogger } from '@aztec/foundation/log';
|
|
2
2
|
import type { Tx, TxValidationResult, TxValidator } from '@aztec/stdlib/tx';
|
|
3
3
|
|
|
4
4
|
export class TxPermittedValidator implements TxValidator<Tx> {
|
|
5
|
-
#log
|
|
5
|
+
#log: Logger;
|
|
6
6
|
|
|
7
|
-
constructor(
|
|
7
|
+
constructor(
|
|
8
|
+
private permitted: boolean,
|
|
9
|
+
bindings?: LoggerBindings,
|
|
10
|
+
) {
|
|
11
|
+
this.#log = createLogger('p2p:tx_validator:tx_permitted', bindings);
|
|
12
|
+
}
|
|
8
13
|
|
|
9
14
|
validateTx(tx: Tx): Promise<TxValidationResult> {
|
|
10
15
|
if (!this.permitted) {
|
|
@@ -1,11 +1,16 @@
|
|
|
1
|
-
import { createLogger } from '@aztec/foundation/log';
|
|
1
|
+
import { type Logger, type LoggerBindings, createLogger } from '@aztec/foundation/log';
|
|
2
2
|
import type { ClientProtocolCircuitVerifier } from '@aztec/stdlib/interfaces/server';
|
|
3
3
|
import { TX_ERROR_INVALID_PROOF, Tx, type TxValidationResult, type TxValidator } from '@aztec/stdlib/tx';
|
|
4
4
|
|
|
5
5
|
export class TxProofValidator implements TxValidator<Tx> {
|
|
6
|
-
#log
|
|
6
|
+
#log: Logger;
|
|
7
7
|
|
|
8
|
-
constructor(
|
|
8
|
+
constructor(
|
|
9
|
+
private verifier: ClientProtocolCircuitVerifier,
|
|
10
|
+
bindings?: LoggerBindings,
|
|
11
|
+
) {
|
|
12
|
+
this.#log = createLogger('p2p:tx_validator:proof', bindings);
|
|
13
|
+
}
|
|
9
14
|
|
|
10
15
|
async validateTx(tx: Tx): Promise<TxValidationResult> {
|
|
11
16
|
const result = await this.verifier.verifyProof(tx);
|
|
@@ -24,6 +24,7 @@ class KeyNotFoundError extends Error {
|
|
|
24
24
|
}
|
|
25
25
|
|
|
26
26
|
export class AztecDatastore implements Datastore {
|
|
27
|
+
#db: AztecAsyncKVStore;
|
|
27
28
|
#memoryDatastore: Map<string, MemoryItem>;
|
|
28
29
|
#dbDatastore: AztecAsyncMap<string, Uint8Array>;
|
|
29
30
|
|
|
@@ -32,9 +33,9 @@ export class AztecDatastore implements Datastore {
|
|
|
32
33
|
private maxMemoryItems: number;
|
|
33
34
|
|
|
34
35
|
constructor(db: AztecAsyncKVStore, { maxMemoryItems } = { maxMemoryItems: 50 }) {
|
|
36
|
+
this.#db = db;
|
|
35
37
|
this.#memoryDatastore = new Map();
|
|
36
38
|
this.#dbDatastore = db.openMap('p2p_datastore');
|
|
37
|
-
|
|
38
39
|
this.maxMemoryItems = maxMemoryItems;
|
|
39
40
|
}
|
|
40
41
|
|
|
@@ -106,13 +107,15 @@ export class AztecDatastore implements Datastore {
|
|
|
106
107
|
});
|
|
107
108
|
},
|
|
108
109
|
commit: async () => {
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
110
|
+
await this.#db.transactionAsync(async () => {
|
|
111
|
+
for (const op of this.#batchOps) {
|
|
112
|
+
if (op.type === 'put' && op.value) {
|
|
113
|
+
await this.put(op.key, op.value);
|
|
114
|
+
} else if (op.type === 'del') {
|
|
115
|
+
await this.delete(op.key);
|
|
116
|
+
}
|
|
114
117
|
}
|
|
115
|
-
}
|
|
118
|
+
});
|
|
116
119
|
this.#batchOps = []; // Clear operations after commit
|
|
117
120
|
},
|
|
118
121
|
};
|
|
@@ -87,7 +87,7 @@ export class DiscV5Service extends EventEmitter implements PeerDiscoveryService
|
|
|
87
87
|
this.packageVersion,
|
|
88
88
|
));
|
|
89
89
|
|
|
90
|
-
const metricsRegistry = new OtelMetricsAdapter(telemetry);
|
|
90
|
+
const metricsRegistry = new OtelMetricsAdapter(telemetry, this.logger.getBindings());
|
|
91
91
|
this.discv5 = Discv5.create({
|
|
92
92
|
enr: this.enr,
|
|
93
93
|
peerId,
|
|
@@ -8,7 +8,9 @@ import type { ENR } from '@nethermindeth/enr';
|
|
|
8
8
|
import EventEmitter from 'events';
|
|
9
9
|
|
|
10
10
|
import type { PeerManagerInterface } from './peer-manager/interface.js';
|
|
11
|
+
import type { BatchTxRequesterLibP2PService } from './reqresp/batch-tx-requester/interface.js';
|
|
11
12
|
import type { P2PReqRespConfig } from './reqresp/config.js';
|
|
13
|
+
import type { ConnectionSampler } from './reqresp/connection-sampler/connection_sampler.js';
|
|
12
14
|
import { type AuthRequest, StatusMessage } from './reqresp/index.js';
|
|
13
15
|
import type {
|
|
14
16
|
ReqRespInterface,
|
|
@@ -24,6 +26,7 @@ import { ReqRespStatus } from './reqresp/status.js';
|
|
|
24
26
|
import {
|
|
25
27
|
type P2PBlockReceivedCallback,
|
|
26
28
|
type P2PCheckpointReceivedCallback,
|
|
29
|
+
type P2PDuplicateProposalCallback,
|
|
27
30
|
type P2PService,
|
|
28
31
|
type PeerDiscoveryService,
|
|
29
32
|
PeerDiscoveryState,
|
|
@@ -80,6 +83,11 @@ export class DummyP2PService implements P2PService {
|
|
|
80
83
|
*/
|
|
81
84
|
public registerCheckpointReceivedCallback(_callback: P2PCheckpointReceivedCallback) {}
|
|
82
85
|
|
|
86
|
+
/**
|
|
87
|
+
* Register a callback for when a duplicate proposal is detected
|
|
88
|
+
*/
|
|
89
|
+
public registerDuplicateProposalCallback(_callback: P2PDuplicateProposalCallback): void {}
|
|
90
|
+
|
|
83
91
|
/**
|
|
84
92
|
* Sends a request to a peer.
|
|
85
93
|
* @param _protocol - The protocol to send the request on.
|
|
@@ -106,6 +114,15 @@ export class DummyP2PService implements P2PService {
|
|
|
106
114
|
return Promise.resolve([]);
|
|
107
115
|
}
|
|
108
116
|
|
|
117
|
+
public sendRequestToPeer(
|
|
118
|
+
_peerId: PeerId,
|
|
119
|
+
_subProtocol: ReqRespSubProtocol,
|
|
120
|
+
_payload: Buffer,
|
|
121
|
+
_dialTimeout?: number,
|
|
122
|
+
): Promise<ReqRespResponse> {
|
|
123
|
+
return Promise.resolve({ status: ReqRespStatus.SUCCESS, data: Buffer.from([]) });
|
|
124
|
+
}
|
|
125
|
+
|
|
109
126
|
/**
|
|
110
127
|
* Returns the ENR of the peer.
|
|
111
128
|
* @returns The ENR of the peer, otherwise undefined.
|
|
@@ -118,6 +135,10 @@ export class DummyP2PService implements P2PService {
|
|
|
118
135
|
return Promise.resolve();
|
|
119
136
|
}
|
|
120
137
|
|
|
138
|
+
validatePropagatedTx(_tx: Tx, _peerId: PeerId): Promise<boolean> {
|
|
139
|
+
return Promise.resolve(true);
|
|
140
|
+
}
|
|
141
|
+
|
|
121
142
|
addReqRespSubProtocol(
|
|
122
143
|
_subProtocol: ReqRespSubProtocol,
|
|
123
144
|
_handler: ReqRespSubProtocolHandler,
|
|
@@ -132,6 +153,27 @@ export class DummyP2PService implements P2PService {
|
|
|
132
153
|
|
|
133
154
|
//this is no-op
|
|
134
155
|
registerThisValidatorAddresses(_address: EthAddress[]): void {}
|
|
156
|
+
|
|
157
|
+
/**
|
|
158
|
+
* Get dummy BatchTxRequesterLibP2PService for testing
|
|
159
|
+
*/
|
|
160
|
+
getBatchTxRequesterService(): BatchTxRequesterLibP2PService {
|
|
161
|
+
return {
|
|
162
|
+
reqResp: this, // The dummy service implements ReqRespInterface
|
|
163
|
+
connectionSampler: new DummyReqResp().getConnectionSampler(),
|
|
164
|
+
txValidatorConfig: {
|
|
165
|
+
l1ChainId: 1,
|
|
166
|
+
rollupVersion: 1,
|
|
167
|
+
proofVerifier: {
|
|
168
|
+
verifyProof: () => Promise.resolve({ valid: true, durationMs: 0, totalDurationMs: 0 }),
|
|
169
|
+
stop: () => Promise.resolve(),
|
|
170
|
+
},
|
|
171
|
+
},
|
|
172
|
+
peerScoring: {
|
|
173
|
+
penalizePeer: (_peerId, _penalty) => {},
|
|
174
|
+
},
|
|
175
|
+
};
|
|
176
|
+
}
|
|
135
177
|
}
|
|
136
178
|
|
|
137
179
|
/**
|
|
@@ -268,6 +310,15 @@ export class DummyReqResp implements ReqRespInterface {
|
|
|
268
310
|
return Promise.resolve({ status: ReqRespStatus.SUCCESS, data: Buffer.from([]) });
|
|
269
311
|
}
|
|
270
312
|
|
|
313
|
+
/**
|
|
314
|
+
* Get dummy connection sampler for testing
|
|
315
|
+
*/
|
|
316
|
+
getConnectionSampler(): Pick<ConnectionSampler, 'getPeerListSortedByConnectionCountAsc'> {
|
|
317
|
+
return {
|
|
318
|
+
getPeerListSortedByConnectionCountAsc: () => [],
|
|
319
|
+
};
|
|
320
|
+
}
|
|
321
|
+
|
|
271
322
|
addSubProtocol(
|
|
272
323
|
_subProtocol: ReqRespSubProtocol,
|
|
273
324
|
_handler: ReqRespSubProtocolHandler,
|