@aztec/p2p 0.0.1-commit.6d63667d → 0.0.1-commit.72dcdcda8
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 +10 -10
- package/dest/client/factory.d.ts.map +1 -1
- package/dest/client/factory.js +39 -15
- package/dest/client/interface.d.ts +46 -33
- package/dest/client/interface.d.ts.map +1 -1
- package/dest/client/p2p_client.d.ts +39 -51
- package/dest/client/p2p_client.d.ts.map +1 -1
- package/dest/client/p2p_client.js +145 -200
- package/dest/client/test/tx_proposal_collector/proposal_tx_collector_worker.js +7 -8
- package/dest/config.d.ts +24 -8
- package/dest/config.d.ts.map +1 -1
- package/dest/config.js +16 -6
- 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/deleted_pool.d.ts +104 -0
- package/dest/mem_pools/tx_pool_v2/deleted_pool.d.ts.map +1 -0
- package/dest/mem_pools/tx_pool_v2/deleted_pool.js +251 -0
- package/dest/mem_pools/tx_pool_v2/eviction/eviction_manager.d.ts +3 -3
- package/dest/mem_pools/tx_pool_v2/eviction/eviction_manager.d.ts.map +1 -1
- package/dest/mem_pools/tx_pool_v2/eviction/eviction_manager.js +18 -9
- package/dest/mem_pools/tx_pool_v2/eviction/fee_payer_balance_eviction_rule.d.ts +1 -1
- package/dest/mem_pools/tx_pool_v2/eviction/fee_payer_balance_eviction_rule.d.ts.map +1 -1
- package/dest/mem_pools/tx_pool_v2/eviction/fee_payer_balance_eviction_rule.js +5 -2
- package/dest/mem_pools/tx_pool_v2/eviction/fee_payer_balance_pre_add_rule.d.ts +3 -3
- package/dest/mem_pools/tx_pool_v2/eviction/fee_payer_balance_pre_add_rule.d.ts.map +1 -1
- package/dest/mem_pools/tx_pool_v2/eviction/fee_payer_balance_pre_add_rule.js +12 -4
- package/dest/mem_pools/tx_pool_v2/eviction/index.d.ts +2 -2
- package/dest/mem_pools/tx_pool_v2/eviction/index.d.ts.map +1 -1
- package/dest/mem_pools/tx_pool_v2/eviction/index.js +1 -1
- package/dest/mem_pools/tx_pool_v2/eviction/interfaces.d.ts +48 -5
- package/dest/mem_pools/tx_pool_v2/eviction/interfaces.d.ts.map +1 -1
- package/dest/mem_pools/tx_pool_v2/eviction/interfaces.js +8 -0
- package/dest/mem_pools/tx_pool_v2/eviction/invalid_txs_after_mining_rule.js +7 -5
- package/dest/mem_pools/tx_pool_v2/eviction/invalid_txs_after_reorg_rule.js +7 -5
- package/dest/mem_pools/tx_pool_v2/eviction/low_priority_eviction_rule.d.ts +2 -2
- package/dest/mem_pools/tx_pool_v2/eviction/low_priority_eviction_rule.d.ts.map +1 -1
- package/dest/mem_pools/tx_pool_v2/eviction/low_priority_eviction_rule.js +14 -6
- package/dest/mem_pools/tx_pool_v2/eviction/low_priority_pre_add_rule.d.ts +4 -4
- package/dest/mem_pools/tx_pool_v2/eviction/low_priority_pre_add_rule.d.ts.map +1 -1
- package/dest/mem_pools/tx_pool_v2/eviction/low_priority_pre_add_rule.js +14 -4
- package/dest/mem_pools/tx_pool_v2/eviction/nullifier_conflict_rule.d.ts +3 -3
- package/dest/mem_pools/tx_pool_v2/eviction/nullifier_conflict_rule.d.ts.map +1 -1
- package/dest/mem_pools/tx_pool_v2/eviction/nullifier_conflict_rule.js +2 -2
- package/dest/mem_pools/tx_pool_v2/index.d.ts +3 -2
- package/dest/mem_pools/tx_pool_v2/index.d.ts.map +1 -1
- package/dest/mem_pools/tx_pool_v2/index.js +2 -1
- package/dest/mem_pools/tx_pool_v2/instrumentation.d.ts +15 -0
- package/dest/mem_pools/tx_pool_v2/instrumentation.d.ts.map +1 -0
- package/dest/mem_pools/tx_pool_v2/instrumentation.js +43 -0
- package/dest/mem_pools/tx_pool_v2/interfaces.d.ts +22 -8
- package/dest/mem_pools/tx_pool_v2/interfaces.d.ts.map +1 -1
- package/dest/mem_pools/tx_pool_v2/interfaces.js +4 -1
- package/dest/mem_pools/tx_pool_v2/tx_metadata.d.ts +56 -8
- package/dest/mem_pools/tx_pool_v2/tx_metadata.d.ts.map +1 -1
- package/dest/mem_pools/tx_pool_v2/tx_metadata.js +108 -10
- package/dest/mem_pools/tx_pool_v2/tx_pool_indices.d.ts +12 -3
- package/dest/mem_pools/tx_pool_v2/tx_pool_indices.d.ts.map +1 -1
- package/dest/mem_pools/tx_pool_v2/tx_pool_indices.js +36 -14
- package/dest/mem_pools/tx_pool_v2/tx_pool_v2.d.ts +9 -4
- package/dest/mem_pools/tx_pool_v2/tx_pool_v2.d.ts.map +1 -1
- package/dest/mem_pools/tx_pool_v2/tx_pool_v2.js +11 -6
- package/dest/mem_pools/tx_pool_v2/tx_pool_v2_impl.d.ts +13 -5
- package/dest/mem_pools/tx_pool_v2/tx_pool_v2_impl.d.ts.map +1 -1
- package/dest/mem_pools/tx_pool_v2/tx_pool_v2_impl.js +342 -185
- 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 +4 -4
- package/dest/msg_validators/tx_validator/aggregate_tx_validator.d.ts.map +1 -1
- package/dest/msg_validators/tx_validator/aggregate_tx_validator.js +3 -3
- package/dest/msg_validators/tx_validator/block_header_validator.d.ts +16 -3
- package/dest/msg_validators/tx_validator/block_header_validator.d.ts.map +1 -1
- package/dest/msg_validators/tx_validator/block_header_validator.js +1 -1
- package/dest/msg_validators/tx_validator/double_spend_validator.d.ts +13 -3
- package/dest/msg_validators/tx_validator/double_spend_validator.d.ts.map +1 -1
- package/dest/msg_validators/tx_validator/double_spend_validator.js +4 -4
- package/dest/msg_validators/tx_validator/factory.d.ts +114 -6
- package/dest/msg_validators/tx_validator/factory.d.ts.map +1 -1
- package/dest/msg_validators/tx_validator/factory.js +219 -58
- package/dest/msg_validators/tx_validator/gas_validator.d.ts +58 -3
- package/dest/msg_validators/tx_validator/gas_validator.d.ts.map +1 -1
- package/dest/msg_validators/tx_validator/gas_validator.js +73 -36
- 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/nullifier_cache.d.ts +14 -0
- package/dest/msg_validators/tx_validator/nullifier_cache.d.ts.map +1 -0
- package/dest/msg_validators/tx_validator/nullifier_cache.js +24 -0
- package/dest/msg_validators/tx_validator/timestamp_validator.d.ts +20 -4
- package/dest/msg_validators/tx_validator/timestamp_validator.d.ts.map +1 -1
- package/dest/msg_validators/tx_validator/timestamp_validator.js +6 -6
- package/dest/services/dummy_service.d.ts +13 -5
- package/dest/services/dummy_service.d.ts.map +1 -1
- package/dest/services/dummy_service.js +10 -4
- package/dest/services/encoding.d.ts +3 -3
- package/dest/services/encoding.d.ts.map +1 -1
- package/dest/services/encoding.js +11 -10
- package/dest/services/gossipsub/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/libp2p/libp2p_service.d.ts +95 -43
- package/dest/services/libp2p/libp2p_service.d.ts.map +1 -1
- package/dest/services/libp2p/libp2p_service.js +418 -331
- 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 +4 -3
- package/dest/services/reqresp/batch-tx-requester/batch_tx_requester.d.ts.map +1 -1
- package/dest/services/reqresp/batch-tx-requester/batch_tx_requester.js +19 -46
- package/dest/services/reqresp/batch-tx-requester/interface.d.ts +2 -6
- package/dest/services/reqresp/batch-tx-requester/interface.d.ts.map +1 -1
- package/dest/services/reqresp/batch-tx-requester/missing_txs.d.ts +10 -13
- package/dest/services/reqresp/batch-tx-requester/missing_txs.d.ts.map +1 -1
- package/dest/services/reqresp/batch-tx-requester/missing_txs.js +25 -46
- package/dest/services/reqresp/batch-tx-requester/peer_collection.d.ts +17 -11
- package/dest/services/reqresp/batch-tx-requester/peer_collection.d.ts.map +1 -1
- package/dest/services/reqresp/batch-tx-requester/peer_collection.js +49 -15
- package/dest/services/reqresp/batch-tx-requester/tx_validator.js +2 -2
- package/dest/services/reqresp/interface.d.ts +10 -1
- package/dest/services/reqresp/interface.d.ts.map +1 -1
- package/dest/services/reqresp/interface.js +15 -1
- package/dest/services/reqresp/protocols/block_txs/block_txs_handler.d.ts +4 -3
- package/dest/services/reqresp/protocols/block_txs/block_txs_handler.d.ts.map +1 -1
- package/dest/services/reqresp/protocols/block_txs/block_txs_reqresp.d.ts +7 -1
- package/dest/services/reqresp/protocols/block_txs/block_txs_reqresp.d.ts.map +1 -1
- package/dest/services/reqresp/protocols/block_txs/block_txs_reqresp.js +15 -0
- package/dest/services/reqresp/protocols/tx.d.ts +7 -1
- package/dest/services/reqresp/protocols/tx.d.ts.map +1 -1
- package/dest/services/reqresp/protocols/tx.js +20 -0
- package/dest/services/reqresp/reqresp.d.ts +1 -1
- package/dest/services/reqresp/reqresp.d.ts.map +1 -1
- package/dest/services/reqresp/reqresp.js +13 -5
- package/dest/services/service.d.ts +39 -3
- package/dest/services/service.d.ts.map +1 -1
- package/dest/services/tx_collection/config.d.ts +19 -1
- package/dest/services/tx_collection/config.d.ts.map +1 -1
- package/dest/services/tx_collection/config.js +46 -0
- package/dest/services/tx_collection/fast_tx_collection.d.ts +3 -1
- package/dest/services/tx_collection/fast_tx_collection.d.ts.map +1 -1
- package/dest/services/tx_collection/fast_tx_collection.js +56 -36
- package/dest/services/tx_collection/file_store_tx_collection.d.ts +53 -0
- package/dest/services/tx_collection/file_store_tx_collection.d.ts.map +1 -0
- package/dest/services/tx_collection/file_store_tx_collection.js +167 -0
- package/dest/services/tx_collection/file_store_tx_source.d.ts +37 -0
- package/dest/services/tx_collection/file_store_tx_source.d.ts.map +1 -0
- package/dest/services/tx_collection/file_store_tx_source.js +90 -0
- package/dest/services/tx_collection/index.d.ts +2 -1
- package/dest/services/tx_collection/index.d.ts.map +1 -1
- package/dest/services/tx_collection/index.js +1 -0
- package/dest/services/tx_collection/instrumentation.d.ts +1 -1
- package/dest/services/tx_collection/instrumentation.d.ts.map +1 -1
- package/dest/services/tx_collection/instrumentation.js +2 -1
- package/dest/services/tx_collection/missing_txs_tracker.d.ts +32 -0
- package/dest/services/tx_collection/missing_txs_tracker.d.ts.map +1 -0
- package/dest/services/tx_collection/missing_txs_tracker.js +27 -0
- package/dest/services/tx_collection/proposal_tx_collector.d.ts +7 -6
- package/dest/services/tx_collection/proposal_tx_collector.d.ts.map +1 -1
- package/dest/services/tx_collection/proposal_tx_collector.js +5 -4
- package/dest/services/tx_collection/slow_tx_collection.d.ts +7 -3
- package/dest/services/tx_collection/slow_tx_collection.d.ts.map +1 -1
- package/dest/services/tx_collection/slow_tx_collection.js +60 -26
- package/dest/services/tx_collection/tx_collection.d.ts +23 -10
- package/dest/services/tx_collection/tx_collection.d.ts.map +1 -1
- package/dest/services/tx_collection/tx_collection.js +75 -3
- package/dest/services/tx_collection/tx_collection_sink.d.ts +18 -8
- package/dest/services/tx_collection/tx_collection_sink.d.ts.map +1 -1
- package/dest/services/tx_collection/tx_collection_sink.js +26 -29
- package/dest/services/tx_collection/tx_source.d.ts +8 -3
- package/dest/services/tx_collection/tx_source.d.ts.map +1 -1
- package/dest/services/tx_collection/tx_source.js +19 -2
- package/dest/services/tx_file_store/config.d.ts +1 -3
- package/dest/services/tx_file_store/config.d.ts.map +1 -1
- package/dest/services/tx_file_store/config.js +0 -4
- package/dest/services/tx_file_store/tx_file_store.d.ts +4 -3
- package/dest/services/tx_file_store/tx_file_store.d.ts.map +1 -1
- package/dest/services/tx_file_store/tx_file_store.js +9 -6
- package/dest/services/tx_provider.d.ts +4 -4
- package/dest/services/tx_provider.d.ts.map +1 -1
- package/dest/services/tx_provider.js +9 -8
- package/dest/test-helpers/make-test-p2p-clients.d.ts +7 -8
- package/dest/test-helpers/make-test-p2p-clients.d.ts.map +1 -1
- package/dest/test-helpers/make-test-p2p-clients.js +1 -2
- package/dest/test-helpers/mock-pubsub.d.ts +30 -4
- package/dest/test-helpers/mock-pubsub.d.ts.map +1 -1
- package/dest/test-helpers/mock-pubsub.js +105 -4
- package/dest/test-helpers/reqresp-nodes.d.ts +2 -3
- package/dest/test-helpers/reqresp-nodes.d.ts.map +1 -1
- package/dest/test-helpers/reqresp-nodes.js +4 -3
- package/dest/test-helpers/testbench-utils.d.ts +43 -38
- package/dest/test-helpers/testbench-utils.d.ts.map +1 -1
- package/dest/test-helpers/testbench-utils.js +128 -59
- 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 +15 -15
- 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 +74 -27
- package/src/client/interface.ts +56 -34
- package/src/client/p2p_client.ts +180 -247
- package/src/client/test/tx_proposal_collector/proposal_tx_collector_worker.ts +20 -11
- package/src/config.ts +35 -11
- package/src/errors/tx-pool.error.ts +12 -0
- package/src/index.ts +1 -0
- package/src/mem_pools/attestation_pool/attestation_pool.ts +496 -91
- package/src/mem_pools/attestation_pool/attestation_pool_test_suite.ts +442 -102
- package/src/mem_pools/attestation_pool/index.ts +9 -2
- package/src/mem_pools/attestation_pool/mocks.ts +2 -1
- package/src/mem_pools/index.ts +4 -1
- package/src/mem_pools/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 +76 -10
- package/src/mem_pools/tx_pool_v2/deleted_pool.ts +321 -0
- package/src/mem_pools/tx_pool_v2/eviction/eviction_manager.ts +21 -8
- package/src/mem_pools/tx_pool_v2/eviction/fee_payer_balance_eviction_rule.ts +5 -2
- package/src/mem_pools/tx_pool_v2/eviction/fee_payer_balance_pre_add_rule.ts +18 -4
- package/src/mem_pools/tx_pool_v2/eviction/index.ts +4 -0
- package/src/mem_pools/tx_pool_v2/eviction/interfaces.ts +49 -4
- package/src/mem_pools/tx_pool_v2/eviction/invalid_txs_after_mining_rule.ts +5 -5
- package/src/mem_pools/tx_pool_v2/eviction/invalid_txs_after_reorg_rule.ts +5 -5
- package/src/mem_pools/tx_pool_v2/eviction/low_priority_eviction_rule.ts +14 -9
- package/src/mem_pools/tx_pool_v2/eviction/low_priority_pre_add_rule.ts +24 -6
- package/src/mem_pools/tx_pool_v2/eviction/nullifier_conflict_rule.ts +3 -3
- package/src/mem_pools/tx_pool_v2/index.ts +2 -1
- package/src/mem_pools/tx_pool_v2/instrumentation.ts +69 -0
- package/src/mem_pools/tx_pool_v2/interfaces.ts +23 -8
- package/src/mem_pools/tx_pool_v2/tx_metadata.ts +153 -17
- package/src/mem_pools/tx_pool_v2/tx_pool_indices.ts +43 -16
- package/src/mem_pools/tx_pool_v2/tx_pool_v2.ts +18 -7
- package/src/mem_pools/tx_pool_v2/tx_pool_v2_impl.ts +383 -182
- package/src/msg_validators/attestation_validator/fisherman_attestation_validator.ts +2 -2
- package/src/msg_validators/tx_validator/README.md +115 -0
- package/src/msg_validators/tx_validator/aggregate_tx_validator.ts +5 -5
- package/src/msg_validators/tx_validator/block_header_validator.ts +15 -3
- package/src/msg_validators/tx_validator/double_spend_validator.ts +11 -6
- package/src/msg_validators/tx_validator/factory.ts +353 -77
- package/src/msg_validators/tx_validator/gas_validator.ts +90 -27
- package/src/msg_validators/tx_validator/index.ts +1 -0
- package/src/msg_validators/tx_validator/nullifier_cache.ts +30 -0
- package/src/msg_validators/tx_validator/timestamp_validator.ts +23 -18
- package/src/services/dummy_service.ts +18 -6
- package/src/services/encoding.ts +9 -9
- package/src/services/gossipsub/README.md +641 -0
- package/src/services/gossipsub/index.ts +2 -0
- package/src/services/gossipsub/scoring.ts +29 -5
- package/src/services/gossipsub/topic_score_params.ts +487 -0
- package/src/services/libp2p/libp2p_service.ts +436 -355
- package/src/services/peer-manager/peer_scoring.ts +25 -0
- package/src/services/reqresp/batch-tx-requester/batch_tx_requester.ts +20 -48
- package/src/services/reqresp/batch-tx-requester/interface.ts +1 -5
- package/src/services/reqresp/batch-tx-requester/missing_txs.ts +23 -71
- package/src/services/reqresp/batch-tx-requester/peer_collection.ts +63 -24
- package/src/services/reqresp/batch-tx-requester/tx_validator.ts +2 -2
- package/src/services/reqresp/interface.ts +26 -1
- package/src/services/reqresp/protocols/block_txs/block_txs_handler.ts +4 -3
- package/src/services/reqresp/protocols/block_txs/block_txs_reqresp.ts +17 -0
- package/src/services/reqresp/protocols/tx.ts +22 -0
- package/src/services/reqresp/reqresp.ts +16 -4
- package/src/services/service.ts +51 -2
- package/src/services/tx_collection/config.ts +68 -0
- package/src/services/tx_collection/fast_tx_collection.ts +65 -32
- package/src/services/tx_collection/file_store_tx_collection.ts +202 -0
- package/src/services/tx_collection/file_store_tx_source.ts +117 -0
- package/src/services/tx_collection/index.ts +1 -0
- package/src/services/tx_collection/instrumentation.ts +7 -1
- package/src/services/tx_collection/missing_txs_tracker.ts +52 -0
- package/src/services/tx_collection/proposal_tx_collector.ts +8 -7
- package/src/services/tx_collection/slow_tx_collection.ts +66 -33
- package/src/services/tx_collection/tx_collection.ts +113 -16
- package/src/services/tx_collection/tx_collection_sink.ts +30 -34
- package/src/services/tx_collection/tx_source.ts +22 -3
- package/src/services/tx_file_store/config.ts +0 -6
- package/src/services/tx_file_store/tx_file_store.ts +10 -8
- package/src/services/tx_provider.ts +10 -9
- package/src/test-helpers/make-test-p2p-clients.ts +3 -5
- package/src/test-helpers/mock-pubsub.ts +146 -9
- package/src/test-helpers/reqresp-nodes.ts +4 -6
- package/src/test-helpers/testbench-utils.ts +127 -71
- package/src/testbench/p2p_client_testbench_worker.ts +24 -21
- 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
|
@@ -1,11 +1,32 @@
|
|
|
1
|
+
import { BlockNumber } from '@aztec/foundation/branded-types';
|
|
1
2
|
import { Fr } from '@aztec/foundation/curves/bn254';
|
|
2
3
|
import { ProtocolContractAddress } from '@aztec/protocol-contracts';
|
|
3
|
-
import type
|
|
4
|
-
import
|
|
4
|
+
import { BlockHash, type L2BlockId } from '@aztec/stdlib/block';
|
|
5
|
+
import { Gas } from '@aztec/stdlib/gas';
|
|
6
|
+
import { type Tx, TxHash } from '@aztec/stdlib/tx';
|
|
5
7
|
|
|
6
8
|
import { getFeePayerBalanceDelta } from '../../msg_validators/tx_validator/fee_payer_balance.js';
|
|
7
9
|
import { getTxPriorityFee } from '../tx_pool/priority.js';
|
|
8
|
-
import type
|
|
10
|
+
import { type PreAddResult, TxPoolRejectionCode } from './eviction/interfaces.js';
|
|
11
|
+
|
|
12
|
+
/** Validator-compatible data interface, mirroring the subset of PrivateKernelTailCircuitPublicInputs used by validators. */
|
|
13
|
+
export type TxMetaValidationData = {
|
|
14
|
+
getNonEmptyNullifiers(): Fr[];
|
|
15
|
+
expirationTimestamp: bigint;
|
|
16
|
+
/** Whether the tx has public calls. Used to select the correct L2 gas minimum. */
|
|
17
|
+
forPublic?: unknown;
|
|
18
|
+
constants: {
|
|
19
|
+
anchorBlockHeader: {
|
|
20
|
+
hash(): Promise<BlockHash>;
|
|
21
|
+
globalVariables: {
|
|
22
|
+
blockNumber: BlockNumber;
|
|
23
|
+
};
|
|
24
|
+
};
|
|
25
|
+
txContext: {
|
|
26
|
+
gasSettings: { gasLimits: Gas };
|
|
27
|
+
};
|
|
28
|
+
};
|
|
29
|
+
};
|
|
9
30
|
|
|
10
31
|
/**
|
|
11
32
|
* Lightweight in-memory representation of a transaction.
|
|
@@ -19,6 +40,9 @@ export type TxMetaData = {
|
|
|
19
40
|
/** The transaction hash as hex string */
|
|
20
41
|
readonly txHash: string;
|
|
21
42
|
|
|
43
|
+
/** The transaction hash as bigint (for efficient Fr conversion in comparisons) */
|
|
44
|
+
readonly txHashBigInt: bigint;
|
|
45
|
+
|
|
22
46
|
/** Block ID (number and hash) in which the transaction was mined (undefined if not mined) */
|
|
23
47
|
minedL2BlockId?: L2BlockId;
|
|
24
48
|
|
|
@@ -41,40 +65,100 @@ export type TxMetaData = {
|
|
|
41
65
|
readonly nullifiers: readonly string[];
|
|
42
66
|
|
|
43
67
|
/** Timestamp by which the transaction must be included (for expiration checks) */
|
|
44
|
-
readonly
|
|
68
|
+
readonly expirationTimestamp: bigint;
|
|
69
|
+
|
|
70
|
+
/** Validator-compatible data, providing the same access patterns as Tx.data */
|
|
71
|
+
readonly data: TxMetaValidationData;
|
|
72
|
+
|
|
73
|
+
/** Timestamp (ms) when the tx was received into the pool. 0 for hydrated txs (always eligible). */
|
|
74
|
+
receivedAt: number;
|
|
75
|
+
|
|
76
|
+
/** Estimated memory footprint of this metadata object in bytes */
|
|
77
|
+
readonly estimatedSizeBytes: number;
|
|
45
78
|
};
|
|
46
79
|
|
|
47
80
|
/** Transaction state derived from TxMetaData fields and pool protection status */
|
|
48
|
-
export type TxState = 'pending' | 'protected' | 'mined';
|
|
81
|
+
export type TxState = 'pending' | 'protected' | 'mined' | 'deleted';
|
|
49
82
|
|
|
50
83
|
/**
|
|
51
84
|
* Builds TxMetaData from a full Tx object.
|
|
52
85
|
* Extracts all relevant fields for efficient in-memory storage and querying.
|
|
86
|
+
* Fr values are captured in closures for zero-cost re-validation.
|
|
53
87
|
*/
|
|
54
88
|
export async function buildTxMetaData(tx: Tx): Promise<TxMetaData> {
|
|
55
|
-
const
|
|
56
|
-
const
|
|
89
|
+
const txHashObj = tx.getTxHash();
|
|
90
|
+
const txHash = txHashObj.toString();
|
|
91
|
+
const txHashBigInt = txHashObj.toBigInt();
|
|
92
|
+
const nullifierFrs = tx.data.getNonEmptyNullifiers();
|
|
93
|
+
const nullifiers = nullifierFrs.map(n => n.toString());
|
|
94
|
+
const anchorBlockHeaderHashFr = await tx.data.constants.anchorBlockHeader.hash();
|
|
95
|
+
const anchorBlockHeaderHash = anchorBlockHeaderHashFr.toString();
|
|
96
|
+
const expirationTimestamp = tx.data.expirationTimestamp;
|
|
97
|
+
const anchorBlockNumber = tx.data.constants.anchorBlockHeader.globalVariables.blockNumber;
|
|
57
98
|
const priorityFee = getTxPriorityFee(tx);
|
|
58
99
|
const feePayer = tx.data.feePayer.toString();
|
|
59
|
-
const nullifiers = tx.data.getNonEmptyNullifiers().map(n => n.toString());
|
|
60
|
-
const includeByTimestamp = tx.data.includeByTimestamp;
|
|
61
100
|
|
|
62
101
|
const { feeLimit, claimAmount } = await getFeePayerBalanceDelta(tx, ProtocolContractAddress.FeeJuice);
|
|
63
102
|
|
|
103
|
+
const estimatedSizeBytes = estimateTxMetaDataSize(nullifiers.length);
|
|
104
|
+
|
|
64
105
|
return {
|
|
65
106
|
txHash,
|
|
107
|
+
txHashBigInt,
|
|
66
108
|
anchorBlockHeaderHash,
|
|
67
109
|
priorityFee,
|
|
68
110
|
feePayer,
|
|
69
111
|
claimAmount,
|
|
70
112
|
feeLimit,
|
|
71
113
|
nullifiers,
|
|
72
|
-
|
|
114
|
+
expirationTimestamp,
|
|
115
|
+
receivedAt: 0,
|
|
116
|
+
estimatedSizeBytes,
|
|
117
|
+
data: {
|
|
118
|
+
getNonEmptyNullifiers: () => nullifierFrs,
|
|
119
|
+
expirationTimestamp,
|
|
120
|
+
forPublic: !!tx.data.forPublic,
|
|
121
|
+
constants: {
|
|
122
|
+
anchorBlockHeader: {
|
|
123
|
+
hash: () => Promise.resolve(anchorBlockHeaderHashFr),
|
|
124
|
+
globalVariables: { blockNumber: anchorBlockNumber },
|
|
125
|
+
},
|
|
126
|
+
txContext: {
|
|
127
|
+
gasSettings: { gasLimits: tx.data.constants.txContext.gasSettings.gasLimits },
|
|
128
|
+
},
|
|
129
|
+
},
|
|
130
|
+
},
|
|
73
131
|
};
|
|
74
132
|
}
|
|
75
133
|
|
|
134
|
+
// V8 JS object overhead (~64 bytes for a plain object with hidden class).
|
|
135
|
+
// String overhead: ~32 bytes header + 1 byte per ASCII char (V8 one-byte strings).
|
|
136
|
+
// Hex string (0x + 64 hex chars = 66 chars): ~98 bytes per string.
|
|
137
|
+
// bigint: ~32 bytes. number: 8 bytes. Fr: ~80 bytes (32 data + object overhead).
|
|
138
|
+
const OBJECT_OVERHEAD = 64;
|
|
139
|
+
const HEX_STRING_BYTES = 98;
|
|
140
|
+
const BIGINT_BYTES = 32;
|
|
141
|
+
const FR_BYTES = 80;
|
|
142
|
+
// Fixed cost: object shell + txHash + anchorBlockHeaderHash + feePayer (3 hex strings)
|
|
143
|
+
// + txHashBigInt + priorityFee + claimAmount + feeLimit + includeByTimestamp (5 bigints)
|
|
144
|
+
// + receivedAt (number, 8 bytes) + estimatedSizeBytes (number, 8 bytes)
|
|
145
|
+
// + data closure object (~OBJECT_OVERHEAD + anchorBlockHeaderHashFr Fr + anchorBlockNumber number)
|
|
146
|
+
const FIXED_METADATA_BYTES =
|
|
147
|
+
OBJECT_OVERHEAD + 3 * HEX_STRING_BYTES + 5 * BIGINT_BYTES + 8 + 8 + OBJECT_OVERHEAD + FR_BYTES + 8;
|
|
148
|
+
|
|
149
|
+
/** Estimates the in-memory size of a TxMetaData object based on the number of nullifiers. */
|
|
150
|
+
function estimateTxMetaDataSize(nullifierCount: number): number {
|
|
151
|
+
// Per nullifier: one hex string in nullifiers[] + one Fr in the captured nullifierFrs[]
|
|
152
|
+
return FIXED_METADATA_BYTES + nullifierCount * (HEX_STRING_BYTES + FR_BYTES);
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
/** Converts a txHash bigint back to the canonical 0x-prefixed 64-char hex string. */
|
|
156
|
+
export function txHashFromBigInt(value: bigint): string {
|
|
157
|
+
return TxHash.fromBigInt(value).toString();
|
|
158
|
+
}
|
|
159
|
+
|
|
76
160
|
/** Minimal fields required for priority comparison. */
|
|
77
|
-
type PriorityComparable = Pick<TxMetaData, '
|
|
161
|
+
type PriorityComparable = Pick<TxMetaData, 'txHashBigInt' | 'priorityFee'>;
|
|
78
162
|
|
|
79
163
|
/**
|
|
80
164
|
* Compares two priority fees in ascending order.
|
|
@@ -89,10 +173,8 @@ export function compareFee(a: bigint, b: bigint): number {
|
|
|
89
173
|
* Uses field element comparison for deterministic ordering.
|
|
90
174
|
* Returns negative if a < b, positive if a > b, 0 if equal.
|
|
91
175
|
*/
|
|
92
|
-
export function compareTxHash(a:
|
|
93
|
-
|
|
94
|
-
const fieldB = Fr.fromHexString(b);
|
|
95
|
-
return fieldA.cmp(fieldB);
|
|
176
|
+
export function compareTxHash(a: bigint, b: bigint): number {
|
|
177
|
+
return Fr.cmpAsBigInt(a, b);
|
|
96
178
|
}
|
|
97
179
|
|
|
98
180
|
/**
|
|
@@ -105,7 +187,7 @@ export function comparePriority(a: PriorityComparable, b: PriorityComparable): n
|
|
|
105
187
|
if (feeComparison !== 0) {
|
|
106
188
|
return feeComparison;
|
|
107
189
|
}
|
|
108
|
-
return compareTxHash(a.
|
|
190
|
+
return compareTxHash(a.txHashBigInt, b.txHashBigInt);
|
|
109
191
|
}
|
|
110
192
|
|
|
111
193
|
/**
|
|
@@ -152,10 +234,64 @@ export function checkNullifierConflict(
|
|
|
152
234
|
return {
|
|
153
235
|
shouldIgnore: true,
|
|
154
236
|
txHashesToEvict: [],
|
|
155
|
-
reason:
|
|
237
|
+
reason: {
|
|
238
|
+
code: TxPoolRejectionCode.NULLIFIER_CONFLICT,
|
|
239
|
+
message: `Nullifier conflict with existing tx ${conflictingHashStr}`,
|
|
240
|
+
conflictingTxHash: conflictingHashStr,
|
|
241
|
+
},
|
|
156
242
|
};
|
|
157
243
|
}
|
|
158
244
|
}
|
|
159
245
|
|
|
160
246
|
return { shouldIgnore: false, txHashesToEvict };
|
|
161
247
|
}
|
|
248
|
+
|
|
249
|
+
/** Creates a stub TxMetaValidationData for tests that don't exercise validators. */
|
|
250
|
+
export function stubTxMetaValidationData(overrides: { expirationTimestamp?: bigint } = {}): TxMetaValidationData {
|
|
251
|
+
return {
|
|
252
|
+
getNonEmptyNullifiers: () => [],
|
|
253
|
+
expirationTimestamp: overrides.expirationTimestamp ?? 0n,
|
|
254
|
+
constants: {
|
|
255
|
+
anchorBlockHeader: {
|
|
256
|
+
hash: () => Promise.resolve(new BlockHash(Fr.ZERO)),
|
|
257
|
+
globalVariables: { blockNumber: BlockNumber(0) },
|
|
258
|
+
},
|
|
259
|
+
txContext: {
|
|
260
|
+
gasSettings: { gasLimits: Gas.empty() },
|
|
261
|
+
},
|
|
262
|
+
},
|
|
263
|
+
};
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
/** Creates a stub TxMetaData for tests. All fields have sensible defaults and can be overridden. */
|
|
267
|
+
export function stubTxMetaData(
|
|
268
|
+
txHash: string,
|
|
269
|
+
overrides: {
|
|
270
|
+
priorityFee?: bigint;
|
|
271
|
+
feePayer?: string;
|
|
272
|
+
claimAmount?: bigint;
|
|
273
|
+
feeLimit?: bigint;
|
|
274
|
+
nullifiers?: string[];
|
|
275
|
+
expirationTimestamp?: bigint;
|
|
276
|
+
anchorBlockHeaderHash?: string;
|
|
277
|
+
} = {},
|
|
278
|
+
): TxMetaData {
|
|
279
|
+
const txHashBigInt = Fr.fromHexString(txHash).toBigInt();
|
|
280
|
+
// Normalize to canonical zero-padded hex so txHashFromBigInt(txHashBigInt) === normalizedTxHash
|
|
281
|
+
const normalizedTxHash = txHashFromBigInt(txHashBigInt);
|
|
282
|
+
const expirationTimestamp = overrides.expirationTimestamp ?? 0n;
|
|
283
|
+
return {
|
|
284
|
+
txHash: normalizedTxHash,
|
|
285
|
+
txHashBigInt,
|
|
286
|
+
anchorBlockHeaderHash: overrides.anchorBlockHeaderHash ?? '0x1234',
|
|
287
|
+
priorityFee: overrides.priorityFee ?? 100n,
|
|
288
|
+
feePayer: overrides.feePayer ?? '0xfeepayer',
|
|
289
|
+
claimAmount: overrides.claimAmount ?? 0n,
|
|
290
|
+
feeLimit: overrides.feeLimit ?? 100n,
|
|
291
|
+
nullifiers: overrides.nullifiers ?? [`0x${normalizedTxHash.slice(2)}null1`],
|
|
292
|
+
expirationTimestamp,
|
|
293
|
+
receivedAt: 0,
|
|
294
|
+
estimatedSizeBytes: 0,
|
|
295
|
+
data: stubTxMetaValidationData({ expirationTimestamp }),
|
|
296
|
+
};
|
|
297
|
+
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { SlotNumber } from '@aztec/foundation/branded-types';
|
|
2
2
|
import type { L2BlockId } from '@aztec/stdlib/block';
|
|
3
3
|
|
|
4
|
-
import { type TxMetaData, type TxState, compareFee, compareTxHash } from './tx_metadata.js';
|
|
4
|
+
import { type TxMetaData, type TxState, compareFee, compareTxHash, txHashFromBigInt } from './tx_metadata.js';
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* Manages in-memory indices for the transaction pool.
|
|
@@ -22,8 +22,8 @@ export class TxPoolIndices {
|
|
|
22
22
|
#nullifierToTxHash: Map<string, string> = new Map();
|
|
23
23
|
/** Fee payer to txHashes index (pending txs only) */
|
|
24
24
|
#feePayerToTxHashes: Map<string, Set<string>> = new Map();
|
|
25
|
-
/** Pending
|
|
26
|
-
#pendingByPriority: Map<bigint, Set<
|
|
25
|
+
/** Pending txHash bigints grouped by priority fee */
|
|
26
|
+
#pendingByPriority: Map<bigint, Set<bigint>> = new Map();
|
|
27
27
|
/** Protected transactions: txHash -> slotNumber */
|
|
28
28
|
#protectedTransactions: Map<string, SlotNumber> = new Map();
|
|
29
29
|
|
|
@@ -72,23 +72,39 @@ export class TxPoolIndices {
|
|
|
72
72
|
* Iterates pending transaction hashes in priority order.
|
|
73
73
|
* @param order - 'desc' for highest priority first, 'asc' for lowest priority first
|
|
74
74
|
*/
|
|
75
|
-
*iteratePendingByPriority(order: 'asc' | 'desc'): Generator<string> {
|
|
76
|
-
// Use compareFee from tx_metadata, swap args for descending order
|
|
75
|
+
*iteratePendingByPriority(order: 'asc' | 'desc', filter?: (hash: string) => boolean): Generator<string> {
|
|
77
76
|
const feeCompareFn = order === 'desc' ? (a: bigint, b: bigint) => compareFee(b, a) : compareFee;
|
|
78
|
-
const hashCompareFn =
|
|
77
|
+
const hashCompareFn =
|
|
78
|
+
order === 'desc' ? (a: bigint, b: bigint) => compareTxHash(b, a) : (a: bigint, b: bigint) => compareTxHash(a, b);
|
|
79
79
|
|
|
80
80
|
const sortedFees = [...this.#pendingByPriority.keys()].sort(feeCompareFn);
|
|
81
81
|
|
|
82
82
|
for (const fee of sortedFees) {
|
|
83
83
|
const hashesAtFee = this.#pendingByPriority.get(fee)!;
|
|
84
|
-
// Use compareTxHash from tx_metadata, swap args for descending order
|
|
85
84
|
const sortedHashes = [...hashesAtFee].sort(hashCompareFn);
|
|
86
|
-
for (const
|
|
87
|
-
|
|
85
|
+
for (const hashBigInt of sortedHashes) {
|
|
86
|
+
const hash = txHashFromBigInt(hashBigInt);
|
|
87
|
+
if (filter === undefined || filter(hash)) {
|
|
88
|
+
yield hash;
|
|
89
|
+
}
|
|
88
90
|
}
|
|
89
91
|
}
|
|
90
92
|
}
|
|
91
93
|
|
|
94
|
+
/**
|
|
95
|
+
* Iterates pending transaction hashes in priority order, skipping txs received after maxReceivedAt.
|
|
96
|
+
* @param order - 'desc' for highest priority first, 'asc' for lowest priority first
|
|
97
|
+
* @param maxReceivedAt - Only yield txs with receivedAt <= this value
|
|
98
|
+
*/
|
|
99
|
+
*iterateEligiblePendingByPriority(order: 'asc' | 'desc', maxReceivedAt: number): Generator<string> {
|
|
100
|
+
const filter = (hash: string) => {
|
|
101
|
+
const meta = this.#metadata.get(hash);
|
|
102
|
+
return meta !== undefined && meta.receivedAt <= maxReceivedAt;
|
|
103
|
+
};
|
|
104
|
+
|
|
105
|
+
yield* this.iteratePendingByPriority(order, filter);
|
|
106
|
+
}
|
|
107
|
+
|
|
92
108
|
/** Iterates all metadata entries */
|
|
93
109
|
*iterateMetadata(): Generator<[string, TxMetaData]> {
|
|
94
110
|
yield* this.#metadata;
|
|
@@ -249,8 +265,8 @@ export class TxPoolIndices {
|
|
|
249
265
|
getPendingTxs(): TxMetaData[] {
|
|
250
266
|
const result: TxMetaData[] = [];
|
|
251
267
|
for (const hashSet of this.#pendingByPriority.values()) {
|
|
252
|
-
for (const
|
|
253
|
-
const meta = this.#metadata.get(
|
|
268
|
+
for (const txHashBigInt of hashSet) {
|
|
269
|
+
const meta = this.#metadata.get(txHashFromBigInt(txHashBigInt));
|
|
254
270
|
if (meta) {
|
|
255
271
|
result.push(meta);
|
|
256
272
|
}
|
|
@@ -332,13 +348,15 @@ export class TxPoolIndices {
|
|
|
332
348
|
// METRICS
|
|
333
349
|
// ============================================================================
|
|
334
350
|
|
|
335
|
-
/** Counts transactions by state */
|
|
336
|
-
countTxs(): { pending: number; protected: number; mined: number } {
|
|
351
|
+
/** Counts transactions by state and estimates total metadata memory usage */
|
|
352
|
+
countTxs(): { pending: number; protected: number; mined: number; totalMetadataBytes: number } {
|
|
337
353
|
let pending = 0;
|
|
338
354
|
let protected_ = 0;
|
|
339
355
|
let mined = 0;
|
|
356
|
+
let totalMetadataBytes = 0;
|
|
340
357
|
|
|
341
358
|
for (const meta of this.#metadata.values()) {
|
|
359
|
+
totalMetadataBytes += meta.estimatedSizeBytes;
|
|
342
360
|
const state = this.getTxState(meta);
|
|
343
361
|
if (state === 'pending') {
|
|
344
362
|
pending++;
|
|
@@ -349,7 +367,16 @@ export class TxPoolIndices {
|
|
|
349
367
|
}
|
|
350
368
|
}
|
|
351
369
|
|
|
352
|
-
return { pending, protected: protected_, mined };
|
|
370
|
+
return { pending, protected: protected_, mined, totalMetadataBytes };
|
|
371
|
+
}
|
|
372
|
+
|
|
373
|
+
/** Returns the estimated total memory consumed by all metadata objects */
|
|
374
|
+
getTotalMetadataBytes(): number {
|
|
375
|
+
let total = 0;
|
|
376
|
+
for (const meta of this.#metadata.values()) {
|
|
377
|
+
total += meta.estimatedSizeBytes;
|
|
378
|
+
}
|
|
379
|
+
return total;
|
|
353
380
|
}
|
|
354
381
|
|
|
355
382
|
/** Gets all mined transactions with their block IDs */
|
|
@@ -387,7 +414,7 @@ export class TxPoolIndices {
|
|
|
387
414
|
prioritySet = new Set();
|
|
388
415
|
this.#pendingByPriority.set(meta.priorityFee, prioritySet);
|
|
389
416
|
}
|
|
390
|
-
prioritySet.add(meta.
|
|
417
|
+
prioritySet.add(meta.txHashBigInt);
|
|
391
418
|
}
|
|
392
419
|
|
|
393
420
|
#removeFromPendingIndices(meta: TxMetaData): void {
|
|
@@ -408,7 +435,7 @@ export class TxPoolIndices {
|
|
|
408
435
|
// Remove from priority map
|
|
409
436
|
const hashSet = this.#pendingByPriority.get(meta.priorityFee);
|
|
410
437
|
if (hashSet) {
|
|
411
|
-
hashSet.delete(meta.
|
|
438
|
+
hashSet.delete(meta.txHashBigInt);
|
|
412
439
|
if (hashSet.size === 0) {
|
|
413
440
|
this.#pendingByPriority.delete(meta.priorityFee);
|
|
414
441
|
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { SlotNumber } from '@aztec/foundation/branded-types';
|
|
2
2
|
import { type Logger, createLogger } from '@aztec/foundation/log';
|
|
3
3
|
import { SerialQueue } from '@aztec/foundation/queue';
|
|
4
|
+
import { DateProvider } from '@aztec/foundation/timer';
|
|
4
5
|
import type { TypedEventEmitter } from '@aztec/foundation/types';
|
|
5
6
|
import type { AztecAsyncKVStore } from '@aztec/kv-store';
|
|
6
7
|
import type { L2Block, L2BlockId } from '@aztec/stdlib/block';
|
|
@@ -35,6 +36,7 @@ export class AztecKVTxPoolV2 extends (EventEmitter as new () => TypedEventEmitte
|
|
|
35
36
|
deps: TxPoolV2Dependencies,
|
|
36
37
|
telemetry: TelemetryClient = getTelemetryClient(),
|
|
37
38
|
config: Partial<TxPoolV2Config> = {},
|
|
39
|
+
dateProvider: DateProvider = new DateProvider(),
|
|
38
40
|
log = createLogger('p2p:tx_pool_v2'),
|
|
39
41
|
) {
|
|
40
42
|
super();
|
|
@@ -59,7 +61,7 @@ export class AztecKVTxPoolV2 extends (EventEmitter as new () => TypedEventEmitte
|
|
|
59
61
|
};
|
|
60
62
|
|
|
61
63
|
// Create the implementation
|
|
62
|
-
this.#impl = new TxPoolV2Impl(store, archiveStore, deps, callbacks, config, log);
|
|
64
|
+
this.#impl = new TxPoolV2Impl(store, archiveStore, deps, callbacks, telemetry, config, dateProvider, log);
|
|
63
65
|
}
|
|
64
66
|
|
|
65
67
|
// ============================================================================
|
|
@@ -68,11 +70,11 @@ export class AztecKVTxPoolV2 extends (EventEmitter as new () => TypedEventEmitte
|
|
|
68
70
|
|
|
69
71
|
// === Core Operations ===
|
|
70
72
|
|
|
71
|
-
addPendingTxs(txs: Tx[], opts: { source?: string } = {}): Promise<AddTxsResult> {
|
|
73
|
+
addPendingTxs(txs: Tx[], opts: { source?: string; feeComparisonOnly?: boolean } = {}): Promise<AddTxsResult> {
|
|
72
74
|
return this.#queue.put(() => this.#impl.addPendingTxs(txs, opts));
|
|
73
75
|
}
|
|
74
76
|
|
|
75
|
-
canAddPendingTx(tx: Tx): Promise<'accepted' | 'ignored'
|
|
77
|
+
canAddPendingTx(tx: Tx): Promise<'accepted' | 'ignored'> {
|
|
76
78
|
return this.#queue.put(() => this.#impl.canAddPendingTx(tx));
|
|
77
79
|
}
|
|
78
80
|
|
|
@@ -81,7 +83,7 @@ export class AztecKVTxPoolV2 extends (EventEmitter as new () => TypedEventEmitte
|
|
|
81
83
|
}
|
|
82
84
|
|
|
83
85
|
protectTxs(txHashes: TxHash[], block: BlockHeader): Promise<TxHash[]> {
|
|
84
|
-
return this.#queue.put(() =>
|
|
86
|
+
return this.#queue.put(() => this.#impl.protectTxs(txHashes, block));
|
|
85
87
|
}
|
|
86
88
|
|
|
87
89
|
addMinedTxs(txs: Tx[], block: BlockHeader, opts: { source?: string } = {}): Promise<void> {
|
|
@@ -98,8 +100,8 @@ export class AztecKVTxPoolV2 extends (EventEmitter as new () => TypedEventEmitte
|
|
|
98
100
|
return this.#queue.put(() => this.#impl.prepareForSlot(slotNumber));
|
|
99
101
|
}
|
|
100
102
|
|
|
101
|
-
handlePrunedBlocks(latestBlock: L2BlockId): Promise<void> {
|
|
102
|
-
return this.#queue.put(() => this.#impl.handlePrunedBlocks(latestBlock));
|
|
103
|
+
handlePrunedBlocks(latestBlock: L2BlockId, options?: { deleteAllTxs?: boolean }): Promise<void> {
|
|
104
|
+
return this.#queue.put(() => this.#impl.handlePrunedBlocks(latestBlock, options));
|
|
103
105
|
}
|
|
104
106
|
|
|
105
107
|
handleFailedExecution(txHashes: TxHash[]): Promise<void> {
|
|
@@ -132,6 +134,10 @@ export class AztecKVTxPoolV2 extends (EventEmitter as new () => TypedEventEmitte
|
|
|
132
134
|
return this.#queue.put(() => Promise.resolve(this.#impl.getPendingTxHashes()));
|
|
133
135
|
}
|
|
134
136
|
|
|
137
|
+
getEligiblePendingTxHashes(): Promise<TxHash[]> {
|
|
138
|
+
return this.#queue.put(() => Promise.resolve(this.#impl.getEligiblePendingTxHashes()));
|
|
139
|
+
}
|
|
140
|
+
|
|
135
141
|
getPendingTxCount(): Promise<number> {
|
|
136
142
|
return this.#queue.put(() => Promise.resolve(this.#impl.getPendingTxCount()));
|
|
137
143
|
}
|
|
@@ -189,7 +195,12 @@ export class AztecKVTxPoolV2 extends (EventEmitter as new () => TypedEventEmitte
|
|
|
189
195
|
this.#queue.put(() => {
|
|
190
196
|
const counts = this.#impl.countTxs();
|
|
191
197
|
return Promise.resolve({
|
|
192
|
-
itemCount: {
|
|
198
|
+
itemCount: {
|
|
199
|
+
pending: counts.pending,
|
|
200
|
+
protected: counts.protected,
|
|
201
|
+
mined: counts.mined,
|
|
202
|
+
softDeleted: counts.softDeleted,
|
|
203
|
+
},
|
|
193
204
|
});
|
|
194
205
|
}),
|
|
195
206
|
() => this.#store.estimateSize(),
|