@aztec/p2p 4.0.0-nightly.20250907 → 4.0.0-nightly.20260108
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 +1 -1
- package/dest/bootstrap/bootstrap.d.ts.map +1 -1
- package/dest/bootstrap/bootstrap.js +14 -4
- package/dest/client/factory.d.ts +3 -2
- package/dest/client/factory.d.ts.map +1 -1
- package/dest/client/factory.js +9 -5
- package/dest/client/index.d.ts +1 -1
- package/dest/client/interface.d.ts +8 -6
- package/dest/client/interface.d.ts.map +1 -1
- package/dest/client/p2p_client.d.ts +13 -36
- package/dest/client/p2p_client.d.ts.map +1 -1
- package/dest/client/p2p_client.js +460 -63
- package/dest/config.d.ts +67 -61
- package/dest/config.d.ts.map +1 -1
- package/dest/config.js +28 -15
- package/dest/enr/generate-enr.d.ts +2 -2
- package/dest/enr/generate-enr.d.ts.map +1 -1
- package/dest/enr/generate-enr.js +1 -1
- package/dest/enr/index.d.ts +1 -1
- package/dest/errors/attestation-pool.error.d.ts +7 -0
- package/dest/errors/attestation-pool.error.d.ts.map +1 -0
- package/dest/errors/attestation-pool.error.js +12 -0
- package/dest/errors/reqresp.error.d.ts +1 -1
- package/dest/errors/reqresp.error.d.ts.map +1 -1
- package/dest/index.d.ts +1 -1
- package/dest/mem_pools/attestation_pool/attestation_pool.d.ts +43 -6
- package/dest/mem_pools/attestation_pool/attestation_pool.d.ts.map +1 -1
- package/dest/mem_pools/attestation_pool/attestation_pool_test_suite.d.ts +1 -1
- package/dest/mem_pools/attestation_pool/attestation_pool_test_suite.d.ts.map +1 -1
- package/dest/mem_pools/attestation_pool/attestation_pool_test_suite.js +72 -46
- package/dest/mem_pools/attestation_pool/index.d.ts +1 -1
- package/dest/mem_pools/attestation_pool/kv_attestation_pool.d.ts +15 -6
- package/dest/mem_pools/attestation_pool/kv_attestation_pool.d.ts.map +1 -1
- package/dest/mem_pools/attestation_pool/kv_attestation_pool.js +73 -18
- package/dest/mem_pools/attestation_pool/memory_attestation_pool.d.ts +13 -6
- package/dest/mem_pools/attestation_pool/memory_attestation_pool.d.ts.map +1 -1
- package/dest/mem_pools/attestation_pool/memory_attestation_pool.js +69 -11
- package/dest/mem_pools/attestation_pool/mocks.d.ts +226 -5
- package/dest/mem_pools/attestation_pool/mocks.d.ts.map +1 -1
- package/dest/mem_pools/attestation_pool/mocks.js +9 -7
- package/dest/mem_pools/index.d.ts +1 -1
- package/dest/mem_pools/instrumentation.d.ts +9 -1
- package/dest/mem_pools/instrumentation.d.ts.map +1 -1
- package/dest/mem_pools/instrumentation.js +38 -2
- package/dest/mem_pools/interface.d.ts +3 -4
- package/dest/mem_pools/interface.d.ts.map +1 -1
- package/dest/mem_pools/tx_pool/aztec_kv_tx_pool.d.ts +39 -58
- package/dest/mem_pools/tx_pool/aztec_kv_tx_pool.d.ts.map +1 -1
- package/dest/mem_pools/tx_pool/aztec_kv_tx_pool.js +314 -317
- package/dest/mem_pools/tx_pool/eviction/eviction_manager.d.ts +18 -0
- package/dest/mem_pools/tx_pool/eviction/eviction_manager.d.ts.map +1 -0
- package/dest/mem_pools/tx_pool/eviction/eviction_manager.js +56 -0
- package/dest/mem_pools/tx_pool/eviction/eviction_strategy.d.ts +83 -0
- package/dest/mem_pools/tx_pool/eviction/eviction_strategy.d.ts.map +1 -0
- package/dest/mem_pools/tx_pool/eviction/eviction_strategy.js +5 -0
- package/dest/mem_pools/tx_pool/eviction/insufficient_fee_payer_balance_rule.d.ts +15 -0
- package/dest/mem_pools/tx_pool/eviction/insufficient_fee_payer_balance_rule.d.ts.map +1 -0
- package/dest/mem_pools/tx_pool/eviction/insufficient_fee_payer_balance_rule.js +88 -0
- package/dest/mem_pools/tx_pool/eviction/invalid_txs_after_mining_rule.d.ts +17 -0
- package/dest/mem_pools/tx_pool/eviction/invalid_txs_after_mining_rule.d.ts.map +1 -0
- package/dest/mem_pools/tx_pool/eviction/invalid_txs_after_mining_rule.js +84 -0
- package/dest/mem_pools/tx_pool/eviction/invalid_txs_after_reorg_rule.d.ts +19 -0
- package/dest/mem_pools/tx_pool/eviction/invalid_txs_after_reorg_rule.d.ts.map +1 -0
- package/dest/mem_pools/tx_pool/eviction/invalid_txs_after_reorg_rule.js +76 -0
- package/dest/mem_pools/tx_pool/eviction/low_priority_eviction_rule.d.ts +26 -0
- package/dest/mem_pools/tx_pool/eviction/low_priority_eviction_rule.d.ts.map +1 -0
- package/dest/mem_pools/tx_pool/eviction/low_priority_eviction_rule.js +84 -0
- package/dest/mem_pools/tx_pool/index.d.ts +1 -2
- package/dest/mem_pools/tx_pool/index.d.ts.map +1 -1
- package/dest/mem_pools/tx_pool/index.js +0 -1
- package/dest/mem_pools/tx_pool/priority.d.ts +5 -1
- package/dest/mem_pools/tx_pool/priority.d.ts.map +1 -1
- package/dest/mem_pools/tx_pool/priority.js +6 -1
- package/dest/mem_pools/tx_pool/tx_pool.d.ts +28 -9
- package/dest/mem_pools/tx_pool/tx_pool.d.ts.map +1 -1
- package/dest/mem_pools/tx_pool/tx_pool_test_suite.d.ts +1 -1
- package/dest/mem_pools/tx_pool/tx_pool_test_suite.d.ts.map +1 -1
- package/dest/mem_pools/tx_pool/tx_pool_test_suite.js +155 -25
- package/dest/msg_validators/attestation_validator/attestation_validator.d.ts +4 -2
- package/dest/msg_validators/attestation_validator/attestation_validator.d.ts.map +1 -1
- package/dest/msg_validators/attestation_validator/attestation_validator.js +32 -5
- package/dest/msg_validators/attestation_validator/fisherman_attestation_validator.d.ts +20 -0
- package/dest/msg_validators/attestation_validator/fisherman_attestation_validator.d.ts.map +1 -0
- package/dest/msg_validators/attestation_validator/fisherman_attestation_validator.js +67 -0
- package/dest/msg_validators/attestation_validator/index.d.ts +2 -1
- package/dest/msg_validators/attestation_validator/index.d.ts.map +1 -1
- package/dest/msg_validators/attestation_validator/index.js +1 -0
- package/dest/msg_validators/block_proposal_validator/block_proposal_validator.d.ts +5 -2
- package/dest/msg_validators/block_proposal_validator/block_proposal_validator.d.ts.map +1 -1
- package/dest/msg_validators/block_proposal_validator/block_proposal_validator.js +44 -12
- package/dest/msg_validators/block_proposal_validator/index.d.ts +1 -1
- package/dest/msg_validators/index.d.ts +1 -1
- package/dest/msg_validators/msg_seen_validator/msg_seen_validator.d.ts +1 -1
- package/dest/msg_validators/msg_seen_validator/msg_seen_validator.d.ts.map +1 -1
- package/dest/msg_validators/tx_validator/aggregate_tx_validator.d.ts +1 -1
- package/dest/msg_validators/tx_validator/aggregate_tx_validator.d.ts.map +1 -1
- package/dest/msg_validators/tx_validator/allowed_public_setup.d.ts +1 -1
- package/dest/msg_validators/tx_validator/archive_cache.d.ts +2 -2
- package/dest/msg_validators/tx_validator/archive_cache.d.ts.map +1 -1
- package/dest/msg_validators/tx_validator/block_header_validator.d.ts +2 -2
- package/dest/msg_validators/tx_validator/block_header_validator.d.ts.map +1 -1
- package/dest/msg_validators/tx_validator/block_header_validator.js +1 -1
- package/dest/msg_validators/tx_validator/data_validator.d.ts +1 -1
- package/dest/msg_validators/tx_validator/data_validator.d.ts.map +1 -1
- package/dest/msg_validators/tx_validator/double_spend_validator.d.ts +1 -1
- package/dest/msg_validators/tx_validator/double_spend_validator.d.ts.map +1 -1
- package/dest/msg_validators/tx_validator/double_spend_validator.js +1 -1
- package/dest/msg_validators/tx_validator/factory.d.ts +4 -3
- package/dest/msg_validators/tx_validator/factory.d.ts.map +1 -1
- package/dest/msg_validators/tx_validator/factory.js +11 -5
- package/dest/msg_validators/tx_validator/gas_validator.d.ts +1 -1
- package/dest/msg_validators/tx_validator/gas_validator.d.ts.map +1 -1
- package/dest/msg_validators/tx_validator/index.d.ts +2 -1
- package/dest/msg_validators/tx_validator/index.d.ts.map +1 -1
- package/dest/msg_validators/tx_validator/index.js +1 -0
- package/dest/msg_validators/tx_validator/metadata_validator.d.ts +3 -6
- package/dest/msg_validators/tx_validator/metadata_validator.d.ts.map +1 -1
- package/dest/msg_validators/tx_validator/metadata_validator.js +6 -24
- package/dest/msg_validators/tx_validator/phases_validator.d.ts +1 -1
- package/dest/msg_validators/tx_validator/phases_validator.d.ts.map +1 -1
- package/dest/msg_validators/tx_validator/phases_validator.js +3 -1
- package/dest/msg_validators/tx_validator/test_utils.d.ts +2 -2
- package/dest/msg_validators/tx_validator/test_utils.d.ts.map +1 -1
- package/dest/msg_validators/tx_validator/timestamp_validator.d.ts +13 -0
- package/dest/msg_validators/tx_validator/timestamp_validator.d.ts.map +1 -0
- package/dest/msg_validators/tx_validator/timestamp_validator.js +32 -0
- package/dest/msg_validators/tx_validator/tx_permitted_validator.d.ts +1 -1
- package/dest/msg_validators/tx_validator/tx_permitted_validator.d.ts.map +1 -1
- package/dest/msg_validators/tx_validator/tx_proof_validator.d.ts +1 -1
- package/dest/msg_validators/tx_validator/tx_proof_validator.d.ts.map +1 -1
- package/dest/services/data_store.d.ts +1 -1
- package/dest/services/data_store.d.ts.map +1 -1
- package/dest/services/discv5/discV5_service.d.ts +3 -3
- package/dest/services/discv5/discV5_service.d.ts.map +1 -1
- package/dest/services/discv5/discV5_service.js +2 -2
- package/dest/services/dummy_service.d.ts +2 -2
- package/dest/services/dummy_service.d.ts.map +1 -1
- package/dest/services/encoding.d.ts +25 -4
- package/dest/services/encoding.d.ts.map +1 -1
- package/dest/services/encoding.js +74 -6
- package/dest/services/gossipsub/scoring.d.ts +1 -1
- package/dest/services/index.d.ts +1 -1
- package/dest/services/libp2p/instrumentation.d.ts +3 -1
- package/dest/services/libp2p/instrumentation.d.ts.map +1 -1
- package/dest/services/libp2p/instrumentation.js +9 -2
- package/dest/services/libp2p/libp2p_service.d.ts +33 -72
- package/dest/services/libp2p/libp2p_service.d.ts.map +1 -1
- package/dest/services/libp2p/libp2p_service.js +841 -175
- package/dest/services/peer-manager/interface.d.ts +1 -1
- package/dest/services/peer-manager/metrics.d.ts +8 -1
- package/dest/services/peer-manager/metrics.d.ts.map +1 -1
- package/dest/services/peer-manager/metrics.js +28 -0
- package/dest/services/peer-manager/peer_manager.d.ts +2 -33
- package/dest/services/peer-manager/peer_manager.d.ts.map +1 -1
- package/dest/services/peer-manager/peer_manager.js +29 -22
- package/dest/services/peer-manager/peer_scoring.d.ts +7 -2
- package/dest/services/peer-manager/peer_scoring.d.ts.map +1 -1
- package/dest/services/peer-manager/peer_scoring.js +40 -2
- package/dest/services/reqresp/config.d.ts +1 -1
- package/dest/services/reqresp/connection-sampler/batch_connection_sampler.d.ts +1 -1
- package/dest/services/reqresp/connection-sampler/batch_connection_sampler.d.ts.map +1 -1
- package/dest/services/reqresp/connection-sampler/connection_sampler.d.ts +1 -4
- package/dest/services/reqresp/connection-sampler/connection_sampler.d.ts.map +1 -1
- package/dest/services/reqresp/index.d.ts +1 -1
- package/dest/services/reqresp/interface.d.ts +2 -11
- package/dest/services/reqresp/interface.d.ts.map +1 -1
- package/dest/services/reqresp/interface.js +1 -18
- package/dest/services/reqresp/metrics.d.ts +1 -1
- package/dest/services/reqresp/metrics.d.ts.map +1 -1
- package/dest/services/reqresp/protocols/auth.d.ts +2 -2
- package/dest/services/reqresp/protocols/auth.d.ts.map +1 -1
- package/dest/services/reqresp/protocols/auth.js +2 -2
- package/dest/services/reqresp/protocols/block.d.ts +1 -1
- package/dest/services/reqresp/protocols/block.d.ts.map +1 -1
- package/dest/services/reqresp/protocols/block.js +3 -2
- package/dest/services/reqresp/protocols/block_txs/bitvector.d.ts +1 -1
- package/dest/services/reqresp/protocols/block_txs/bitvector.d.ts.map +1 -1
- package/dest/services/reqresp/protocols/block_txs/block_txs_handler.d.ts +1 -1
- package/dest/services/reqresp/protocols/block_txs/block_txs_reqresp.d.ts +4 -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 +1 -1
- package/dest/services/reqresp/protocols/block_txs/index.d.ts +1 -1
- package/dest/services/reqresp/protocols/goodbye.d.ts +1 -1
- package/dest/services/reqresp/protocols/goodbye.d.ts.map +1 -1
- package/dest/services/reqresp/protocols/index.d.ts +1 -1
- package/dest/services/reqresp/protocols/ping.d.ts +1 -1
- package/dest/services/reqresp/protocols/status.d.ts +6 -5
- package/dest/services/reqresp/protocols/status.d.ts.map +1 -1
- package/dest/services/reqresp/protocols/status.js +4 -3
- package/dest/services/reqresp/protocols/tx.d.ts +2 -3
- package/dest/services/reqresp/protocols/tx.d.ts.map +1 -1
- package/dest/services/reqresp/rate-limiter/index.d.ts +1 -1
- package/dest/services/reqresp/rate-limiter/rate_limiter.d.ts +2 -2
- package/dest/services/reqresp/rate-limiter/rate_limiter.d.ts.map +1 -1
- package/dest/services/reqresp/rate-limiter/rate_limits.d.ts +1 -1
- package/dest/services/reqresp/reqresp.d.ts +1 -41
- package/dest/services/reqresp/reqresp.d.ts.map +1 -1
- package/dest/services/reqresp/reqresp.js +416 -34
- package/dest/services/reqresp/status.d.ts +2 -2
- package/dest/services/reqresp/status.d.ts.map +1 -1
- package/dest/services/service.d.ts +2 -2
- package/dest/services/service.d.ts.map +1 -1
- package/dest/services/tx_collection/config.d.ts +1 -1
- package/dest/services/tx_collection/config.js +1 -1
- package/dest/services/tx_collection/fast_tx_collection.d.ts +4 -9
- package/dest/services/tx_collection/fast_tx_collection.d.ts.map +1 -1
- package/dest/services/tx_collection/fast_tx_collection.js +6 -1
- package/dest/services/tx_collection/index.d.ts +1 -1
- 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/slow_tx_collection.d.ts +6 -7
- package/dest/services/tx_collection/slow_tx_collection.d.ts.map +1 -1
- package/dest/services/tx_collection/slow_tx_collection.js +2 -1
- package/dest/services/tx_collection/tx_collection.d.ts +12 -11
- package/dest/services/tx_collection/tx_collection.d.ts.map +1 -1
- package/dest/services/tx_collection/tx_collection.js +3 -2
- package/dest/services/tx_collection/tx_collection_sink.d.ts +3 -3
- package/dest/services/tx_collection/tx_collection_sink.d.ts.map +1 -1
- package/dest/services/tx_collection/tx_collection_sink.js +34 -4
- package/dest/services/tx_collection/tx_source.d.ts +1 -1
- package/dest/services/tx_collection/tx_source.d.ts.map +1 -1
- package/dest/services/tx_collection/tx_source.js +2 -2
- package/dest/services/tx_provider.d.ts +6 -4
- package/dest/services/tx_provider.d.ts.map +1 -1
- package/dest/services/tx_provider.js +19 -6
- package/dest/services/tx_provider_instrumentation.d.ts +5 -2
- package/dest/services/tx_provider_instrumentation.d.ts.map +1 -1
- package/dest/services/tx_provider_instrumentation.js +14 -1
- package/dest/test-helpers/generate-peer-id-private-keys.d.ts +1 -1
- package/dest/test-helpers/get-ports.d.ts +1 -1
- package/dest/test-helpers/get-ports.d.ts.map +1 -1
- package/dest/test-helpers/index.d.ts +1 -1
- package/dest/test-helpers/make-enrs.d.ts +1 -1
- package/dest/test-helpers/make-enrs.js +1 -1
- package/dest/test-helpers/make-test-p2p-clients.d.ts +2 -2
- package/dest/test-helpers/make-test-p2p-clients.d.ts.map +1 -1
- package/dest/test-helpers/mock-pubsub.d.ts +4 -4
- package/dest/test-helpers/mock-pubsub.d.ts.map +1 -1
- package/dest/test-helpers/mock-tx-helpers.d.ts +12 -0
- package/dest/test-helpers/mock-tx-helpers.d.ts.map +1 -0
- package/dest/test-helpers/mock-tx-helpers.js +19 -0
- package/dest/test-helpers/reqresp-nodes.d.ts +3 -3
- package/dest/test-helpers/reqresp-nodes.d.ts.map +1 -1
- package/dest/test-helpers/reqresp-nodes.js +4 -3
- package/dest/testbench/p2p_client_testbench_worker.d.ts +1 -1
- package/dest/testbench/p2p_client_testbench_worker.js +17 -9
- package/dest/testbench/parse_log_file.d.ts +1 -1
- package/dest/testbench/testbench.d.ts +1 -1
- package/dest/testbench/testbench.js +2 -2
- package/dest/testbench/worker_client_manager.d.ts +1 -1
- package/dest/testbench/worker_client_manager.d.ts.map +1 -1
- package/dest/types/index.d.ts +1 -1
- package/dest/util.d.ts +2 -1
- package/dest/util.d.ts.map +1 -1
- package/dest/util.js +11 -2
- package/dest/versioning.d.ts +2 -2
- package/dest/versioning.d.ts.map +1 -1
- package/dest/versioning.js +2 -2
- package/package.json +21 -21
- package/src/bootstrap/bootstrap.ts +15 -4
- package/src/client/factory.ts +21 -12
- package/src/client/interface.ts +8 -5
- package/src/client/p2p_client.ts +106 -106
- package/src/config.ts +42 -21
- package/src/enr/generate-enr.ts +1 -1
- package/src/errors/attestation-pool.error.ts +13 -0
- package/src/mem_pools/attestation_pool/attestation_pool.ts +46 -5
- package/src/mem_pools/attestation_pool/attestation_pool_test_suite.ts +89 -48
- package/src/mem_pools/attestation_pool/kv_attestation_pool.ts +107 -24
- package/src/mem_pools/attestation_pool/memory_attestation_pool.ts +98 -19
- package/src/mem_pools/attestation_pool/mocks.ts +11 -8
- package/src/mem_pools/instrumentation.ts +46 -0
- package/src/mem_pools/interface.ts +2 -4
- package/src/mem_pools/tx_pool/README.md +255 -0
- package/src/mem_pools/tx_pool/aztec_kv_tx_pool.ts +368 -360
- package/src/mem_pools/tx_pool/eviction/eviction_manager.ts +71 -0
- package/src/mem_pools/tx_pool/eviction/eviction_strategy.ts +93 -0
- package/src/mem_pools/tx_pool/eviction/insufficient_fee_payer_balance_rule.ts +108 -0
- package/src/mem_pools/tx_pool/eviction/invalid_txs_after_mining_rule.ts +104 -0
- package/src/mem_pools/tx_pool/eviction/invalid_txs_after_reorg_rule.ts +91 -0
- package/src/mem_pools/tx_pool/eviction/low_priority_eviction_rule.ts +106 -0
- package/src/mem_pools/tx_pool/index.ts +0 -1
- package/src/mem_pools/tx_pool/priority.ts +8 -1
- package/src/mem_pools/tx_pool/tx_pool.ts +28 -8
- package/src/mem_pools/tx_pool/tx_pool_test_suite.ts +131 -18
- package/src/msg_validators/attestation_validator/attestation_validator.ts +41 -6
- package/src/msg_validators/attestation_validator/fisherman_attestation_validator.ts +91 -0
- package/src/msg_validators/attestation_validator/index.ts +1 -0
- package/src/msg_validators/block_proposal_validator/block_proposal_validator.ts +53 -12
- package/src/msg_validators/tx_validator/archive_cache.ts +1 -1
- package/src/msg_validators/tx_validator/block_header_validator.ts +2 -2
- package/src/msg_validators/tx_validator/double_spend_validator.ts +1 -1
- package/src/msg_validators/tx_validator/factory.ts +13 -6
- package/src/msg_validators/tx_validator/index.ts +1 -0
- package/src/msg_validators/tx_validator/metadata_validator.ts +8 -42
- package/src/msg_validators/tx_validator/phases_validator.ts +3 -1
- package/src/msg_validators/tx_validator/test_utils.ts +1 -1
- package/src/msg_validators/tx_validator/timestamp_validator.ts +47 -0
- package/src/services/discv5/discV5_service.ts +2 -2
- package/src/services/dummy_service.ts +1 -1
- package/src/services/encoding.ts +81 -6
- package/src/services/libp2p/instrumentation.ts +10 -1
- package/src/services/libp2p/libp2p_service.ts +494 -169
- package/src/services/peer-manager/metrics.ts +32 -0
- package/src/services/peer-manager/peer_manager.ts +25 -16
- package/src/services/peer-manager/peer_scoring.ts +46 -3
- package/src/services/reqresp/interface.ts +1 -22
- package/src/services/reqresp/protocols/auth.ts +2 -2
- package/src/services/reqresp/protocols/block.ts +3 -2
- package/src/services/reqresp/protocols/block_txs/block_txs_reqresp.ts +1 -1
- package/src/services/reqresp/protocols/status.ts +9 -8
- package/src/services/reqresp/protocols/tx.ts +1 -2
- package/src/services/reqresp/reqresp.ts +15 -11
- package/src/services/service.ts +1 -1
- package/src/services/tx_collection/config.ts +1 -1
- package/src/services/tx_collection/fast_tx_collection.ts +8 -5
- package/src/services/tx_collection/slow_tx_collection.ts +7 -6
- package/src/services/tx_collection/tx_collection.ts +12 -10
- package/src/services/tx_collection/tx_collection_sink.ts +34 -3
- package/src/services/tx_collection/tx_source.ts +2 -2
- package/src/services/tx_provider.ts +26 -9
- package/src/services/tx_provider_instrumentation.ts +19 -2
- package/src/test-helpers/make-enrs.ts +1 -1
- package/src/test-helpers/mock-pubsub.ts +1 -1
- package/src/test-helpers/mock-tx-helpers.ts +24 -0
- package/src/test-helpers/reqresp-nodes.ts +4 -3
- package/src/testbench/p2p_client_testbench_worker.ts +14 -6
- package/src/testbench/testbench.ts +2 -2
- package/src/util.ts +12 -2
- package/src/versioning.ts +3 -3
- package/dest/mem_pools/tx_pool/memory_tx_pool.d.ts +0 -68
- package/dest/mem_pools/tx_pool/memory_tx_pool.d.ts.map +0 -1
- package/dest/mem_pools/tx_pool/memory_tx_pool.js +0 -160
- package/src/mem_pools/tx_pool/memory_tx_pool.ts +0 -199
|
@@ -1,8 +1,9 @@
|
|
|
1
|
+
import { BlockNumber } from '@aztec/foundation/branded-types';
|
|
1
2
|
import { compactArray } from '@aztec/foundation/collection';
|
|
2
3
|
import { type Logger, createLogger } from '@aztec/foundation/log';
|
|
3
4
|
import { type PromiseWithResolvers, RunningPromise } from '@aztec/foundation/promise';
|
|
4
5
|
import { DateProvider } from '@aztec/foundation/timer';
|
|
5
|
-
import type {
|
|
6
|
+
import type { L2BlockInfo, L2BlockNew } from '@aztec/stdlib/block';
|
|
6
7
|
import type { L1RollupConstants } from '@aztec/stdlib/epoch-helpers';
|
|
7
8
|
import type { BlockProposal } from '@aztec/stdlib/p2p';
|
|
8
9
|
import { Tx, TxHash } from '@aztec/stdlib/tx';
|
|
@@ -21,16 +22,16 @@ import type { TxSource } from './tx_source.js';
|
|
|
21
22
|
|
|
22
23
|
export type CollectionMethod = 'fast-req-resp' | 'fast-node-rpc' | 'slow-req-resp' | 'slow-node-rpc';
|
|
23
24
|
|
|
24
|
-
export type MissingTxInfo = { blockNumber:
|
|
25
|
+
export type MissingTxInfo = { blockNumber: BlockNumber; deadline: Date; readyForReqResp: boolean };
|
|
25
26
|
|
|
26
27
|
export type FastCollectionRequestInput =
|
|
27
|
-
| { type: 'block'; block:
|
|
28
|
-
| { type: 'proposal'; blockProposal: BlockProposal };
|
|
28
|
+
| { type: 'block'; block: L2BlockNew }
|
|
29
|
+
| { type: 'proposal'; blockProposal: BlockProposal; blockNumber: BlockNumber };
|
|
29
30
|
|
|
30
31
|
export type FastCollectionRequest = FastCollectionRequestInput & {
|
|
31
32
|
missingTxHashes: Set<string>;
|
|
32
33
|
deadline: Date;
|
|
33
|
-
blockInfo:
|
|
34
|
+
blockInfo: L2BlockInfo;
|
|
34
35
|
promise: PromiseWithResolvers<void>;
|
|
35
36
|
foundTxs: Map<string, Tx>;
|
|
36
37
|
};
|
|
@@ -145,22 +146,23 @@ export class TxCollection {
|
|
|
145
146
|
}
|
|
146
147
|
|
|
147
148
|
/** Starts collecting the given tx hashes for the given L2Block in the slow loop */
|
|
148
|
-
public startCollecting(block:
|
|
149
|
+
public startCollecting(block: L2BlockNew, txHashes: TxHash[]) {
|
|
149
150
|
return this.slowCollection.startCollecting(block, txHashes);
|
|
150
151
|
}
|
|
151
152
|
|
|
152
153
|
/** Collects the set of txs for the given block proposal as fast as possible */
|
|
153
154
|
public collectFastForProposal(
|
|
154
155
|
blockProposal: BlockProposal,
|
|
156
|
+
blockNumber: BlockNumber,
|
|
155
157
|
txHashes: TxHash[] | string[],
|
|
156
158
|
opts: { deadline: Date; pinnedPeer?: PeerId },
|
|
157
159
|
) {
|
|
158
|
-
return this.collectFastFor({ type: 'proposal', blockProposal }, txHashes, opts);
|
|
160
|
+
return this.collectFastFor({ type: 'proposal', blockProposal, blockNumber }, txHashes, opts);
|
|
159
161
|
}
|
|
160
162
|
|
|
161
163
|
/** Collects the set of txs for the given mined block as fast as possible */
|
|
162
164
|
public collectFastForBlock(
|
|
163
|
-
block:
|
|
165
|
+
block: L2BlockNew,
|
|
164
166
|
txHashes: TxHash[] | string[],
|
|
165
167
|
opts: { deadline: Date; pinnedPeer?: PeerId },
|
|
166
168
|
) {
|
|
@@ -186,7 +188,7 @@ export class TxCollection {
|
|
|
186
188
|
* Stop collecting all txs for blocks less than or requal to the block number specified.
|
|
187
189
|
* To be called when we no longer care about gathering txs up to a certain block, eg when they become proven or finalized.
|
|
188
190
|
*/
|
|
189
|
-
public stopCollectingForBlocksUpTo(blockNumber:
|
|
191
|
+
public stopCollectingForBlocksUpTo(blockNumber: BlockNumber): void {
|
|
190
192
|
this.slowCollection.stopCollectingForBlocksUpTo(blockNumber);
|
|
191
193
|
this.fastCollection.stopCollectingForBlocksUpTo(blockNumber);
|
|
192
194
|
}
|
|
@@ -195,7 +197,7 @@ export class TxCollection {
|
|
|
195
197
|
* Stop collecting all txs for blocks greater than the block number specified.
|
|
196
198
|
* To be called when there is a chain prune and previously mined txs are no longer relevant.
|
|
197
199
|
*/
|
|
198
|
-
public stopCollectingForBlocksAfter(blockNumber:
|
|
200
|
+
public stopCollectingForBlocksAfter(blockNumber: BlockNumber): void {
|
|
199
201
|
this.slowCollection.stopCollectingForBlocksAfter(blockNumber);
|
|
200
202
|
this.fastCollection.stopCollectingForBlocksAfter(blockNumber);
|
|
201
203
|
}
|
|
@@ -58,17 +58,48 @@ export class TxCollectionSink extends (EventEmitter as new () => TypedEventEmitt
|
|
|
58
58
|
return { txs, requested, duration };
|
|
59
59
|
}
|
|
60
60
|
|
|
61
|
+
// Validate tx hashes for all collected txs from external sources
|
|
62
|
+
const validTxs: Tx[] = [];
|
|
63
|
+
const invalidTxHashes: string[] = [];
|
|
64
|
+
await Promise.all(
|
|
65
|
+
txs.map(async tx => {
|
|
66
|
+
const isValid = await tx.validateTxHash();
|
|
67
|
+
if (isValid) {
|
|
68
|
+
validTxs.push(tx);
|
|
69
|
+
} else {
|
|
70
|
+
invalidTxHashes.push(tx.getTxHash().toString());
|
|
71
|
+
}
|
|
72
|
+
}),
|
|
73
|
+
);
|
|
74
|
+
|
|
75
|
+
if (invalidTxHashes.length > 0) {
|
|
76
|
+
this.log.warn(`Rejecting ${invalidTxHashes.length} txs with invalid hashes from ${info.description}`, {
|
|
77
|
+
...info,
|
|
78
|
+
invalidTxHashes,
|
|
79
|
+
});
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
if (validTxs.length === 0) {
|
|
83
|
+
this.log.trace(`No valid txs found via ${info.description} after validation`, {
|
|
84
|
+
...info,
|
|
85
|
+
requestedTxs: requested.map(t => t.toString()),
|
|
86
|
+
invalidTxHashes,
|
|
87
|
+
});
|
|
88
|
+
return { txs: [], requested, duration };
|
|
89
|
+
}
|
|
90
|
+
|
|
61
91
|
this.log.verbose(
|
|
62
|
-
`Collected ${
|
|
92
|
+
`Collected ${validTxs.length} txs out of ${requested.length} requested via ${info.description} in ${duration}ms`,
|
|
63
93
|
{
|
|
64
94
|
...info,
|
|
65
95
|
duration,
|
|
66
|
-
txs:
|
|
96
|
+
txs: validTxs.map(t => t.getTxHash().toString()),
|
|
67
97
|
requestedTxs: requested.map(t => t.toString()),
|
|
98
|
+
rejectedCount: invalidTxHashes.length,
|
|
68
99
|
},
|
|
69
100
|
);
|
|
70
101
|
|
|
71
|
-
return await this.foundTxs(
|
|
102
|
+
return await this.foundTxs(validTxs, { ...info, duration });
|
|
72
103
|
}
|
|
73
104
|
|
|
74
105
|
private async foundTxs(
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { getVKTreeRoot } from '@aztec/noir-protocol-circuits-types/vk-tree';
|
|
2
|
-
import {
|
|
2
|
+
import { protocolContractsHash } from '@aztec/protocol-contracts';
|
|
3
3
|
import type { ChainConfig } from '@aztec/stdlib/config';
|
|
4
4
|
import { type AztecNode, createAztecNodeClient } from '@aztec/stdlib/interfaces/client';
|
|
5
5
|
import type { Tx, TxHash } from '@aztec/stdlib/tx';
|
|
@@ -32,6 +32,6 @@ export class NodeRpcTxSource implements TxSource {
|
|
|
32
32
|
}
|
|
33
33
|
|
|
34
34
|
export function createNodeRpcTxSources(urls: string[], chainConfig: ChainConfig) {
|
|
35
|
-
const versions = getComponentsVersionsFromConfig(chainConfig,
|
|
35
|
+
const versions = getComponentsVersionsFromConfig(chainConfig, protocolContractsHash, getVKTreeRoot());
|
|
36
36
|
return urls.map(url => NodeRpcTxSource.fromUrl(url, versions));
|
|
37
37
|
}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
+
import { BlockNumber } from '@aztec/foundation/branded-types';
|
|
1
2
|
import { compactArray } from '@aztec/foundation/collection';
|
|
2
3
|
import { type Logger, createLogger } from '@aztec/foundation/log';
|
|
3
4
|
import { elapsed } from '@aztec/foundation/timer';
|
|
4
|
-
import type {
|
|
5
|
+
import type { L2BlockInfo, L2BlockNew } from '@aztec/stdlib/block';
|
|
5
6
|
import type { ITxProvider } from '@aztec/stdlib/interfaces/server';
|
|
6
7
|
import type { BlockProposal } from '@aztec/stdlib/p2p';
|
|
7
8
|
import { Tx, TxHash } from '@aztec/stdlib/tx';
|
|
@@ -45,7 +46,7 @@ export class TxProvider implements ITxProvider {
|
|
|
45
46
|
if (tx === undefined) {
|
|
46
47
|
missingTxs.push(txHashes[i]);
|
|
47
48
|
} else {
|
|
48
|
-
txs.push(tx
|
|
49
|
+
txs.push(tx);
|
|
49
50
|
}
|
|
50
51
|
}
|
|
51
52
|
|
|
@@ -55,18 +56,19 @@ export class TxProvider implements ITxProvider {
|
|
|
55
56
|
/** Gathers txs from the tx pool, proposal body, remote rpc nodes, and reqresp. */
|
|
56
57
|
public getTxsForBlockProposal(
|
|
57
58
|
blockProposal: BlockProposal,
|
|
59
|
+
blockNumber: BlockNumber,
|
|
58
60
|
opts: { pinnedPeer: PeerId | undefined; deadline: Date },
|
|
59
61
|
): Promise<{ txs: Tx[]; missingTxs: TxHash[] }> {
|
|
60
62
|
return this.getOrderedTxsFromAllSources(
|
|
61
|
-
{ type: 'proposal', blockProposal },
|
|
62
|
-
blockProposal.toBlockInfo(),
|
|
63
|
+
{ type: 'proposal', blockProposal, blockNumber },
|
|
64
|
+
{ ...blockProposal.toBlockInfo(), blockNumber },
|
|
63
65
|
blockProposal.txHashes,
|
|
64
66
|
{ ...opts, pinnedPeer: opts.pinnedPeer },
|
|
65
67
|
);
|
|
66
68
|
}
|
|
67
69
|
|
|
68
70
|
/** Gathers txs from the tx pool, remote rpc nodes, and reqresp. */
|
|
69
|
-
public getTxsForBlock(block:
|
|
71
|
+
public getTxsForBlock(block: L2BlockNew, opts: { deadline: Date }): Promise<{ txs: Tx[]; missingTxs: TxHash[] }> {
|
|
70
72
|
return this.getOrderedTxsFromAllSources(
|
|
71
73
|
{ type: 'block', block },
|
|
72
74
|
block.toBlockInfo(),
|
|
@@ -77,7 +79,7 @@ export class TxProvider implements ITxProvider {
|
|
|
77
79
|
|
|
78
80
|
private async getOrderedTxsFromAllSources(
|
|
79
81
|
request: FastCollectionRequestInput,
|
|
80
|
-
blockInfo:
|
|
82
|
+
blockInfo: L2BlockInfo,
|
|
81
83
|
txHashes: TxHash[],
|
|
82
84
|
opts: { pinnedPeer: PeerId | undefined; deadline: Date },
|
|
83
85
|
) {
|
|
@@ -114,7 +116,7 @@ export class TxProvider implements ITxProvider {
|
|
|
114
116
|
|
|
115
117
|
private async getTxsFromAllSources(
|
|
116
118
|
request: FastCollectionRequestInput,
|
|
117
|
-
blockInfo:
|
|
119
|
+
blockInfo: L2BlockInfo,
|
|
118
120
|
txHashes: TxHash[],
|
|
119
121
|
opts: { pinnedPeer: PeerId | undefined; deadline: Date },
|
|
120
122
|
) {
|
|
@@ -135,6 +137,7 @@ export class TxProvider implements ITxProvider {
|
|
|
135
137
|
);
|
|
136
138
|
|
|
137
139
|
if (missingTxHashes.size === 0) {
|
|
140
|
+
this.instrumentation.incTxsFromP2P(0, txHashes.length);
|
|
138
141
|
return { txsFromMempool };
|
|
139
142
|
}
|
|
140
143
|
|
|
@@ -153,24 +156,26 @@ export class TxProvider implements ITxProvider {
|
|
|
153
156
|
|
|
154
157
|
if (missingTxHashes.size === 0) {
|
|
155
158
|
await this.processProposalTxs(txsFromProposal);
|
|
159
|
+
this.instrumentation.incTxsFromP2P(0, txHashes.length);
|
|
156
160
|
return { txsFromMempool, txsFromProposal };
|
|
157
161
|
}
|
|
158
162
|
|
|
159
163
|
// Start tx collection from the network if needed, while we validate the txs taken from the proposal in parallel
|
|
160
164
|
const [txsFromNetwork] = await Promise.all([
|
|
161
|
-
this.
|
|
165
|
+
this.collectFromP2P(request, [...missingTxHashes], opts),
|
|
162
166
|
this.processProposalTxs(txsFromProposal),
|
|
163
167
|
] as const);
|
|
164
168
|
|
|
165
169
|
if (txsFromNetwork.length > 0) {
|
|
166
170
|
txsFromNetwork.forEach(tx => missingTxHashes.delete(tx.txHash.toString()));
|
|
167
|
-
this.instrumentation.incTxsFromP2P(txsFromNetwork.length);
|
|
168
171
|
this.log.debug(
|
|
169
172
|
`Retrieved ${txsFromNetwork.length} txs from network for block proposal (${missingTxHashes.size} pending)`,
|
|
170
173
|
{ ...blockInfo, missingTxHashes: [...missingTxHashes] },
|
|
171
174
|
);
|
|
172
175
|
}
|
|
173
176
|
|
|
177
|
+
this.instrumentation.incTxsFromP2P(txsFromNetwork.length, txHashes.length);
|
|
178
|
+
|
|
174
179
|
if (missingTxHashes.size === 0) {
|
|
175
180
|
return { txsFromNetwork, txsFromMempool, txsFromProposal };
|
|
176
181
|
}
|
|
@@ -198,6 +203,18 @@ export class TxProvider implements ITxProvider {
|
|
|
198
203
|
};
|
|
199
204
|
}
|
|
200
205
|
|
|
206
|
+
private async collectFromP2P(
|
|
207
|
+
input: FastCollectionRequestInput,
|
|
208
|
+
txHashes: TxHash[] | string[],
|
|
209
|
+
opts: { deadline: Date; pinnedPeer?: PeerId },
|
|
210
|
+
): Promise<Tx[]> {
|
|
211
|
+
const requestedAt = Date.now();
|
|
212
|
+
const result = await this.txCollection.collectFastFor(input, txHashes, opts);
|
|
213
|
+
const requestProcessedAt = Date.now();
|
|
214
|
+
this.instrumentation.recordTxsRequestDelay(requestProcessedAt - requestedAt);
|
|
215
|
+
return result;
|
|
216
|
+
}
|
|
217
|
+
|
|
201
218
|
private extractFromProposal(proposal: BlockProposal | undefined, missingTxHashes: string[]): Tx[] {
|
|
202
219
|
if (!proposal) {
|
|
203
220
|
return [];
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Metrics, type TelemetryClient, type UpDownCounter } from '@aztec/telemetry-client';
|
|
1
|
+
import { type Histogram, Metrics, type TelemetryClient, type UpDownCounter } from '@aztec/telemetry-client';
|
|
2
2
|
|
|
3
3
|
export class TxProviderInstrumentation {
|
|
4
4
|
private txFromProposalCount: UpDownCounter;
|
|
@@ -6,6 +6,9 @@ export class TxProviderInstrumentation {
|
|
|
6
6
|
private txFromP2PCount: UpDownCounter;
|
|
7
7
|
private missingTxsCount: UpDownCounter;
|
|
8
8
|
|
|
9
|
+
private fractionOfTxsRequestedFromP2P: Histogram;
|
|
10
|
+
private txsRequestDelay: Histogram;
|
|
11
|
+
|
|
9
12
|
constructor(client: TelemetryClient, name: string) {
|
|
10
13
|
const meter = client.getMeter(name);
|
|
11
14
|
|
|
@@ -24,6 +27,15 @@ export class TxProviderInstrumentation {
|
|
|
24
27
|
this.missingTxsCount = meter.createUpDownCounter(Metrics.TX_PROVIDER_MISSING_TXS_COUNT, {
|
|
25
28
|
description: 'The number of txs not found anywhere',
|
|
26
29
|
});
|
|
30
|
+
|
|
31
|
+
this.fractionOfTxsRequestedFromP2P = meter.createHistogram(Metrics.TX_PROVIDER_P2P_TXS_REQUESTED_FRACTION, {
|
|
32
|
+
description: 'The fraction of transaction requested from peers',
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
this.txsRequestDelay = meter.createHistogram(Metrics.TX_PROVIDER_P2P_TXS_REQUEST_DELAY, {
|
|
36
|
+
unit: 'ms',
|
|
37
|
+
description: 'The time it took to request missing transactions from p2p',
|
|
38
|
+
});
|
|
27
39
|
}
|
|
28
40
|
|
|
29
41
|
incTxsFromProposals(count: number) {
|
|
@@ -34,8 +46,13 @@ export class TxProviderInstrumentation {
|
|
|
34
46
|
this.txFromMempoolCount.add(count);
|
|
35
47
|
}
|
|
36
48
|
|
|
37
|
-
incTxsFromP2P(count: number) {
|
|
49
|
+
incTxsFromP2P(count: number, total: number) {
|
|
38
50
|
this.txFromP2PCount.add(count);
|
|
51
|
+
this.fractionOfTxsRequestedFromP2P.record(count / total);
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
recordTxsRequestDelay(delay: number) {
|
|
55
|
+
this.txsRequestDelay.record(delay);
|
|
39
56
|
}
|
|
40
57
|
|
|
41
58
|
incMissingTxs(count: number) {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { ChainConfig } from '@aztec/stdlib/config';
|
|
2
2
|
|
|
3
|
-
import { SignableENR } from '@chainsafe/enr';
|
|
4
3
|
import { multiaddr } from '@multiformats/multiaddr';
|
|
4
|
+
import { SignableENR } from '@nethermindeth/enr';
|
|
5
5
|
|
|
6
6
|
import { convertToMultiaddr, createLibP2PPeerIdFromPrivateKey } from '../util.js';
|
|
7
7
|
import { setAztecEnrKey } from '../versioning.js';
|
|
@@ -39,7 +39,7 @@ export function getMockPubSubP2PServiceFactory<T extends P2PClientType>(
|
|
|
39
39
|
peerId: PeerId,
|
|
40
40
|
deps: {
|
|
41
41
|
packageVersion: string;
|
|
42
|
-
mempools: MemPools
|
|
42
|
+
mempools: MemPools;
|
|
43
43
|
l2BlockSource: L2BlockSource & ContractDataSource;
|
|
44
44
|
epochCache: EpochCacheInterface;
|
|
45
45
|
proofVerifier: ClientProtocolCircuitVerifier;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { Fr } from '@aztec/foundation/curves/bn254';
|
|
2
|
+
import { getVKTreeRoot } from '@aztec/noir-protocol-circuits-types/vk-tree';
|
|
3
|
+
import { protocolContractsHash } from '@aztec/protocol-contracts';
|
|
4
|
+
import { mockTx } from '@aztec/stdlib/testing';
|
|
5
|
+
import { Tx } from '@aztec/stdlib/tx';
|
|
6
|
+
|
|
7
|
+
import type { P2PConfig } from '../config.js';
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Helper function to create mock transactions with the correct metadata values
|
|
11
|
+
* that will pass validation when sent over the p2p network.
|
|
12
|
+
*
|
|
13
|
+
* @param config - The P2P configuration containing chainId and rollupVersion
|
|
14
|
+
* @param seed - Optional seed for the mock transaction
|
|
15
|
+
* @returns A mock transaction with valid metadata for p2p network transmission
|
|
16
|
+
*/
|
|
17
|
+
export const createMockTxWithMetadata = (config: P2PConfig, seed?: number): Promise<Tx> => {
|
|
18
|
+
return mockTx(seed, {
|
|
19
|
+
chainId: new Fr(config.l1ChainId),
|
|
20
|
+
version: new Fr(config.rollupVersion),
|
|
21
|
+
vkTreeRoot: getVKTreeRoot(),
|
|
22
|
+
protocolContractsHash,
|
|
23
|
+
});
|
|
24
|
+
};
|
|
@@ -17,7 +17,6 @@ import type { Tx } from '@aztec/stdlib/tx';
|
|
|
17
17
|
import { compressComponentVersions } from '@aztec/stdlib/versioning';
|
|
18
18
|
import { type TelemetryClient, getTelemetryClient } from '@aztec/telemetry-client';
|
|
19
19
|
|
|
20
|
-
import { SignableENR } from '@chainsafe/enr';
|
|
21
20
|
import { gossipsub } from '@chainsafe/libp2p-gossipsub';
|
|
22
21
|
import { noise } from '@chainsafe/libp2p-noise';
|
|
23
22
|
import { yamux } from '@chainsafe/libp2p-yamux';
|
|
@@ -27,6 +26,7 @@ import type { PeerId } from '@libp2p/interface';
|
|
|
27
26
|
import { createSecp256k1PeerId } from '@libp2p/peer-id-factory';
|
|
28
27
|
import { tcp } from '@libp2p/tcp';
|
|
29
28
|
import { multiaddr } from '@multiformats/multiaddr';
|
|
29
|
+
import { SignableENR } from '@nethermindeth/enr';
|
|
30
30
|
import getPort from 'get-port';
|
|
31
31
|
import { type Libp2p, type Libp2pOptions, createLibp2p } from 'libp2p';
|
|
32
32
|
|
|
@@ -112,7 +112,7 @@ export async function createTestLibP2PService<T extends P2PClientType>(
|
|
|
112
112
|
archiver: L2BlockSource & ContractDataSource,
|
|
113
113
|
worldStateSynchronizer: WorldStateSynchronizer,
|
|
114
114
|
epochCache: EpochCache,
|
|
115
|
-
mempools: MemPools
|
|
115
|
+
mempools: MemPools,
|
|
116
116
|
telemetry: TelemetryClient,
|
|
117
117
|
port: number = 0,
|
|
118
118
|
peerId?: PeerId,
|
|
@@ -288,9 +288,10 @@ export function createBootstrapNodeConfig(privateKey: string, port: number, chai
|
|
|
288
288
|
p2pPort: port,
|
|
289
289
|
peerIdPrivateKey: new SecretValue(privateKey),
|
|
290
290
|
dataDirectory: undefined,
|
|
291
|
-
|
|
291
|
+
dataStoreMapSizeKb: 0,
|
|
292
292
|
bootstrapNodes: [],
|
|
293
293
|
listenAddress: '127.0.0.1',
|
|
294
|
+
queryForIp: false,
|
|
294
295
|
};
|
|
295
296
|
}
|
|
296
297
|
|
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
*/
|
|
6
6
|
import { MockL2BlockSource } from '@aztec/archiver/test';
|
|
7
7
|
import type { EpochCacheInterface } from '@aztec/epoch-cache';
|
|
8
|
+
import { EpochNumber, SlotNumber } from '@aztec/foundation/branded-types';
|
|
8
9
|
import { EthAddress } from '@aztec/foundation/eth-address';
|
|
9
10
|
import { createLogger } from '@aztec/foundation/log';
|
|
10
11
|
import { sleep } from '@aztec/foundation/sleep';
|
|
@@ -52,8 +53,11 @@ function mockTxPool(): TxPool {
|
|
|
52
53
|
getTxStatus: () => Promise.resolve(TxStatus.PENDING),
|
|
53
54
|
getTxsByHash: () => Promise.resolve([]),
|
|
54
55
|
hasTxs: () => Promise.resolve([]),
|
|
56
|
+
hasTx: () => Promise.resolve(false),
|
|
55
57
|
updateConfig: () => {},
|
|
56
58
|
markTxsAsNonEvictable: () => Promise.resolve(),
|
|
59
|
+
clearNonEvictableTxs: () => Promise.resolve(),
|
|
60
|
+
cleanupDeletedMinedTxs: () => Promise.resolve(0),
|
|
57
61
|
};
|
|
58
62
|
return Object.assign(new EventEmitter(), pool);
|
|
59
63
|
}
|
|
@@ -70,23 +74,27 @@ function mockAttestationPool(): AttestationPool {
|
|
|
70
74
|
getAttestationsForSlotAndProposal: () => Promise.resolve([]),
|
|
71
75
|
addBlockProposal: () => Promise.resolve(),
|
|
72
76
|
getBlockProposal: () => Promise.resolve(undefined),
|
|
77
|
+
hasBlockProposal: () => Promise.resolve(false),
|
|
78
|
+
hasAttestation: () => Promise.resolve(false),
|
|
79
|
+
canAddProposal: () => Promise.resolve(true),
|
|
80
|
+
canAddAttestation: () => Promise.resolve(true),
|
|
73
81
|
};
|
|
74
82
|
}
|
|
75
83
|
|
|
76
84
|
function mockEpochCache(): EpochCacheInterface {
|
|
77
85
|
return {
|
|
78
|
-
getCommittee: () => Promise.resolve({ committee: [], seed: 1n, epoch:
|
|
86
|
+
getCommittee: () => Promise.resolve({ committee: [], seed: 1n, epoch: EpochNumber.ZERO }),
|
|
79
87
|
getProposerIndexEncoding: () => '0x' as `0x${string}`,
|
|
80
|
-
getEpochAndSlotNow: () => ({ epoch:
|
|
88
|
+
getEpochAndSlotNow: () => ({ epoch: EpochNumber.ZERO, slot: SlotNumber.ZERO, ts: 0n }),
|
|
81
89
|
computeProposerIndex: () => 0n,
|
|
82
90
|
getProposerAttesterAddressInCurrentOrNextSlot: () =>
|
|
83
91
|
Promise.resolve({
|
|
84
92
|
currentProposer: EthAddress.ZERO,
|
|
85
93
|
nextProposer: EthAddress.ZERO,
|
|
86
|
-
currentSlot:
|
|
87
|
-
nextSlot:
|
|
94
|
+
currentSlot: SlotNumber.ZERO,
|
|
95
|
+
nextSlot: SlotNumber.ZERO,
|
|
88
96
|
}),
|
|
89
|
-
getEpochAndSlotInNextL1Slot: () => ({ epoch:
|
|
97
|
+
getEpochAndSlotInNextL1Slot: () => ({ epoch: EpochNumber.ZERO, slot: SlotNumber.ZERO, ts: 0n, now: 0n }),
|
|
90
98
|
isInCommittee: () => Promise.resolve(false),
|
|
91
99
|
getRegisteredValidators: () => Promise.resolve([]),
|
|
92
100
|
filterInCommittee: () => Promise.resolve([]),
|
|
@@ -119,7 +127,7 @@ class TestLibP2PService<T extends P2PClientType = P2PClientType.Full> extends Li
|
|
|
119
127
|
peerDiscoveryService: PeerDiscoveryService,
|
|
120
128
|
reqresp: ReqResp,
|
|
121
129
|
peerManager: PeerManager,
|
|
122
|
-
mempools: MemPools
|
|
130
|
+
mempools: MemPools,
|
|
123
131
|
archiver: L2BlockSource & ContractDataSource,
|
|
124
132
|
epochCache: EpochCacheInterface,
|
|
125
133
|
proofVerifier: ClientProtocolCircuitVerifier,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { createLogger } from '@aztec/foundation/log';
|
|
2
2
|
import { sleep } from '@aztec/foundation/sleep';
|
|
3
|
-
import {
|
|
3
|
+
import { ChonkProof } from '@aztec/stdlib/proofs';
|
|
4
4
|
import { mockTx } from '@aztec/stdlib/testing';
|
|
5
5
|
|
|
6
6
|
import assert from 'assert';
|
|
@@ -35,7 +35,7 @@ async function main() {
|
|
|
35
35
|
|
|
36
36
|
// Send tx from client 0
|
|
37
37
|
const tx = await mockTx(1, {
|
|
38
|
-
|
|
38
|
+
chonkProof: ChonkProof.random(),
|
|
39
39
|
});
|
|
40
40
|
|
|
41
41
|
workerClientManager.processes[0].send({ type: 'SEND_TX', tx: tx.toBuffer() });
|
package/src/util.ts
CHANGED
|
@@ -12,6 +12,7 @@ import { createFromPrivKey } from '@libp2p/peer-id-factory';
|
|
|
12
12
|
import { resolve } from 'dns/promises';
|
|
13
13
|
import { promises as fs } from 'fs';
|
|
14
14
|
import type { Libp2p } from 'libp2p';
|
|
15
|
+
import net from 'net';
|
|
15
16
|
import path from 'path';
|
|
16
17
|
|
|
17
18
|
import type { P2PConfig } from './config.js';
|
|
@@ -56,9 +57,18 @@ export function convertToMultiaddr(address: string, port: number, protocol: 'tcp
|
|
|
56
57
|
* Queries the public IP address of the machine.
|
|
57
58
|
*/
|
|
58
59
|
export async function getPublicIp(): Promise<string> {
|
|
59
|
-
const resp = await fetch('
|
|
60
|
+
const resp = await fetch('https://checkip.amazonaws.com/');
|
|
60
61
|
const text = await resp.text();
|
|
61
|
-
|
|
62
|
+
const address = text.trim();
|
|
63
|
+
if (!isValidIpAddress(address)) {
|
|
64
|
+
throw new Error(`Received invalid IP address from checkip service: ${address}`);
|
|
65
|
+
}
|
|
66
|
+
return address;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
export function isValidIpAddress(address: string): boolean {
|
|
70
|
+
const netType = net.isIP(address);
|
|
71
|
+
return netType === 4;
|
|
62
72
|
}
|
|
63
73
|
|
|
64
74
|
export async function resolveAddressIfNecessary(address: string, port: string): Promise<string> {
|
package/src/versioning.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { toBufferBE } from '@aztec/foundation/bigint-buffer';
|
|
2
2
|
import { getVKTreeRoot } from '@aztec/noir-protocol-circuits-types/vk-tree';
|
|
3
|
-
import {
|
|
3
|
+
import { protocolContractsHash } from '@aztec/protocol-contracts';
|
|
4
4
|
import type { ChainConfig } from '@aztec/stdlib/config';
|
|
5
5
|
import {
|
|
6
6
|
type ComponentsVersions,
|
|
@@ -9,7 +9,7 @@ import {
|
|
|
9
9
|
getComponentsVersionsFromConfig,
|
|
10
10
|
} from '@aztec/stdlib/versioning';
|
|
11
11
|
|
|
12
|
-
import type { SignableENR } from '@
|
|
12
|
+
import type { SignableENR } from '@nethermindeth/enr';
|
|
13
13
|
import xxhashFactory from 'xxhash-wasm';
|
|
14
14
|
|
|
15
15
|
import { AZTEC_ENR_CLIENT_VERSION_KEY, AZTEC_ENR_KEY } from './types/index.js';
|
|
@@ -20,7 +20,7 @@ const xxhash = await xxhashFactory();
|
|
|
20
20
|
|
|
21
21
|
/** Returns the component versions based on config and this build. */
|
|
22
22
|
export function getVersions(config: ChainConfig) {
|
|
23
|
-
return getComponentsVersionsFromConfig(config,
|
|
23
|
+
return getComponentsVersionsFromConfig(config, protocolContractsHash, getVKTreeRoot());
|
|
24
24
|
}
|
|
25
25
|
|
|
26
26
|
/** Sets the aztec key on the ENR record with versioning info. */
|
|
@@ -1,68 +0,0 @@
|
|
|
1
|
-
import type { TypedEventEmitter } from '@aztec/foundation/types';
|
|
2
|
-
import { BlockHeader, Tx, TxHash } from '@aztec/stdlib/tx';
|
|
3
|
-
import { type TelemetryClient } from '@aztec/telemetry-client';
|
|
4
|
-
import type { TxPool, TxPoolEvents, TxPoolOptions } from './tx_pool.js';
|
|
5
|
-
declare const InMemoryTxPool_base: new () => TypedEventEmitter<TxPoolEvents>;
|
|
6
|
-
/**
|
|
7
|
-
* In-memory implementation of the Transaction Pool.
|
|
8
|
-
*/
|
|
9
|
-
export declare class InMemoryTxPool extends InMemoryTxPool_base implements TxPool {
|
|
10
|
-
private log;
|
|
11
|
-
/**
|
|
12
|
-
* Our tx pool, stored as a Map in-memory, with K: tx hash and V: the transaction.
|
|
13
|
-
*/
|
|
14
|
-
private txs;
|
|
15
|
-
private minedTxs;
|
|
16
|
-
private pendingTxs;
|
|
17
|
-
private metrics;
|
|
18
|
-
/**
|
|
19
|
-
* Class constructor for in-memory TxPool. Initiates our transaction pool as a JS Map.
|
|
20
|
-
* @param log - A logger.
|
|
21
|
-
*/
|
|
22
|
-
constructor(telemetry?: TelemetryClient, log?: import("@aztec/foundation/log").Logger);
|
|
23
|
-
private countTx;
|
|
24
|
-
isEmpty(): Promise<boolean>;
|
|
25
|
-
markAsMined(txHashes: TxHash[], blockHeader: BlockHeader): Promise<void>;
|
|
26
|
-
markMinedAsPending(txHashes: TxHash[]): Promise<void>;
|
|
27
|
-
getPendingTxHashes(): Promise<TxHash[]>;
|
|
28
|
-
getMinedTxHashes(): Promise<[TxHash, number][]>;
|
|
29
|
-
getPendingTxCount(): Promise<number>;
|
|
30
|
-
getTxStatus(txHash: TxHash): Promise<'pending' | 'mined' | undefined>;
|
|
31
|
-
/**
|
|
32
|
-
* Checks if a transaction exists in the pool and returns it.
|
|
33
|
-
* @param txHash - The generated tx hash.
|
|
34
|
-
* @returns The transaction, if found, 'undefined' otherwise.
|
|
35
|
-
*/
|
|
36
|
-
getTxByHash(txHash: TxHash): Promise<Tx | undefined>;
|
|
37
|
-
getTxsByHash(txHashes: TxHash[]): Promise<(Tx | undefined)[]>;
|
|
38
|
-
hasTxs(txHashes: TxHash[]): Promise<boolean[]>;
|
|
39
|
-
getArchivedTxByHash(): Promise<Tx | undefined>;
|
|
40
|
-
/**
|
|
41
|
-
* Adds a list of transactions to the pool. Duplicates are ignored.
|
|
42
|
-
* @param txs - An array of txs to be added to the pool.
|
|
43
|
-
* @returns Empty promise.
|
|
44
|
-
*/
|
|
45
|
-
addTxs(txs: Tx[], opts?: {
|
|
46
|
-
source?: string;
|
|
47
|
-
}): Promise<number>;
|
|
48
|
-
/**
|
|
49
|
-
* Deletes transactions from the pool. Tx hashes that are not present are ignored.
|
|
50
|
-
* @param txHashes - An array of tx hashes to be removed from the tx pool.
|
|
51
|
-
* @returns The number of transactions that was deleted from the pool.
|
|
52
|
-
*/
|
|
53
|
-
deleteTxs(txHashes: TxHash[]): Promise<void>;
|
|
54
|
-
/**
|
|
55
|
-
* Gets all the transactions stored in the pool.
|
|
56
|
-
* @returns Array of tx objects in the order they were added to the pool.
|
|
57
|
-
*/
|
|
58
|
-
getAllTxs(): Promise<Tx[]>;
|
|
59
|
-
/**
|
|
60
|
-
* Gets the hashes of all transactions currently in the tx pool.
|
|
61
|
-
* @returns An array of transaction hashes found in the tx pool.
|
|
62
|
-
*/
|
|
63
|
-
getAllTxHashes(): Promise<TxHash[]>;
|
|
64
|
-
updateConfig(_config: TxPoolOptions): void;
|
|
65
|
-
markTxsAsNonEvictable(_: TxHash[]): Promise<void>;
|
|
66
|
-
}
|
|
67
|
-
export {};
|
|
68
|
-
//# sourceMappingURL=memory_tx_pool.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"memory_tx_pool.d.ts","sourceRoot":"","sources":["../../../src/mem_pools/tx_pool/memory_tx_pool.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAEjE,OAAO,EAAE,WAAW,EAAE,EAAE,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAC3D,OAAO,EAAE,KAAK,eAAe,EAAsB,MAAM,yBAAyB,CAAC;AAMnF,OAAO,KAAK,EAAE,MAAM,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;mCAKnB,UAAU,iBAAiB,CAAC,YAAY,CAAC;AAH9F;;GAEG;AACH,qBAAa,cAAe,SAAQ,mBAA4D,YAAW,MAAM;IAgB7G,OAAO,CAAC,GAAG;IAfb;;OAEG;IACH,OAAO,CAAC,GAAG,CAAkB;IAC7B,OAAO,CAAC,QAAQ,CAAsB;IACtC,OAAO,CAAC,UAAU,CAAc;IAEhC,OAAO,CAAC,OAAO,CAA0B;IAEzC;;;OAGG;gBAED,SAAS,GAAE,eAAsC,EACzC,GAAG,yCAA8B;IAS3C,OAAO,CAAC,OAAO,CAOb;IAEK,OAAO,IAAI,OAAO,CAAC,OAAO,CAAC;IAI3B,WAAW,CAAC,QAAQ,EAAE,MAAM,EAAE,EAAE,WAAW,EAAE,WAAW,GAAG,OAAO,CAAC,IAAI,CAAC;IASxE,kBAAkB,CAAC,QAAQ,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC;IAkB/C,kBAAkB,IAAI,OAAO,CAAC,MAAM,EAAE,CAAC;IAQ7C,gBAAgB,IAAI,OAAO,CAAC,CAAC,MAAM,EAAE,MAAM,CAAC,EAAE,CAAC;IAM/C,iBAAiB,IAAI,OAAO,CAAC,MAAM,CAAC;IAIpC,WAAW,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,SAAS,GAAG,OAAO,GAAG,SAAS,CAAC;IAW5E;;;;OAIG;IACI,WAAW,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,EAAE,GAAG,SAAS,CAAC;IAK3D,YAAY,CAAC,QAAQ,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,CAAC,EAAE,GAAG,SAAS,CAAC,EAAE,CAAC;IAG7D,MAAM,CAAC,QAAQ,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,OAAO,EAAE,CAAC;IAIvC,mBAAmB,IAAI,OAAO,CAAC,EAAE,GAAG,SAAS,CAAC;IAIrD;;;;OAIG;IACI,MAAM,CAAC,GAAG,EAAE,EAAE,EAAE,EAAE,IAAI,GAAE;QAAE,MAAM,CAAC,EAAE,MAAM,CAAA;KAAO,GAAG,OAAO,CAAC,MAAM,CAAC;IA0BzE;;;;OAIG;IACI,SAAS,CAAC,QAAQ,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC;IAWnD;;;OAGG;IACI,SAAS,IAAI,OAAO,CAAC,EAAE,EAAE,CAAC;IAIjC;;;OAGG;IACI,cAAc,IAAI,OAAO,CAAC,MAAM,EAAE,CAAC;IAI1C,YAAY,CAAC,OAAO,EAAE,aAAa,GAAG,IAAI;IAE1C,qBAAqB,CAAC,CAAC,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC;CAGlD"}
|