@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
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import type { EpochCacheInterface } from '@aztec/epoch-cache';
|
|
2
2
|
import { BlockNumber, type SlotNumber } from '@aztec/foundation/branded-types';
|
|
3
|
-
import { maxBy } from '@aztec/foundation/collection';
|
|
4
|
-
import { Fr } from '@aztec/foundation/curves/bn254';
|
|
3
|
+
import { compactArray, maxBy, merge } from '@aztec/foundation/collection';
|
|
5
4
|
import { type Logger, createLibp2pComponentLogger, createLogger } from '@aztec/foundation/log';
|
|
6
5
|
import { RunningPromise } from '@aztec/foundation/running-promise';
|
|
7
6
|
import { Timer } from '@aztec/foundation/timer';
|
|
8
7
|
import type { AztecAsyncKVStore } from '@aztec/kv-store';
|
|
9
8
|
import { protocolContractsHash } from '@aztec/protocol-contracts';
|
|
10
|
-
import type { EthAddress,
|
|
9
|
+
import type { EthAddress, L2BlockSource } from '@aztec/stdlib/block';
|
|
10
|
+
import { DEFAULT_MAX_BLOCKS_PER_CHECKPOINT } from '@aztec/stdlib/config';
|
|
11
11
|
import type { ContractDataSource } from '@aztec/stdlib/contract';
|
|
12
|
-
import { GasFees } from '@aztec/stdlib/gas';
|
|
12
|
+
import { type BlockMinFeesProvider, GasFees, getNetworkTxGasLimits } from '@aztec/stdlib/gas';
|
|
13
13
|
import type { ClientProtocolCircuitVerifier, PeerInfo, WorldStateSynchronizer } from '@aztec/stdlib/interfaces/server';
|
|
14
14
|
import {
|
|
15
15
|
BlockProposal,
|
|
@@ -25,8 +25,9 @@ import {
|
|
|
25
25
|
getTopicsForConfig,
|
|
26
26
|
metricsTopicStrToLabels,
|
|
27
27
|
} from '@aztec/stdlib/p2p';
|
|
28
|
+
import { ConsensusTimetable, getDefaultCheckpointProposalSyncGrace } from '@aztec/stdlib/timetable';
|
|
28
29
|
import { MerkleTreeId } from '@aztec/stdlib/trees';
|
|
29
|
-
import { Tx, type
|
|
30
|
+
import { Tx, type TxValidationResult } from '@aztec/stdlib/tx';
|
|
30
31
|
import type { UInt64 } from '@aztec/stdlib/types';
|
|
31
32
|
import { compressComponentVersions } from '@aztec/stdlib/versioning';
|
|
32
33
|
import {
|
|
@@ -75,38 +76,34 @@ import {
|
|
|
75
76
|
createFirstStageTxValidationsForGossipedTransactions,
|
|
76
77
|
createSecondStageTxValidationsForGossipedTransactions,
|
|
77
78
|
createTxValidatorForBlockProposalReceivedTxs,
|
|
78
|
-
createTxValidatorForReqResponseReceivedTxs,
|
|
79
79
|
} from '../../msg_validators/tx_validator/factory.js';
|
|
80
|
+
import { TxValidationCache } from '../../msg_validators/tx_validator/tx_validation_cache.js';
|
|
80
81
|
import { GossipSubEvent } from '../../types/index.js';
|
|
81
82
|
import { type PubSubLibp2p, convertToMultiaddr } from '../../util.js';
|
|
82
83
|
import { getVersions } from '../../versioning.js';
|
|
83
84
|
import { AztecDatastore } from '../data_store.js';
|
|
84
85
|
import { DiscV5Service } from '../discv5/discV5_service.js';
|
|
85
|
-
import { SnappyTransform,
|
|
86
|
+
import { SnappyTransform, getMsgIdFn, msgIdToStrFn } from '../encoding.js';
|
|
86
87
|
import { APP_SPECIFIC_WEIGHT, gossipScoreThresholds } from '../gossipsub/scoring.js';
|
|
87
88
|
import { createAllTopicScoreParams } from '../gossipsub/topic_score_params.js';
|
|
88
89
|
import type { PeerManagerInterface } from '../peer-manager/interface.js';
|
|
89
90
|
import { PeerManager } from '../peer-manager/peer_manager.js';
|
|
90
91
|
import { PeerScoring } from '../peer-manager/peer_scoring.js';
|
|
91
92
|
import type { BatchTxRequesterLibP2PService } from '../reqresp/batch-tx-requester/interface.js';
|
|
92
|
-
import type
|
|
93
|
+
import { type P2PReqRespConfig, YAMUX_MAX_MESSAGE_SIZE_BYTES } from '../reqresp/config.js';
|
|
93
94
|
import {
|
|
94
95
|
AuthRequest,
|
|
95
96
|
BlockTxsRequest,
|
|
96
97
|
BlockTxsResponse,
|
|
97
|
-
DEFAULT_SUB_PROTOCOL_VALIDATORS,
|
|
98
98
|
type ReqRespInterface,
|
|
99
99
|
type ReqRespResponse,
|
|
100
100
|
ReqRespSubProtocol,
|
|
101
101
|
type ReqRespSubProtocolHandler,
|
|
102
102
|
type ReqRespSubProtocolHandlers,
|
|
103
|
-
type ReqRespSubProtocolValidators,
|
|
104
103
|
StatusMessage,
|
|
105
|
-
type SubProtocolMap,
|
|
106
104
|
ValidationError,
|
|
107
105
|
pingHandler,
|
|
108
106
|
reqGoodbyeHandler,
|
|
109
|
-
reqRespBlockHandler,
|
|
110
107
|
reqRespBlockTxsHandler,
|
|
111
108
|
reqRespStatusHandler,
|
|
112
109
|
reqRespTxHandler,
|
|
@@ -114,13 +111,33 @@ import {
|
|
|
114
111
|
import { ReqResp } from '../reqresp/reqresp.js';
|
|
115
112
|
import type {
|
|
116
113
|
P2PBlockReceivedCallback,
|
|
114
|
+
P2PCheckpointAttestationCallback,
|
|
117
115
|
P2PCheckpointReceivedCallback,
|
|
118
116
|
P2PDuplicateAttestationCallback,
|
|
117
|
+
P2POversizedProposalCallback,
|
|
119
118
|
P2PService,
|
|
120
119
|
PeerDiscoveryService,
|
|
121
120
|
} from '../service.js';
|
|
122
121
|
import { P2PInstrumentation } from './instrumentation.js';
|
|
123
122
|
|
|
123
|
+
/**
|
|
124
|
+
* Builds the {@link ConsensusTimetable} shared by the gossip validators for proposal/attestation receive-window
|
|
125
|
+
* bounds. Derived purely from protocol slot-timing constants plus the block sub-slot duration and the consensus
|
|
126
|
+
* materialization grace, so every node agrees on these bounds without depending on proposer operational budgets.
|
|
127
|
+
*/
|
|
128
|
+
function buildConsensusTimetable(
|
|
129
|
+
config: P2PConfig,
|
|
130
|
+
l1Constants: ReturnType<EpochCacheInterface['getL1Constants']>,
|
|
131
|
+
): ConsensusTimetable {
|
|
132
|
+
const blockDuration = config.blockDurationMs / 1000;
|
|
133
|
+
return new ConsensusTimetable({
|
|
134
|
+
l1Constants,
|
|
135
|
+
blockDuration,
|
|
136
|
+
checkpointProposalSyncGrace:
|
|
137
|
+
config.checkpointProposalSyncGraceSeconds ?? getDefaultCheckpointProposalSyncGrace(blockDuration),
|
|
138
|
+
});
|
|
139
|
+
}
|
|
140
|
+
|
|
124
141
|
interface ValidationResult {
|
|
125
142
|
name: string;
|
|
126
143
|
isValid: TxValidationResult;
|
|
@@ -149,8 +166,6 @@ export class LibP2PService extends WithTracer implements P2PService {
|
|
|
149
166
|
private protocolVersion = '';
|
|
150
167
|
private topicStrings: Record<TopicType, string> = {} as Record<TopicType, string>;
|
|
151
168
|
|
|
152
|
-
private feesCache: { blockNumber: BlockNumber; gasFees: GasFees } | undefined;
|
|
153
|
-
|
|
154
169
|
/** Callback invoked when a duplicate proposal is detected (triggers slashing). */
|
|
155
170
|
private duplicateProposalCallback?: (info: {
|
|
156
171
|
slot: SlotNumber;
|
|
@@ -158,9 +173,15 @@ export class LibP2PService extends WithTracer implements P2PService {
|
|
|
158
173
|
type: 'checkpoint' | 'block';
|
|
159
174
|
}) => void;
|
|
160
175
|
|
|
176
|
+
/** Callback invoked when an oversized block proposal is stored as slashing evidence (triggers slashing). */
|
|
177
|
+
private oversizedProposalCallback?: P2POversizedProposalCallback;
|
|
178
|
+
|
|
161
179
|
/** Callback invoked when a duplicate attestation is detected (triggers slashing). */
|
|
162
180
|
private duplicateAttestationCallback?: P2PDuplicateAttestationCallback;
|
|
163
181
|
|
|
182
|
+
/** Callback invoked when a valid checkpoint attestation is accepted into the pool. */
|
|
183
|
+
private checkpointAttestationCallback?: P2PCheckpointAttestationCallback;
|
|
184
|
+
|
|
164
185
|
/**
|
|
165
186
|
* Callback for when a block is received from a peer.
|
|
166
187
|
* @param block - The block received from the peer.
|
|
@@ -203,8 +224,10 @@ export class LibP2PService extends WithTracer implements P2PService {
|
|
|
203
224
|
private epochCache: EpochCacheInterface,
|
|
204
225
|
private proofVerifier: ClientProtocolCircuitVerifier,
|
|
205
226
|
private worldStateSynchronizer: WorldStateSynchronizer,
|
|
227
|
+
private blockMinFeesProvider: BlockMinFeesProvider,
|
|
206
228
|
telemetry: TelemetryClient,
|
|
207
229
|
logger: Logger = createLogger('p2p:libp2p_service'),
|
|
230
|
+
private txValidationCache?: TxValidationCache,
|
|
208
231
|
) {
|
|
209
232
|
super(telemetry, 'LibP2PService');
|
|
210
233
|
this.telemetry = telemetry;
|
|
@@ -234,15 +257,39 @@ export class LibP2PService extends WithTracer implements P2PService {
|
|
|
234
257
|
this.protocolVersion,
|
|
235
258
|
);
|
|
236
259
|
|
|
260
|
+
// Build the consensus timetable once from protocol slot-timing constants and inject it into every
|
|
261
|
+
// validator so they share one set of receive-window bounds, independent of proposer operational budgets.
|
|
262
|
+
const consensusTimetable = buildConsensusTimetable(config, epochCache.getL1Constants());
|
|
237
263
|
const proposalValidatorOpts = {
|
|
238
264
|
txsPermitted: !config.disableTransactions,
|
|
239
265
|
maxTxsPerBlock: config.validateMaxTxsPerBlock ?? config.validateMaxTxsPerCheckpoint,
|
|
266
|
+
maxBlocksPerCheckpoint: config.maxBlocksPerCheckpoint,
|
|
267
|
+
skipSlotValidation: config.skipProposalSlotValidation,
|
|
268
|
+
signatureContext: {
|
|
269
|
+
chainId: config.l1ChainId,
|
|
270
|
+
rollupAddress: config.rollupAddress,
|
|
271
|
+
},
|
|
272
|
+
clockDisparityMs: config.maxGossipClockDisparityMs,
|
|
273
|
+
};
|
|
274
|
+
this.blockProposalValidator = new BlockProposalValidator(epochCache, consensusTimetable, proposalValidatorOpts);
|
|
275
|
+
this.checkpointProposalValidator = new CheckpointProposalValidator(
|
|
276
|
+
epochCache,
|
|
277
|
+
consensusTimetable,
|
|
278
|
+
proposalValidatorOpts,
|
|
279
|
+
);
|
|
280
|
+
const attestationValidatorOpts = {
|
|
281
|
+
signatureContext: proposalValidatorOpts.signatureContext,
|
|
282
|
+
clockDisparityMs: config.maxGossipClockDisparityMs,
|
|
240
283
|
};
|
|
241
|
-
this.blockProposalValidator = new BlockProposalValidator(epochCache, proposalValidatorOpts);
|
|
242
|
-
this.checkpointProposalValidator = new CheckpointProposalValidator(epochCache, proposalValidatorOpts);
|
|
243
284
|
this.checkpointAttestationValidator = config.fishermanMode
|
|
244
|
-
? new FishermanAttestationValidator(
|
|
245
|
-
|
|
285
|
+
? new FishermanAttestationValidator(
|
|
286
|
+
epochCache,
|
|
287
|
+
consensusTimetable,
|
|
288
|
+
mempools.attestationPool,
|
|
289
|
+
telemetry,
|
|
290
|
+
attestationValidatorOpts,
|
|
291
|
+
)
|
|
292
|
+
: new CheckpointAttestationValidator(epochCache, consensusTimetable, attestationValidatorOpts);
|
|
246
293
|
|
|
247
294
|
this.gossipSubEventHandler = this.handleGossipSubEvent.bind(this);
|
|
248
295
|
|
|
@@ -267,8 +314,9 @@ export class LibP2PService extends WithTracer implements P2PService {
|
|
|
267
314
|
};
|
|
268
315
|
}
|
|
269
316
|
|
|
270
|
-
public updateConfig(config: Partial<P2PReqRespConfig
|
|
317
|
+
public updateConfig(config: Partial<P2PReqRespConfig & Pick<P2PConfig, 'skipIncomingProposals'>>) {
|
|
271
318
|
this.reqresp.updateConfig(config);
|
|
319
|
+
this.config = merge(this.config, config);
|
|
272
320
|
}
|
|
273
321
|
|
|
274
322
|
/**
|
|
@@ -287,9 +335,11 @@ export class LibP2PService extends WithTracer implements P2PService {
|
|
|
287
335
|
proofVerifier: ClientProtocolCircuitVerifier;
|
|
288
336
|
worldStateSynchronizer: WorldStateSynchronizer;
|
|
289
337
|
peerStore: AztecAsyncKVStore;
|
|
338
|
+
blockMinFeesProvider: BlockMinFeesProvider;
|
|
290
339
|
telemetry: TelemetryClient;
|
|
291
340
|
logger: Logger;
|
|
292
341
|
packageVersion: string;
|
|
342
|
+
txValidationCache?: TxValidationCache;
|
|
293
343
|
},
|
|
294
344
|
) {
|
|
295
345
|
const {
|
|
@@ -299,9 +349,11 @@ export class LibP2PService extends WithTracer implements P2PService {
|
|
|
299
349
|
mempools,
|
|
300
350
|
proofVerifier,
|
|
301
351
|
peerStore,
|
|
352
|
+
blockMinFeesProvider,
|
|
302
353
|
telemetry,
|
|
303
354
|
logger,
|
|
304
355
|
packageVersion,
|
|
356
|
+
txValidationCache,
|
|
305
357
|
} = deps;
|
|
306
358
|
const { p2pPort, maxPeerCount, listenAddress } = config;
|
|
307
359
|
const bindAddrTcp = convertToMultiaddr(listenAddress, p2pPort, 'tcp');
|
|
@@ -316,6 +368,7 @@ export class LibP2PService extends WithTracer implements P2PService {
|
|
|
316
368
|
packageVersion,
|
|
317
369
|
telemetry,
|
|
318
370
|
createLogger(`${logger.module}:discv5_service`, logger.getBindings()),
|
|
371
|
+
peerStore,
|
|
319
372
|
);
|
|
320
373
|
|
|
321
374
|
// Seed libp2p's bootstrap discovery with private and trusted peers
|
|
@@ -330,34 +383,49 @@ export class LibP2PService extends WithTracer implements P2PService {
|
|
|
330
383
|
const protocolVersion = compressComponentVersions(versions);
|
|
331
384
|
|
|
332
385
|
const preferredPeersEnrs: ENR[] = config.preferredPeers.map(enr => ENR.decodeTxt(enr));
|
|
333
|
-
const directPeers = (
|
|
386
|
+
const directPeers = compactArray(
|
|
334
387
|
await Promise.all(
|
|
335
388
|
preferredPeersEnrs.map(async enr => {
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
389
|
+
try {
|
|
390
|
+
const peerId = await enr.peerId();
|
|
391
|
+
const address = enr.getLocationMultiaddr('tcp');
|
|
392
|
+
if (address === undefined) {
|
|
393
|
+
throw new Error(`Direct peer ${peerId.toString()} has no TCP address, ENR: ${enr.encodeTxt()}`);
|
|
394
|
+
}
|
|
395
|
+
return {
|
|
396
|
+
id: peerId,
|
|
397
|
+
addrs: [address],
|
|
398
|
+
};
|
|
399
|
+
} catch (err) {
|
|
400
|
+
// A malformed configured ENR shouldn't abort node setup — skip it and log.
|
|
401
|
+
logger.warn(`Skipping preferred peer with invalid ENR`, { err });
|
|
402
|
+
return undefined;
|
|
340
403
|
}
|
|
341
|
-
return {
|
|
342
|
-
id: peerId,
|
|
343
|
-
addrs: [address],
|
|
344
|
-
};
|
|
345
404
|
}),
|
|
346
|
-
)
|
|
347
|
-
)
|
|
405
|
+
),
|
|
406
|
+
);
|
|
348
407
|
|
|
349
408
|
const announceTcpMultiaddr = config.p2pIp ? [convertToMultiaddr(config.p2pIp, p2pPort, 'tcp')] : [];
|
|
350
409
|
|
|
351
|
-
// Create dynamic topic score params based on network configuration
|
|
410
|
+
// Create dynamic topic score params based on network configuration. Scoring uses the network-wide
|
|
411
|
+
// max-blocks-per-checkpoint config value directly to size expected per-slot message rates; these are
|
|
412
|
+
// peer-rate thresholds, not consensus deadlines, so they need no proposer operational budgets.
|
|
352
413
|
const l1Constants = epochCache.getL1Constants();
|
|
353
414
|
const topicScoreParams = createAllTopicScoreParams(protocolVersion, {
|
|
354
415
|
slotDurationMs: l1Constants.slotDuration * 1000,
|
|
355
416
|
heartbeatIntervalMs: config.gossipsubInterval,
|
|
356
417
|
targetCommitteeSize: l1Constants.targetCommitteeSize,
|
|
357
|
-
|
|
418
|
+
maxBlocksPerCheckpoint: config.maxBlocksPerCheckpoint ?? DEFAULT_MAX_BLOCKS_PER_CHECKPOINT,
|
|
358
419
|
expectedBlockProposalsPerSlot: config.expectedBlockProposalsPerSlot,
|
|
359
420
|
});
|
|
360
421
|
|
|
422
|
+
// Restrict gossipsub to exactly the topics we subscribe to. Without this, an arbitrary-topic
|
|
423
|
+
// message is transformed, msg-id'd and inserted into the seenCache before the subscription check,
|
|
424
|
+
// so a crafted topic colliding on msg id can suppress a real message as a duplicate.
|
|
425
|
+
const allowedTopics = getTopicsForConfig(config.disableTransactions).map(topic =>
|
|
426
|
+
createTopicString(topic, protocolVersion),
|
|
427
|
+
);
|
|
428
|
+
|
|
361
429
|
const node = await createLibp2p({
|
|
362
430
|
start: false,
|
|
363
431
|
peerId,
|
|
@@ -389,7 +457,8 @@ export class LibP2PService extends WithTracer implements P2PService {
|
|
|
389
457
|
],
|
|
390
458
|
datastore,
|
|
391
459
|
peerDiscovery,
|
|
392
|
-
|
|
460
|
+
// Pin the yamux frame size: MAX_REQRESP_REQUEST_SIZE_BYTES relies on a reqresp request fitting in one frame.
|
|
461
|
+
streamMuxers: [yamux({ maxMessageSize: YAMUX_MAX_MESSAGE_SIZE_BYTES }), mplex()],
|
|
393
462
|
connectionEncryption: [noise()],
|
|
394
463
|
connectionManager: {
|
|
395
464
|
minConnections: 0, // Disable libp2p peer dialing, we do it manually
|
|
@@ -403,7 +472,7 @@ export class LibP2PService extends WithTracer implements P2PService {
|
|
|
403
472
|
},
|
|
404
473
|
connectionGater: {
|
|
405
474
|
denyInboundConnection: (maConn: MultiaddrConnection) => {
|
|
406
|
-
const allowed = peerManager.
|
|
475
|
+
const allowed = peerManager.isAddressAllowedToConnect(maConn.remoteAddr.nodeAddress().address);
|
|
407
476
|
if (allowed) {
|
|
408
477
|
return false;
|
|
409
478
|
}
|
|
@@ -414,7 +483,7 @@ export class LibP2PService extends WithTracer implements P2PService {
|
|
|
414
483
|
denyInboundEncryptedConnection: (peerId: PeerId, _maConn: MultiaddrConnection) => {
|
|
415
484
|
//NOTE: it is not necessary to check address here because this was already done by
|
|
416
485
|
// denyInboundConnection
|
|
417
|
-
const allowed = peerManager.
|
|
486
|
+
const allowed = peerManager.isPeerAllowedToConnect(peerId);
|
|
418
487
|
if (allowed) {
|
|
419
488
|
return false;
|
|
420
489
|
}
|
|
@@ -442,9 +511,13 @@ export class LibP2PService extends WithTracer implements P2PService {
|
|
|
442
511
|
mcacheLength: config.gossipsubMcacheLength,
|
|
443
512
|
mcacheGossip: config.gossipsubMcacheGossip,
|
|
444
513
|
seenTTL: config.gossipsubSeenTTL,
|
|
514
|
+
allowedTopics,
|
|
515
|
+
// No fastMsgIdFn: the fast-path dedup cache keys on a non-cryptographic 64-bit hash of the
|
|
516
|
+
// raw data only (no topic), so a collision — accidental or engineered via a weak seed — drops
|
|
517
|
+
// a different message with no fallback to the full id. Dedup instead rests solely on the
|
|
518
|
+
// cryptographic, topic-framed msgIdFn below.
|
|
445
519
|
msgIdFn: getMsgIdFn,
|
|
446
520
|
msgIdToStrFn: msgIdToStrFn,
|
|
447
|
-
fastMsgIdFn: fastMsgIdFn,
|
|
448
521
|
dataTransform: new SnappyTransform(),
|
|
449
522
|
metricsRegister: otelMetricsAdapter,
|
|
450
523
|
metricsTopicStrToLabel: metricsTopicStrToLabels(protocolVersion),
|
|
@@ -480,6 +553,9 @@ export class LibP2PService extends WithTracer implements P2PService {
|
|
|
480
553
|
epochCache,
|
|
481
554
|
);
|
|
482
555
|
|
|
556
|
+
// Gate req/resp data protocols for unauthenticated peers when p2pAllowOnlyValidators is enabled
|
|
557
|
+
reqresp.setShouldRejectPeer(peerId => peerManager.shouldDisableP2PGossip(peerId));
|
|
558
|
+
|
|
483
559
|
// Configure application-specific scoring for gossipsub.
|
|
484
560
|
// The weight scales app score to align with gossipsub thresholds:
|
|
485
561
|
// - Disconnect (-50) × 10 = -500 = gossipThreshold (stops receiving gossip)
|
|
@@ -500,8 +576,10 @@ export class LibP2PService extends WithTracer implements P2PService {
|
|
|
500
576
|
epochCache,
|
|
501
577
|
proofVerifier,
|
|
502
578
|
worldStateSynchronizer,
|
|
579
|
+
blockMinFeesProvider,
|
|
503
580
|
telemetry,
|
|
504
581
|
logger,
|
|
582
|
+
txValidationCache,
|
|
505
583
|
);
|
|
506
584
|
}
|
|
507
585
|
|
|
@@ -524,14 +602,12 @@ export class LibP2PService extends WithTracer implements P2PService {
|
|
|
524
602
|
// Create request response protocol handlers
|
|
525
603
|
const txHandler = reqRespTxHandler(this.mempools);
|
|
526
604
|
const goodbyeHandler = reqGoodbyeHandler(this.peerManager);
|
|
527
|
-
const blockHandler = reqRespBlockHandler(this.archiver);
|
|
528
605
|
const statusHandler = reqRespStatusHandler(this.protocolVersion, this.worldStateSynchronizer, this.logger);
|
|
529
606
|
|
|
530
607
|
const requestResponseHandlers: Partial<ReqRespSubProtocolHandlers> = {
|
|
531
608
|
[ReqRespSubProtocol.PING]: pingHandler,
|
|
532
609
|
[ReqRespSubProtocol.STATUS]: statusHandler.bind(this),
|
|
533
610
|
[ReqRespSubProtocol.GOODBYE]: goodbyeHandler.bind(this),
|
|
534
|
-
[ReqRespSubProtocol.BLOCK]: blockHandler.bind(this),
|
|
535
611
|
};
|
|
536
612
|
|
|
537
613
|
if (!this.config.disableTransactions) {
|
|
@@ -547,17 +623,9 @@ export class LibP2PService extends WithTracer implements P2PService {
|
|
|
547
623
|
requestResponseHandlers[ReqRespSubProtocol.TX] = txHandler.bind(this);
|
|
548
624
|
}
|
|
549
625
|
|
|
550
|
-
// Define the sub protocol validators - This is done within this start() method to gain a callback to the existing validateTx function
|
|
551
|
-
const reqrespSubProtocolValidators = {
|
|
552
|
-
...DEFAULT_SUB_PROTOCOL_VALIDATORS,
|
|
553
|
-
[ReqRespSubProtocol.TX]: this.validateRequestedTxs.bind(this),
|
|
554
|
-
[ReqRespSubProtocol.BLOCK_TXS]: this.validateRequestedBlockTxs.bind(this),
|
|
555
|
-
[ReqRespSubProtocol.BLOCK]: this.validateRequestedBlock.bind(this),
|
|
556
|
-
};
|
|
557
|
-
|
|
558
626
|
await this.peerManager.initializePeers();
|
|
559
627
|
|
|
560
|
-
await this.reqresp.start(requestResponseHandlers
|
|
628
|
+
await this.reqresp.start(requestResponseHandlers);
|
|
561
629
|
|
|
562
630
|
await this.node.start();
|
|
563
631
|
|
|
@@ -576,19 +644,31 @@ export class LibP2PService extends WithTracer implements P2PService {
|
|
|
576
644
|
|
|
577
645
|
// Bridge discv5 IP changes to libp2p's AddressManager so peers see the updated address
|
|
578
646
|
if (this.config.queryForIp) {
|
|
647
|
+
this.discoveredP2pIp = this.config.p2pIp;
|
|
648
|
+
this.logger.info('IP change tracking enabled, bridging discv5 IP updates to libp2p AddressManager');
|
|
579
649
|
this.ipChangedHandler = (ip: string) => {
|
|
580
650
|
const addressManager = this.node.services.components.addressManager;
|
|
581
651
|
const newAddr = multiaddr(convertToMultiaddr(ip, this.config.p2pPort, 'tcp'));
|
|
652
|
+
const previousIp = this.discoveredP2pIp;
|
|
582
653
|
|
|
583
|
-
if (
|
|
584
|
-
const oldAddr = multiaddr(convertToMultiaddr(
|
|
654
|
+
if (previousIp) {
|
|
655
|
+
const oldAddr = multiaddr(convertToMultiaddr(previousIp, this.config.p2pPort, 'tcp'));
|
|
585
656
|
addressManager.removeObservedAddr(oldAddr);
|
|
657
|
+
this.logger.info('Libp2p announce address updated due to IP change', {
|
|
658
|
+
previousIp,
|
|
659
|
+
newIp: ip,
|
|
660
|
+
newMultiaddr: newAddr.toString(),
|
|
661
|
+
});
|
|
662
|
+
} else {
|
|
663
|
+
this.logger.info('Libp2p announce address set from initial discv5 IP discovery', {
|
|
664
|
+
ip,
|
|
665
|
+
multiaddr: newAddr.toString(),
|
|
666
|
+
});
|
|
586
667
|
}
|
|
587
668
|
|
|
588
669
|
addressManager.addObservedAddr(newAddr);
|
|
589
670
|
addressManager.confirmObservedAddr(newAddr);
|
|
590
671
|
this.discoveredP2pIp = ip;
|
|
591
|
-
this.logger.info('Public IP discovered via discv5', { ip });
|
|
592
672
|
};
|
|
593
673
|
this.peerDiscoveryService.on('ip:changed', this.ipChangedHandler);
|
|
594
674
|
}
|
|
@@ -637,12 +717,8 @@ export class LibP2PService extends WithTracer implements P2PService {
|
|
|
637
717
|
this.logger.info('LibP2P service stopped');
|
|
638
718
|
}
|
|
639
719
|
|
|
640
|
-
addReqRespSubProtocol(
|
|
641
|
-
subProtocol
|
|
642
|
-
handler: ReqRespSubProtocolHandler,
|
|
643
|
-
validator?: ReqRespSubProtocolValidators[ReqRespSubProtocol],
|
|
644
|
-
): Promise<void> {
|
|
645
|
-
return this.reqresp.addSubProtocol(subProtocol, handler, validator);
|
|
720
|
+
addReqRespSubProtocol(subProtocol: ReqRespSubProtocol, handler: ReqRespSubProtocolHandler): Promise<void> {
|
|
721
|
+
return this.reqresp.addSubProtocol(subProtocol, handler);
|
|
646
722
|
}
|
|
647
723
|
|
|
648
724
|
public registerThisValidatorAddresses(address: EthAddress[]): void {
|
|
@@ -670,20 +746,6 @@ export class LibP2PService extends WithTracer implements P2PService {
|
|
|
670
746
|
setImmediate(() => void safeJob());
|
|
671
747
|
}
|
|
672
748
|
|
|
673
|
-
/**
|
|
674
|
-
* Send a batch of requests to peers, and return the responses
|
|
675
|
-
* @param protocol - The request response protocol to use
|
|
676
|
-
* @param requests - The requests to send to the peers
|
|
677
|
-
* @returns The responses to the requests
|
|
678
|
-
*/
|
|
679
|
-
sendBatchRequest<SubProtocol extends ReqRespSubProtocol>(
|
|
680
|
-
protocol: SubProtocol,
|
|
681
|
-
requests: InstanceType<SubProtocolMap[SubProtocol]['request']>[],
|
|
682
|
-
pinnedPeerId: PeerId | undefined,
|
|
683
|
-
): Promise<InstanceType<SubProtocolMap[SubProtocol]['response']>[]> {
|
|
684
|
-
return this.reqresp.sendBatchRequest(protocol, requests, pinnedPeerId);
|
|
685
|
-
}
|
|
686
|
-
|
|
687
749
|
public sendRequestToPeer(
|
|
688
750
|
peerId: PeerId,
|
|
689
751
|
subProtocol: ReqRespSubProtocol,
|
|
@@ -713,10 +775,6 @@ export class LibP2PService extends WithTracer implements P2PService {
|
|
|
713
775
|
this.allNodesCheckpointReceivedCallback = callback;
|
|
714
776
|
}
|
|
715
777
|
|
|
716
|
-
public async notifyOwnCheckpointProposal(checkpoint: CheckpointProposalCore): Promise<void> {
|
|
717
|
-
await this.allNodesCheckpointReceivedCallback(checkpoint, this.node.peerId);
|
|
718
|
-
}
|
|
719
|
-
|
|
720
778
|
/**
|
|
721
779
|
* Registers a callback to be invoked when a duplicate proposal is detected.
|
|
722
780
|
* This callback is triggered on the first duplicate (when count goes from 1 to 2).
|
|
@@ -727,6 +785,13 @@ export class LibP2PService extends WithTracer implements P2PService {
|
|
|
727
785
|
this.duplicateProposalCallback = callback;
|
|
728
786
|
}
|
|
729
787
|
|
|
788
|
+
/**
|
|
789
|
+
* Registers a callback to be invoked when an oversized block proposal is stored as slashing evidence.
|
|
790
|
+
*/
|
|
791
|
+
public registerOversizedProposalCallback(callback: P2POversizedProposalCallback): void {
|
|
792
|
+
this.oversizedProposalCallback = callback;
|
|
793
|
+
}
|
|
794
|
+
|
|
730
795
|
/**
|
|
731
796
|
* Registers a callback to be invoked when a duplicate attestation is detected.
|
|
732
797
|
* A validator signing attestations for different proposals at the same slot.
|
|
@@ -736,6 +801,10 @@ export class LibP2PService extends WithTracer implements P2PService {
|
|
|
736
801
|
this.duplicateAttestationCallback = callback;
|
|
737
802
|
}
|
|
738
803
|
|
|
804
|
+
public registerCheckpointAttestationCallback(callback: P2PCheckpointAttestationCallback): void {
|
|
805
|
+
this.checkpointAttestationCallback = callback;
|
|
806
|
+
}
|
|
807
|
+
|
|
739
808
|
/**
|
|
740
809
|
* Subscribes to a topic.
|
|
741
810
|
* @param topic - The topic to subscribe to.
|
|
@@ -864,6 +933,15 @@ export class LibP2PService extends WithTracer implements P2PService {
|
|
|
864
933
|
|
|
865
934
|
// Process the message, optionally within a linked span for trace propagation
|
|
866
935
|
const processMessage = async () => {
|
|
936
|
+
if (
|
|
937
|
+
this.config.skipIncomingProposals &&
|
|
938
|
+
(msg.topic === this.topicStrings[TopicType.block_proposal] ||
|
|
939
|
+
msg.topic === this.topicStrings[TopicType.checkpoint_proposal])
|
|
940
|
+
) {
|
|
941
|
+
this.logger.warn(`Ignoring incoming proposal (skipIncomingProposals is set)`, { topic: msg.topic });
|
|
942
|
+
this.node.services.pubsub.reportMessageValidationResult(msgId, source.toString(), TopicValidatorResult.Ignore);
|
|
943
|
+
return;
|
|
944
|
+
}
|
|
867
945
|
if (msg.topic === this.topicStrings[TopicType.tx]) {
|
|
868
946
|
await this.handleGossipedTx(p2pMessage.payload, msgId, source);
|
|
869
947
|
} else if (msg.topic === this.topicStrings[TopicType.checkpoint_attestation]) {
|
|
@@ -941,6 +1019,17 @@ export class LibP2PService extends WithTracer implements P2PService {
|
|
|
941
1019
|
this.logger.error(`Error validating gossipsub message`, err, { msgId, source: source.toString(), topicType });
|
|
942
1020
|
}
|
|
943
1021
|
|
|
1022
|
+
const validationTimeMs = timer.ms();
|
|
1023
|
+
const mcacheWindowMs = this.config.gossipsubMcacheLength * this.config.gossipsubInterval;
|
|
1024
|
+
if (validationTimeMs > mcacheWindowMs * 0.75) {
|
|
1025
|
+
this.instrumentation.incSlowValidation(topicType);
|
|
1026
|
+
this.logger.warn(
|
|
1027
|
+
`Gossip validation for ${topicType} took ${validationTimeMs}ms, approaching mcache eviction window of ${mcacheWindowMs}ms. ` +
|
|
1028
|
+
`Message forwarding may be skipped if validation exceeds the window.`,
|
|
1029
|
+
{ msgId, source: source.toString(), topicType, validationTimeMs, mcacheWindowMs },
|
|
1030
|
+
);
|
|
1031
|
+
}
|
|
1032
|
+
|
|
944
1033
|
if (resultAndObj.result === TopicValidatorResult.Accept) {
|
|
945
1034
|
this.logger.debug(`Message ${topicType} accepted by validator`, { msgId, source: source.toString(), topicType });
|
|
946
1035
|
this.instrumentation.recordMessageValidation(topicType, timer);
|
|
@@ -1176,6 +1265,7 @@ export class LibP2PService extends WithTracer implements P2PService {
|
|
|
1176
1265
|
}
|
|
1177
1266
|
|
|
1178
1267
|
// Attestation was added successfully - accept it so other nodes can also detect the equivocation
|
|
1268
|
+
this.checkpointAttestationCallback?.(attestation);
|
|
1179
1269
|
return { result: TopicValidatorResult.Accept, obj: attestation };
|
|
1180
1270
|
}
|
|
1181
1271
|
|
|
@@ -1183,16 +1273,17 @@ export class LibP2PService extends WithTracer implements P2PService {
|
|
|
1183
1273
|
const {
|
|
1184
1274
|
result,
|
|
1185
1275
|
obj: block,
|
|
1186
|
-
metadata: { isEquivocated } = {},
|
|
1187
|
-
} = await this.validateReceivedMessage<BlockProposal, { isEquivocated: boolean }>(
|
|
1276
|
+
metadata: { isEquivocated, isOversized } = {},
|
|
1277
|
+
} = await this.validateReceivedMessage<BlockProposal, { isEquivocated: boolean; isOversized: boolean }>(
|
|
1188
1278
|
() => this.validateAndStoreBlockProposal(source, BlockProposal.fromBuffer(payloadData)),
|
|
1189
1279
|
msgId,
|
|
1190
1280
|
source,
|
|
1191
1281
|
TopicType.block_proposal,
|
|
1192
1282
|
);
|
|
1193
1283
|
|
|
1194
|
-
// If not accepted or
|
|
1195
|
-
|
|
1284
|
+
// If not accepted, equivocated, or oversized, return. Oversized proposals are re-broadcast as
|
|
1285
|
+
// slashing evidence but never attested or processed.
|
|
1286
|
+
if (result !== TopicValidatorResult.Accept || !block || isEquivocated || isOversized) {
|
|
1196
1287
|
return;
|
|
1197
1288
|
}
|
|
1198
1289
|
|
|
@@ -1207,7 +1298,7 @@ export class LibP2PService extends WithTracer implements P2PService {
|
|
|
1207
1298
|
protected async validateAndStoreBlockProposal(
|
|
1208
1299
|
peerId: PeerId,
|
|
1209
1300
|
block: BlockProposal,
|
|
1210
|
-
): Promise<ReceivedMessageValidationResult<BlockProposal, { isEquivocated: boolean }>> {
|
|
1301
|
+
): Promise<ReceivedMessageValidationResult<BlockProposal, { isEquivocated: boolean; isOversized: boolean }>> {
|
|
1211
1302
|
const validationResult = await this.blockProposalValidator.validate(block);
|
|
1212
1303
|
|
|
1213
1304
|
if (validationResult.result === 'reject') {
|
|
@@ -1222,6 +1313,12 @@ export class LibP2PService extends WithTracer implements P2PService {
|
|
|
1222
1313
|
// Try to add the proposal: this handles existence check, cap check, and adding in one call
|
|
1223
1314
|
const { added, alreadyExists, count } = await this.mempools.attestationPool.tryAddBlockProposal(block);
|
|
1224
1315
|
const isEquivocated = count !== undefined && count > 1;
|
|
1316
|
+
// An oversized proposal (index at or beyond the consensus per-checkpoint limit) is structurally valid
|
|
1317
|
+
// proposer misbehavior: it is stored and re-broadcast as slashing evidence but never processed or
|
|
1318
|
+
// attested to. No-ops when maxBlocksPerCheckpoint is unset (local/test).
|
|
1319
|
+
const isOversized =
|
|
1320
|
+
this.config.maxBlocksPerCheckpoint !== undefined &&
|
|
1321
|
+
block.indexWithinCheckpoint >= this.config.maxBlocksPerCheckpoint;
|
|
1225
1322
|
|
|
1226
1323
|
// Duplicate proposal received, no need to re-broadcast
|
|
1227
1324
|
if (alreadyExists) {
|
|
@@ -1231,7 +1328,7 @@ export class LibP2PService extends WithTracer implements P2PService {
|
|
|
1231
1328
|
proposer: block.getSender()?.toString(),
|
|
1232
1329
|
source: peerId.toString(),
|
|
1233
1330
|
});
|
|
1234
|
-
return { result: TopicValidatorResult.Ignore, obj: block, metadata: { isEquivocated } };
|
|
1331
|
+
return { result: TopicValidatorResult.Ignore, obj: block, metadata: { isEquivocated, isOversized } };
|
|
1235
1332
|
}
|
|
1236
1333
|
|
|
1237
1334
|
// Too many blocks received for this slot and index, penalize peer and do not re-broadcast
|
|
@@ -1245,11 +1342,27 @@ export class LibP2PService extends WithTracer implements P2PService {
|
|
|
1245
1342
|
});
|
|
1246
1343
|
return {
|
|
1247
1344
|
result: TopicValidatorResult.Reject,
|
|
1248
|
-
metadata: { isEquivocated },
|
|
1345
|
+
metadata: { isEquivocated, isOversized },
|
|
1249
1346
|
severity: PeerErrorSeverity.HighToleranceError,
|
|
1250
1347
|
};
|
|
1251
1348
|
}
|
|
1252
1349
|
|
|
1350
|
+
// The proposal was stored: if oversized, invoke the oversized callback so the proposer can be
|
|
1351
|
+
// slashed. Fired alongside (not instead of) equivocation detection below.
|
|
1352
|
+
if (isOversized) {
|
|
1353
|
+
const proposer = block.getSender();
|
|
1354
|
+
if (proposer) {
|
|
1355
|
+
this.logger.warn(`Detected oversized block proposal at slot ${block.slotNumber}`, {
|
|
1356
|
+
...block.toBlockInfo(),
|
|
1357
|
+
indexWithinCheckpoint: block.indexWithinCheckpoint,
|
|
1358
|
+
maxBlocksPerCheckpoint: this.config.maxBlocksPerCheckpoint,
|
|
1359
|
+
source: peerId.toString(),
|
|
1360
|
+
proposer: proposer.toString(),
|
|
1361
|
+
});
|
|
1362
|
+
this.oversizedProposalCallback?.({ slot: block.slotNumber, proposer });
|
|
1363
|
+
}
|
|
1364
|
+
}
|
|
1365
|
+
|
|
1253
1366
|
// If this was a duplicate proposal, do not process it, but do invoke the duplicate callback,
|
|
1254
1367
|
// and do re-broadcast it so other nodes in the network know to slash the proposer
|
|
1255
1368
|
if (isEquivocated) {
|
|
@@ -1263,11 +1376,11 @@ export class LibP2PService extends WithTracer implements P2PService {
|
|
|
1263
1376
|
if (proposer && count === 2) {
|
|
1264
1377
|
this.duplicateProposalCallback?.({ slot: block.slotNumber, proposer, type: 'block' });
|
|
1265
1378
|
}
|
|
1266
|
-
return { result: TopicValidatorResult.Accept, obj: block, metadata: { isEquivocated } };
|
|
1379
|
+
return { result: TopicValidatorResult.Accept, obj: block, metadata: { isEquivocated, isOversized } };
|
|
1267
1380
|
}
|
|
1268
1381
|
|
|
1269
1382
|
// Otherwise, we're good to go!
|
|
1270
|
-
return { result: TopicValidatorResult.Accept, obj: block };
|
|
1383
|
+
return { result: TopicValidatorResult.Accept, obj: block, metadata: { isEquivocated: false, isOversized } };
|
|
1271
1384
|
}
|
|
1272
1385
|
|
|
1273
1386
|
// REFACTOR(palla): This method should be moved to the p2p_client or to a separate component,
|
|
@@ -1293,6 +1406,9 @@ export class LibP2PService extends WithTracer implements P2PService {
|
|
|
1293
1406
|
const isValid = await this.blockReceivedCallback(block, sender);
|
|
1294
1407
|
if (!isValid) {
|
|
1295
1408
|
this.logger.info(`Block proposal validation failed for block ${block.blockNumber}`, block.toBlockInfo());
|
|
1409
|
+
// Release the protections this proposal created so its txs return to pending. Only entries still
|
|
1410
|
+
// keyed to this slot are cleared, so a tx referenced by a live proposal at another slot stays protected.
|
|
1411
|
+
await this.mempools.txPool.unprotectTxs(block.txHashes, slot);
|
|
1296
1412
|
}
|
|
1297
1413
|
}
|
|
1298
1414
|
|
|
@@ -1304,25 +1420,45 @@ export class LibP2PService extends WithTracer implements P2PService {
|
|
|
1304
1420
|
const {
|
|
1305
1421
|
result,
|
|
1306
1422
|
obj: checkpoint,
|
|
1307
|
-
metadata: { isEquivocated, processBlock } = {},
|
|
1308
|
-
} = await this.validateReceivedMessage<
|
|
1423
|
+
metadata: { isEquivocated, processBlock, isOversized } = {},
|
|
1424
|
+
} = await this.validateReceivedMessage<
|
|
1425
|
+
CheckpointProposal,
|
|
1426
|
+
{ isEquivocated: boolean; processBlock: boolean; isOversized: boolean }
|
|
1427
|
+
>(
|
|
1309
1428
|
() => this.validateAndStoreCheckpointProposal(source, CheckpointProposal.fromBuffer(payloadData)),
|
|
1310
1429
|
msgId,
|
|
1311
1430
|
source,
|
|
1312
1431
|
TopicType.checkpoint_proposal,
|
|
1313
1432
|
);
|
|
1314
1433
|
|
|
1434
|
+
// An oversized checkpoint is re-broadcast as slashing evidence but never attested or processed.
|
|
1435
|
+
// Process checkpoint proposal if valid and neither equivocated nor oversized.
|
|
1436
|
+
const processCheckpointFn = () =>
|
|
1437
|
+
result === TopicValidatorResult.Accept && checkpoint && !isEquivocated && !isOversized
|
|
1438
|
+
? this.processValidCheckpointProposal(checkpoint.toCore(), source)
|
|
1439
|
+
: Promise.resolve();
|
|
1440
|
+
|
|
1315
1441
|
// If the checkpoint contained a valid last block, we process it even if the checkpoint itself is to be rejected
|
|
1316
1442
|
// TODO(palla/mbps): Is this ok? Should we be considering a block from a checkpoint that was equivocated?
|
|
1317
|
-
|
|
1318
|
-
|
|
1319
|
-
|
|
1320
|
-
|
|
1321
|
-
|
|
1443
|
+
const processBlockFn = () =>
|
|
1444
|
+
processBlock && checkpoint && checkpoint.getBlockProposal()
|
|
1445
|
+
? this.processValidBlockProposal(checkpoint.getBlockProposal()!, source)
|
|
1446
|
+
: Promise.resolve();
|
|
1447
|
+
|
|
1448
|
+
// A node that skips checkpoint validation attests without re-executing the embedded last block, so run
|
|
1449
|
+
// the checkpoint callback first: this creates and broadcasts the attestation before the block is
|
|
1450
|
+
// processed. Otherwise the block's re-execution — which can stall until the re-execution deadline
|
|
1451
|
+
// waiting for a parent that may never arrive — would delay the attestation past the slot's attestation
|
|
1452
|
+
// window, after which peers reject it as stale.
|
|
1453
|
+
if (this.config.skipCheckpointProposalValidation) {
|
|
1454
|
+
await processCheckpointFn();
|
|
1455
|
+
await processBlockFn();
|
|
1322
1456
|
return;
|
|
1323
1457
|
}
|
|
1324
1458
|
|
|
1325
|
-
|
|
1459
|
+
// Process the block first, since it's required for the checkpoint proposal validation.
|
|
1460
|
+
await processBlockFn();
|
|
1461
|
+
await processCheckpointFn();
|
|
1326
1462
|
}
|
|
1327
1463
|
|
|
1328
1464
|
/**
|
|
@@ -1335,7 +1471,12 @@ export class LibP2PService extends WithTracer implements P2PService {
|
|
|
1335
1471
|
protected async validateAndStoreCheckpointProposal(
|
|
1336
1472
|
peerId: PeerId,
|
|
1337
1473
|
checkpoint: CheckpointProposal,
|
|
1338
|
-
): Promise<
|
|
1474
|
+
): Promise<
|
|
1475
|
+
ReceivedMessageValidationResult<
|
|
1476
|
+
CheckpointProposal,
|
|
1477
|
+
{ isEquivocated: boolean; processBlock: boolean; isOversized: boolean }
|
|
1478
|
+
>
|
|
1479
|
+
> {
|
|
1339
1480
|
const validationResult = await this.checkpointProposalValidator.validate(checkpoint);
|
|
1340
1481
|
|
|
1341
1482
|
if (validationResult.result === 'reject') {
|
|
@@ -1350,13 +1491,16 @@ export class LibP2PService extends WithTracer implements P2PService {
|
|
|
1350
1491
|
// Extract and try to add the block proposal first if present
|
|
1351
1492
|
const blockProposal = checkpoint.getBlockProposal();
|
|
1352
1493
|
let processBlock = false;
|
|
1494
|
+
let isOversized = false;
|
|
1353
1495
|
if (blockProposal) {
|
|
1354
1496
|
this.logger.debug(`Validating block proposal from propagated checkpoint`, {
|
|
1355
1497
|
[Attributes.SLOT_NUMBER]: checkpoint.slotNumber.toString(),
|
|
1356
1498
|
[Attributes.P2P_ID]: peerId.toString(),
|
|
1357
1499
|
});
|
|
1358
1500
|
const blockProposalResult = await this.validateAndStoreBlockProposal(peerId, blockProposal);
|
|
1359
|
-
const { obj, metadata: { isEquivocated } = {} } = blockProposalResult;
|
|
1501
|
+
const { obj, metadata: { isEquivocated, isOversized: blockIsOversized } = {} } = blockProposalResult;
|
|
1502
|
+
isOversized = blockIsOversized ?? false;
|
|
1503
|
+
|
|
1360
1504
|
if (blockProposalResult.result === TopicValidatorResult.Reject || !obj || isEquivocated) {
|
|
1361
1505
|
this.logger.debug(`Rejecting checkpoint due to invalid last block proposal`, {
|
|
1362
1506
|
[Attributes.SLOT_NUMBER]: checkpoint.slotNumber.toString(),
|
|
@@ -1369,7 +1513,8 @@ export class LibP2PService extends WithTracer implements P2PService {
|
|
|
1369
1513
|
severity:
|
|
1370
1514
|
'severity' in blockProposalResult ? blockProposalResult.severity : PeerErrorSeverity.MidToleranceError,
|
|
1371
1515
|
};
|
|
1372
|
-
} else if (blockProposalResult.result === TopicValidatorResult.Accept && obj && !isEquivocated) {
|
|
1516
|
+
} else if (blockProposalResult.result === TopicValidatorResult.Accept && obj && !isEquivocated && !isOversized) {
|
|
1517
|
+
// An oversized terminal block is re-broadcast as slashing evidence but never processed.
|
|
1373
1518
|
processBlock = true;
|
|
1374
1519
|
}
|
|
1375
1520
|
}
|
|
@@ -1389,11 +1534,11 @@ export class LibP2PService extends WithTracer implements P2PService {
|
|
|
1389
1534
|
return {
|
|
1390
1535
|
result: TopicValidatorResult.Ignore,
|
|
1391
1536
|
obj: checkpoint,
|
|
1392
|
-
metadata: { isEquivocated, processBlock },
|
|
1537
|
+
metadata: { isEquivocated, processBlock, isOversized },
|
|
1393
1538
|
};
|
|
1394
1539
|
}
|
|
1395
1540
|
|
|
1396
|
-
// Too many checkpoint proposals received for this slot, penalize peer and do not re-broadcast
|
|
1541
|
+
// Too many checkpoint proposals received for this slot, penalize peer and do not re-broadcast.
|
|
1397
1542
|
// Note: We still return the checkpoint obj so the lastBlock can be processed if valid
|
|
1398
1543
|
if (!added) {
|
|
1399
1544
|
this.logger.warn(`Penalizing peer for checkpoint proposal exceeding per-slot cap`, {
|
|
@@ -1404,7 +1549,7 @@ export class LibP2PService extends WithTracer implements P2PService {
|
|
|
1404
1549
|
return {
|
|
1405
1550
|
result: TopicValidatorResult.Reject,
|
|
1406
1551
|
obj: checkpoint,
|
|
1407
|
-
metadata: { isEquivocated, processBlock },
|
|
1552
|
+
metadata: { isEquivocated, processBlock, isOversized },
|
|
1408
1553
|
severity: PeerErrorSeverity.HighToleranceError,
|
|
1409
1554
|
};
|
|
1410
1555
|
}
|
|
@@ -1425,12 +1570,16 @@ export class LibP2PService extends WithTracer implements P2PService {
|
|
|
1425
1570
|
return {
|
|
1426
1571
|
result: TopicValidatorResult.Accept,
|
|
1427
1572
|
obj: checkpoint,
|
|
1428
|
-
metadata: { isEquivocated, processBlock },
|
|
1573
|
+
metadata: { isEquivocated, processBlock, isOversized },
|
|
1429
1574
|
};
|
|
1430
1575
|
}
|
|
1431
1576
|
|
|
1432
1577
|
// Otherwise, we're good to go!
|
|
1433
|
-
return {
|
|
1578
|
+
return {
|
|
1579
|
+
result: TopicValidatorResult.Accept,
|
|
1580
|
+
obj: checkpoint,
|
|
1581
|
+
metadata: { processBlock, isEquivocated, isOversized },
|
|
1582
|
+
};
|
|
1434
1583
|
}
|
|
1435
1584
|
|
|
1436
1585
|
/**
|
|
@@ -1478,82 +1627,87 @@ export class LibP2PService extends WithTracer implements P2PService {
|
|
|
1478
1627
|
}
|
|
1479
1628
|
|
|
1480
1629
|
/**
|
|
1481
|
-
* Validate the requested block transactions
|
|
1630
|
+
* Validate the requested block transactions request-response consistency.
|
|
1631
|
+
* It does NOT validate the transactions themselves.
|
|
1482
1632
|
* @param request - The block transactions request.
|
|
1483
1633
|
* @param response - The block transactions response.
|
|
1484
1634
|
* @param peerId - The ID of the peer that made the request.
|
|
1485
|
-
* @returns True if the
|
|
1635
|
+
* @returns True if the request-response is consistent, false otherwise.
|
|
1486
1636
|
*/
|
|
1487
|
-
@trackSpan('Libp2pService.
|
|
1637
|
+
@trackSpan('Libp2pService.validateRequestedBlockTxsConsistency', request => ({
|
|
1488
1638
|
[Attributes.BLOCK_ARCHIVE]: request.archiveRoot.toString(),
|
|
1489
1639
|
}))
|
|
1490
|
-
protected async
|
|
1640
|
+
protected async validateRequestedBlockTxsConsistency(
|
|
1491
1641
|
request: BlockTxsRequest,
|
|
1492
1642
|
response: BlockTxsResponse,
|
|
1493
1643
|
peerId: PeerId,
|
|
1494
1644
|
): Promise<boolean> {
|
|
1495
|
-
const requestedTxValidator = this.createRequestedTxValidator();
|
|
1496
|
-
|
|
1497
1645
|
try {
|
|
1498
|
-
|
|
1646
|
+
// Check for duplicates txs (or hashes) in the response.
|
|
1647
|
+
const returnedHashes = response.txs.map(tx => tx.getTxHash().toString());
|
|
1648
|
+
const uniqueReturned = new Set(returnedHashes.map(h => h.toString()));
|
|
1649
|
+
if (uniqueReturned.size !== returnedHashes.length) {
|
|
1499
1650
|
this.peerManager.penalizePeer(peerId, PeerErrorSeverity.MidToleranceError);
|
|
1500
|
-
throw new ValidationError(
|
|
1501
|
-
|
|
1651
|
+
throw new ValidationError(`Received duplicate txs in block txs response`);
|
|
1652
|
+
}
|
|
1653
|
+
|
|
1654
|
+
// We get the block tx hashes from the proposal or the archiver.
|
|
1655
|
+
const proposal = await this.mempools.attestationPool.getBlockProposalByArchive(request.archiveRoot.toString());
|
|
1656
|
+
const blockTxHashes =
|
|
1657
|
+
proposal?.txHashes ??
|
|
1658
|
+
(await this.archiver.getBlock({ archive: request.archiveRoot }))?.body.txEffects.map(e => e.txHash);
|
|
1659
|
+
|
|
1660
|
+
// If we don't have the block, we can't verify membership/order of the returned txs.
|
|
1661
|
+
if (!blockTxHashes) {
|
|
1662
|
+
// This shouldn't happen, since we asked for the block (proposal).
|
|
1663
|
+
// Neither a local proposal nor an archived block: we cannot verify membership/order of the
|
|
1664
|
+
// returned txs. This is a local-state gap, not a peer fault, so we do not penalize.
|
|
1665
|
+
this.logger.warn(
|
|
1666
|
+
`Block ${request.archiveRoot.toString()} not found in attestation pool or archiver; cannot validate membership/order of returned txs`,
|
|
1502
1667
|
);
|
|
1668
|
+
// NOTE: We mark the response as invalid, given the limitations of a true/false return value.
|
|
1669
|
+
return false;
|
|
1503
1670
|
}
|
|
1504
1671
|
|
|
1505
|
-
|
|
1506
|
-
|
|
1672
|
+
// Verify that the returned tx hashes are a subset of (tx hashes by index) U (explicitly requested tx hashes).
|
|
1673
|
+
const uniqueRequestedHashes = new Set([
|
|
1674
|
+
// tx hashes requested by index.
|
|
1675
|
+
...request.txIndices.getTrueIndices().map(i => blockTxHashes[i].toString()),
|
|
1676
|
+
// explicitly requested tx hashes.
|
|
1677
|
+
...request.txHashes.map(h => h.toString()),
|
|
1678
|
+
]);
|
|
1679
|
+
if (!returnedHashes.every(h => uniqueRequestedHashes.has(h))) {
|
|
1680
|
+
this.peerManager.penalizePeer(peerId, PeerErrorSeverity.LowToleranceError);
|
|
1507
1681
|
throw new ValidationError(
|
|
1508
|
-
|
|
1682
|
+
'Returned txs should be a subset of (tx hashes by index) U (explicitly requested tx hashes)',
|
|
1509
1683
|
);
|
|
1510
1684
|
}
|
|
1511
1685
|
|
|
1512
|
-
//
|
|
1513
|
-
|
|
1514
|
-
|
|
1515
|
-
|
|
1516
|
-
|
|
1517
|
-
const returnedHashes = await Promise.all(response.txs.map(tx => tx.getTxHash().toString()));
|
|
1518
|
-
const uniqueReturned = new Set(returnedHashes.map(h => h.toString()));
|
|
1519
|
-
if (uniqueReturned.size !== returnedHashes.length) {
|
|
1520
|
-
this.peerManager.penalizePeer(peerId, PeerErrorSeverity.MidToleranceError);
|
|
1521
|
-
throw new ValidationError(`Received duplicate txs in block txs response`);
|
|
1686
|
+
// Tx indices information is optional, but if present, we need to verify a few things.
|
|
1687
|
+
if (!response.peerHasBlock()) {
|
|
1688
|
+
this.logger.debug(`Peer ${peerId.toString()} signalled missing block`);
|
|
1689
|
+
return true;
|
|
1522
1690
|
}
|
|
1523
|
-
|
|
1691
|
+
|
|
1692
|
+
// If the response has a non-empty bitvector, it needs to be consistent with the number of txs in the block.
|
|
1693
|
+
if (response.txIndices.getLength() !== blockTxHashes.length) {
|
|
1524
1694
|
this.peerManager.penalizePeer(peerId, PeerErrorSeverity.MidToleranceError);
|
|
1525
1695
|
throw new ValidationError(
|
|
1526
|
-
`Received
|
|
1696
|
+
`Received block txs with mismatched bitvector length: expected ${blockTxHashes.length}, got ${response.txIndices.getLength()}`,
|
|
1527
1697
|
);
|
|
1528
1698
|
}
|
|
1529
1699
|
|
|
1530
|
-
//
|
|
1531
|
-
|
|
1532
|
-
|
|
1533
|
-
|
|
1534
|
-
|
|
1535
|
-
|
|
1536
|
-
|
|
1537
|
-
|
|
1538
|
-
|
|
1539
|
-
);
|
|
1540
|
-
const allowedIndexSet = new Set(intersectIdx);
|
|
1541
|
-
const indices = returnedHashes.map(h => hashToIndexInProposal.get(h));
|
|
1542
|
-
const allAllowed = indices.every(idx => idx !== undefined && allowedIndexSet.has(idx));
|
|
1543
|
-
const strictlyIncreasing = indices.every((idx, i) => (i === 0 ? idx !== undefined : idx! > indices[i - 1]!));
|
|
1544
|
-
if (!allAllowed || !strictlyIncreasing) {
|
|
1545
|
-
this.peerManager.penalizePeer(peerId, PeerErrorSeverity.LowToleranceError);
|
|
1546
|
-
throw new ValidationError('Returned txs do not match expected subset/order for requested indices');
|
|
1547
|
-
}
|
|
1548
|
-
} else {
|
|
1549
|
-
// No local proposal, cannot check the membership/order of the returned txs
|
|
1550
|
-
this.logger.warn(
|
|
1551
|
-
`Block proposal not found for archive root ${request.archiveRoot.toString()}; cannot validate membership/order of returned txs`,
|
|
1552
|
-
);
|
|
1553
|
-
return false;
|
|
1700
|
+
// For every index we requested that the peer claims to have (per its bitvector), the
|
|
1701
|
+
// corresponding tx must be present in the response. A peer advertising availability but
|
|
1702
|
+
// withholding the tx is inconsistent.
|
|
1703
|
+
const returnedHashSet = new Set(returnedHashes);
|
|
1704
|
+
const expectedIndices = request.txIndices.getTrueIndices().filter(i => response.txIndices.isSet(i));
|
|
1705
|
+
const missingExpected = expectedIndices.some(i => !returnedHashSet.has(blockTxHashes[i].toString()));
|
|
1706
|
+
if (missingExpected) {
|
|
1707
|
+
this.peerManager.penalizePeer(peerId, PeerErrorSeverity.LowToleranceError);
|
|
1708
|
+
throw new ValidationError('Peer advertised requested txs via indices but did not return them');
|
|
1554
1709
|
}
|
|
1555
1710
|
|
|
1556
|
-
await Promise.all(response.txs.map(tx => this.validateRequestedTx(tx, peerId, requestedTxValidator)));
|
|
1557
1711
|
return true;
|
|
1558
1712
|
} catch (e: any) {
|
|
1559
1713
|
if (e instanceof ValidationError) {
|
|
@@ -1566,125 +1720,8 @@ export class LibP2PService extends WithTracer implements P2PService {
|
|
|
1566
1720
|
}
|
|
1567
1721
|
}
|
|
1568
1722
|
|
|
1569
|
-
|
|
1570
|
-
|
|
1571
|
-
*
|
|
1572
|
-
* The core component of this validator is that each tx hash MUST match the requested tx hash,
|
|
1573
|
-
* In order to perform this check, the tx proof must be verified.
|
|
1574
|
-
*
|
|
1575
|
-
* Note: This function is called from within `ReqResp.sendRequest` as part of the
|
|
1576
|
-
* ReqRespSubProtocol.TX subprotocol validation.
|
|
1577
|
-
*
|
|
1578
|
-
* @param requestedTxHash - The collection of the txs that was requested.
|
|
1579
|
-
* @param responseTx - The collection of txs that was received as a response to the request.
|
|
1580
|
-
* @param peerId - The peer ID of the peer that sent the tx.
|
|
1581
|
-
* @returns True if the whole collection of txs is valid, false otherwise.
|
|
1582
|
-
*/
|
|
1583
|
-
@trackSpan('Libp2pService.validateRequestedTx', (requestedTxHash, _responseTx) => ({
|
|
1584
|
-
[Attributes.TX_HASH]: requestedTxHash.toString(),
|
|
1585
|
-
}))
|
|
1586
|
-
private async validateRequestedTxs(requestedTxHash: TxHash[], responseTx: Tx[], peerId: PeerId): Promise<boolean> {
|
|
1587
|
-
const requested = new Set(requestedTxHash.map(h => h.toString()));
|
|
1588
|
-
const requestedTxValidator = this.createRequestedTxValidator();
|
|
1589
|
-
|
|
1590
|
-
//TODO: (mralj) - this is somewhat naive implementation, if single tx is invalid we consider the whole response invalid.
|
|
1591
|
-
// I think we should still extract the valid txs and return them, so that we can still use the response.
|
|
1592
|
-
try {
|
|
1593
|
-
await Promise.all(responseTx.map(tx => this.validateRequestedTx(tx, peerId, requestedTxValidator, requested)));
|
|
1594
|
-
return true;
|
|
1595
|
-
} catch (e: any) {
|
|
1596
|
-
if (e instanceof ValidationError) {
|
|
1597
|
-
this.logger.warn(`Failed to validate requested txs from peer ${peerId.toString()}, reason ${e.message}`);
|
|
1598
|
-
} else {
|
|
1599
|
-
this.logger.error(`Error during validation of requested txs`, e);
|
|
1600
|
-
}
|
|
1601
|
-
|
|
1602
|
-
return false;
|
|
1603
|
-
}
|
|
1604
|
-
}
|
|
1605
|
-
|
|
1606
|
-
/**
|
|
1607
|
-
* Validates a BLOCK response.
|
|
1608
|
-
*
|
|
1609
|
-
* If a local copy exists, enforces hash equality. If missing, rejects (no penalty) since the hash cannot be verified.
|
|
1610
|
-
* Penalizes on block number mismatch or hash mismatch.
|
|
1611
|
-
*
|
|
1612
|
-
* @param requestedBlockNumber - The requested block number.
|
|
1613
|
-
* @param responseBlock - The block returned by the peer.
|
|
1614
|
-
* @param peerId - The peer that returned the block.
|
|
1615
|
-
* @returns True if the response is valid, false otherwise.
|
|
1616
|
-
*/
|
|
1617
|
-
@trackSpan('Libp2pService.validateRequestedBlock', (requestedBlockNumber, _responseBlock) => ({
|
|
1618
|
-
[Attributes.BLOCK_NUMBER]: requestedBlockNumber.toString(),
|
|
1619
|
-
}))
|
|
1620
|
-
protected async validateRequestedBlock(
|
|
1621
|
-
requestedBlockNumber: Fr,
|
|
1622
|
-
responseBlock: L2Block,
|
|
1623
|
-
peerId: PeerId,
|
|
1624
|
-
): Promise<boolean> {
|
|
1625
|
-
try {
|
|
1626
|
-
const reqNum = Number(requestedBlockNumber.toString());
|
|
1627
|
-
if (responseBlock.number !== reqNum) {
|
|
1628
|
-
this.peerManager.penalizePeer(peerId, PeerErrorSeverity.LowToleranceError);
|
|
1629
|
-
return false;
|
|
1630
|
-
}
|
|
1631
|
-
|
|
1632
|
-
const local = await this.archiver.getBlock(BlockNumber(reqNum));
|
|
1633
|
-
if (!local) {
|
|
1634
|
-
// We are missing the local block; we cannot verify the hash yet. Reject without penalizing.
|
|
1635
|
-
// TODO: Consider extending this validator to accept an expected hash or
|
|
1636
|
-
// performing quorum-based checks when using P2P syncing prior to L1 sync.
|
|
1637
|
-
this.logger.warn(`Local block ${reqNum} not found; rejecting BLOCK response without hash verification`);
|
|
1638
|
-
return false;
|
|
1639
|
-
}
|
|
1640
|
-
const [localHash, respHash] = await Promise.all([local.hash(), responseBlock.hash()]);
|
|
1641
|
-
if (!localHash.equals(respHash)) {
|
|
1642
|
-
this.peerManager.penalizePeer(peerId, PeerErrorSeverity.MidToleranceError);
|
|
1643
|
-
return false;
|
|
1644
|
-
}
|
|
1645
|
-
|
|
1646
|
-
return true;
|
|
1647
|
-
} catch (e) {
|
|
1648
|
-
this.logger.warn(`Error validating requested block`, e);
|
|
1649
|
-
return false;
|
|
1650
|
-
}
|
|
1651
|
-
}
|
|
1652
|
-
|
|
1653
|
-
protected async validateRequestedTx(
|
|
1654
|
-
tx: Tx,
|
|
1655
|
-
peerId: PeerId,
|
|
1656
|
-
txValidator: TxValidator,
|
|
1657
|
-
requested?: Set<`0x${string}`>,
|
|
1658
|
-
) {
|
|
1659
|
-
const penalize = (severity: PeerErrorSeverity) => this.peerManager.penalizePeer(peerId, severity);
|
|
1660
|
-
if (requested && !requested.has(tx.getTxHash().toString())) {
|
|
1661
|
-
penalize(PeerErrorSeverity.MidToleranceError);
|
|
1662
|
-
throw new ValidationError(`Received tx with hash ${tx.getTxHash().toString()} that was not requested.`);
|
|
1663
|
-
}
|
|
1664
|
-
|
|
1665
|
-
const { result } = await txValidator.validateTx(tx);
|
|
1666
|
-
if (result === 'invalid') {
|
|
1667
|
-
penalize(PeerErrorSeverity.LowToleranceError);
|
|
1668
|
-
throw new ValidationError(`Received tx with hash ${tx.getTxHash().toString()} that is invalid.`);
|
|
1669
|
-
}
|
|
1670
|
-
}
|
|
1671
|
-
|
|
1672
|
-
protected createRequestedTxValidator(): TxValidator {
|
|
1673
|
-
return createTxValidatorForReqResponseReceivedTxs(this.proofVerifier, {
|
|
1674
|
-
l1ChainId: this.config.l1ChainId,
|
|
1675
|
-
rollupVersion: this.config.rollupVersion,
|
|
1676
|
-
});
|
|
1677
|
-
}
|
|
1678
|
-
|
|
1679
|
-
private async getGasFees(blockNumber: BlockNumber): Promise<GasFees> {
|
|
1680
|
-
if (blockNumber === this.feesCache?.blockNumber) {
|
|
1681
|
-
return this.feesCache.gasFees;
|
|
1682
|
-
}
|
|
1683
|
-
|
|
1684
|
-
const header = await this.archiver.getBlockHeader(blockNumber);
|
|
1685
|
-
const gasFees = header?.globalVariables.gasFees ?? GasFees.empty();
|
|
1686
|
-
this.feesCache = { blockNumber, gasFees };
|
|
1687
|
-
return gasFees;
|
|
1723
|
+
private getGasFees(): Promise<GasFees> {
|
|
1724
|
+
return this.blockMinFeesProvider.getCurrentMinFees();
|
|
1688
1725
|
}
|
|
1689
1726
|
|
|
1690
1727
|
/**
|
|
@@ -1698,8 +1735,10 @@ export class LibP2PService extends WithTracer implements P2PService {
|
|
|
1698
1735
|
l1ChainId: this.config.l1ChainId,
|
|
1699
1736
|
rollupVersion: this.config.rollupVersion,
|
|
1700
1737
|
proofVerifier: this.proofVerifier,
|
|
1738
|
+
txValidationCache: this.txValidationCache,
|
|
1701
1739
|
},
|
|
1702
1740
|
peerScoring: this.peerManager,
|
|
1741
|
+
validateRequestedBlockTxsConsistency: this.validateRequestedBlockTxsConsistency.bind(this),
|
|
1703
1742
|
};
|
|
1704
1743
|
}
|
|
1705
1744
|
|
|
@@ -1708,6 +1747,7 @@ export class LibP2PService extends WithTracer implements P2PService {
|
|
|
1708
1747
|
this.proofVerifier,
|
|
1709
1748
|
{ l1ChainId: this.config.l1ChainId, rollupVersion: this.config.rollupVersion },
|
|
1710
1749
|
this.logger.getBindings(),
|
|
1750
|
+
this.txValidationCache,
|
|
1711
1751
|
);
|
|
1712
1752
|
|
|
1713
1753
|
const results = await Promise.all(
|
|
@@ -1726,13 +1766,14 @@ export class LibP2PService extends WithTracer implements P2PService {
|
|
|
1726
1766
|
currentBlockNumber: BlockNumber,
|
|
1727
1767
|
nextSlotTimestamp: UInt64,
|
|
1728
1768
|
): Promise<Record<string, TransactionValidator>> {
|
|
1729
|
-
const gasFees = await this.getGasFees(
|
|
1769
|
+
const gasFees = await this.getGasFees();
|
|
1730
1770
|
const allowedInSetup = [
|
|
1731
1771
|
...(await getDefaultAllowedSetupFunctions()),
|
|
1732
1772
|
...(this.config.txPublicSetupAllowListExtend ?? []),
|
|
1733
1773
|
];
|
|
1734
1774
|
const blockNumber = BlockNumber(currentBlockNumber + 1);
|
|
1735
1775
|
const l1Constants = await this.archiver.getL1Constants();
|
|
1776
|
+
const networkTxGasLimits = getNetworkTxGasLimits(this.config, l1Constants);
|
|
1736
1777
|
|
|
1737
1778
|
return createFirstStageTxValidationsForGossipedTransactions(
|
|
1738
1779
|
nextSlotTimestamp,
|
|
@@ -1747,9 +1788,8 @@ export class LibP2PService extends WithTracer implements P2PService {
|
|
|
1747
1788
|
allowedInSetup,
|
|
1748
1789
|
this.logger.getBindings(),
|
|
1749
1790
|
{
|
|
1750
|
-
|
|
1751
|
-
|
|
1752
|
-
maxBlockDAGas: this.config.validateMaxDABlockGas,
|
|
1791
|
+
maxTxL2Gas: networkTxGasLimits.l2Gas,
|
|
1792
|
+
maxTxDAGas: networkTxGasLimits.daGas,
|
|
1753
1793
|
},
|
|
1754
1794
|
);
|
|
1755
1795
|
}
|