@aztec/p2p 0.0.1-commit.4d3c002 → 0.0.1-commit.4d9804df
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/README.md +7 -6
- package/dest/bootstrap/bootstrap.d.ts +1 -1
- package/dest/bootstrap/bootstrap.d.ts.map +1 -1
- package/dest/bootstrap/bootstrap.js +22 -6
- package/dest/client/factory.d.ts +4 -3
- package/dest/client/factory.d.ts.map +1 -1
- package/dest/client/factory.js +33 -24
- package/dest/client/interface.d.ts +40 -10
- package/dest/client/interface.d.ts.map +1 -1
- package/dest/client/p2p_client.d.ts +32 -18
- package/dest/client/p2p_client.d.ts.map +1 -1
- package/dest/client/p2p_client.js +97 -51
- package/dest/config.d.ts +143 -107
- package/dest/config.d.ts.map +1 -1
- package/dest/config.js +72 -26
- package/dest/errors/reqresp.error.d.ts +9 -16
- package/dest/errors/reqresp.error.d.ts.map +1 -1
- package/dest/errors/reqresp.error.js +10 -17
- package/dest/mem_pools/attestation_pool/attestation_pool.d.ts +98 -56
- package/dest/mem_pools/attestation_pool/attestation_pool.d.ts.map +1 -1
- package/dest/mem_pools/attestation_pool/attestation_pool.js +270 -198
- 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 +218 -59
- package/dest/mem_pools/attestation_pool/mocks.d.ts +1 -1
- package/dest/mem_pools/attestation_pool/mocks.d.ts.map +1 -1
- package/dest/mem_pools/attestation_pool/mocks.js +6 -4
- package/dest/mem_pools/instrumentation.d.ts +9 -4
- package/dest/mem_pools/instrumentation.d.ts.map +1 -1
- package/dest/mem_pools/instrumentation.js +28 -9
- package/dest/mem_pools/tx_pool_v2/archive/tx_archive.d.ts +1 -5
- package/dest/mem_pools/tx_pool_v2/archive/tx_archive.d.ts.map +1 -1
- package/dest/mem_pools/tx_pool_v2/archive/tx_archive.js +1 -7
- package/dest/mem_pools/tx_pool_v2/deleted_pool.d.ts +3 -3
- package/dest/mem_pools/tx_pool_v2/deleted_pool.d.ts.map +1 -1
- package/dest/mem_pools/tx_pool_v2/deleted_pool.js +6 -6
- package/dest/mem_pools/tx_pool_v2/eviction/fee_payer_balance_eviction_rule.js +1 -1
- package/dest/mem_pools/tx_pool_v2/eviction/index.d.ts +2 -1
- 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 -0
- package/dest/mem_pools/tx_pool_v2/eviction/insufficient_fee_per_gas_eviction_rule.d.ts +16 -0
- package/dest/mem_pools/tx_pool_v2/eviction/insufficient_fee_per_gas_eviction_rule.d.ts.map +1 -0
- package/dest/mem_pools/tx_pool_v2/eviction/insufficient_fee_per_gas_eviction_rule.js +62 -0
- package/dest/mem_pools/tx_pool_v2/eviction/invalid_txs_after_reorg_rule.js +2 -2
- package/dest/mem_pools/tx_pool_v2/interfaces.d.ts +33 -5
- package/dest/mem_pools/tx_pool_v2/interfaces.d.ts.map +1 -1
- package/dest/mem_pools/tx_pool_v2/interfaces.js +2 -1
- package/dest/mem_pools/tx_pool_v2/tx_metadata.d.ts +5 -2
- package/dest/mem_pools/tx_pool_v2/tx_metadata.d.ts.map +1 -1
- package/dest/mem_pools/tx_pool_v2/tx_metadata.js +8 -5
- package/dest/mem_pools/tx_pool_v2/tx_pool_indices.d.ts +15 -1
- 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 +31 -0
- package/dest/mem_pools/tx_pool_v2/tx_pool_v2.d.ts +9 -3
- 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 +19 -8
- package/dest/mem_pools/tx_pool_v2/tx_pool_v2_impl.d.ts +17 -4
- 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 +208 -118
- package/dest/msg_validators/attestation_validator/attestation_validator.d.ts +10 -3
- package/dest/msg_validators/attestation_validator/attestation_validator.d.ts.map +1 -1
- package/dest/msg_validators/attestation_validator/attestation_validator.js +38 -16
- package/dest/msg_validators/attestation_validator/fisherman_attestation_validator.d.ts +7 -3
- package/dest/msg_validators/attestation_validator/fisherman_attestation_validator.d.ts.map +1 -1
- package/dest/msg_validators/attestation_validator/fisherman_attestation_validator.js +4 -5
- package/dest/msg_validators/proposal_validator/block_proposal_validator.d.ts +8 -3
- package/dest/msg_validators/proposal_validator/block_proposal_validator.d.ts.map +1 -1
- package/dest/msg_validators/proposal_validator/block_proposal_validator.js +2 -2
- package/dest/msg_validators/proposal_validator/checkpoint_proposal_validator.d.ts +8 -3
- package/dest/msg_validators/proposal_validator/checkpoint_proposal_validator.d.ts.map +1 -1
- package/dest/msg_validators/proposal_validator/checkpoint_proposal_validator.js +8 -2
- package/dest/msg_validators/proposal_validator/proposal_validator.d.ts +25 -3
- package/dest/msg_validators/proposal_validator/proposal_validator.d.ts.map +1 -1
- package/dest/msg_validators/proposal_validator/proposal_validator.js +85 -15
- 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/aggregate_tx_validator.js +8 -15
- package/dest/msg_validators/tx_validator/allowed_public_setup.js +3 -3
- package/dest/msg_validators/tx_validator/archive_cache.js +1 -1
- package/dest/msg_validators/tx_validator/cached_tx_validator.d.ts +15 -0
- package/dest/msg_validators/tx_validator/cached_tx_validator.d.ts.map +1 -0
- package/dest/msg_validators/tx_validator/cached_tx_validator.js +19 -0
- package/dest/msg_validators/tx_validator/data_validator.d.ts +2 -1
- package/dest/msg_validators/tx_validator/data_validator.d.ts.map +1 -1
- package/dest/msg_validators/tx_validator/data_validator.js +1 -0
- package/dest/msg_validators/tx_validator/factory.d.ts +14 -15
- package/dest/msg_validators/tx_validator/factory.d.ts.map +1 -1
- package/dest/msg_validators/tx_validator/factory.js +29 -16
- package/dest/msg_validators/tx_validator/gas_validator.d.ts +47 -10
- package/dest/msg_validators/tx_validator/gas_validator.d.ts.map +1 -1
- package/dest/msg_validators/tx_validator/gas_validator.js +65 -48
- package/dest/msg_validators/tx_validator/index.d.ts +3 -1
- package/dest/msg_validators/tx_validator/index.d.ts.map +1 -1
- package/dest/msg_validators/tx_validator/index.js +2 -0
- package/dest/msg_validators/tx_validator/phases_validator.js +2 -2
- package/dest/msg_validators/tx_validator/tx_proof_validator.d.ts +2 -1
- package/dest/msg_validators/tx_validator/tx_proof_validator.d.ts.map +1 -1
- package/dest/msg_validators/tx_validator/tx_proof_validator.js +2 -0
- package/dest/msg_validators/tx_validator/tx_validation_cache.d.ts +48 -0
- package/dest/msg_validators/tx_validator/tx_validation_cache.d.ts.map +1 -0
- package/dest/msg_validators/tx_validator/tx_validation_cache.js +68 -0
- package/dest/services/data_store.d.ts +1 -1
- package/dest/services/data_store.d.ts.map +1 -1
- package/dest/services/data_store.js +5 -5
- package/dest/services/discv5/discV5_service.d.ts +13 -2
- package/dest/services/discv5/discV5_service.d.ts.map +1 -1
- package/dest/services/discv5/discV5_service.js +117 -24
- package/dest/services/discv5/persisted_enr_store.d.ts +38 -0
- package/dest/services/discv5/persisted_enr_store.d.ts.map +1 -0
- package/dest/services/discv5/persisted_enr_store.js +145 -0
- package/dest/services/dummy_service.d.ts +15 -17
- package/dest/services/dummy_service.d.ts.map +1 -1
- package/dest/services/dummy_service.js +13 -18
- package/dest/services/encoding.d.ts +19 -6
- package/dest/services/encoding.d.ts.map +1 -1
- package/dest/services/encoding.js +25 -15
- package/dest/services/gossipsub/topic_score_params.d.ts +6 -12
- package/dest/services/gossipsub/topic_score_params.d.ts.map +1 -1
- package/dest/services/gossipsub/topic_score_params.js +4 -14
- 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 +14 -0
- package/dest/services/libp2p/libp2p_service.d.ts +31 -38
- package/dest/services/libp2p/libp2p_service.d.ts.map +1 -1
- package/dest/services/libp2p/libp2p_service.js +268 -248
- package/dest/services/peer-manager/peer_manager.d.ts +15 -2
- package/dest/services/peer-manager/peer_manager.d.ts.map +1 -1
- package/dest/services/peer-manager/peer_manager.js +59 -17
- package/dest/services/peer-manager/peer_scoring.d.ts +30 -1
- package/dest/services/peer-manager/peer_scoring.d.ts.map +1 -1
- package/dest/services/peer-manager/peer_scoring.js +74 -3
- package/dest/services/reqresp/batch-tx-requester/batch_tx_requester.d.ts +1 -8
- 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 +35 -44
- package/dest/services/reqresp/batch-tx-requester/interface.d.ts +8 -5
- package/dest/services/reqresp/batch-tx-requester/interface.d.ts.map +1 -1
- package/dest/services/reqresp/batch-tx-requester/tx_validator.d.ts +5 -14
- package/dest/services/reqresp/batch-tx-requester/tx_validator.d.ts.map +1 -1
- package/dest/services/reqresp/batch-tx-requester/tx_validator.js +6 -20
- package/dest/services/reqresp/config.d.ts +15 -3
- package/dest/services/reqresp/config.d.ts.map +1 -1
- package/dest/services/reqresp/config.js +11 -0
- package/dest/services/reqresp/interface.d.ts +16 -18
- package/dest/services/reqresp/interface.d.ts.map +1 -1
- package/dest/services/reqresp/interface.js +10 -20
- package/dest/services/reqresp/metrics.d.ts +1 -1
- package/dest/services/reqresp/metrics.d.ts.map +1 -1
- package/dest/services/reqresp/metrics.js +0 -1
- package/dest/services/reqresp/protocols/block_txs/bitvector.d.ts +4 -3
- package/dest/services/reqresp/protocols/block_txs/bitvector.d.ts.map +1 -1
- package/dest/services/reqresp/protocols/block_txs/bitvector.js +3 -2
- package/dest/services/reqresp/protocols/block_txs/block_txs_handler.d.ts +1 -1
- package/dest/services/reqresp/protocols/block_txs/block_txs_handler.d.ts.map +1 -1
- package/dest/services/reqresp/protocols/block_txs/block_txs_handler.js +31 -28
- package/dest/services/reqresp/protocols/block_txs/block_txs_reqresp.d.ts +12 -7
- 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 +42 -24
- package/dest/services/reqresp/protocols/index.d.ts +1 -2
- package/dest/services/reqresp/protocols/index.d.ts.map +1 -1
- package/dest/services/reqresp/protocols/index.js +0 -1
- package/dest/services/reqresp/protocols/tx.d.ts +1 -1
- package/dest/services/reqresp/protocols/tx.d.ts.map +1 -1
- package/dest/services/reqresp/protocols/tx.js +1 -3
- package/dest/services/reqresp/rate-limiter/rate_limits.d.ts +1 -1
- package/dest/services/reqresp/rate-limiter/rate_limits.d.ts.map +1 -1
- package/dest/services/reqresp/rate-limiter/rate_limits.js +3 -13
- package/dest/services/reqresp/reqresp.d.ts +7 -29
- package/dest/services/reqresp/reqresp.d.ts.map +1 -1
- package/dest/services/reqresp/reqresp.js +59 -209
- package/dest/services/service.d.ts +21 -13
- package/dest/services/service.d.ts.map +1 -1
- package/dest/services/tx_collection/config.d.ts +2 -23
- package/dest/services/tx_collection/config.d.ts.map +1 -1
- package/dest/services/tx_collection/config.js +2 -55
- package/dest/services/tx_collection/file_store_tx_collection.d.ts +12 -28
- package/dest/services/tx_collection/file_store_tx_collection.d.ts.map +1 -1
- package/dest/services/tx_collection/file_store_tx_collection.js +43 -83
- package/dest/services/tx_collection/index.d.ts +2 -3
- package/dest/services/tx_collection/index.d.ts.map +1 -1
- package/dest/services/tx_collection/index.js +0 -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/instrumentation.js +0 -2
- package/dest/services/tx_collection/tx_collection.d.ts +35 -51
- package/dest/services/tx_collection/tx_collection.d.ts.map +1 -1
- package/dest/services/tx_collection/tx_collection.js +275 -119
- package/dest/services/tx_collection/tx_collection_sink.d.ts +1 -1
- package/dest/services/tx_collection/tx_collection_sink.js +2 -2
- 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 +4 -1
- package/dest/services/tx_file_store/tx_file_store.d.ts +1 -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 +4 -14
- package/dest/services/tx_provider.d.ts +3 -1
- package/dest/services/tx_provider.d.ts.map +1 -1
- package/dest/services/tx_provider.js +3 -0
- package/dest/test-helpers/make-test-p2p-clients.d.ts +1 -1
- package/dest/test-helpers/make-test-p2p-clients.d.ts.map +1 -1
- package/dest/test-helpers/make-test-p2p-clients.js +5 -2
- package/dest/test-helpers/mock-pubsub.d.ts +16 -9
- package/dest/test-helpers/mock-pubsub.d.ts.map +1 -1
- package/dest/test-helpers/mock-pubsub.js +36 -43
- package/dest/test-helpers/reqresp-nodes.d.ts +4 -5
- package/dest/test-helpers/reqresp-nodes.d.ts.map +1 -1
- package/dest/test-helpers/reqresp-nodes.js +11 -17
- package/dest/test-helpers/test_tx_provider.d.ts +3 -1
- package/dest/test-helpers/test_tx_provider.d.ts.map +1 -1
- package/dest/test-helpers/test_tx_provider.js +3 -0
- package/dest/test-helpers/testbench-utils.d.ts +15 -14
- package/dest/test-helpers/testbench-utils.d.ts.map +1 -1
- package/dest/test-helpers/testbench-utils.js +28 -13
- package/dest/testbench/p2p_client_testbench_worker.d.ts +3 -5
- package/dest/testbench/p2p_client_testbench_worker.d.ts.map +1 -1
- package/dest/testbench/p2p_client_testbench_worker.js +60 -27
- package/dest/testbench/worker_client_manager.d.ts +10 -6
- package/dest/testbench/worker_client_manager.d.ts.map +1 -1
- package/dest/testbench/worker_client_manager.js +51 -8
- package/dest/util.d.ts +7 -6
- package/dest/util.d.ts.map +1 -1
- package/dest/util.js +39 -10
- package/dest/versioning.d.ts +3 -6
- package/dest/versioning.d.ts.map +1 -1
- package/dest/versioning.js +3 -24
- package/package.json +16 -16
- package/src/bootstrap/bootstrap.ts +17 -3
- package/src/client/factory.ts +49 -25
- package/src/client/interface.ts +35 -16
- package/src/client/p2p_client.ts +116 -85
- package/src/client/test/{tx_proposal_collector/README.md → p2p_client.batch_tx_requester.bench.README.md} +23 -53
- package/src/config.ts +146 -34
- package/src/errors/reqresp.error.ts +13 -19
- package/src/mem_pools/attestation_pool/attestation_pool.ts +325 -242
- package/src/mem_pools/attestation_pool/attestation_pool_test_suite.ts +238 -63
- package/src/mem_pools/attestation_pool/mocks.ts +13 -8
- package/src/mem_pools/instrumentation.ts +18 -12
- package/src/mem_pools/tx_pool_v2/archive/tx_archive.ts +1 -9
- package/src/mem_pools/tx_pool_v2/deleted_pool.ts +7 -7
- package/src/mem_pools/tx_pool_v2/eviction/fee_payer_balance_eviction_rule.ts +1 -1
- package/src/mem_pools/tx_pool_v2/eviction/index.ts +1 -0
- package/src/mem_pools/tx_pool_v2/eviction/insufficient_fee_per_gas_eviction_rule.ts +65 -0
- package/src/mem_pools/tx_pool_v2/eviction/invalid_txs_after_reorg_rule.ts +3 -3
- package/src/mem_pools/tx_pool_v2/interfaces.ts +31 -4
- package/src/mem_pools/tx_pool_v2/tx_metadata.ts +13 -7
- package/src/mem_pools/tx_pool_v2/tx_pool_indices.ts +35 -0
- package/src/mem_pools/tx_pool_v2/tx_pool_v2.ts +22 -8
- package/src/mem_pools/tx_pool_v2/tx_pool_v2_impl.ts +233 -123
- package/src/msg_validators/attestation_validator/attestation_validator.ts +46 -15
- package/src/msg_validators/attestation_validator/fisherman_attestation_validator.ts +15 -7
- package/src/msg_validators/proposal_validator/block_proposal_validator.ts +15 -3
- package/src/msg_validators/proposal_validator/checkpoint_proposal_validator.ts +26 -3
- package/src/msg_validators/proposal_validator/proposal_validator.ts +94 -12
- package/src/msg_validators/tx_validator/README.md +13 -3
- package/src/msg_validators/tx_validator/aggregate_tx_validator.ts +3 -12
- package/src/msg_validators/tx_validator/allowed_public_setup.ts +3 -3
- package/src/msg_validators/tx_validator/archive_cache.ts +1 -1
- package/src/msg_validators/tx_validator/cached_tx_validator.ts +31 -0
- package/src/msg_validators/tx_validator/data_validator.ts +2 -0
- package/src/msg_validators/tx_validator/factory.ts +37 -20
- package/src/msg_validators/tx_validator/gas_validator.ts +99 -54
- package/src/msg_validators/tx_validator/index.ts +2 -0
- package/src/msg_validators/tx_validator/phases_validator.ts +2 -2
- package/src/msg_validators/tx_validator/tx_proof_validator.ts +2 -0
- package/src/msg_validators/tx_validator/tx_validation_cache.ts +101 -0
- package/src/services/data_store.ts +5 -13
- package/src/services/discv5/discV5_service.ts +124 -15
- package/src/services/discv5/persisted_enr_store.ts +158 -0
- package/src/services/dummy_service.ts +19 -43
- package/src/services/encoding.ts +28 -20
- package/src/services/gossipsub/README.md +33 -11
- package/src/services/gossipsub/topic_score_params.ts +9 -18
- package/src/services/libp2p/instrumentation.ts +14 -0
- package/src/services/libp2p/libp2p_service.ts +311 -271
- package/src/services/peer-manager/peer_manager.ts +63 -16
- package/src/services/peer-manager/peer_scoring.ts +81 -3
- package/src/services/reqresp/README.md +2 -37
- package/src/services/reqresp/batch-tx-requester/batch_tx_requester.ts +39 -52
- package/src/services/reqresp/batch-tx-requester/interface.ts +11 -4
- package/src/services/reqresp/batch-tx-requester/tx_validator.ts +12 -25
- package/src/services/reqresp/config.ts +19 -2
- package/src/services/reqresp/interface.ts +21 -47
- package/src/services/reqresp/metrics.ts +0 -1
- package/src/services/reqresp/protocols/block_txs/bitvector.ts +3 -2
- package/src/services/reqresp/protocols/block_txs/block_txs_handler.ts +34 -30
- package/src/services/reqresp/protocols/block_txs/block_txs_reqresp.ts +47 -20
- package/src/services/reqresp/protocols/index.ts +0 -1
- package/src/services/reqresp/protocols/tx.ts +1 -3
- package/src/services/reqresp/rate-limiter/rate_limits.ts +3 -13
- package/src/services/reqresp/reqresp.ts +69 -252
- package/src/services/service.ts +25 -30
- package/src/services/tx_collection/config.ts +3 -80
- package/src/services/tx_collection/file_store_tx_collection.ts +54 -103
- package/src/services/tx_collection/index.ts +1 -6
- package/src/services/tx_collection/instrumentation.ts +1 -7
- package/src/services/tx_collection/tx_collection.ts +330 -173
- package/src/services/tx_collection/tx_collection_sink.ts +2 -2
- package/src/services/tx_collection/tx_source.ts +2 -1
- package/src/services/tx_file_store/tx_file_store.ts +5 -17
- package/src/services/tx_provider.ts +5 -0
- package/src/test-helpers/make-test-p2p-clients.ts +3 -0
- package/src/test-helpers/mock-pubsub.ts +39 -60
- package/src/test-helpers/reqresp-nodes.ts +8 -22
- package/src/test-helpers/test_tx_provider.ts +5 -0
- package/src/test-helpers/testbench-utils.ts +35 -26
- package/src/testbench/p2p_client_testbench_worker.ts +68 -44
- package/src/testbench/worker_client_manager.ts +59 -19
- package/src/util.ts +34 -12
- package/src/versioning.ts +3 -33
- package/dest/client/test/tx_proposal_collector/proposal_tx_collector_worker.d.ts +0 -2
- package/dest/client/test/tx_proposal_collector/proposal_tx_collector_worker.d.ts.map +0 -1
- package/dest/client/test/tx_proposal_collector/proposal_tx_collector_worker.js +0 -315
- package/dest/client/test/tx_proposal_collector/proposal_tx_collector_worker_protocol.d.ts +0 -73
- package/dest/client/test/tx_proposal_collector/proposal_tx_collector_worker_protocol.d.ts.map +0 -1
- package/dest/client/test/tx_proposal_collector/proposal_tx_collector_worker_protocol.js +0 -8
- package/dest/msg_validators/clock_tolerance.d.ts +0 -21
- package/dest/msg_validators/clock_tolerance.d.ts.map +0 -1
- package/dest/msg_validators/clock_tolerance.js +0 -38
- package/dest/services/reqresp/connection-sampler/batch_connection_sampler.d.ts +0 -64
- package/dest/services/reqresp/connection-sampler/batch_connection_sampler.d.ts.map +0 -1
- package/dest/services/reqresp/connection-sampler/batch_connection_sampler.js +0 -151
- package/dest/services/reqresp/protocols/block.d.ts +0 -9
- package/dest/services/reqresp/protocols/block.d.ts.map +0 -1
- package/dest/services/reqresp/protocols/block.js +0 -32
- package/dest/services/tx_collection/fast_tx_collection.d.ts +0 -51
- package/dest/services/tx_collection/fast_tx_collection.d.ts.map +0 -1
- package/dest/services/tx_collection/fast_tx_collection.js +0 -311
- package/dest/services/tx_collection/proposal_tx_collector.d.ts +0 -48
- package/dest/services/tx_collection/proposal_tx_collector.d.ts.map +0 -1
- package/dest/services/tx_collection/proposal_tx_collector.js +0 -50
- package/dest/services/tx_collection/slow_tx_collection.d.ts +0 -57
- package/dest/services/tx_collection/slow_tx_collection.d.ts.map +0 -1
- package/dest/services/tx_collection/slow_tx_collection.js +0 -211
- package/src/client/test/tx_proposal_collector/proposal_tx_collector_worker.ts +0 -355
- package/src/client/test/tx_proposal_collector/proposal_tx_collector_worker_protocol.ts +0 -43
- package/src/msg_validators/clock_tolerance.ts +0 -52
- package/src/services/reqresp/connection-sampler/batch_connection_sampler.ts +0 -161
- package/src/services/reqresp/protocols/block.ts +0 -37
- package/src/services/tx_collection/fast_tx_collection.ts +0 -361
- package/src/services/tx_collection/proposal_tx_collector.ts +0 -108
- package/src/services/tx_collection/slow_tx_collection.ts +0 -266
package/dest/versioning.d.ts
CHANGED
|
@@ -1,12 +1,9 @@
|
|
|
1
1
|
import type { ChainConfig } from '@aztec/stdlib/config';
|
|
2
|
-
import { type ComponentsVersions } from '@aztec/stdlib/versioning';
|
|
3
2
|
import type { SignableENR } from '@nethermindeth/enr';
|
|
4
3
|
/** Returns the component versions based on config and this build. */
|
|
5
|
-
export declare function getVersions(config: ChainConfig): ComponentsVersions;
|
|
4
|
+
export declare function getVersions(config: ChainConfig): import("@aztec/stdlib/versioning").ComponentsVersions;
|
|
6
5
|
/** Sets the aztec key on the ENR record with versioning info. */
|
|
7
|
-
export declare function setAztecEnrKey(enr: SignableENR, config: ChainConfig
|
|
6
|
+
export declare function setAztecEnrKey(enr: SignableENR, config: ChainConfig): import("@aztec/stdlib/versioning").ComponentsVersions;
|
|
8
7
|
/** Sets the Aztec client version on ENR record **/
|
|
9
8
|
export declare function setAztecClientVersionEnrKey(enr: SignableENR, clientVersion: string): void;
|
|
10
|
-
|
|
11
|
-
export declare function checkAztecEnrVersion(enrValue: Buffer, expectedVersions: ComponentsVersions): void;
|
|
12
|
-
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidmVyc2lvbmluZy5kLnRzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vc3JjL3ZlcnNpb25pbmcudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBR0EsT0FBTyxLQUFLLEVBQUUsV0FBVyxFQUFFLE1BQU0sc0JBQXNCLENBQUM7QUFDeEQsT0FBTyxFQUNMLEtBQUssa0JBQWtCLEVBSXhCLE1BQU0sMEJBQTBCLENBQUM7QUFFbEMsT0FBTyxLQUFLLEVBQUUsV0FBVyxFQUFFLE1BQU0sb0JBQW9CLENBQUM7QUFTdEQscUVBQXFFO0FBQ3JFLHdCQUFnQixXQUFXLENBQUMsTUFBTSxFQUFFLFdBQVcsc0JBRTlDO0FBRUQsaUVBQWlFO0FBQ2pFLHdCQUFnQixjQUFjLENBQUMsR0FBRyxFQUFFLFdBQVcsRUFBRSxNQUFNLEVBQUUsV0FBVyxFQUFFLFNBQVMsVUFBYyxzQkFLNUY7QUFFRCxtREFBbUQ7QUFDbkQsd0JBQWdCLDJCQUEyQixDQUFDLEdBQUcsRUFBRSxXQUFXLEVBQUUsYUFBYSxFQUFFLE1BQU0sUUFJbEY7QUFFRCwrRUFBK0U7QUFDL0Usd0JBQWdCLG9CQUFvQixDQUFDLFFBQVEsRUFBRSxNQUFNLEVBQUUsZ0JBQWdCLEVBQUUsa0JBQWtCLFFBVTFGIn0=
|
|
9
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidmVyc2lvbmluZy5kLnRzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vc3JjL3ZlcnNpb25pbmcudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBRUEsT0FBTyxLQUFLLEVBQUUsV0FBVyxFQUFFLE1BQU0sc0JBQXNCLENBQUM7QUFHeEQsT0FBTyxLQUFLLEVBQUUsV0FBVyxFQUFFLE1BQU0sb0JBQW9CLENBQUM7QUFJdEQscUVBQXFFO0FBQ3JFLHdCQUFnQixXQUFXLENBQUMsTUFBTSxFQUFFLFdBQVcseURBRTlDO0FBRUQsaUVBQWlFO0FBQ2pFLHdCQUFnQixjQUFjLENBQUMsR0FBRyxFQUFFLFdBQVcsRUFBRSxNQUFNLEVBQUUsV0FBVyx5REFJbkU7QUFFRCxtREFBbUQ7QUFDbkQsd0JBQWdCLDJCQUEyQixDQUFDLEdBQUcsRUFBRSxXQUFXLEVBQUUsYUFBYSxFQUFFLE1BQU0sUUFJbEYifQ==
|
package/dest/versioning.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"versioning.d.ts","sourceRoot":"","sources":["../src/versioning.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"versioning.d.ts","sourceRoot":"","sources":["../src/versioning.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAGxD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAItD,qEAAqE;AACrE,wBAAgB,WAAW,CAAC,MAAM,EAAE,WAAW,yDAE9C;AAED,iEAAiE;AACjE,wBAAgB,cAAc,CAAC,GAAG,EAAE,WAAW,EAAE,MAAM,EAAE,WAAW,yDAInE;AAED,mDAAmD;AACnD,wBAAgB,2BAA2B,CAAC,GAAG,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,QAIlF"}
|
package/dest/versioning.js
CHANGED
|
@@ -1,19 +1,13 @@
|
|
|
1
|
-
import { toBufferBE } from '@aztec/foundation/bigint-buffer';
|
|
2
1
|
import { getVKTreeRoot } from '@aztec/noir-protocol-circuits-types/vk-tree';
|
|
3
2
|
import { protocolContractsHash } from '@aztec/protocol-contracts';
|
|
4
|
-
import {
|
|
5
|
-
import xxhashFactory from 'xxhash-wasm';
|
|
3
|
+
import { compressComponentVersions, getComponentsVersionsFromConfig } from '@aztec/stdlib/versioning';
|
|
6
4
|
import { AZTEC_ENR_CLIENT_VERSION_KEY, AZTEC_ENR_KEY } from './types/index.js';
|
|
7
|
-
const USE_XX_HASH = false; // Enable to reduce the size of the ENR record for production
|
|
8
|
-
const XX_HASH_LEN = 8;
|
|
9
|
-
const xxhash = await xxhashFactory();
|
|
10
5
|
/** Returns the component versions based on config and this build. */ export function getVersions(config) {
|
|
11
6
|
return getComponentsVersionsFromConfig(config, protocolContractsHash, getVKTreeRoot());
|
|
12
7
|
}
|
|
13
|
-
/** Sets the aztec key on the ENR record with versioning info. */ export function setAztecEnrKey(enr, config
|
|
8
|
+
/** Sets the aztec key on the ENR record with versioning info. */ export function setAztecEnrKey(enr, config) {
|
|
14
9
|
const versions = getVersions(config);
|
|
15
|
-
|
|
16
|
-
enr.set(AZTEC_ENR_KEY, value);
|
|
10
|
+
enr.set(AZTEC_ENR_KEY, Buffer.from(compressComponentVersions(versions)));
|
|
17
11
|
return versions;
|
|
18
12
|
}
|
|
19
13
|
/** Sets the Aztec client version on ENR record **/ export function setAztecClientVersionEnrKey(enr, clientVersion) {
|
|
@@ -21,18 +15,3 @@ const xxhash = await xxhashFactory();
|
|
|
21
15
|
enr.set(AZTEC_ENR_CLIENT_VERSION_KEY, Buffer.from(clientVersion));
|
|
22
16
|
}
|
|
23
17
|
}
|
|
24
|
-
/** Checks the given value from an ENR record against the expected versions. */ export function checkAztecEnrVersion(enrValue, expectedVersions) {
|
|
25
|
-
if (enrValue.length === XX_HASH_LEN) {
|
|
26
|
-
const expected = versionsToEnrValue(expectedVersions, true);
|
|
27
|
-
if (!Buffer.from(enrValue).equals(expected)) {
|
|
28
|
-
throw new Error(`Expected ENR version ${expected.toString('hex')} but received ${enrValue.toString('hex')}`);
|
|
29
|
-
}
|
|
30
|
-
} else {
|
|
31
|
-
const actual = Buffer.from(enrValue).toString();
|
|
32
|
-
checkCompressedComponentVersion(actual, expectedVersions);
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
function versionsToEnrValue(versions, useXxHash) {
|
|
36
|
-
const compressed = compressComponentVersions(versions);
|
|
37
|
-
return useXxHash ? toBufferBE(xxhash.h64(compressed), XX_HASH_LEN) : Buffer.from(compressed);
|
|
38
|
-
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aztec/p2p",
|
|
3
|
-
"version": "0.0.1-commit.
|
|
3
|
+
"version": "0.0.1-commit.4d9804df",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"exports": {
|
|
6
6
|
".": "./dest/index.js",
|
|
@@ -67,17 +67,18 @@
|
|
|
67
67
|
]
|
|
68
68
|
},
|
|
69
69
|
"dependencies": {
|
|
70
|
-
"@aztec/constants": "0.0.1-commit.
|
|
71
|
-
"@aztec/epoch-cache": "0.0.1-commit.
|
|
72
|
-
"@aztec/ethereum": "0.0.1-commit.
|
|
73
|
-
"@aztec/foundation": "0.0.1-commit.
|
|
74
|
-
"@aztec/kv-store": "0.0.1-commit.
|
|
75
|
-
"@aztec/noir-contracts.js": "0.0.1-commit.
|
|
76
|
-
"@aztec/noir-protocol-circuits-types": "0.0.1-commit.
|
|
77
|
-
"@aztec/protocol-contracts": "0.0.1-commit.
|
|
78
|
-
"@aztec/simulator": "0.0.1-commit.
|
|
79
|
-
"@aztec/
|
|
80
|
-
"@aztec/
|
|
70
|
+
"@aztec/constants": "0.0.1-commit.4d9804df",
|
|
71
|
+
"@aztec/epoch-cache": "0.0.1-commit.4d9804df",
|
|
72
|
+
"@aztec/ethereum": "0.0.1-commit.4d9804df",
|
|
73
|
+
"@aztec/foundation": "0.0.1-commit.4d9804df",
|
|
74
|
+
"@aztec/kv-store": "0.0.1-commit.4d9804df",
|
|
75
|
+
"@aztec/noir-contracts.js": "0.0.1-commit.4d9804df",
|
|
76
|
+
"@aztec/noir-protocol-circuits-types": "0.0.1-commit.4d9804df",
|
|
77
|
+
"@aztec/protocol-contracts": "0.0.1-commit.4d9804df",
|
|
78
|
+
"@aztec/simulator": "0.0.1-commit.4d9804df",
|
|
79
|
+
"@aztec/standard-contracts": "0.0.1-commit.4d9804df",
|
|
80
|
+
"@aztec/stdlib": "0.0.1-commit.4d9804df",
|
|
81
|
+
"@aztec/telemetry-client": "0.0.1-commit.4d9804df",
|
|
81
82
|
"@chainsafe/libp2p-gossipsub": "13.0.0",
|
|
82
83
|
"@chainsafe/libp2p-noise": "^15.0.0",
|
|
83
84
|
"@chainsafe/libp2p-yamux": "^6.0.2",
|
|
@@ -100,12 +101,11 @@
|
|
|
100
101
|
"semver": "^7.6.0",
|
|
101
102
|
"sha3": "^2.1.4",
|
|
102
103
|
"snappy": "^7.2.2",
|
|
103
|
-
"tslib": "^2.4.0"
|
|
104
|
-
"xxhash-wasm": "^1.1.0"
|
|
104
|
+
"tslib": "^2.4.0"
|
|
105
105
|
},
|
|
106
106
|
"devDependencies": {
|
|
107
|
-
"@aztec/archiver": "0.0.1-commit.
|
|
108
|
-
"@aztec/world-state": "0.0.1-commit.
|
|
107
|
+
"@aztec/archiver": "0.0.1-commit.4d9804df",
|
|
108
|
+
"@aztec/world-state": "0.0.1-commit.4d9804df",
|
|
109
109
|
"@jest/globals": "^30.0.0",
|
|
110
110
|
"@types/jest": "^30.0.0",
|
|
111
111
|
"@types/node": "^22.15.17",
|
|
@@ -40,7 +40,7 @@ export class BootstrapNode implements P2PBootstrapApi {
|
|
|
40
40
|
if (!p2pIp) {
|
|
41
41
|
if (queryForIp) {
|
|
42
42
|
this.logger.info('Querying for public IP address...');
|
|
43
|
-
const publicIp = await getPublicIp();
|
|
43
|
+
const publicIp = await getPublicIp(config.publicIpServices);
|
|
44
44
|
p2pIp = publicIp;
|
|
45
45
|
this.logger.info(`Found public IP address: ${publicIp}`);
|
|
46
46
|
}
|
|
@@ -84,8 +84,22 @@ export class BootstrapNode implements P2PBootstrapApi {
|
|
|
84
84
|
this.logger.info('Advertised socket address updated', { addr: addr.toString() });
|
|
85
85
|
});
|
|
86
86
|
this.node.on('discovered', async (enr: SignableENR) => {
|
|
87
|
-
|
|
88
|
-
|
|
87
|
+
try {
|
|
88
|
+
const addr = await enr.getFullMultiaddr('udp');
|
|
89
|
+
this.logger.verbose(`Discovered new peer`, { enr: enr.encodeTxt(), addr: addr?.toString() });
|
|
90
|
+
// discv5's discovered() only updates routing table entries that already exist. Nodes that
|
|
91
|
+
// established a session with an empty-IP ENR are never inserted, so even after their ENR
|
|
92
|
+
// gains a valid socket address the routing table stays empty and FINDNODE always returns 0
|
|
93
|
+
// peers. Calling addEnr() here does an insertOrUpdate regardless of prior state, fixing
|
|
94
|
+
// the routing table so these nodes become discoverable to other peers.
|
|
95
|
+
if (addr) {
|
|
96
|
+
this.node.addEnr(enr);
|
|
97
|
+
}
|
|
98
|
+
} catch (err) {
|
|
99
|
+
// A malformed ENR address field makes the parser throw. As an async listener this would crash
|
|
100
|
+
// the bootnode on an unhandled rejection — catch, log, and drop the ENR instead.
|
|
101
|
+
this.logger.warn(`Dropping discovered ENR with unparseable address`, { err });
|
|
102
|
+
}
|
|
89
103
|
});
|
|
90
104
|
|
|
91
105
|
try {
|
package/src/client/factory.ts
CHANGED
|
@@ -4,9 +4,10 @@ import { type Logger, createLogger } from '@aztec/foundation/log';
|
|
|
4
4
|
import { DateProvider } from '@aztec/foundation/timer';
|
|
5
5
|
import type { AztecAsyncKVStore } from '@aztec/kv-store';
|
|
6
6
|
import { AztecLMDBStoreV2, createStore } from '@aztec/kv-store/lmdb-v2';
|
|
7
|
-
import type { L2BlockSource } from '@aztec/stdlib/block';
|
|
7
|
+
import type { BlockHash, L2BlockSource } from '@aztec/stdlib/block';
|
|
8
8
|
import type { ChainConfig } from '@aztec/stdlib/config';
|
|
9
9
|
import type { ContractDataSource } from '@aztec/stdlib/contract';
|
|
10
|
+
import { type BlockMinFeesProvider, getNetworkTxGasLimits } from '@aztec/stdlib/gas';
|
|
10
11
|
import type { AztecNode, ClientProtocolCircuitVerifier, WorldStateSynchronizer } from '@aztec/stdlib/interfaces/server';
|
|
11
12
|
import type { DataStoreConfig } from '@aztec/stdlib/kv-store';
|
|
12
13
|
import { type TelemetryClient, getTelemetryClient } from '@aztec/telemetry-client';
|
|
@@ -19,10 +20,11 @@ import type { TxPoolV2 } from '../mem_pools/tx_pool_v2/interfaces.js';
|
|
|
19
20
|
import { AztecKVTxPoolV2 } from '../mem_pools/tx_pool_v2/tx_pool_v2.js';
|
|
20
21
|
import {
|
|
21
22
|
createCheckAllowedSetupCalls,
|
|
22
|
-
|
|
23
|
+
createTxValidatorForOnDemandReceivedTxs,
|
|
23
24
|
createTxValidatorForTransactionsEnteringPendingTxPool,
|
|
24
25
|
getDefaultAllowedSetupFunctions,
|
|
25
26
|
} from '../msg_validators/index.js';
|
|
27
|
+
import { TxValidationCache } from '../msg_validators/tx_validator/tx_validation_cache.js';
|
|
26
28
|
import { DummyP2PService } from '../services/dummy_service.js';
|
|
27
29
|
import { LibP2PService } from '../services/index.js';
|
|
28
30
|
import { createFileStoreTxSources } from '../services/tx_collection/file_store_tx_source.js';
|
|
@@ -52,12 +54,14 @@ export async function createP2PClient(
|
|
|
52
54
|
proofVerifier: ClientProtocolCircuitVerifier,
|
|
53
55
|
worldStateSynchronizer: WorldStateSynchronizer,
|
|
54
56
|
epochCache: EpochCacheInterface,
|
|
57
|
+
blockMinFeesProvider: BlockMinFeesProvider,
|
|
55
58
|
packageVersion: string,
|
|
56
59
|
dateProvider: DateProvider = new DateProvider(),
|
|
57
60
|
telemetry: TelemetryClient = getTelemetryClient(),
|
|
58
61
|
deps: P2PClientDeps = {},
|
|
62
|
+
initialBlockHash: BlockHash,
|
|
59
63
|
) {
|
|
60
|
-
const config = configureP2PClientAddresses({
|
|
64
|
+
const config = await configureP2PClientAddresses({
|
|
61
65
|
...inputConfig,
|
|
62
66
|
dataStoreMapSizeKb: inputConfig.p2pStoreMapSizeKb ?? inputConfig.dataStoreMapSizeKb,
|
|
63
67
|
});
|
|
@@ -71,13 +75,16 @@ export async function createP2PClient(
|
|
|
71
75
|
}
|
|
72
76
|
|
|
73
77
|
const bindings = logger.getBindings();
|
|
74
|
-
|
|
78
|
+
// Schema version 4: L2 tips store resolves checkpoint tips from per-tip ids in l2_tip_checkpoints; the
|
|
79
|
+
// block->checkpoint mapping and checkpoint maps were dropped. Bumped to wipe stores whose tips predate
|
|
80
|
+
// per-tip ids, which would otherwise make getL2Tips throw on every read.
|
|
81
|
+
const store = deps.store ?? (await createStore(P2P_STORE_NAME, 4, config, bindings));
|
|
75
82
|
const archive = await createStore(P2P_ARCHIVE_STORE_NAME, 1, config, bindings);
|
|
76
83
|
const peerStore = await createStore(P2P_PEER_STORE_NAME, 1, config, bindings);
|
|
77
|
-
const attestationStore = await createStore(P2P_ATTESTATION_STORE_NAME,
|
|
84
|
+
const attestationStore = await createStore(P2P_ATTESTATION_STORE_NAME, 2, config, bindings);
|
|
78
85
|
const l1Constants = await archiver.getL1Constants();
|
|
79
86
|
|
|
80
|
-
const rollupAddress = inputConfig.
|
|
87
|
+
const rollupAddress = inputConfig.rollupAddress.toString().toLowerCase().replace(/^0x/, '');
|
|
81
88
|
const txFileStoreBasePath = `aztec-${inputConfig.l1ChainId}-${inputConfig.rollupVersion}-0x${rollupAddress}`;
|
|
82
89
|
|
|
83
90
|
const allowedInSetup = [
|
|
@@ -90,23 +97,6 @@ export async function createP2PClient(
|
|
|
90
97
|
() => epochCache.getEpochAndSlotInNextL1Slot().ts,
|
|
91
98
|
);
|
|
92
99
|
|
|
93
|
-
const createTxValidator = async () => {
|
|
94
|
-
// We accept transactions if they are not expired by the next slot and block number (checked based on the ExpirationTimestamp field)
|
|
95
|
-
const currentBlockNumber = await archiver.getBlockNumber();
|
|
96
|
-
const { ts: nextSlotTimestamp } = epochCache.getEpochAndSlotInNextL1Slot();
|
|
97
|
-
const l1Constants = await archiver.getL1Constants();
|
|
98
|
-
return createTxValidatorForTransactionsEnteringPendingTxPool(
|
|
99
|
-
worldStateSynchronizer,
|
|
100
|
-
nextSlotTimestamp,
|
|
101
|
-
BlockNumber(currentBlockNumber + 1),
|
|
102
|
-
{
|
|
103
|
-
rollupManaLimit: l1Constants.rollupManaLimit,
|
|
104
|
-
maxBlockL2Gas: config.validateMaxL2BlockGas,
|
|
105
|
-
maxBlockDAGas: config.validateMaxDABlockGas,
|
|
106
|
-
},
|
|
107
|
-
);
|
|
108
|
-
};
|
|
109
|
-
|
|
110
100
|
const txPool =
|
|
111
101
|
deps.txPool ??
|
|
112
102
|
new AztecKVTxPoolV2(
|
|
@@ -116,7 +106,24 @@ export async function createP2PClient(
|
|
|
116
106
|
l2BlockSource: archiver,
|
|
117
107
|
worldStateSynchronizer,
|
|
118
108
|
checkAllowedSetupCalls,
|
|
119
|
-
createTxValidator
|
|
109
|
+
createTxValidator: async () => {
|
|
110
|
+
const currentBlockNumber = await archiver.getBlockNumber();
|
|
111
|
+
const { ts: nextSlotTimestamp } = epochCache.getEpochAndSlotInNextL1Slot();
|
|
112
|
+
const l1Constants = await archiver.getL1Constants();
|
|
113
|
+
const gasFees = await blockMinFeesProvider.getCurrentMinFees();
|
|
114
|
+
const networkTxGasLimits = getNetworkTxGasLimits(config, l1Constants);
|
|
115
|
+
return createTxValidatorForTransactionsEnteringPendingTxPool(
|
|
116
|
+
worldStateSynchronizer,
|
|
117
|
+
nextSlotTimestamp,
|
|
118
|
+
BlockNumber(currentBlockNumber + 1),
|
|
119
|
+
{
|
|
120
|
+
maxTxL2Gas: networkTxGasLimits.l2Gas,
|
|
121
|
+
maxTxDAGas: networkTxGasLimits.daGas,
|
|
122
|
+
},
|
|
123
|
+
gasFees,
|
|
124
|
+
);
|
|
125
|
+
},
|
|
126
|
+
blockMinFeesProvider,
|
|
120
127
|
},
|
|
121
128
|
telemetry,
|
|
122
129
|
{
|
|
@@ -125,6 +132,7 @@ export async function createP2PClient(
|
|
|
125
132
|
minTxPoolAgeMs: config.minTxPoolAgeMs,
|
|
126
133
|
dropTransactionsProbability: config.dropTransactionsProbability,
|
|
127
134
|
priceBumpPercentage: config.priceBumpPercentage,
|
|
135
|
+
keepFinalizedTxsForSlots: config.keepFinalizedTxsForSlots,
|
|
128
136
|
},
|
|
129
137
|
dateProvider,
|
|
130
138
|
);
|
|
@@ -134,12 +142,16 @@ export async function createP2PClient(
|
|
|
134
142
|
attestationPool: deps.attestationPool ?? new AttestationPool(attestationStore, telemetry),
|
|
135
143
|
};
|
|
136
144
|
|
|
145
|
+
const txValidationCache =
|
|
146
|
+
config.txValidationCacheSize > 0 ? new TxValidationCache(config.txValidationCacheSize) : undefined;
|
|
147
|
+
|
|
137
148
|
const p2pService = await createP2PService(
|
|
138
149
|
config,
|
|
139
150
|
archiver,
|
|
140
151
|
proofVerifier,
|
|
141
152
|
worldStateSynchronizer,
|
|
142
153
|
epochCache,
|
|
154
|
+
blockMinFeesProvider,
|
|
143
155
|
store,
|
|
144
156
|
peerStore,
|
|
145
157
|
mempools,
|
|
@@ -147,9 +159,15 @@ export async function createP2PClient(
|
|
|
147
159
|
packageVersion,
|
|
148
160
|
logger.createChild('libp2p_service'),
|
|
149
161
|
telemetry,
|
|
162
|
+
txValidationCache,
|
|
150
163
|
);
|
|
151
164
|
|
|
152
|
-
const txValidatorForTxCollection =
|
|
165
|
+
const txValidatorForTxCollection = createTxValidatorForOnDemandReceivedTxs(
|
|
166
|
+
proofVerifier,
|
|
167
|
+
config,
|
|
168
|
+
/*bindings=*/ undefined,
|
|
169
|
+
txValidationCache,
|
|
170
|
+
);
|
|
153
171
|
const nodeSources = [
|
|
154
172
|
...createNodeRpcTxSources(config.txCollectionNodeRpcUrls, txValidatorForTxCollection, config),
|
|
155
173
|
...(deps.rpcTxProviders ?? []).map(
|
|
@@ -207,6 +225,8 @@ export async function createP2PClient(
|
|
|
207
225
|
config,
|
|
208
226
|
dateProvider,
|
|
209
227
|
telemetry,
|
|
228
|
+
undefined,
|
|
229
|
+
initialBlockHash,
|
|
210
230
|
);
|
|
211
231
|
}
|
|
212
232
|
|
|
@@ -216,6 +236,7 @@ async function createP2PService(
|
|
|
216
236
|
proofVerifier: ClientProtocolCircuitVerifier,
|
|
217
237
|
worldStateSynchronizer: WorldStateSynchronizer,
|
|
218
238
|
epochCache: EpochCacheInterface,
|
|
239
|
+
blockMinFeesProvider: BlockMinFeesProvider,
|
|
219
240
|
store: AztecAsyncKVStore,
|
|
220
241
|
peerStore: AztecLMDBStoreV2,
|
|
221
242
|
mempools: MemPools,
|
|
@@ -223,6 +244,7 @@ async function createP2PService(
|
|
|
223
244
|
packageVersion: string,
|
|
224
245
|
logger: Logger,
|
|
225
246
|
telemetry: TelemetryClient,
|
|
247
|
+
txValidationCache?: TxValidationCache,
|
|
226
248
|
) {
|
|
227
249
|
if (!config.p2pEnabled) {
|
|
228
250
|
logger.verbose('P2P is disabled. Using dummy P2P service.');
|
|
@@ -243,8 +265,10 @@ async function createP2PService(
|
|
|
243
265
|
proofVerifier,
|
|
244
266
|
worldStateSynchronizer,
|
|
245
267
|
peerStore,
|
|
268
|
+
blockMinFeesProvider,
|
|
246
269
|
telemetry,
|
|
247
270
|
logger: logger.createChild(`libp2p_service`),
|
|
271
|
+
txValidationCache,
|
|
248
272
|
});
|
|
249
273
|
|
|
250
274
|
return p2pService;
|
package/src/client/interface.ts
CHANGED
|
@@ -9,15 +9,13 @@ import type { ENR } from '@nethermindeth/enr';
|
|
|
9
9
|
|
|
10
10
|
import type { P2PConfig } from '../config.js';
|
|
11
11
|
import type { AuthRequest, StatusMessage } from '../services/index.js';
|
|
12
|
-
import type {
|
|
13
|
-
ReqRespSubProtocol,
|
|
14
|
-
ReqRespSubProtocolHandler,
|
|
15
|
-
ReqRespSubProtocolValidators,
|
|
16
|
-
} from '../services/reqresp/interface.js';
|
|
12
|
+
import type { ReqRespSubProtocol, ReqRespSubProtocolHandler } from '../services/reqresp/interface.js';
|
|
17
13
|
import type {
|
|
18
14
|
DuplicateAttestationInfo,
|
|
19
15
|
DuplicateProposalInfo,
|
|
16
|
+
OversizedProposalInfo,
|
|
20
17
|
P2PBlockReceivedCallback,
|
|
18
|
+
P2PCheckpointAttestationCallback,
|
|
21
19
|
P2PCheckpointReceivedCallback,
|
|
22
20
|
} from '../services/service.js';
|
|
23
21
|
|
|
@@ -100,6 +98,14 @@ export type P2P = P2PClient & {
|
|
|
100
98
|
*/
|
|
101
99
|
registerDuplicateProposalCallback(callback: (info: DuplicateProposalInfo) => void): void;
|
|
102
100
|
|
|
101
|
+
/**
|
|
102
|
+
* Registers a callback invoked when an oversized block proposal (index at or beyond the consensus
|
|
103
|
+
* per-checkpoint block limit) is stored and re-broadcast as slashing evidence.
|
|
104
|
+
*
|
|
105
|
+
* @param callback - Function called with info about the oversized proposal
|
|
106
|
+
*/
|
|
107
|
+
registerOversizedProposalCallback(callback: (info: OversizedProposalInfo) => void): void;
|
|
108
|
+
|
|
103
109
|
/**
|
|
104
110
|
* Registers a callback invoked when a duplicate attestation is detected (equivocation).
|
|
105
111
|
* A validator signing attestations for different proposals at the same slot.
|
|
@@ -109,6 +115,9 @@ export type P2P = P2PClient & {
|
|
|
109
115
|
*/
|
|
110
116
|
registerDuplicateAttestationCallback(callback: (info: DuplicateAttestationInfo) => void): void;
|
|
111
117
|
|
|
118
|
+
/** Registers a callback invoked when a valid checkpoint attestation is accepted into the pool. */
|
|
119
|
+
registerCheckpointAttestationCallback(callback: P2PCheckpointAttestationCallback): void;
|
|
120
|
+
|
|
112
121
|
/**
|
|
113
122
|
* Verifies the 'tx' and, if valid, adds it to local tx pool and forwards it to other peers.
|
|
114
123
|
* @param tx - The transaction.
|
|
@@ -124,16 +133,18 @@ export type P2P = P2PClient & {
|
|
|
124
133
|
/**
|
|
125
134
|
* Returns a transaction in the transaction pool by its hash.
|
|
126
135
|
* @param txHash - Hash of tx to return.
|
|
136
|
+
* @param opts - Set `includeProof: false` to skip loading the tx proof from the DB.
|
|
127
137
|
* @returns A single tx or undefined.
|
|
128
138
|
*/
|
|
129
|
-
getTxByHashFromPool(txHash: TxHash): Promise<Tx | undefined>;
|
|
139
|
+
getTxByHashFromPool(txHash: TxHash, opts?: { includeProof?: boolean }): Promise<Tx | undefined>;
|
|
130
140
|
|
|
131
141
|
/**
|
|
132
142
|
* Returns transactions in the transaction pool by hash.
|
|
133
143
|
* @param txHashes - Hashes of txs to return.
|
|
144
|
+
* @param opts - Set `includeProof: false` to skip loading tx proofs from the DB.
|
|
134
145
|
* @returns An array of txs or undefined.
|
|
135
146
|
*/
|
|
136
|
-
getTxsByHashFromPool(txHashes: TxHash[]): Promise<(Tx | undefined)[]>;
|
|
147
|
+
getTxsByHashFromPool(txHashes: TxHash[], opts?: { includeProof?: boolean }): Promise<(Tx | undefined)[]>;
|
|
137
148
|
|
|
138
149
|
/**
|
|
139
150
|
* Checks if transactions exist in the pool
|
|
@@ -156,15 +167,27 @@ export type P2P = P2PClient & {
|
|
|
156
167
|
*/
|
|
157
168
|
getTxStatus(txHash: TxHash): Promise<'pending' | 'mined' | 'deleted' | undefined>;
|
|
158
169
|
|
|
159
|
-
/**
|
|
160
|
-
|
|
170
|
+
/**
|
|
171
|
+
* Returns an iterator over pending txs on the mempool.
|
|
172
|
+
* Set `includeProof: false` to skip loading tx proofs from the DB.
|
|
173
|
+
*/
|
|
174
|
+
iteratePendingTxs(opts?: { includeProof?: boolean }): AsyncIterableIterator<Tx>;
|
|
161
175
|
|
|
162
|
-
/**
|
|
163
|
-
|
|
176
|
+
/**
|
|
177
|
+
* Returns an iterator over pending txs that have been in the pool long enough to be eligible for block building.
|
|
178
|
+
* Set `includeProof: false` to skip loading tx proofs from the DB.
|
|
179
|
+
*/
|
|
180
|
+
iterateEligiblePendingTxs(opts?: { includeProof?: boolean }): AsyncIterableIterator<Tx>;
|
|
164
181
|
|
|
165
182
|
/** Returns the number of pending txs in the mempool. */
|
|
166
183
|
getPendingTxCount(): Promise<number>;
|
|
167
184
|
|
|
185
|
+
/**
|
|
186
|
+
* Returns whether at least `minCount` pending txs have been in the pool long enough to be eligible for block
|
|
187
|
+
* building. Early-exits once the threshold is met instead of counting every eligible tx.
|
|
188
|
+
*/
|
|
189
|
+
hasEligiblePendingTxs(minCount: number): Promise<boolean>;
|
|
190
|
+
|
|
168
191
|
/**
|
|
169
192
|
* Protects existing transactions by hash for a given slot.
|
|
170
193
|
* Returns hashes of transactions that weren't found in the pool.
|
|
@@ -224,11 +247,7 @@ export type P2P = P2PClient & {
|
|
|
224
247
|
/** Clears the db. */
|
|
225
248
|
clear(): Promise<void>;
|
|
226
249
|
|
|
227
|
-
addReqRespSubProtocol(
|
|
228
|
-
subProtocol: ReqRespSubProtocol,
|
|
229
|
-
handler: ReqRespSubProtocolHandler,
|
|
230
|
-
validator?: ReqRespSubProtocolValidators[ReqRespSubProtocol],
|
|
231
|
-
): Promise<void>;
|
|
250
|
+
addReqRespSubProtocol(subProtocol: ReqRespSubProtocol, handler: ReqRespSubProtocolHandler): Promise<void>;
|
|
232
251
|
|
|
233
252
|
handleAuthRequestFromPeer(authRequest: AuthRequest, peerId: PeerId): Promise<StatusMessage>;
|
|
234
253
|
|