@aztec/p2p 0.0.1-commit.b1c78909e → 0.0.1-commit.b2a5d0dd1
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 +129 -3
- package/dest/client/factory.d.ts +3 -2
- package/dest/client/factory.d.ts.map +1 -1
- package/dest/client/factory.js +19 -10
- package/dest/client/interface.d.ts +9 -2
- package/dest/client/interface.d.ts.map +1 -1
- package/dest/client/p2p_client.d.ts +3 -2
- package/dest/client/p2p_client.d.ts.map +1 -1
- package/dest/client/p2p_client.js +40 -14
- package/dest/client/test/tx_proposal_collector/proposal_tx_collector_worker.js +21 -7
- package/dest/config.d.ts +107 -97
- package/dest/config.d.ts.map +1 -1
- package/dest/config.js +20 -5
- package/dest/errors/p2p-service.error.d.ts +9 -0
- package/dest/errors/p2p-service.error.d.ts.map +1 -0
- package/dest/errors/p2p-service.error.js +10 -0
- package/dest/index.d.ts +1 -2
- package/dest/index.d.ts.map +1 -1
- package/dest/index.js +0 -1
- package/dest/mem_pools/attestation_pool/attestation_pool.d.ts +7 -5
- package/dest/mem_pools/attestation_pool/attestation_pool.d.ts.map +1 -1
- package/dest/mem_pools/attestation_pool/attestation_pool.js +11 -8
- package/dest/mem_pools/attestation_pool/attestation_pool_test_suite.js +6 -6
- package/dest/mem_pools/index.d.ts +1 -2
- package/dest/mem_pools/index.d.ts.map +1 -1
- package/dest/mem_pools/tx_pool_v2/eviction/fee_payer_balance_eviction_rule.d.ts +1 -1
- package/dest/mem_pools/tx_pool_v2/eviction/fee_payer_balance_eviction_rule.d.ts.map +1 -1
- package/dest/mem_pools/tx_pool_v2/eviction/fee_payer_balance_eviction_rule.js +2 -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 +10 -5
- package/dest/mem_pools/tx_pool_v2/interfaces.d.ts.map +1 -1
- package/dest/mem_pools/tx_pool_v2/tx_metadata.d.ts +13 -3
- package/dest/mem_pools/tx_pool_v2/tx_metadata.d.ts.map +1 -1
- package/dest/mem_pools/tx_pool_v2/tx_metadata.js +20 -7
- package/dest/mem_pools/tx_pool_v2/tx_pool_v2.d.ts +4 -2
- 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 +3 -0
- package/dest/mem_pools/tx_pool_v2/tx_pool_v2_impl.d.ts +1 -1
- 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 +13 -5
- package/dest/msg_validators/attestation_validator/attestation_validator.d.ts +5 -2
- package/dest/msg_validators/attestation_validator/attestation_validator.d.ts.map +1 -1
- package/dest/msg_validators/attestation_validator/attestation_validator.js +20 -11
- package/dest/msg_validators/attestation_validator/fisherman_attestation_validator.d.ts +4 -2
- package/dest/msg_validators/attestation_validator/fisherman_attestation_validator.d.ts.map +1 -1
- package/dest/msg_validators/attestation_validator/fisherman_attestation_validator.js +2 -2
- package/dest/msg_validators/clock_tolerance.d.ts +12 -1
- package/dest/msg_validators/clock_tolerance.d.ts.map +1 -1
- package/dest/msg_validators/clock_tolerance.js +54 -3
- package/dest/msg_validators/proposal_validator/block_proposal_validator.d.ts +2 -1
- package/dest/msg_validators/proposal_validator/block_proposal_validator.d.ts.map +1 -1
- package/dest/msg_validators/proposal_validator/checkpoint_proposal_validator.d.ts +2 -1
- package/dest/msg_validators/proposal_validator/checkpoint_proposal_validator.d.ts.map +1 -1
- package/dest/msg_validators/proposal_validator/proposal_validator.d.ts +3 -1
- package/dest/msg_validators/proposal_validator/proposal_validator.d.ts.map +1 -1
- package/dest/msg_validators/proposal_validator/proposal_validator.js +19 -11
- package/dest/msg_validators/tx_validator/archive_cache.js +1 -1
- package/dest/msg_validators/tx_validator/contract_instance_validator.d.ts +9 -0
- package/dest/msg_validators/tx_validator/contract_instance_validator.d.ts.map +1 -0
- package/dest/msg_validators/tx_validator/contract_instance_validator.js +48 -0
- package/dest/msg_validators/tx_validator/data_validator.d.ts +1 -1
- package/dest/msg_validators/tx_validator/data_validator.d.ts.map +1 -1
- package/dest/msg_validators/tx_validator/data_validator.js +35 -2
- package/dest/msg_validators/tx_validator/factory.d.ts +10 -2
- package/dest/msg_validators/tx_validator/factory.d.ts.map +1 -1
- package/dest/msg_validators/tx_validator/factory.js +26 -7
- package/dest/msg_validators/tx_validator/gas_validator.d.ts +36 -4
- package/dest/msg_validators/tx_validator/gas_validator.d.ts.map +1 -1
- package/dest/msg_validators/tx_validator/gas_validator.js +50 -33
- package/dest/msg_validators/tx_validator/phases_validator.d.ts +21 -1
- package/dest/msg_validators/tx_validator/phases_validator.d.ts.map +1 -1
- package/dest/msg_validators/tx_validator/phases_validator.js +28 -1
- 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/dummy_service.d.ts +6 -3
- package/dest/services/dummy_service.d.ts.map +1 -1
- package/dest/services/dummy_service.js +6 -1
- package/dest/services/encoding.d.ts +5 -1
- package/dest/services/encoding.d.ts.map +1 -1
- package/dest/services/encoding.js +7 -1
- package/dest/services/gossipsub/topic_score_params.d.ts +13 -2
- package/dest/services/gossipsub/topic_score_params.d.ts.map +1 -1
- package/dest/services/gossipsub/topic_score_params.js +21 -4
- 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 +19 -27
- package/dest/services/libp2p/libp2p_service.d.ts.map +1 -1
- package/dest/services/libp2p/libp2p_service.js +141 -130
- package/dest/services/peer-manager/peer_manager.d.ts +6 -2
- package/dest/services/peer-manager/peer_manager.d.ts.map +1 -1
- package/dest/services/peer-manager/peer_manager.js +37 -10
- package/dest/services/peer-manager/peer_scoring.d.ts +7 -2
- package/dest/services/peer-manager/peer_scoring.d.ts.map +1 -1
- package/dest/services/peer-manager/peer_scoring.js +32 -10
- package/dest/services/reqresp/batch-tx-requester/batch_tx_requester.d.ts +11 -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 +69 -65
- package/dest/services/reqresp/batch-tx-requester/interface.d.ts +3 -2
- package/dest/services/reqresp/batch-tx-requester/interface.d.ts.map +1 -1
- package/dest/services/reqresp/batch-tx-requester/missing_txs.d.ts +5 -4
- package/dest/services/reqresp/batch-tx-requester/missing_txs.d.ts.map +1 -1
- package/dest/services/reqresp/batch-tx-requester/missing_txs.js +13 -7
- package/dest/services/reqresp/batch-tx-requester/peer_collection.d.ts +3 -1
- package/dest/services/reqresp/batch-tx-requester/peer_collection.d.ts.map +1 -1
- package/dest/services/reqresp/batch-tx-requester/peer_collection.js +3 -0
- package/dest/services/reqresp/config.d.ts +3 -3
- package/dest/services/reqresp/config.d.ts.map +1 -1
- package/dest/services/reqresp/interface.d.ts +14 -9
- package/dest/services/reqresp/interface.d.ts.map +1 -1
- package/dest/services/reqresp/interface.js +10 -11
- 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/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_limiter.d.ts +5 -4
- package/dest/services/reqresp/rate-limiter/rate_limiter.d.ts.map +1 -1
- package/dest/services/reqresp/rate-limiter/rate_limiter.js +10 -8
- 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 +0 -10
- package/dest/services/reqresp/reqresp.d.ts +4 -2
- package/dest/services/reqresp/reqresp.d.ts.map +1 -1
- package/dest/services/reqresp/reqresp.js +28 -11
- package/dest/services/service.d.ts +5 -2
- package/dest/services/service.d.ts.map +1 -1
- package/dest/services/tx_collection/fast_tx_collection.d.ts +1 -4
- package/dest/services/tx_collection/fast_tx_collection.d.ts.map +1 -1
- package/dest/services/tx_collection/fast_tx_collection.js +57 -73
- package/dest/services/tx_collection/file_store_tx_source.d.ts +5 -4
- package/dest/services/tx_collection/file_store_tx_source.d.ts.map +1 -1
- package/dest/services/tx_collection/file_store_tx_source.js +39 -29
- package/dest/services/tx_collection/proposal_tx_collector.d.ts +6 -7
- package/dest/services/tx_collection/proposal_tx_collector.d.ts.map +1 -1
- package/dest/services/tx_collection/proposal_tx_collector.js +4 -4
- package/dest/services/tx_collection/request_tracker.d.ts +53 -0
- package/dest/services/tx_collection/request_tracker.d.ts.map +1 -0
- package/dest/services/tx_collection/request_tracker.js +84 -0
- package/dest/services/tx_collection/slow_tx_collection.js +1 -1
- package/dest/services/tx_collection/tx_collection.d.ts +3 -6
- package/dest/services/tx_collection/tx_collection.d.ts.map +1 -1
- package/dest/services/tx_collection/tx_source.d.ts +6 -5
- package/dest/services/tx_collection/tx_source.d.ts.map +1 -1
- package/dest/services/tx_collection/tx_source.js +9 -7
- 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 +4 -1
- package/dest/test-helpers/mock-pubsub.d.ts +11 -3
- package/dest/test-helpers/mock-pubsub.d.ts.map +1 -1
- package/dest/test-helpers/mock-pubsub.js +36 -11
- package/dest/test-helpers/reqresp-nodes.d.ts +1 -1
- package/dest/test-helpers/reqresp-nodes.d.ts.map +1 -1
- package/dest/test-helpers/reqresp-nodes.js +5 -3
- package/dest/test-helpers/testbench-utils.d.ts +1 -1
- package/dest/test-helpers/testbench-utils.d.ts.map +1 -1
- package/dest/test-helpers/testbench-utils.js +21 -2
- package/dest/testbench/p2p_client_testbench_worker.d.ts +1 -1
- package/dest/testbench/p2p_client_testbench_worker.d.ts.map +1 -1
- package/dest/testbench/p2p_client_testbench_worker.js +73 -17
- package/dest/testbench/worker_client_manager.d.ts +8 -1
- package/dest/testbench/worker_client_manager.d.ts.map +1 -1
- package/dest/testbench/worker_client_manager.js +49 -1
- package/package.json +14 -14
- package/src/client/factory.ts +31 -4
- package/src/client/interface.ts +9 -1
- package/src/client/p2p_client.ts +47 -15
- package/src/client/test/tx_proposal_collector/proposal_tx_collector_worker.ts +20 -8
- package/src/config.ts +35 -6
- package/src/errors/p2p-service.error.ts +11 -0
- package/src/index.ts +0 -1
- package/src/mem_pools/attestation_pool/attestation_pool.ts +12 -8
- package/src/mem_pools/attestation_pool/attestation_pool_test_suite.ts +6 -6
- package/src/mem_pools/index.ts +0 -3
- package/src/mem_pools/tx_pool_v2/eviction/fee_payer_balance_eviction_rule.ts +2 -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 +9 -4
- package/src/mem_pools/tx_pool_v2/tx_metadata.ts +31 -9
- package/src/mem_pools/tx_pool_v2/tx_pool_v2.ts +13 -1
- package/src/mem_pools/tx_pool_v2/tx_pool_v2_impl.ts +14 -4
- package/src/msg_validators/attestation_validator/README.md +49 -0
- package/src/msg_validators/attestation_validator/attestation_validator.ts +21 -9
- package/src/msg_validators/attestation_validator/fisherman_attestation_validator.ts +4 -1
- package/src/msg_validators/clock_tolerance.ts +72 -3
- package/src/msg_validators/proposal_validator/README.md +123 -0
- package/src/msg_validators/proposal_validator/block_proposal_validator.ts +4 -1
- package/src/msg_validators/proposal_validator/checkpoint_proposal_validator.ts +4 -1
- package/src/msg_validators/proposal_validator/proposal_validator.ts +17 -10
- package/src/msg_validators/tx_validator/README.md +15 -3
- package/src/msg_validators/tx_validator/archive_cache.ts +1 -1
- package/src/msg_validators/tx_validator/contract_instance_validator.ts +56 -0
- package/src/msg_validators/tx_validator/data_validator.ts +42 -1
- package/src/msg_validators/tx_validator/factory.ts +31 -2
- package/src/msg_validators/tx_validator/gas_validator.ts +82 -33
- package/src/msg_validators/tx_validator/phases_validator.ts +31 -1
- package/src/services/data_store.ts +5 -13
- package/src/services/dummy_service.ts +8 -2
- package/src/services/encoding.ts +9 -1
- package/src/services/gossipsub/topic_score_params.ts +36 -4
- package/src/services/libp2p/instrumentation.ts +14 -0
- package/src/services/libp2p/libp2p_service.ts +141 -141
- package/src/services/peer-manager/peer_manager.ts +43 -10
- package/src/services/peer-manager/peer_scoring.ts +27 -5
- package/src/services/reqresp/README.md +229 -0
- package/src/services/reqresp/batch-tx-requester/README.md +46 -7
- package/src/services/reqresp/batch-tx-requester/batch_tx_requester.ts +64 -69
- package/src/services/reqresp/batch-tx-requester/interface.ts +2 -1
- package/src/services/reqresp/batch-tx-requester/missing_txs.ts +13 -6
- package/src/services/reqresp/batch-tx-requester/peer_collection.ts +5 -0
- package/src/services/reqresp/config.ts +2 -2
- package/src/services/reqresp/interface.ts +21 -11
- package/src/services/reqresp/metrics.ts +0 -1
- 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_limiter.ts +13 -9
- package/src/services/reqresp/rate-limiter/rate_limits.ts +0 -10
- package/src/services/reqresp/reqresp.ts +37 -12
- package/src/services/service.ts +6 -1
- package/src/services/tx_collection/fast_tx_collection.ts +57 -83
- package/src/services/tx_collection/file_store_tx_source.ts +43 -31
- package/src/services/tx_collection/proposal_tx_collector.ts +8 -13
- package/src/services/tx_collection/request_tracker.ts +127 -0
- package/src/services/tx_collection/slow_tx_collection.ts +1 -1
- package/src/services/tx_collection/tx_collection.ts +3 -5
- package/src/services/tx_collection/tx_source.ts +8 -7
- package/src/test-helpers/make-test-p2p-clients.ts +2 -0
- package/src/test-helpers/mock-pubsub.ts +34 -5
- package/src/test-helpers/reqresp-nodes.ts +4 -2
- package/src/test-helpers/testbench-utils.ts +29 -3
- package/src/testbench/p2p_client_testbench_worker.ts +73 -14
- package/src/testbench/worker_client_manager.ts +55 -1
- package/dest/mem_pools/tx_pool/aztec_kv_tx_pool.d.ts +0 -125
- package/dest/mem_pools/tx_pool/aztec_kv_tx_pool.d.ts.map +0 -1
- package/dest/mem_pools/tx_pool/aztec_kv_tx_pool.js +0 -596
- package/dest/mem_pools/tx_pool/eviction/eviction_manager.d.ts +0 -32
- package/dest/mem_pools/tx_pool/eviction/eviction_manager.d.ts.map +0 -1
- package/dest/mem_pools/tx_pool/eviction/eviction_manager.js +0 -112
- package/dest/mem_pools/tx_pool/eviction/eviction_strategy.d.ts +0 -157
- package/dest/mem_pools/tx_pool/eviction/eviction_strategy.d.ts.map +0 -1
- package/dest/mem_pools/tx_pool/eviction/eviction_strategy.js +0 -52
- package/dest/mem_pools/tx_pool/eviction/fee_payer_balance_eviction_rule.d.ts +0 -16
- package/dest/mem_pools/tx_pool/eviction/fee_payer_balance_eviction_rule.d.ts.map +0 -1
- package/dest/mem_pools/tx_pool/eviction/fee_payer_balance_eviction_rule.js +0 -122
- package/dest/mem_pools/tx_pool/eviction/invalid_txs_after_mining_rule.d.ts +0 -17
- package/dest/mem_pools/tx_pool/eviction/invalid_txs_after_mining_rule.d.ts.map +0 -1
- package/dest/mem_pools/tx_pool/eviction/invalid_txs_after_mining_rule.js +0 -84
- package/dest/mem_pools/tx_pool/eviction/invalid_txs_after_reorg_rule.d.ts +0 -19
- package/dest/mem_pools/tx_pool/eviction/invalid_txs_after_reorg_rule.d.ts.map +0 -1
- package/dest/mem_pools/tx_pool/eviction/invalid_txs_after_reorg_rule.js +0 -78
- package/dest/mem_pools/tx_pool/eviction/low_priority_eviction_rule.d.ts +0 -26
- package/dest/mem_pools/tx_pool/eviction/low_priority_eviction_rule.d.ts.map +0 -1
- package/dest/mem_pools/tx_pool/eviction/low_priority_eviction_rule.js +0 -84
- package/dest/mem_pools/tx_pool/eviction/nullifier_conflict_pre_add_rule.d.ts +0 -25
- package/dest/mem_pools/tx_pool/eviction/nullifier_conflict_pre_add_rule.d.ts.map +0 -1
- package/dest/mem_pools/tx_pool/eviction/nullifier_conflict_pre_add_rule.js +0 -57
- package/dest/mem_pools/tx_pool/index.d.ts +0 -3
- package/dest/mem_pools/tx_pool/index.d.ts.map +0 -1
- package/dest/mem_pools/tx_pool/index.js +0 -2
- package/dest/mem_pools/tx_pool/priority.d.ts +0 -12
- package/dest/mem_pools/tx_pool/priority.d.ts.map +0 -1
- package/dest/mem_pools/tx_pool/priority.js +0 -16
- package/dest/mem_pools/tx_pool/tx_pool.d.ts +0 -127
- package/dest/mem_pools/tx_pool/tx_pool.d.ts.map +0 -1
- package/dest/mem_pools/tx_pool/tx_pool.js +0 -3
- package/dest/mem_pools/tx_pool/tx_pool_test_suite.d.ts +0 -7
- package/dest/mem_pools/tx_pool/tx_pool_test_suite.d.ts.map +0 -1
- package/dest/mem_pools/tx_pool/tx_pool_test_suite.js +0 -402
- 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/missing_txs_tracker.d.ts +0 -32
- package/dest/services/tx_collection/missing_txs_tracker.d.ts.map +0 -1
- package/dest/services/tx_collection/missing_txs_tracker.js +0 -27
- package/src/mem_pools/tx_pool/README.md +0 -270
- package/src/mem_pools/tx_pool/aztec_kv_tx_pool.ts +0 -746
- package/src/mem_pools/tx_pool/eviction/eviction_manager.ts +0 -132
- package/src/mem_pools/tx_pool/eviction/eviction_strategy.ts +0 -208
- package/src/mem_pools/tx_pool/eviction/fee_payer_balance_eviction_rule.ts +0 -162
- package/src/mem_pools/tx_pool/eviction/invalid_txs_after_mining_rule.ts +0 -104
- package/src/mem_pools/tx_pool/eviction/invalid_txs_after_reorg_rule.ts +0 -93
- package/src/mem_pools/tx_pool/eviction/low_priority_eviction_rule.ts +0 -106
- package/src/mem_pools/tx_pool/eviction/nullifier_conflict_pre_add_rule.ts +0 -75
- package/src/mem_pools/tx_pool/index.ts +0 -2
- package/src/mem_pools/tx_pool/priority.ts +0 -23
- package/src/mem_pools/tx_pool/tx_pool.ts +0 -141
- package/src/mem_pools/tx_pool/tx_pool_test_suite.ts +0 -321
- package/src/services/reqresp/protocols/block.ts +0 -37
- package/src/services/tx_collection/missing_txs_tracker.ts +0 -52
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.b2a5d0dd1",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"exports": {
|
|
6
6
|
".": "./dest/index.js",
|
|
@@ -67,17 +67,17 @@
|
|
|
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/stdlib": "0.0.1-commit.
|
|
80
|
-
"@aztec/telemetry-client": "0.0.1-commit.
|
|
70
|
+
"@aztec/constants": "0.0.1-commit.b2a5d0dd1",
|
|
71
|
+
"@aztec/epoch-cache": "0.0.1-commit.b2a5d0dd1",
|
|
72
|
+
"@aztec/ethereum": "0.0.1-commit.b2a5d0dd1",
|
|
73
|
+
"@aztec/foundation": "0.0.1-commit.b2a5d0dd1",
|
|
74
|
+
"@aztec/kv-store": "0.0.1-commit.b2a5d0dd1",
|
|
75
|
+
"@aztec/noir-contracts.js": "0.0.1-commit.b2a5d0dd1",
|
|
76
|
+
"@aztec/noir-protocol-circuits-types": "0.0.1-commit.b2a5d0dd1",
|
|
77
|
+
"@aztec/protocol-contracts": "0.0.1-commit.b2a5d0dd1",
|
|
78
|
+
"@aztec/simulator": "0.0.1-commit.b2a5d0dd1",
|
|
79
|
+
"@aztec/stdlib": "0.0.1-commit.b2a5d0dd1",
|
|
80
|
+
"@aztec/telemetry-client": "0.0.1-commit.b2a5d0dd1",
|
|
81
81
|
"@chainsafe/libp2p-gossipsub": "13.0.0",
|
|
82
82
|
"@chainsafe/libp2p-noise": "^15.0.0",
|
|
83
83
|
"@chainsafe/libp2p-yamux": "^6.0.2",
|
|
@@ -104,8 +104,8 @@
|
|
|
104
104
|
"xxhash-wasm": "^1.1.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.b2a5d0dd1",
|
|
108
|
+
"@aztec/world-state": "0.0.1-commit.b2a5d0dd1",
|
|
109
109
|
"@jest/globals": "^30.0.0",
|
|
110
110
|
"@types/jest": "^30.0.0",
|
|
111
111
|
"@types/node": "^22.15.17",
|
package/src/client/factory.ts
CHANGED
|
@@ -7,6 +7,7 @@ import { AztecLMDBStoreV2, createStore } from '@aztec/kv-store/lmdb-v2';
|
|
|
7
7
|
import type { 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 } 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';
|
|
@@ -17,7 +18,12 @@ import { AttestationPool, type AttestationPoolApi } from '../mem_pools/attestati
|
|
|
17
18
|
import type { MemPools } from '../mem_pools/interface.js';
|
|
18
19
|
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
|
-
import {
|
|
21
|
+
import {
|
|
22
|
+
createCheckAllowedSetupCalls,
|
|
23
|
+
createTxValidatorForReqResponseReceivedTxs,
|
|
24
|
+
createTxValidatorForTransactionsEnteringPendingTxPool,
|
|
25
|
+
getDefaultAllowedSetupFunctions,
|
|
26
|
+
} from '../msg_validators/index.js';
|
|
21
27
|
import { DummyP2PService } from '../services/dummy_service.js';
|
|
22
28
|
import { LibP2PService } from '../services/index.js';
|
|
23
29
|
import { createFileStoreTxSources } from '../services/tx_collection/file_store_tx_source.js';
|
|
@@ -47,6 +53,7 @@ export async function createP2PClient(
|
|
|
47
53
|
proofVerifier: ClientProtocolCircuitVerifier,
|
|
48
54
|
worldStateSynchronizer: WorldStateSynchronizer,
|
|
49
55
|
epochCache: EpochCacheInterface,
|
|
56
|
+
blockMinFeesProvider: BlockMinFeesProvider,
|
|
50
57
|
packageVersion: string,
|
|
51
58
|
dateProvider: DateProvider = new DateProvider(),
|
|
52
59
|
telemetry: TelemetryClient = getTelemetryClient(),
|
|
@@ -75,6 +82,16 @@ export async function createP2PClient(
|
|
|
75
82
|
const rollupAddress = inputConfig.l1Contracts.rollupAddress.toString().toLowerCase().replace(/^0x/, '');
|
|
76
83
|
const txFileStoreBasePath = `aztec-${inputConfig.l1ChainId}-${inputConfig.rollupVersion}-0x${rollupAddress}`;
|
|
77
84
|
|
|
85
|
+
const allowedInSetup = [
|
|
86
|
+
...(await getDefaultAllowedSetupFunctions()),
|
|
87
|
+
...(inputConfig.txPublicSetupAllowListExtend ?? []),
|
|
88
|
+
];
|
|
89
|
+
const checkAllowedSetupCalls = createCheckAllowedSetupCalls(
|
|
90
|
+
archiver,
|
|
91
|
+
allowedInSetup,
|
|
92
|
+
() => epochCache.getEpochAndSlotInNextL1Slot().ts,
|
|
93
|
+
);
|
|
94
|
+
|
|
78
95
|
const txPool =
|
|
79
96
|
deps.txPool ??
|
|
80
97
|
new AztecKVTxPoolV2(
|
|
@@ -83,11 +100,12 @@ export async function createP2PClient(
|
|
|
83
100
|
{
|
|
84
101
|
l2BlockSource: archiver,
|
|
85
102
|
worldStateSynchronizer,
|
|
103
|
+
checkAllowedSetupCalls,
|
|
86
104
|
createTxValidator: async () => {
|
|
87
|
-
// We accept transactions if they are not expired by the next slot and block number (checked based on the ExpirationTimestamp field)
|
|
88
105
|
const currentBlockNumber = await archiver.getBlockNumber();
|
|
89
106
|
const { ts: nextSlotTimestamp } = epochCache.getEpochAndSlotInNextL1Slot();
|
|
90
107
|
const l1Constants = await archiver.getL1Constants();
|
|
108
|
+
const gasFees = await blockMinFeesProvider.getCurrentMinFees();
|
|
91
109
|
return createTxValidatorForTransactionsEnteringPendingTxPool(
|
|
92
110
|
worldStateSynchronizer,
|
|
93
111
|
nextSlotTimestamp,
|
|
@@ -97,8 +115,10 @@ export async function createP2PClient(
|
|
|
97
115
|
maxBlockL2Gas: config.validateMaxL2BlockGas,
|
|
98
116
|
maxBlockDAGas: config.validateMaxDABlockGas,
|
|
99
117
|
},
|
|
118
|
+
gasFees,
|
|
100
119
|
);
|
|
101
120
|
},
|
|
121
|
+
blockMinFeesProvider,
|
|
102
122
|
},
|
|
103
123
|
telemetry,
|
|
104
124
|
{
|
|
@@ -122,6 +142,7 @@ export async function createP2PClient(
|
|
|
122
142
|
proofVerifier,
|
|
123
143
|
worldStateSynchronizer,
|
|
124
144
|
epochCache,
|
|
145
|
+
blockMinFeesProvider,
|
|
125
146
|
store,
|
|
126
147
|
peerStore,
|
|
127
148
|
mempools,
|
|
@@ -131,9 +152,12 @@ export async function createP2PClient(
|
|
|
131
152
|
telemetry,
|
|
132
153
|
);
|
|
133
154
|
|
|
155
|
+
const txValidatorForTxCollection = createTxValidatorForReqResponseReceivedTxs(proofVerifier, config);
|
|
134
156
|
const nodeSources = [
|
|
135
|
-
...createNodeRpcTxSources(config.txCollectionNodeRpcUrls, config),
|
|
136
|
-
...(deps.rpcTxProviders ?? []).map(
|
|
157
|
+
...createNodeRpcTxSources(config.txCollectionNodeRpcUrls, txValidatorForTxCollection, config),
|
|
158
|
+
...(deps.rpcTxProviders ?? []).map(
|
|
159
|
+
(node, i) => new NodeRpcTxSource(node, txValidatorForTxCollection, `node-rpc-provider-${i}`),
|
|
160
|
+
),
|
|
137
161
|
...(deps.txCollectionNodeSources ?? []),
|
|
138
162
|
];
|
|
139
163
|
if (nodeSources.length > 0) {
|
|
@@ -145,6 +169,7 @@ export async function createP2PClient(
|
|
|
145
169
|
const fileStoreSources = await createFileStoreTxSources(
|
|
146
170
|
config.txCollectionFileStoreUrls,
|
|
147
171
|
txFileStoreBasePath,
|
|
172
|
+
txValidatorForTxCollection,
|
|
148
173
|
logger.createChild('file-store-tx-source'),
|
|
149
174
|
telemetry,
|
|
150
175
|
);
|
|
@@ -194,6 +219,7 @@ async function createP2PService(
|
|
|
194
219
|
proofVerifier: ClientProtocolCircuitVerifier,
|
|
195
220
|
worldStateSynchronizer: WorldStateSynchronizer,
|
|
196
221
|
epochCache: EpochCacheInterface,
|
|
222
|
+
blockMinFeesProvider: BlockMinFeesProvider,
|
|
197
223
|
store: AztecAsyncKVStore,
|
|
198
224
|
peerStore: AztecLMDBStoreV2,
|
|
199
225
|
mempools: MemPools,
|
|
@@ -221,6 +247,7 @@ async function createP2PService(
|
|
|
221
247
|
proofVerifier,
|
|
222
248
|
worldStateSynchronizer,
|
|
223
249
|
peerStore,
|
|
250
|
+
blockMinFeesProvider,
|
|
224
251
|
telemetry,
|
|
225
252
|
logger: logger.createChild(`libp2p_service`),
|
|
226
253
|
});
|
package/src/client/interface.ts
CHANGED
|
@@ -82,7 +82,15 @@ export type P2P = P2PClient & {
|
|
|
82
82
|
*
|
|
83
83
|
* @param handler - A function taking a received checkpoint proposal and producing attestations
|
|
84
84
|
*/
|
|
85
|
-
|
|
85
|
+
registerValidatorCheckpointProposalHandler(callback: P2PCheckpointReceivedCallback): void;
|
|
86
|
+
|
|
87
|
+
/**
|
|
88
|
+
* Registers a callback that runs for ALL nodes (not just validators) when a checkpoint proposal is received.
|
|
89
|
+
* Used to set the proposed checkpoint number on the archiver so the sequencer can build on top of it.
|
|
90
|
+
*
|
|
91
|
+
* @param handler - A function taking a received checkpoint proposal
|
|
92
|
+
*/
|
|
93
|
+
registerAllNodesCheckpointProposalHandler(callback: P2PCheckpointReceivedCallback): void;
|
|
86
94
|
|
|
87
95
|
/**
|
|
88
96
|
* Registers a callback invoked when a duplicate proposal is detected (equivocation).
|
package/src/client/p2p_client.ts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { GENESIS_BLOCK_HEADER_HASH } from '@aztec/constants';
|
|
2
1
|
import type { EpochCacheInterface } from '@aztec/epoch-cache';
|
|
3
2
|
import { BlockNumber, CheckpointNumber, SlotNumber } from '@aztec/foundation/branded-types';
|
|
4
3
|
import { createLogger } from '@aztec/foundation/log';
|
|
@@ -9,6 +8,7 @@ import { L2TipsKVStore } from '@aztec/kv-store/stores';
|
|
|
9
8
|
import {
|
|
10
9
|
type CheckpointId,
|
|
11
10
|
type EthAddress,
|
|
11
|
+
GENESIS_BLOCK_HEADER_HASH,
|
|
12
12
|
type L2Block,
|
|
13
13
|
type L2BlockId,
|
|
14
14
|
type L2BlockSource,
|
|
@@ -257,7 +257,11 @@ export class P2PClient extends WithTracer implements P2P {
|
|
|
257
257
|
});
|
|
258
258
|
}
|
|
259
259
|
|
|
260
|
-
|
|
260
|
+
// Should never happen: all branches above call initBlockStream()
|
|
261
|
+
if (!this.blockStream) {
|
|
262
|
+
throw new Error('Block stream not initialized');
|
|
263
|
+
}
|
|
264
|
+
this.blockStream.start();
|
|
261
265
|
await this.txCollection.start();
|
|
262
266
|
this.txFileStore?.start();
|
|
263
267
|
|
|
@@ -319,7 +323,11 @@ export class P2PClient extends WithTracer implements P2P {
|
|
|
319
323
|
/** Triggers a sync to the archiver. Used for testing. */
|
|
320
324
|
public async sync() {
|
|
321
325
|
this.initBlockStream();
|
|
322
|
-
|
|
326
|
+
// Should never happen: initBlockStream() creates blockStream if absent
|
|
327
|
+
if (!this.blockStream) {
|
|
328
|
+
throw new Error('Block stream not initialized');
|
|
329
|
+
}
|
|
330
|
+
await this.blockStream.sync();
|
|
323
331
|
}
|
|
324
332
|
|
|
325
333
|
@trackSpan('p2pClient.broadcastProposal', async proposal => ({
|
|
@@ -357,6 +365,8 @@ export class P2PClient extends WithTracer implements P2P {
|
|
|
357
365
|
// Store our own last-block proposal so we can respond to req/resp requests for it.
|
|
358
366
|
await this.attestationPool.tryAddBlockProposal(blockProposal);
|
|
359
367
|
}
|
|
368
|
+
// Gossipsub doesn't deliver own messages, so fire the all-nodes handler locally
|
|
369
|
+
await this.p2pService.notifyOwnCheckpointProposal(proposal.toCore());
|
|
360
370
|
return this.p2pService.propagate(proposal);
|
|
361
371
|
}
|
|
362
372
|
|
|
@@ -388,8 +398,12 @@ export class P2PClient extends WithTracer implements P2P {
|
|
|
388
398
|
this.p2pService.registerBlockReceivedCallback(handler);
|
|
389
399
|
}
|
|
390
400
|
|
|
391
|
-
public
|
|
392
|
-
this.p2pService.
|
|
401
|
+
public registerValidatorCheckpointProposalHandler(handler: P2PCheckpointReceivedCallback): void {
|
|
402
|
+
this.p2pService.registerValidatorCheckpointReceivedCallback(handler);
|
|
403
|
+
}
|
|
404
|
+
|
|
405
|
+
public registerAllNodesCheckpointProposalHandler(handler: P2PCheckpointReceivedCallback): void {
|
|
406
|
+
this.p2pService.registerAllNodesCheckpointReceivedCallback(handler);
|
|
393
407
|
}
|
|
394
408
|
|
|
395
409
|
public registerDuplicateProposalCallback(callback: (info: DuplicateProposalInfo) => void): void {
|
|
@@ -669,32 +683,50 @@ export class P2PClient extends WithTracer implements P2P {
|
|
|
669
683
|
}
|
|
670
684
|
|
|
671
685
|
/**
|
|
672
|
-
* Returns true if the prune
|
|
673
|
-
* If the
|
|
674
|
-
* If they differ, the prune spans across checkpoints (epoch prune).
|
|
686
|
+
* Returns true if the prune is an epoch prune (new checkpoint number is less than old).
|
|
687
|
+
* If the checkpoint number stays the same or increases, the prune is within a checkpoint.
|
|
675
688
|
*/
|
|
676
689
|
private async isEpochPrune(newCheckpoint: CheckpointId): Promise<boolean> {
|
|
677
690
|
const tips = await this.l2Tips.getL2Tips();
|
|
678
691
|
const oldCheckpointNumber = tips.checkpointed.checkpoint.number;
|
|
679
|
-
if (oldCheckpointNumber <= CheckpointNumber.
|
|
692
|
+
if (oldCheckpointNumber <= CheckpointNumber.INITIAL) {
|
|
680
693
|
return false;
|
|
681
694
|
}
|
|
682
695
|
const newCheckpointNumber = newCheckpoint.number;
|
|
683
|
-
|
|
696
|
+
// We check that the new checkpoint number is less than the old checkpoint number in order to consider it an epoch prune.
|
|
697
|
+
// To be more certain that it is an epoch prune, we will check that at least 2 checkpoints were removed.
|
|
698
|
+
// This means we should avoid thinking checkpoints removed by L1 re-orgs are epoch prunes
|
|
699
|
+
const thresholdForEpochPrune = CheckpointNumber(oldCheckpointNumber - 2);
|
|
700
|
+
const isEpochPrune = newCheckpointNumber <= thresholdForEpochPrune;
|
|
684
701
|
if (isEpochPrune) {
|
|
685
|
-
this.log.info(`Detected epoch prune to ${newCheckpointNumber}`, {
|
|
702
|
+
this.log.info(`Detected epoch prune to ${newCheckpointNumber}`, {
|
|
703
|
+
oldCheckpointNumber,
|
|
704
|
+
newCheckpointNumber,
|
|
705
|
+
thresholdForEpochPrune,
|
|
706
|
+
});
|
|
686
707
|
}
|
|
687
708
|
return isEpochPrune;
|
|
688
709
|
}
|
|
689
710
|
|
|
690
711
|
/** Checks if the slot has changed and calls prepareForSlot if so. */
|
|
691
712
|
private async maybeCallPrepareForSlot(): Promise<void> {
|
|
692
|
-
|
|
693
|
-
|
|
713
|
+
// If we have a proposed checkpoint available, we want to prepare the target slot - otherwise we prepare the current slot
|
|
714
|
+
const l2Tips = await this.l2Tips.getL2Tips();
|
|
715
|
+
const hasProposedCheckpoint = l2Tips.proposedCheckpoint.checkpoint.number > l2Tips.checkpointed.checkpoint.number;
|
|
716
|
+
|
|
717
|
+
let slot;
|
|
718
|
+
if (this.epochCache.isProposerPipeliningEnabled() && hasProposedCheckpoint) {
|
|
719
|
+
const { targetSlot } = this.epochCache.getTargetAndNextSlot();
|
|
720
|
+
slot = targetSlot;
|
|
721
|
+
} else {
|
|
722
|
+
const { currentSlot } = this.epochCache.getCurrentAndNextSlot();
|
|
723
|
+
slot = currentSlot;
|
|
724
|
+
}
|
|
725
|
+
if (slot <= this.lastSlotProcessed) {
|
|
694
726
|
return;
|
|
695
727
|
}
|
|
696
|
-
this.lastSlotProcessed =
|
|
697
|
-
await this.txPool.prepareForSlot(
|
|
728
|
+
this.lastSlotProcessed = slot;
|
|
729
|
+
await this.txPool.prepareForSlot(slot);
|
|
698
730
|
}
|
|
699
731
|
|
|
700
732
|
private async startServiceIfSynched() {
|
|
@@ -6,6 +6,7 @@ import { DateProvider, Timer, executeTimeout } from '@aztec/foundation/timer';
|
|
|
6
6
|
import { openTmpStore } from '@aztec/kv-store/lmdb-v2';
|
|
7
7
|
import type { L2BlockSource } from '@aztec/stdlib/block';
|
|
8
8
|
import type { ContractDataSource } from '@aztec/stdlib/contract';
|
|
9
|
+
import { GasFees } from '@aztec/stdlib/gas';
|
|
9
10
|
import type { ClientProtocolCircuitVerifier } from '@aztec/stdlib/interfaces/server';
|
|
10
11
|
import type { DataStoreConfig } from '@aztec/stdlib/kv-store';
|
|
11
12
|
import { PeerErrorSeverity } from '@aztec/stdlib/p2p';
|
|
@@ -19,7 +20,7 @@ import type { P2PConfig } from '../../../config.js';
|
|
|
19
20
|
import { BatchTxRequesterCollector, SendBatchRequestCollector } from '../../../services/index.js';
|
|
20
21
|
import type { IBatchRequestTxValidator } from '../../../services/reqresp/batch-tx-requester/tx_validator.js';
|
|
21
22
|
import { RateLimitStatus } from '../../../services/reqresp/rate-limiter/rate_limiter.js';
|
|
22
|
-
import {
|
|
23
|
+
import { RequestTracker } from '../../../services/tx_collection/request_tracker.js';
|
|
23
24
|
import {
|
|
24
25
|
AlwaysTrueCircuitVerifier,
|
|
25
26
|
BENCHMARK_CONSTANTS,
|
|
@@ -119,6 +120,7 @@ async function startClient(config: P2PConfig, clientIndex: number) {
|
|
|
119
120
|
proofVerifier as ClientProtocolCircuitVerifier,
|
|
120
121
|
worldState,
|
|
121
122
|
epochCache,
|
|
123
|
+
{ getCurrentMinFees: () => Promise.resolve(GasFees.empty()) },
|
|
122
124
|
'proposal-tx-collector-bench-worker',
|
|
123
125
|
new DateProvider(),
|
|
124
126
|
telemetry as TelemetryClient,
|
|
@@ -213,10 +215,9 @@ async function runCollector(cmd: Extract<WorkerCommand, { type: 'RUN_COLLECTOR'
|
|
|
213
215
|
const fetched = await executeTimeout(
|
|
214
216
|
(_signal: AbortSignal) =>
|
|
215
217
|
collector.collectTxs(
|
|
216
|
-
|
|
218
|
+
RequestTracker.create(parsedTxHashes, new Date(Date.now() + internalTimeoutMs)),
|
|
217
219
|
parsedProposal,
|
|
218
220
|
pinnedPeer,
|
|
219
|
-
internalTimeoutMs,
|
|
220
221
|
),
|
|
221
222
|
timeoutMs,
|
|
222
223
|
() => new Error(`Collector timed out after ${timeoutMs}ms`),
|
|
@@ -231,10 +232,9 @@ async function runCollector(cmd: Extract<WorkerCommand, { type: 'RUN_COLLECTOR'
|
|
|
231
232
|
const fetched = await executeTimeout(
|
|
232
233
|
(_signal: AbortSignal) =>
|
|
233
234
|
collector.collectTxs(
|
|
234
|
-
|
|
235
|
+
RequestTracker.create(parsedTxHashes, new Date(Date.now() + internalTimeoutMs)),
|
|
235
236
|
parsedProposal,
|
|
236
237
|
pinnedPeer,
|
|
237
|
-
internalTimeoutMs,
|
|
238
238
|
),
|
|
239
239
|
timeoutMs,
|
|
240
240
|
() => new Error(`Collector timed out after ${timeoutMs}ms`),
|
|
@@ -261,9 +261,20 @@ async function stopClient() {
|
|
|
261
261
|
attestationPool = undefined;
|
|
262
262
|
}
|
|
263
263
|
|
|
264
|
+
function gracefulExit(code: number = 0) {
|
|
265
|
+
try {
|
|
266
|
+
if (process.connected) {
|
|
267
|
+
process.disconnect();
|
|
268
|
+
}
|
|
269
|
+
} catch {
|
|
270
|
+
// IPC channel already closed
|
|
271
|
+
}
|
|
272
|
+
setTimeout(() => process.exit(code), 5000).unref();
|
|
273
|
+
}
|
|
274
|
+
|
|
264
275
|
process.on('disconnect', () => {
|
|
265
276
|
ipcDisconnected = true;
|
|
266
|
-
void stopClient()
|
|
277
|
+
void stopClient();
|
|
267
278
|
});
|
|
268
279
|
|
|
269
280
|
process.on('error', err => {
|
|
@@ -327,7 +338,7 @@ process.on('message', (msg: WorkerCommand) => {
|
|
|
327
338
|
case 'STOP': {
|
|
328
339
|
await stopClient();
|
|
329
340
|
await sendMessage({ type: 'STOPPED', requestId });
|
|
330
|
-
|
|
341
|
+
gracefulExit(0);
|
|
331
342
|
break;
|
|
332
343
|
}
|
|
333
344
|
default: {
|
|
@@ -338,7 +349,8 @@ process.on('message', (msg: WorkerCommand) => {
|
|
|
338
349
|
} catch (err: any) {
|
|
339
350
|
await sendMessage({ type: 'ERROR', requestId, error: err?.message ?? String(err) });
|
|
340
351
|
if (msg.type === 'START') {
|
|
341
|
-
|
|
352
|
+
await stopClient();
|
|
353
|
+
gracefulExit(1);
|
|
342
354
|
}
|
|
343
355
|
}
|
|
344
356
|
})();
|
package/src/config.ts
CHANGED
|
@@ -39,10 +39,20 @@ export interface P2PConfig
|
|
|
39
39
|
ChainConfig,
|
|
40
40
|
TxCollectionConfig,
|
|
41
41
|
TxFileStoreConfig,
|
|
42
|
-
Pick<
|
|
42
|
+
Pick<
|
|
43
|
+
SequencerConfig,
|
|
44
|
+
| 'blockDurationMs'
|
|
45
|
+
| 'expectedBlockProposalsPerSlot'
|
|
46
|
+
| 'l1PublishingTime'
|
|
47
|
+
| 'maxTxsPerBlock'
|
|
48
|
+
| 'attestationPropagationTime'
|
|
49
|
+
> {
|
|
43
50
|
/** Maximum transactions per block for validation. Overrides maxTxsPerBlock for gossip validation when set. */
|
|
44
51
|
validateMaxTxsPerBlock?: number;
|
|
45
52
|
|
|
53
|
+
/** Maximum transactions per checkpoint for validation. Used as fallback for maxTxsPerBlock when that is not set. */
|
|
54
|
+
validateMaxTxsPerCheckpoint?: number;
|
|
55
|
+
|
|
46
56
|
/** Maximum L2 gas per block for validation. When set, txs exceeding this limit are rejected. */
|
|
47
57
|
validateMaxL2BlockGas?: number;
|
|
48
58
|
|
|
@@ -67,6 +77,9 @@ export interface P2PConfig
|
|
|
67
77
|
/** The frequency in which to check for new peers. */
|
|
68
78
|
peerCheckIntervalMS: number;
|
|
69
79
|
|
|
80
|
+
/** How long to ban a peer after it fails MAX_DIAL_ATTEMPTS dials. */
|
|
81
|
+
peerFailedBanTimeMs: number;
|
|
82
|
+
|
|
70
83
|
/** Size of queue of L2 blocks to store. */
|
|
71
84
|
l2QueueSize: number;
|
|
72
85
|
|
|
@@ -212,17 +225,23 @@ export const p2pConfigMappings: ConfigMappingsType<P2PConfig> = {
|
|
|
212
225
|
env: 'VALIDATOR_MAX_TX_PER_BLOCK',
|
|
213
226
|
description:
|
|
214
227
|
'Maximum transactions per block for validation. Overrides maxTxsPerBlock for gossip validation when set.',
|
|
215
|
-
parseEnv: (val: string) =>
|
|
228
|
+
parseEnv: (val: string) => parseInt(val, 10),
|
|
229
|
+
},
|
|
230
|
+
validateMaxTxsPerCheckpoint: {
|
|
231
|
+
env: 'VALIDATOR_MAX_TX_PER_CHECKPOINT',
|
|
232
|
+
description:
|
|
233
|
+
'Maximum transactions per checkpoint for validation. Used as fallback for maxTxsPerBlock when that is not set.',
|
|
234
|
+
parseEnv: (val: string) => parseInt(val, 10),
|
|
216
235
|
},
|
|
217
236
|
validateMaxL2BlockGas: {
|
|
218
237
|
env: 'VALIDATOR_MAX_L2_BLOCK_GAS',
|
|
219
238
|
description: 'Maximum L2 gas per block for validation. When set, txs exceeding this limit are rejected.',
|
|
220
|
-
parseEnv: (val: string) =>
|
|
239
|
+
parseEnv: (val: string) => parseInt(val, 10),
|
|
221
240
|
},
|
|
222
241
|
validateMaxDABlockGas: {
|
|
223
242
|
env: 'VALIDATOR_MAX_DA_BLOCK_GAS',
|
|
224
243
|
description: 'Maximum DA gas per block for validation. When set, txs exceeding this limit are rejected.',
|
|
225
|
-
parseEnv: (val: string) =>
|
|
244
|
+
parseEnv: (val: string) => parseInt(val, 10),
|
|
226
245
|
},
|
|
227
246
|
p2pEnabled: {
|
|
228
247
|
env: 'P2P_ENABLED',
|
|
@@ -254,6 +273,11 @@ export const p2pConfigMappings: ConfigMappingsType<P2PConfig> = {
|
|
|
254
273
|
description: 'The frequency in which to check for new peers.',
|
|
255
274
|
...numberConfigHelper(30_000),
|
|
256
275
|
},
|
|
276
|
+
peerFailedBanTimeMs: {
|
|
277
|
+
env: 'P2P_PEER_FAILED_BAN_TIME_MS',
|
|
278
|
+
description: 'How long to ban a peer after it fails maximum dial attempts.',
|
|
279
|
+
...numberConfigHelper(5 * 60 * 1000),
|
|
280
|
+
},
|
|
257
281
|
l2QueueSize: {
|
|
258
282
|
env: 'P2P_L2_QUEUE_SIZE',
|
|
259
283
|
description: 'Size of queue of L2 blocks to store.',
|
|
@@ -347,7 +371,7 @@ export const p2pConfigMappings: ConfigMappingsType<P2PConfig> = {
|
|
|
347
371
|
gossipsubMcacheLength: {
|
|
348
372
|
env: 'P2P_GOSSIPSUB_MCACHE_LENGTH',
|
|
349
373
|
description: 'The number of gossipsub interval message cache windows to keep.',
|
|
350
|
-
...numberConfigHelper(
|
|
374
|
+
...numberConfigHelper(12),
|
|
351
375
|
},
|
|
352
376
|
gossipsubMcacheGossip: {
|
|
353
377
|
env: 'P2P_GOSSIPSUB_MCACHE_GOSSIP',
|
|
@@ -419,7 +443,7 @@ export const p2pConfigMappings: ConfigMappingsType<P2PConfig> = {
|
|
|
419
443
|
},
|
|
420
444
|
p2pStoreMapSizeKb: {
|
|
421
445
|
env: 'P2P_STORE_MAP_SIZE_KB',
|
|
422
|
-
parseEnv: (val: string
|
|
446
|
+
parseEnv: (val: string) => +val,
|
|
423
447
|
description: 'The maximum possible size of the P2P DB in KB. Overwrites the general dataStoreMapSizeKb.',
|
|
424
448
|
},
|
|
425
449
|
txPublicSetupAllowListExtend: {
|
|
@@ -478,6 +502,11 @@ export const p2pConfigMappings: ConfigMappingsType<P2PConfig> = {
|
|
|
478
502
|
description: 'Alters the format of p2p messages to include things like broadcast timestamp FOR TESTING ONLY',
|
|
479
503
|
...booleanConfigHelper(false),
|
|
480
504
|
},
|
|
505
|
+
l1PublishingTime: {
|
|
506
|
+
env: 'SEQ_L1_PUBLISHING_TIME_ALLOWANCE_IN_SLOT',
|
|
507
|
+
description: 'How much time (in seconds) we allow in the slot for publishing the L1 tx (defaults to 1 L1 slot).',
|
|
508
|
+
parseEnv: (val: string) => parseInt(val, 10),
|
|
509
|
+
},
|
|
481
510
|
fishermanMode: {
|
|
482
511
|
env: 'FISHERMAN_MODE',
|
|
483
512
|
description:
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/** Checkpoint Proposal Received Callback Not Registered Error
|
|
2
|
+
*
|
|
3
|
+
* Error triggered if the allNodesCheckpointReceivedCallback is not registered
|
|
4
|
+
* @category Errors
|
|
5
|
+
*/
|
|
6
|
+
export class CheckpointProposalReceivedCallbackNotRegisteredError extends Error {
|
|
7
|
+
constructor() {
|
|
8
|
+
super('FATAL (allNodesCheckpointReceivedCallback): All nodes should register a checkpoint proposal handler');
|
|
9
|
+
this.name = 'CheckpointProposalReceivedCallbackNotRegisteredError';
|
|
10
|
+
}
|
|
11
|
+
}
|
package/src/index.ts
CHANGED
|
@@ -6,7 +6,6 @@ export * from './client/index.js';
|
|
|
6
6
|
export * from './enr/index.js';
|
|
7
7
|
export * from './config.js';
|
|
8
8
|
export * from './mem_pools/attestation_pool/index.js';
|
|
9
|
-
export * from './mem_pools/tx_pool/index.js';
|
|
10
9
|
export * from './mem_pools/tx_pool_v2/index.js';
|
|
11
10
|
export * from './msg_validators/index.js';
|
|
12
11
|
export * from './services/index.js';
|
|
@@ -26,10 +26,10 @@ export type TryAddResult = {
|
|
|
26
26
|
count: number;
|
|
27
27
|
};
|
|
28
28
|
|
|
29
|
-
export const MAX_CHECKPOINT_PROPOSALS_PER_SLOT =
|
|
30
|
-
export const MAX_BLOCK_PROPOSALS_PER_POSITION =
|
|
29
|
+
export const MAX_CHECKPOINT_PROPOSALS_PER_SLOT = 2;
|
|
30
|
+
export const MAX_BLOCK_PROPOSALS_PER_POSITION = 2;
|
|
31
31
|
/** Maximum attestations a single signer can make per slot before being rejected. */
|
|
32
|
-
export const MAX_ATTESTATIONS_PER_SLOT_AND_SIGNER =
|
|
32
|
+
export const MAX_ATTESTATIONS_PER_SLOT_AND_SIGNER = 2;
|
|
33
33
|
|
|
34
34
|
/** Public API interface for attestation pools. Used for typing mocks and test implementations. */
|
|
35
35
|
export type AttestationPoolApi = Pick<
|
|
@@ -154,14 +154,16 @@ export class AttestationPool {
|
|
|
154
154
|
/** Maximum indexWithinCheckpoint value (2^10 - 1 = 1023). */
|
|
155
155
|
private static readonly MAX_INDEX = (1 << AttestationPool.INDEX_BITS) - 1;
|
|
156
156
|
|
|
157
|
-
/** Creates a position key for block proposals:
|
|
157
|
+
/** Creates a position key for block proposals: slot * 1024 + indexWithinCheckpoint.
|
|
158
|
+
* Uses multiplication instead of bit-shift to avoid 32-bit signed integer overflow
|
|
159
|
+
* (bit-shift overflows after slot ~2^21, roughly 278 days of uptime). */
|
|
158
160
|
private getBlockPositionKey(slot: number, indexWithinCheckpoint: number): number {
|
|
159
161
|
if (indexWithinCheckpoint > AttestationPool.MAX_INDEX) {
|
|
160
162
|
throw new Error(
|
|
161
163
|
`Value for indexWithinCheckpoint ${indexWithinCheckpoint} exceeds maximum ${AttestationPool.MAX_INDEX}`,
|
|
162
164
|
);
|
|
163
165
|
}
|
|
164
|
-
return
|
|
166
|
+
return slot * (1 << AttestationPool.INDEX_BITS) + indexWithinCheckpoint;
|
|
165
167
|
}
|
|
166
168
|
|
|
167
169
|
/**
|
|
@@ -278,7 +280,7 @@ export class AttestationPool {
|
|
|
278
280
|
* @returns Result indicating whether the proposal was added and duplicate detection info
|
|
279
281
|
*/
|
|
280
282
|
public async tryAddCheckpointProposal(proposal: CheckpointProposalCore): Promise<TryAddResult> {
|
|
281
|
-
|
|
283
|
+
const result = await this.store.transactionAsync(async () => {
|
|
282
284
|
const proposalId = proposal.archive.toString();
|
|
283
285
|
|
|
284
286
|
// Check if already exists
|
|
@@ -304,6 +306,8 @@ export class AttestationPool {
|
|
|
304
306
|
|
|
305
307
|
return { added: true, alreadyExists: false, count: count + 1 };
|
|
306
308
|
});
|
|
309
|
+
|
|
310
|
+
return result;
|
|
307
311
|
}
|
|
308
312
|
|
|
309
313
|
/** Internal method - must be called within a transaction. */
|
|
@@ -345,7 +349,7 @@ export class AttestationPool {
|
|
|
345
349
|
await this.store.transactionAsync(async () => {
|
|
346
350
|
for (const attestation of attestations) {
|
|
347
351
|
const slotNumber = attestation.payload.header.slotNumber;
|
|
348
|
-
const proposalId = attestation.archive;
|
|
352
|
+
const proposalId = attestation.archive.toString();
|
|
349
353
|
const sender = attestation.getSender();
|
|
350
354
|
|
|
351
355
|
// Skip attestations with invalid signatures
|
|
@@ -452,7 +456,7 @@ export class AttestationPool {
|
|
|
452
456
|
|
|
453
457
|
// Delete block proposals for slots < oldestSlot, using blockProposalsForSlotAndIndex as index
|
|
454
458
|
// Key format: (slot << INDEX_BITS) | indexWithinCheckpoint
|
|
455
|
-
const blockPositionEndKey = oldestSlot << AttestationPool.INDEX_BITS;
|
|
459
|
+
const blockPositionEndKey = oldestSlot * (1 << AttestationPool.INDEX_BITS);
|
|
456
460
|
for await (const positionKey of this.blockProposalsForSlotAndIndex.keysAsync({ end: blockPositionEndKey })) {
|
|
457
461
|
const proposalIds = await toArray(this.blockProposalsForSlotAndIndex.getValuesAsync(positionKey));
|
|
458
462
|
for (const proposalId of proposalIds) {
|
|
@@ -446,12 +446,12 @@ export function describeAttestationPool(getAttestationPool: () => AttestationPoo
|
|
|
446
446
|
const result2 = await ap.tryAddBlockProposal(proposal2);
|
|
447
447
|
expect(result2.count).toBe(2);
|
|
448
448
|
|
|
449
|
-
//
|
|
449
|
+
// Third proposal for same position should be rejected (cap is 2)
|
|
450
450
|
const proposal3 = await mockBlockProposalWithIndex(signers[2], slotNumber, indexWithinCheckpoint);
|
|
451
451
|
const result3 = await ap.tryAddBlockProposal(proposal3);
|
|
452
452
|
|
|
453
|
-
expect(result3.added).toBe(
|
|
454
|
-
expect(result3.count).toBe(
|
|
453
|
+
expect(result3.added).toBe(false);
|
|
454
|
+
expect(result3.count).toBe(2);
|
|
455
455
|
});
|
|
456
456
|
|
|
457
457
|
it('should return added=false when exceeding capacity', async () => {
|
|
@@ -666,12 +666,12 @@ export function describeAttestationPool(getAttestationPool: () => AttestationPoo
|
|
|
666
666
|
const result2 = await ap.tryAddCheckpointProposal(proposal2);
|
|
667
667
|
expect(result2.count).toBe(2);
|
|
668
668
|
|
|
669
|
-
//
|
|
669
|
+
// Third proposal for same slot should be rejected (cap is 2)
|
|
670
670
|
const proposal3 = await mockCheckpointProposalCoreForPool(signers[2], slotNumber);
|
|
671
671
|
const result3 = await ap.tryAddCheckpointProposal(proposal3);
|
|
672
672
|
|
|
673
|
-
expect(result3.added).toBe(
|
|
674
|
-
expect(result3.count).toBe(
|
|
673
|
+
expect(result3.added).toBe(false);
|
|
674
|
+
expect(result3.count).toBe(2);
|
|
675
675
|
});
|
|
676
676
|
|
|
677
677
|
it('should not count attestations as proposals for duplicate detection', async () => {
|
package/src/mem_pools/index.ts
CHANGED
|
@@ -1,6 +1,3 @@
|
|
|
1
1
|
export { AttestationPool, type AttestationPoolApi } from './attestation_pool/attestation_pool.js';
|
|
2
2
|
export { type MemPools } from './interface.js';
|
|
3
|
-
// Old TxPool exports - kept temporarily for external consumers
|
|
4
|
-
export { type TxPool } from './tx_pool/tx_pool.js';
|
|
5
|
-
// New TxPoolV2 exports
|
|
6
3
|
export { type TxPoolV2, type TxPoolV2Config, type TxPoolV2Events, type AddTxsResult } from './tx_pool_v2/index.js';
|
|
@@ -29,7 +29,8 @@ export class FeePayerBalanceEvictionRule implements EvictionRule {
|
|
|
29
29
|
|
|
30
30
|
if (context.event === EvictionEvent.BLOCK_MINED) {
|
|
31
31
|
const blockNumber = context.block.getBlockNumber();
|
|
32
|
-
await
|
|
32
|
+
const blockHash = await context.block.hash();
|
|
33
|
+
await this.worldState.syncImmediate(blockNumber, blockHash);
|
|
33
34
|
return await this.evictForFeePayers(context.feePayers, this.worldState.getSnapshot(blockNumber), pool);
|
|
34
35
|
}
|
|
35
36
|
|
|
@@ -21,6 +21,7 @@ export { FeePayerBalancePreAddRule } from './fee_payer_balance_pre_add_rule.js';
|
|
|
21
21
|
export { LowPriorityPreAddRule } from './low_priority_pre_add_rule.js';
|
|
22
22
|
|
|
23
23
|
// Post-event eviction rules
|
|
24
|
+
export { InsufficientFeePerGasEvictionRule } from './insufficient_fee_per_gas_eviction_rule.js';
|
|
24
25
|
export { InvalidTxsAfterMiningRule } from './invalid_txs_after_mining_rule.js';
|
|
25
26
|
export { InvalidTxsAfterReorgRule } from './invalid_txs_after_reorg_rule.js';
|
|
26
27
|
export { FeePayerBalanceEvictionRule } from './fee_payer_balance_eviction_rule.js';
|