@aztec/p2p 0.0.1-commit.c80b6263 → 0.0.1-commit.cd76b27
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dest/client/factory.d.ts +7 -6
- package/dest/client/factory.d.ts.map +1 -1
- package/dest/client/factory.js +47 -10
- package/dest/client/interface.d.ts +43 -23
- package/dest/client/interface.d.ts.map +1 -1
- package/dest/client/p2p_client.d.ts +40 -42
- package/dest/client/p2p_client.d.ts.map +1 -1
- package/dest/client/p2p_client.js +156 -145
- package/dest/client/test/tx_proposal_collector/proposal_tx_collector_worker.js +7 -7
- package/dest/config.d.ts +29 -4
- package/dest/config.d.ts.map +1 -1
- package/dest/config.js +19 -2
- package/dest/errors/tx-pool.error.d.ts +8 -0
- package/dest/errors/tx-pool.error.d.ts.map +1 -0
- package/dest/errors/tx-pool.error.js +9 -0
- package/dest/index.d.ts +2 -1
- package/dest/index.d.ts.map +1 -1
- package/dest/index.js +1 -0
- package/dest/mem_pools/attestation_pool/attestation_pool.d.ts +104 -88
- package/dest/mem_pools/attestation_pool/attestation_pool.d.ts.map +1 -1
- package/dest/mem_pools/attestation_pool/attestation_pool.js +441 -3
- package/dest/mem_pools/attestation_pool/attestation_pool_test_suite.d.ts +2 -2
- package/dest/mem_pools/attestation_pool/attestation_pool_test_suite.d.ts.map +1 -1
- package/dest/mem_pools/attestation_pool/attestation_pool_test_suite.js +353 -87
- package/dest/mem_pools/attestation_pool/index.d.ts +2 -3
- package/dest/mem_pools/attestation_pool/index.d.ts.map +1 -1
- package/dest/mem_pools/attestation_pool/index.js +1 -2
- package/dest/mem_pools/attestation_pool/mocks.d.ts +2 -2
- package/dest/mem_pools/attestation_pool/mocks.d.ts.map +1 -1
- package/dest/mem_pools/attestation_pool/mocks.js +2 -2
- package/dest/mem_pools/index.d.ts +3 -2
- package/dest/mem_pools/index.d.ts.map +1 -1
- package/dest/mem_pools/index.js +1 -1
- package/dest/mem_pools/interface.d.ts +5 -5
- package/dest/mem_pools/interface.d.ts.map +1 -1
- package/dest/mem_pools/tx_pool/eviction/invalid_txs_after_mining_rule.js +3 -3
- package/dest/mem_pools/tx_pool_v2/archive/index.d.ts +2 -0
- package/dest/mem_pools/tx_pool_v2/archive/index.d.ts.map +1 -0
- package/dest/mem_pools/tx_pool_v2/archive/index.js +1 -0
- package/dest/mem_pools/tx_pool_v2/archive/tx_archive.d.ts +43 -0
- package/dest/mem_pools/tx_pool_v2/archive/tx_archive.d.ts.map +1 -0
- package/dest/mem_pools/tx_pool_v2/archive/tx_archive.js +103 -0
- package/dest/mem_pools/tx_pool_v2/deleted_pool.d.ts +104 -0
- package/dest/mem_pools/tx_pool_v2/deleted_pool.d.ts.map +1 -0
- package/dest/mem_pools/tx_pool_v2/deleted_pool.js +251 -0
- package/dest/mem_pools/tx_pool_v2/eviction/eviction_manager.d.ts +47 -0
- package/dest/mem_pools/tx_pool_v2/eviction/eviction_manager.d.ts.map +1 -0
- package/dest/mem_pools/tx_pool_v2/eviction/eviction_manager.js +128 -0
- package/dest/mem_pools/tx_pool_v2/eviction/fee_payer_balance_eviction_rule.d.ts +17 -0
- package/dest/mem_pools/tx_pool_v2/eviction/fee_payer_balance_eviction_rule.d.ts.map +1 -0
- package/dest/mem_pools/tx_pool_v2/eviction/fee_payer_balance_eviction_rule.js +93 -0
- package/dest/mem_pools/tx_pool_v2/eviction/fee_payer_balance_pre_add_rule.d.ts +19 -0
- package/dest/mem_pools/tx_pool_v2/eviction/fee_payer_balance_pre_add_rule.d.ts.map +1 -0
- package/dest/mem_pools/tx_pool_v2/eviction/fee_payer_balance_pre_add_rule.js +95 -0
- package/dest/mem_pools/tx_pool_v2/eviction/index.d.ts +10 -0
- package/dest/mem_pools/tx_pool_v2/eviction/index.d.ts.map +1 -0
- package/dest/mem_pools/tx_pool_v2/eviction/index.js +11 -0
- package/dest/mem_pools/tx_pool_v2/eviction/interfaces.d.ts +174 -0
- package/dest/mem_pools/tx_pool_v2/eviction/interfaces.d.ts.map +1 -0
- package/dest/mem_pools/tx_pool_v2/eviction/interfaces.js +25 -0
- package/dest/mem_pools/tx_pool_v2/eviction/invalid_txs_after_mining_rule.d.ts +15 -0
- package/dest/mem_pools/tx_pool_v2/eviction/invalid_txs_after_mining_rule.d.ts.map +1 -0
- package/dest/mem_pools/tx_pool_v2/eviction/invalid_txs_after_mining_rule.js +65 -0
- package/dest/mem_pools/tx_pool_v2/eviction/invalid_txs_after_reorg_rule.d.ts +17 -0
- package/dest/mem_pools/tx_pool_v2/eviction/invalid_txs_after_reorg_rule.d.ts.map +1 -0
- package/dest/mem_pools/tx_pool_v2/eviction/invalid_txs_after_reorg_rule.js +93 -0
- package/dest/mem_pools/tx_pool_v2/eviction/low_priority_eviction_rule.d.ts +16 -0
- package/dest/mem_pools/tx_pool_v2/eviction/low_priority_eviction_rule.d.ts.map +1 -0
- package/dest/mem_pools/tx_pool_v2/eviction/low_priority_eviction_rule.js +74 -0
- package/dest/mem_pools/tx_pool_v2/eviction/low_priority_pre_add_rule.d.ts +20 -0
- package/dest/mem_pools/tx_pool_v2/eviction/low_priority_pre_add_rule.d.ts.map +1 -0
- package/dest/mem_pools/tx_pool_v2/eviction/low_priority_pre_add_rule.js +73 -0
- package/dest/mem_pools/tx_pool_v2/eviction/nullifier_conflict_rule.d.ts +15 -0
- package/dest/mem_pools/tx_pool_v2/eviction/nullifier_conflict_rule.d.ts.map +1 -0
- package/dest/mem_pools/tx_pool_v2/eviction/nullifier_conflict_rule.js +19 -0
- package/dest/mem_pools/tx_pool_v2/index.d.ts +6 -0
- package/dest/mem_pools/tx_pool_v2/index.d.ts.map +1 -0
- package/dest/mem_pools/tx_pool_v2/index.js +5 -0
- package/dest/mem_pools/tx_pool_v2/instrumentation.d.ts +15 -0
- package/dest/mem_pools/tx_pool_v2/instrumentation.d.ts.map +1 -0
- package/dest/mem_pools/tx_pool_v2/instrumentation.js +43 -0
- package/dest/mem_pools/tx_pool_v2/interfaces.d.ts +209 -0
- package/dest/mem_pools/tx_pool_v2/interfaces.d.ts.map +1 -0
- package/dest/mem_pools/tx_pool_v2/interfaces.js +8 -0
- package/dest/mem_pools/tx_pool_v2/tx_metadata.d.ts +97 -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 +152 -0
- package/dest/mem_pools/tx_pool_v2/tx_pool_bench_metrics.d.ts +26 -0
- package/dest/mem_pools/tx_pool_v2/tx_pool_bench_metrics.d.ts.map +1 -0
- package/dest/mem_pools/tx_pool_v2/tx_pool_bench_metrics.js +70 -0
- package/dest/mem_pools/tx_pool_v2/tx_pool_indices.d.ts +108 -0
- package/dest/mem_pools/tx_pool_v2/tx_pool_indices.d.ts.map +1 -0
- package/dest/mem_pools/tx_pool_v2/tx_pool_indices.js +355 -0
- package/dest/mem_pools/tx_pool_v2/tx_pool_v2.d.ts +60 -0
- package/dest/mem_pools/tx_pool_v2/tx_pool_v2.d.ts.map +1 -0
- package/dest/mem_pools/tx_pool_v2/tx_pool_v2.js +161 -0
- package/dest/mem_pools/tx_pool_v2/tx_pool_v2_impl.d.ts +77 -0
- package/dest/mem_pools/tx_pool_v2/tx_pool_v2_impl.d.ts.map +1 -0
- package/dest/mem_pools/tx_pool_v2/tx_pool_v2_impl.js +878 -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/tx_validator/aggregate_tx_validator.d.ts +3 -3
- package/dest/msg_validators/tx_validator/aggregate_tx_validator.d.ts.map +1 -1
- package/dest/msg_validators/tx_validator/archive_cache.d.ts +3 -3
- package/dest/msg_validators/tx_validator/archive_cache.d.ts.map +1 -1
- package/dest/msg_validators/tx_validator/archive_cache.js +1 -1
- package/dest/msg_validators/tx_validator/block_header_validator.d.ts +18 -5
- package/dest/msg_validators/tx_validator/block_header_validator.d.ts.map +1 -1
- package/dest/msg_validators/tx_validator/block_header_validator.js +2 -2
- package/dest/msg_validators/tx_validator/double_spend_validator.d.ts +13 -3
- package/dest/msg_validators/tx_validator/double_spend_validator.d.ts.map +1 -1
- package/dest/msg_validators/tx_validator/double_spend_validator.js +4 -4
- package/dest/msg_validators/tx_validator/timestamp_validator.d.ts +20 -4
- package/dest/msg_validators/tx_validator/timestamp_validator.d.ts.map +1 -1
- package/dest/msg_validators/tx_validator/timestamp_validator.js +6 -6
- package/dest/services/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/dummy_service.d.ts +12 -3
- package/dest/services/dummy_service.d.ts.map +1 -1
- package/dest/services/dummy_service.js +9 -0
- package/dest/services/encoding.d.ts +2 -2
- package/dest/services/encoding.d.ts.map +1 -1
- package/dest/services/encoding.js +4 -3
- package/dest/services/gossipsub/index.d.ts +3 -0
- package/dest/services/gossipsub/index.d.ts.map +1 -0
- package/dest/services/gossipsub/index.js +2 -0
- package/dest/services/gossipsub/scoring.d.ts +21 -3
- package/dest/services/gossipsub/scoring.d.ts.map +1 -1
- package/dest/services/gossipsub/scoring.js +24 -7
- package/dest/services/gossipsub/topic_score_params.d.ts +173 -0
- package/dest/services/gossipsub/topic_score_params.d.ts.map +1 -0
- package/dest/services/gossipsub/topic_score_params.js +346 -0
- package/dest/services/index.d.ts +2 -1
- package/dest/services/index.d.ts.map +1 -1
- package/dest/services/index.js +1 -0
- package/dest/services/libp2p/libp2p_service.d.ts +85 -35
- package/dest/services/libp2p/libp2p_service.d.ts.map +1 -1
- package/dest/services/libp2p/libp2p_service.js +379 -280
- 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 +25 -2
- package/dest/services/reqresp/batch-tx-requester/batch_tx_requester.d.ts +6 -5
- package/dest/services/reqresp/batch-tx-requester/batch_tx_requester.d.ts.map +1 -1
- package/dest/services/reqresp/batch-tx-requester/batch_tx_requester.js +13 -17
- package/dest/services/reqresp/batch-tx-requester/interface.d.ts +2 -6
- package/dest/services/reqresp/batch-tx-requester/interface.d.ts.map +1 -1
- package/dest/services/reqresp/batch-tx-requester/missing_txs.d.ts +10 -13
- package/dest/services/reqresp/batch-tx-requester/missing_txs.d.ts.map +1 -1
- package/dest/services/reqresp/batch-tx-requester/missing_txs.js +25 -46
- package/dest/services/reqresp/interface.d.ts +10 -1
- package/dest/services/reqresp/interface.d.ts.map +1 -1
- package/dest/services/reqresp/interface.js +15 -1
- package/dest/services/reqresp/protocols/block_txs/block_txs_handler.d.ts +7 -5
- package/dest/services/reqresp/protocols/block_txs/block_txs_handler.d.ts.map +1 -1
- package/dest/services/reqresp/protocols/block_txs/block_txs_handler.js +17 -12
- package/dest/services/reqresp/protocols/block_txs/block_txs_reqresp.d.ts +25 -14
- 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 +40 -24
- package/dest/services/reqresp/protocols/tx.d.ts +7 -1
- package/dest/services/reqresp/protocols/tx.d.ts.map +1 -1
- package/dest/services/reqresp/protocols/tx.js +20 -0
- package/dest/services/reqresp/reqresp.d.ts +1 -1
- package/dest/services/reqresp/reqresp.d.ts.map +1 -1
- package/dest/services/reqresp/reqresp.js +11 -4
- package/dest/services/service.d.ts +38 -2
- package/dest/services/service.d.ts.map +1 -1
- package/dest/services/tx_collection/config.d.ts +22 -4
- package/dest/services/tx_collection/config.d.ts.map +1 -1
- package/dest/services/tx_collection/config.js +49 -3
- package/dest/services/tx_collection/fast_tx_collection.d.ts +6 -5
- package/dest/services/tx_collection/fast_tx_collection.d.ts.map +1 -1
- package/dest/services/tx_collection/fast_tx_collection.js +64 -48
- package/dest/services/tx_collection/file_store_tx_collection.d.ts +53 -0
- package/dest/services/tx_collection/file_store_tx_collection.d.ts.map +1 -0
- package/dest/services/tx_collection/file_store_tx_collection.js +167 -0
- package/dest/services/tx_collection/file_store_tx_source.d.ts +37 -0
- package/dest/services/tx_collection/file_store_tx_source.d.ts.map +1 -0
- package/dest/services/tx_collection/file_store_tx_source.js +90 -0
- package/dest/services/tx_collection/index.d.ts +3 -2
- package/dest/services/tx_collection/index.d.ts.map +1 -1
- package/dest/services/tx_collection/index.js +1 -0
- package/dest/services/tx_collection/instrumentation.d.ts +1 -1
- package/dest/services/tx_collection/instrumentation.d.ts.map +1 -1
- package/dest/services/tx_collection/instrumentation.js +2 -1
- package/dest/services/tx_collection/missing_txs_tracker.d.ts +32 -0
- package/dest/services/tx_collection/missing_txs_tracker.d.ts.map +1 -0
- package/dest/services/tx_collection/missing_txs_tracker.js +27 -0
- package/dest/services/tx_collection/proposal_tx_collector.d.ts +15 -14
- package/dest/services/tx_collection/proposal_tx_collector.d.ts.map +1 -1
- package/dest/services/tx_collection/proposal_tx_collector.js +6 -6
- package/dest/services/tx_collection/slow_tx_collection.d.ts +7 -3
- package/dest/services/tx_collection/slow_tx_collection.d.ts.map +1 -1
- package/dest/services/tx_collection/slow_tx_collection.js +60 -26
- package/dest/services/tx_collection/tx_collection.d.ts +23 -10
- package/dest/services/tx_collection/tx_collection.d.ts.map +1 -1
- package/dest/services/tx_collection/tx_collection.js +75 -3
- package/dest/services/tx_collection/tx_collection_sink.d.ts +18 -8
- package/dest/services/tx_collection/tx_collection_sink.d.ts.map +1 -1
- package/dest/services/tx_collection/tx_collection_sink.js +26 -29
- package/dest/services/tx_collection/tx_source.d.ts +8 -3
- package/dest/services/tx_collection/tx_source.d.ts.map +1 -1
- package/dest/services/tx_collection/tx_source.js +19 -2
- package/dest/services/tx_file_store/config.d.ts +16 -0
- package/dest/services/tx_file_store/config.d.ts.map +1 -0
- package/dest/services/tx_file_store/config.js +22 -0
- package/dest/services/tx_file_store/index.d.ts +4 -0
- package/dest/services/tx_file_store/index.d.ts.map +1 -0
- package/dest/services/tx_file_store/index.js +3 -0
- package/dest/services/tx_file_store/instrumentation.d.ts +15 -0
- package/dest/services/tx_file_store/instrumentation.d.ts.map +1 -0
- package/dest/services/tx_file_store/instrumentation.js +29 -0
- package/dest/services/tx_file_store/tx_file_store.d.ts +48 -0
- package/dest/services/tx_file_store/tx_file_store.d.ts.map +1 -0
- package/dest/services/tx_file_store/tx_file_store.js +152 -0
- package/dest/services/tx_provider.d.ts +3 -3
- package/dest/services/tx_provider.d.ts.map +1 -1
- package/dest/services/tx_provider.js +5 -4
- package/dest/test-helpers/make-test-p2p-clients.d.ts +3 -3
- package/dest/test-helpers/make-test-p2p-clients.d.ts.map +1 -1
- package/dest/test-helpers/mock-pubsub.d.ts +29 -2
- package/dest/test-helpers/mock-pubsub.d.ts.map +1 -1
- package/dest/test-helpers/mock-pubsub.js +103 -2
- 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/testbench-utils.d.ts +45 -38
- package/dest/test-helpers/testbench-utils.d.ts.map +1 -1
- package/dest/test-helpers/testbench-utils.js +130 -60
- package/dest/testbench/p2p_client_testbench_worker.d.ts +2 -2
- package/dest/testbench/p2p_client_testbench_worker.d.ts.map +1 -1
- package/dest/testbench/p2p_client_testbench_worker.js +11 -11
- package/dest/util.d.ts +2 -2
- package/dest/util.d.ts.map +1 -1
- package/package.json +14 -14
- package/src/client/factory.ts +89 -14
- package/src/client/interface.ts +59 -23
- package/src/client/p2p_client.ts +196 -167
- package/src/client/test/tx_proposal_collector/README.md +4 -4
- package/src/client/test/tx_proposal_collector/proposal_tx_collector_worker.ts +20 -10
- package/src/config.ts +41 -2
- package/src/errors/tx-pool.error.ts +12 -0
- package/src/index.ts +1 -0
- package/src/mem_pools/attestation_pool/attestation_pool.ts +496 -91
- package/src/mem_pools/attestation_pool/attestation_pool_test_suite.ts +442 -102
- package/src/mem_pools/attestation_pool/index.ts +9 -2
- package/src/mem_pools/attestation_pool/mocks.ts +2 -1
- package/src/mem_pools/index.ts +4 -1
- package/src/mem_pools/interface.ts +4 -4
- package/src/mem_pools/tx_pool/README.md +1 -1
- package/src/mem_pools/tx_pool/eviction/invalid_txs_after_mining_rule.ts +3 -3
- package/src/mem_pools/tx_pool_v2/README.md +275 -0
- package/src/mem_pools/tx_pool_v2/archive/index.ts +1 -0
- package/src/mem_pools/tx_pool_v2/archive/tx_archive.ts +120 -0
- package/src/mem_pools/tx_pool_v2/deleted_pool.ts +321 -0
- package/src/mem_pools/tx_pool_v2/eviction/eviction_manager.ts +160 -0
- package/src/mem_pools/tx_pool_v2/eviction/fee_payer_balance_eviction_rule.ts +121 -0
- package/src/mem_pools/tx_pool_v2/eviction/fee_payer_balance_pre_add_rule.ts +122 -0
- package/src/mem_pools/tx_pool_v2/eviction/index.ts +27 -0
- package/src/mem_pools/tx_pool_v2/eviction/interfaces.ts +209 -0
- package/src/mem_pools/tx_pool_v2/eviction/invalid_txs_after_mining_rule.ts +74 -0
- package/src/mem_pools/tx_pool_v2/eviction/invalid_txs_after_reorg_rule.ts +101 -0
- package/src/mem_pools/tx_pool_v2/eviction/low_priority_eviction_rule.ts +87 -0
- package/src/mem_pools/tx_pool_v2/eviction/low_priority_pre_add_rule.ts +90 -0
- package/src/mem_pools/tx_pool_v2/eviction/nullifier_conflict_rule.ts +31 -0
- package/src/mem_pools/tx_pool_v2/index.ts +12 -0
- package/src/mem_pools/tx_pool_v2/instrumentation.ts +69 -0
- package/src/mem_pools/tx_pool_v2/interfaces.ts +239 -0
- package/src/mem_pools/tx_pool_v2/tx_metadata.ts +242 -0
- package/src/mem_pools/tx_pool_v2/tx_pool_bench_metrics.ts +77 -0
- package/src/mem_pools/tx_pool_v2/tx_pool_indices.ts +444 -0
- package/src/mem_pools/tx_pool_v2/tx_pool_v2.ts +223 -0
- package/src/mem_pools/tx_pool_v2/tx_pool_v2_impl.ts +1052 -0
- package/src/msg_validators/attestation_validator/fisherman_attestation_validator.ts +2 -2
- package/src/msg_validators/tx_validator/aggregate_tx_validator.ts +2 -2
- package/src/msg_validators/tx_validator/archive_cache.ts +3 -3
- package/src/msg_validators/tx_validator/block_header_validator.ts +18 -8
- package/src/msg_validators/tx_validator/double_spend_validator.ts +11 -6
- package/src/msg_validators/tx_validator/timestamp_validator.ts +23 -18
- package/src/services/data_store.ts +10 -7
- package/src/services/dummy_service.ts +17 -1
- package/src/services/encoding.ts +4 -3
- package/src/services/gossipsub/README.md +641 -0
- package/src/services/gossipsub/index.ts +2 -0
- package/src/services/gossipsub/scoring.ts +29 -5
- package/src/services/gossipsub/topic_score_params.ts +487 -0
- package/src/services/index.ts +1 -0
- package/src/services/libp2p/libp2p_service.ts +382 -282
- package/src/services/peer-manager/peer_scoring.ts +25 -0
- package/src/services/reqresp/batch-tx-requester/README.md +14 -14
- package/src/services/reqresp/batch-tx-requester/batch_tx_requester.ts +18 -18
- package/src/services/reqresp/batch-tx-requester/interface.ts +1 -5
- package/src/services/reqresp/batch-tx-requester/missing_txs.ts +23 -71
- package/src/services/reqresp/interface.ts +26 -1
- package/src/services/reqresp/protocols/block_txs/block_txs_handler.ts +24 -15
- package/src/services/reqresp/protocols/block_txs/block_txs_reqresp.ts +47 -24
- package/src/services/reqresp/protocols/tx.ts +22 -0
- package/src/services/reqresp/reqresp.ts +13 -3
- package/src/services/service.ts +50 -1
- package/src/services/tx_collection/config.ts +74 -6
- package/src/services/tx_collection/fast_tx_collection.ts +74 -51
- package/src/services/tx_collection/file_store_tx_collection.ts +202 -0
- package/src/services/tx_collection/file_store_tx_source.ts +117 -0
- package/src/services/tx_collection/index.ts +2 -1
- package/src/services/tx_collection/instrumentation.ts +7 -1
- package/src/services/tx_collection/missing_txs_tracker.ts +52 -0
- package/src/services/tx_collection/proposal_tx_collector.ts +20 -21
- package/src/services/tx_collection/slow_tx_collection.ts +66 -33
- package/src/services/tx_collection/tx_collection.ts +113 -16
- package/src/services/tx_collection/tx_collection_sink.ts +30 -34
- package/src/services/tx_collection/tx_source.ts +22 -3
- package/src/services/tx_file_store/config.ts +37 -0
- package/src/services/tx_file_store/index.ts +3 -0
- package/src/services/tx_file_store/instrumentation.ts +36 -0
- package/src/services/tx_file_store/tx_file_store.ts +175 -0
- package/src/services/tx_provider.ts +8 -7
- package/src/test-helpers/make-test-p2p-clients.ts +3 -3
- package/src/test-helpers/mock-pubsub.ts +143 -3
- package/src/test-helpers/reqresp-nodes.ts +2 -1
- package/src/test-helpers/testbench-utils.ts +129 -71
- package/src/testbench/p2p_client_testbench_worker.ts +23 -16
- package/src/util.ts +7 -1
- package/dest/mem_pools/attestation_pool/kv_attestation_pool.d.ts +0 -40
- package/dest/mem_pools/attestation_pool/kv_attestation_pool.d.ts.map +0 -1
- package/dest/mem_pools/attestation_pool/kv_attestation_pool.js +0 -218
- package/dest/mem_pools/attestation_pool/memory_attestation_pool.d.ts +0 -31
- package/dest/mem_pools/attestation_pool/memory_attestation_pool.d.ts.map +0 -1
- package/dest/mem_pools/attestation_pool/memory_attestation_pool.js +0 -180
- package/src/mem_pools/attestation_pool/kv_attestation_pool.ts +0 -320
- package/src/mem_pools/attestation_pool/memory_attestation_pool.ts +0 -264
|
@@ -2,7 +2,7 @@ import type { EpochCacheInterface } from '@aztec/epoch-cache';
|
|
|
2
2
|
import { type CheckpointAttestation, PeerErrorSeverity, type ValidationResult } from '@aztec/stdlib/p2p';
|
|
3
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,7 +18,7 @@ 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);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { TxValidationResult, TxValidator } from '@aztec/stdlib/tx';
|
|
2
2
|
|
|
3
|
-
export class AggregateTxValidator<T
|
|
3
|
+
export class AggregateTxValidator<T> implements TxValidator<T> {
|
|
4
4
|
#validators: TxValidator<T>[];
|
|
5
5
|
constructor(...validators: TxValidator<T>[]) {
|
|
6
6
|
if (validators.length === 0) {
|
|
@@ -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,12 +1,24 @@
|
|
|
1
|
-
import type { Fr } from '@aztec/foundation/curves/bn254';
|
|
2
1
|
import { type Logger, type LoggerBindings, createLogger } from '@aztec/foundation/log';
|
|
3
|
-
import
|
|
2
|
+
import type { BlockHash } from '@aztec/stdlib/block';
|
|
3
|
+
import { 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
|
+
/** Structural interface for block header validation. */
|
|
10
|
+
export interface HasBlockHeaderData {
|
|
11
|
+
txHash: { toString(): string };
|
|
12
|
+
data: {
|
|
13
|
+
constants: {
|
|
14
|
+
anchorBlockHeader: {
|
|
15
|
+
hash(): Promise<BlockHash>;
|
|
16
|
+
};
|
|
17
|
+
};
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export class BlockHeaderTxValidator<T extends HasBlockHeaderData> implements TxValidator<T> {
|
|
10
22
|
#log: Logger;
|
|
11
23
|
#archiveSource: ArchiveSource;
|
|
12
24
|
|
|
@@ -16,11 +28,9 @@ export class BlockHeaderTxValidator<T extends AnyTx> implements TxValidator<T> {
|
|
|
16
28
|
}
|
|
17
29
|
|
|
18
30
|
async validateTx(tx: T): Promise<TxValidationResult> {
|
|
19
|
-
const [index] = await this.#archiveSource.getArchiveIndices([
|
|
20
|
-
(await tx.data.constants.anchorBlockHeader.hash()).toField(),
|
|
21
|
-
]);
|
|
31
|
+
const [index] = await this.#archiveSource.getArchiveIndices([await tx.data.constants.anchorBlockHeader.hash()]);
|
|
22
32
|
if (index === undefined) {
|
|
23
|
-
this.#log.verbose(`Rejecting tx ${
|
|
33
|
+
this.#log.verbose(`Rejecting tx ${tx.txHash} for referencing an unknown block header`);
|
|
24
34
|
return { result: 'invalid', reason: [TX_ERROR_BLOCK_HEADER] };
|
|
25
35
|
}
|
|
26
36
|
return { result: 'valid' };
|
|
@@ -1,9 +1,8 @@
|
|
|
1
|
+
import type { Fr } from '@aztec/foundation/curves/bn254';
|
|
1
2
|
import { type Logger, type LoggerBindings, createLogger } from '@aztec/foundation/log';
|
|
2
3
|
import {
|
|
3
|
-
type AnyTx,
|
|
4
4
|
TX_ERROR_DUPLICATE_NULLIFIER_IN_TX,
|
|
5
5
|
TX_ERROR_EXISTING_NULLIFIER,
|
|
6
|
-
Tx,
|
|
7
6
|
type TxValidationResult,
|
|
8
7
|
type TxValidator,
|
|
9
8
|
} from '@aztec/stdlib/tx';
|
|
@@ -12,7 +11,13 @@ export interface NullifierSource {
|
|
|
12
11
|
nullifiersExist: (nullifiers: Buffer[]) => Promise<boolean[]>;
|
|
13
12
|
}
|
|
14
13
|
|
|
15
|
-
|
|
14
|
+
/** Structural interface for double-spend validation. */
|
|
15
|
+
export interface HasNullifierData {
|
|
16
|
+
txHash: { toString(): string };
|
|
17
|
+
data: { getNonEmptyNullifiers(): Fr[] };
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export class DoubleSpendTxValidator<T extends HasNullifierData> implements TxValidator<T> {
|
|
16
21
|
#log: Logger;
|
|
17
22
|
#nullifierSource: NullifierSource;
|
|
18
23
|
|
|
@@ -22,17 +27,17 @@ export class DoubleSpendTxValidator<T extends AnyTx> implements TxValidator<T> {
|
|
|
22
27
|
}
|
|
23
28
|
|
|
24
29
|
async validateTx(tx: T): Promise<TxValidationResult> {
|
|
25
|
-
const nullifiers = tx
|
|
30
|
+
const nullifiers = tx.data.getNonEmptyNullifiers();
|
|
26
31
|
|
|
27
32
|
// Ditch this tx if it has repeated nullifiers
|
|
28
33
|
const uniqueNullifiers = new Set(nullifiers.map(n => n.toBigInt()));
|
|
29
34
|
if (uniqueNullifiers.size !== nullifiers.length) {
|
|
30
|
-
this.#log.verbose(`Rejecting tx ${
|
|
35
|
+
this.#log.verbose(`Rejecting tx ${tx.txHash} for emitting duplicate nullifiers`);
|
|
31
36
|
return { result: 'invalid', reason: [TX_ERROR_DUPLICATE_NULLIFIER_IN_TX] };
|
|
32
37
|
}
|
|
33
38
|
|
|
34
39
|
if ((await this.#nullifierSource.nullifiersExist(nullifiers.map(n => n.toBuffer()))).some(Boolean)) {
|
|
35
|
-
this.#log.verbose(`Rejecting tx ${
|
|
40
|
+
this.#log.verbose(`Rejecting tx ${tx.txHash} for repeating a nullifier`);
|
|
36
41
|
return { result: 'invalid', reason: [TX_ERROR_EXISTING_NULLIFIER] };
|
|
37
42
|
}
|
|
38
43
|
|
|
@@ -1,15 +1,24 @@
|
|
|
1
|
-
import { BlockNumber } from '@aztec/foundation/branded-types';
|
|
1
|
+
import type { BlockNumber } from '@aztec/foundation/branded-types';
|
|
2
2
|
import { type Logger, type LoggerBindings, createLogger } from '@aztec/foundation/log';
|
|
3
|
-
import {
|
|
4
|
-
type AnyTx,
|
|
5
|
-
TX_ERROR_INVALID_INCLUDE_BY_TIMESTAMP,
|
|
6
|
-
type TxValidationResult,
|
|
7
|
-
type TxValidator,
|
|
8
|
-
getTxHash,
|
|
9
|
-
} from '@aztec/stdlib/tx';
|
|
3
|
+
import { TX_ERROR_INVALID_EXPIRATION_TIMESTAMP, type TxValidationResult, type TxValidator } from '@aztec/stdlib/tx';
|
|
10
4
|
import type { UInt64 } from '@aztec/stdlib/types';
|
|
11
5
|
|
|
12
|
-
|
|
6
|
+
/** Structural interface for timestamp validation. */
|
|
7
|
+
export interface HasTimestampData {
|
|
8
|
+
txHash: { toString(): string };
|
|
9
|
+
data: {
|
|
10
|
+
expirationTimestamp: bigint;
|
|
11
|
+
constants: {
|
|
12
|
+
anchorBlockHeader: {
|
|
13
|
+
globalVariables: {
|
|
14
|
+
blockNumber: BlockNumber;
|
|
15
|
+
};
|
|
16
|
+
};
|
|
17
|
+
};
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export class TimestampTxValidator<T extends HasTimestampData> implements TxValidator<T> {
|
|
13
22
|
#log: Logger;
|
|
14
23
|
|
|
15
24
|
constructor(
|
|
@@ -26,25 +35,21 @@ export class TimestampTxValidator<T extends AnyTx> implements TxValidator<T> {
|
|
|
26
35
|
}
|
|
27
36
|
|
|
28
37
|
validateTx(tx: T): Promise<TxValidationResult> {
|
|
29
|
-
const
|
|
30
|
-
// If building block 1, we skip the expiration check. For details on why see the `
|
|
38
|
+
const expirationTimestamp = tx.data.expirationTimestamp;
|
|
39
|
+
// If building block 1, we skip the expiration check. For details on why see the `validate_expiration_timestamp`
|
|
31
40
|
// function in `noir-projects/noir-protocol-circuits/crates/rollup-lib/src/base/components/validation_requests.nr`.
|
|
32
41
|
const buildingBlock1 = this.values.blockNumber === 1;
|
|
33
42
|
|
|
34
|
-
if (!buildingBlock1 &&
|
|
43
|
+
if (!buildingBlock1 && expirationTimestamp < this.values.timestamp) {
|
|
35
44
|
if (tx.data.constants.anchorBlockHeader.globalVariables.blockNumber === 0) {
|
|
36
45
|
this.#log.warn(
|
|
37
46
|
`A tx built against a genesis block failed to be included in block 1 which is the only block in which txs built against a genesis block are allowed to be included.`,
|
|
38
47
|
);
|
|
39
48
|
}
|
|
40
49
|
this.#log.verbose(
|
|
41
|
-
`Rejecting tx ${
|
|
42
|
-
tx,
|
|
43
|
-
)} for low expiration timestamp. Tx expiration timestamp: ${includeByTimestamp}, timestamp: ${
|
|
44
|
-
this.values.timestamp
|
|
45
|
-
}.`,
|
|
50
|
+
`Rejecting tx ${tx.txHash} for low expiration timestamp. Tx expiration timestamp: ${expirationTimestamp}, timestamp: ${this.values.timestamp}.`,
|
|
46
51
|
);
|
|
47
|
-
return Promise.resolve({ result: 'invalid', reason: [
|
|
52
|
+
return Promise.resolve({ result: 'invalid', reason: [TX_ERROR_INVALID_EXPIRATION_TIMESTAMP] });
|
|
48
53
|
} else {
|
|
49
54
|
return Promise.resolve({ result: 'valid' });
|
|
50
55
|
}
|
|
@@ -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
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { EthAddress } from '@aztec/foundation/eth-address';
|
|
2
2
|
import type { PeerInfo } from '@aztec/stdlib/interfaces/server';
|
|
3
|
-
import type { Gossipable, PeerErrorSeverity } from '@aztec/stdlib/p2p';
|
|
3
|
+
import type { Gossipable, PeerErrorSeverity, TopicType } from '@aztec/stdlib/p2p';
|
|
4
4
|
import { Tx, TxHash } from '@aztec/stdlib/tx';
|
|
5
5
|
|
|
6
6
|
import type { PeerId } from '@libp2p/interface';
|
|
@@ -26,6 +26,8 @@ import { ReqRespStatus } from './reqresp/status.js';
|
|
|
26
26
|
import {
|
|
27
27
|
type P2PBlockReceivedCallback,
|
|
28
28
|
type P2PCheckpointReceivedCallback,
|
|
29
|
+
type P2PDuplicateAttestationCallback,
|
|
30
|
+
type P2PDuplicateProposalCallback,
|
|
29
31
|
type P2PService,
|
|
30
32
|
type PeerDiscoveryService,
|
|
31
33
|
PeerDiscoveryState,
|
|
@@ -42,6 +44,10 @@ export class DummyP2PService implements P2PService {
|
|
|
42
44
|
return [];
|
|
43
45
|
}
|
|
44
46
|
|
|
47
|
+
getGossipMeshPeerCount(_topicType: TopicType): number {
|
|
48
|
+
return 0;
|
|
49
|
+
}
|
|
50
|
+
|
|
45
51
|
/**
|
|
46
52
|
* Starts the dummy implementation.
|
|
47
53
|
* @returns A resolved promise.
|
|
@@ -82,6 +88,16 @@ export class DummyP2PService implements P2PService {
|
|
|
82
88
|
*/
|
|
83
89
|
public registerCheckpointReceivedCallback(_callback: P2PCheckpointReceivedCallback) {}
|
|
84
90
|
|
|
91
|
+
/**
|
|
92
|
+
* Register a callback for when a duplicate proposal is detected
|
|
93
|
+
*/
|
|
94
|
+
public registerDuplicateProposalCallback(_callback: P2PDuplicateProposalCallback): void {}
|
|
95
|
+
|
|
96
|
+
/**
|
|
97
|
+
* Register a callback for when a duplicate attestation is detected
|
|
98
|
+
*/
|
|
99
|
+
public registerDuplicateAttestationCallback(_callback: P2PDuplicateAttestationCallback): void {}
|
|
100
|
+
|
|
85
101
|
/**
|
|
86
102
|
* Sends a request to a peer.
|
|
87
103
|
* @param _protocol - The protocol to send the request on.
|
package/src/services/encoding.ts
CHANGED
|
@@ -58,7 +58,8 @@ const DefaultMaxSizesKb: Record<TopicType, number> = {
|
|
|
58
58
|
// Proposals may carry some tx objects, so we allow a larger size capped at 10mb
|
|
59
59
|
// Note this may not be enough for carrying all tx objects in a block
|
|
60
60
|
[TopicType.block_proposal]: 1024 * 10,
|
|
61
|
-
//
|
|
61
|
+
// Checkpoint proposals carry almost the same data as a block proposal (see the lastBlockProposal)
|
|
62
|
+
// Only diff is an additional header, which is pretty small compared to the 10mb limit
|
|
62
63
|
[TopicType.checkpoint_proposal]: 1024 * 10,
|
|
63
64
|
};
|
|
64
65
|
|
|
@@ -78,11 +79,11 @@ export class SnappyTransform implements DataTransform {
|
|
|
78
79
|
return this.inboundTransformData(Buffer.from(data), topic);
|
|
79
80
|
}
|
|
80
81
|
|
|
81
|
-
public inboundTransformData(data: Buffer, topic?: TopicType): Buffer {
|
|
82
|
+
public inboundTransformData(data: Buffer, topic?: TopicType, maxSizeKbOverride?: number): Buffer {
|
|
82
83
|
if (data.length === 0) {
|
|
83
84
|
return data;
|
|
84
85
|
}
|
|
85
|
-
const maxSizeKb = this.maxSizesKb[topic!] ?? this.defaultMaxSizeKb;
|
|
86
|
+
const maxSizeKb = maxSizeKbOverride ?? this.maxSizesKb[topic!] ?? this.defaultMaxSizeKb;
|
|
86
87
|
const { decompressedSize } = readSnappyPreamble(data);
|
|
87
88
|
if (decompressedSize > maxSizeKb * 1024) {
|
|
88
89
|
this.logger.warn(`Decompressed size ${decompressedSize} exceeds maximum allowed size of ${maxSizeKb}kb`);
|