@aztec/p2p 0.0.1-commit.85d7d01 → 0.0.1-commit.8655d4a
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/bootstrap/bootstrap.d.ts +1 -1
- package/dest/bootstrap/bootstrap.d.ts.map +1 -1
- package/dest/bootstrap/bootstrap.js +9 -1
- package/dest/client/factory.d.ts +5 -4
- package/dest/client/factory.d.ts.map +1 -1
- package/dest/client/factory.js +33 -15
- package/dest/client/interface.d.ts +14 -5
- package/dest/client/interface.d.ts.map +1 -1
- package/dest/client/p2p_client.d.ts +13 -9
- package/dest/client/p2p_client.d.ts.map +1 -1
- package/dest/client/p2p_client.js +93 -49
- package/dest/config.d.ts +153 -102
- package/dest/config.d.ts.map +1 -1
- package/dest/config.js +134 -35
- 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/errors/reqresp.error.d.ts +1 -20
- package/dest/errors/reqresp.error.d.ts.map +1 -1
- package/dest/errors/reqresp.error.js +0 -21
- 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 +99 -59
- package/dest/mem_pools/attestation_pool/attestation_pool.d.ts.map +1 -1
- package/dest/mem_pools/attestation_pool/attestation_pool.js +267 -197
- 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 +181 -65
- 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/index.d.ts +1 -2
- package/dest/mem_pools/index.d.ts.map +1 -1
- package/dest/mem_pools/instrumentation.d.ts +4 -2
- package/dest/mem_pools/instrumentation.d.ts.map +1 -1
- package/dest/mem_pools/instrumentation.js +33 -15
- 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/interfaces.d.ts +7 -1
- package/dest/mem_pools/tx_pool_v2/eviction/interfaces.d.ts.map +1 -1
- package/dest/mem_pools/tx_pool_v2/eviction/invalid_txs_after_reorg_rule.js +2 -2
- package/dest/mem_pools/tx_pool_v2/eviction/low_priority_pre_add_rule.d.ts +1 -1
- package/dest/mem_pools/tx_pool_v2/eviction/low_priority_pre_add_rule.d.ts.map +1 -1
- package/dest/mem_pools/tx_pool_v2/eviction/low_priority_pre_add_rule.js +8 -6
- package/dest/mem_pools/tx_pool_v2/eviction/nullifier_conflict_rule.d.ts +2 -2
- package/dest/mem_pools/tx_pool_v2/eviction/nullifier_conflict_rule.d.ts.map +1 -1
- package/dest/mem_pools/tx_pool_v2/eviction/nullifier_conflict_rule.js +2 -2
- package/dest/mem_pools/tx_pool_v2/interfaces.d.ts +12 -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 +29 -11
- package/dest/mem_pools/tx_pool_v2/tx_metadata.d.ts.map +1 -1
- package/dest/mem_pools/tx_pool_v2/tx_metadata.js +46 -16
- package/dest/mem_pools/tx_pool_v2/tx_pool_indices.d.ts +1 -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 +26 -43
- 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 +6 -0
- package/dest/mem_pools/tx_pool_v2/tx_pool_v2_impl.d.ts +2 -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 +97 -88
- package/dest/msg_validators/attestation_validator/attestation_validator.d.ts +9 -3
- package/dest/msg_validators/attestation_validator/attestation_validator.d.ts.map +1 -1
- package/dest/msg_validators/attestation_validator/attestation_validator.js +37 -12
- 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/clock_tolerance.d.ts +12 -1
- package/dest/msg_validators/clock_tolerance.d.ts.map +1 -1
- package/dest/msg_validators/clock_tolerance.js +61 -3
- package/dest/msg_validators/proposal_validator/block_proposal_validator.d.ts +10 -4
- package/dest/msg_validators/proposal_validator/block_proposal_validator.d.ts.map +1 -1
- package/dest/msg_validators/proposal_validator/block_proposal_validator.js +10 -2
- package/dest/msg_validators/proposal_validator/checkpoint_proposal_validator.d.ts +10 -4
- package/dest/msg_validators/proposal_validator/checkpoint_proposal_validator.d.ts.map +1 -1
- package/dest/msg_validators/proposal_validator/checkpoint_proposal_validator.js +16 -2
- package/dest/msg_validators/proposal_validator/proposal_validator.d.ts +21 -8
- package/dest/msg_validators/proposal_validator/proposal_validator.d.ts.map +1 -1
- package/dest/msg_validators/proposal_validator/proposal_validator.js +90 -44
- 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.d.ts +2 -1
- package/dest/msg_validators/tx_validator/allowed_public_setup.d.ts.map +1 -1
- package/dest/msg_validators/tx_validator/allowed_public_setup.js +25 -21
- package/dest/msg_validators/tx_validator/allowed_setup_helpers.d.ts +17 -0
- package/dest/msg_validators/tx_validator/allowed_setup_helpers.d.ts.map +1 -0
- package/dest/msg_validators/tx_validator/allowed_setup_helpers.js +24 -0
- 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/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 +2 -1
- package/dest/msg_validators/tx_validator/data_validator.d.ts.map +1 -1
- package/dest/msg_validators/tx_validator/data_validator.js +36 -2
- package/dest/msg_validators/tx_validator/factory.d.ts +27 -7
- package/dest/msg_validators/tx_validator/factory.d.ts.map +1 -1
- package/dest/msg_validators/tx_validator/factory.js +47 -17
- package/dest/msg_validators/tx_validator/fee_payer_balance.d.ts +1 -1
- package/dest/msg_validators/tx_validator/fee_payer_balance.d.ts.map +1 -1
- package/dest/msg_validators/tx_validator/fee_payer_balance.js +6 -2
- package/dest/msg_validators/tx_validator/gas_validator.d.ts +48 -7
- package/dest/msg_validators/tx_validator/gas_validator.d.ts.map +1 -1
- package/dest/msg_validators/tx_validator/gas_validator.js +88 -41
- package/dest/msg_validators/tx_validator/index.d.ts +4 -1
- package/dest/msg_validators/tx_validator/index.d.ts.map +1 -1
- package/dest/msg_validators/tx_validator/index.js +3 -0
- package/dest/msg_validators/tx_validator/metadata_validator.d.ts +1 -1
- package/dest/msg_validators/tx_validator/metadata_validator.d.ts.map +1 -1
- package/dest/msg_validators/tx_validator/metadata_validator.js +4 -4
- package/dest/msg_validators/tx_validator/phases_validator.d.ts +22 -2
- package/dest/msg_validators/tx_validator/phases_validator.d.ts.map +1 -1
- package/dest/msg_validators/tx_validator/phases_validator.js +72 -24
- 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 +69 -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 +2 -1
- package/dest/services/discv5/discV5_service.d.ts.map +1 -1
- package/dest/services/discv5/discV5_service.js +35 -8
- package/dest/services/dummy_service.d.ts +11 -15
- package/dest/services/dummy_service.d.ts.map +1 -1
- package/dest/services/dummy_service.js +12 -16
- 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 +36 -46
- package/dest/services/libp2p/libp2p_service.d.ts.map +1 -1
- package/dest/services/libp2p/libp2p_service.js +296 -244
- package/dest/services/peer-manager/metrics.d.ts +3 -1
- package/dest/services/peer-manager/metrics.d.ts.map +1 -1
- package/dest/services/peer-manager/metrics.js +6 -0
- 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 +40 -11
- 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 +84 -71
- package/dest/services/reqresp/batch-tx-requester/interface.d.ts +10 -6
- package/dest/services/reqresp/batch-tx-requester/interface.d.ts.map +1 -1
- package/dest/services/reqresp/batch-tx-requester/missing_txs.d.ts +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/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 +3 -3
- package/dest/services/reqresp/config.d.ts.map +1 -1
- 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/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 +4 -2
- 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 +7 -29
- package/dest/services/reqresp/reqresp.d.ts.map +1 -1
- package/dest/services/reqresp/reqresp.js +41 -214
- package/dest/services/service.d.ts +9 -12
- 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/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/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/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/tx_collection.d.ts +36 -55
- 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 +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/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 +23 -9
- package/dest/test-helpers/mock-pubsub.d.ts.map +1 -1
- package/dest/test-helpers/mock-pubsub.js +44 -44
- 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 +16 -18
- 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 +12 -14
- package/dest/test-helpers/testbench-utils.d.ts.map +1 -1
- package/dest/test-helpers/testbench-utils.js +42 -15
- 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 +85 -39
- package/dest/testbench/worker_client_manager.d.ts +12 -6
- package/dest/testbench/worker_client_manager.d.ts.map +1 -1
- package/dest/testbench/worker_client_manager.js +57 -11
- package/dest/util.d.ts +12 -7
- package/dest/util.d.ts.map +1 -1
- package/dest/util.js +35 -14
- package/dest/versioning.d.ts +3 -6
- package/dest/versioning.d.ts.map +1 -1
- package/dest/versioning.js +3 -24
- package/package.json +15 -14
- package/src/bootstrap/bootstrap.ts +9 -1
- package/src/client/factory.ts +57 -8
- package/src/client/interface.ts +15 -11
- package/src/client/p2p_client.ts +106 -70
- package/src/client/test/{tx_proposal_collector/README.md → p2p_client.batch_tx_requester.bench.README.md} +23 -53
- package/src/config.ts +226 -36
- package/src/errors/p2p-service.error.ts +11 -0
- package/src/errors/reqresp.error.ts +0 -25
- package/src/index.ts +0 -1
- package/src/mem_pools/attestation_pool/attestation_pool.ts +318 -242
- package/src/mem_pools/attestation_pool/attestation_pool_test_suite.ts +204 -68
- package/src/mem_pools/attestation_pool/mocks.ts +13 -8
- package/src/mem_pools/index.ts +0 -3
- package/src/mem_pools/instrumentation.ts +22 -14
- package/src/mem_pools/tx_pool_v2/README.md +9 -1
- 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/interfaces.ts +11 -1
- package/src/mem_pools/tx_pool_v2/eviction/invalid_txs_after_reorg_rule.ts +3 -3
- package/src/mem_pools/tx_pool_v2/eviction/low_priority_pre_add_rule.ts +15 -6
- package/src/mem_pools/tx_pool_v2/eviction/nullifier_conflict_rule.ts +2 -1
- package/src/mem_pools/tx_pool_v2/interfaces.ts +12 -4
- package/src/mem_pools/tx_pool_v2/tx_metadata.ts +72 -20
- package/src/mem_pools/tx_pool_v2/tx_pool_indices.ts +29 -43
- package/src/mem_pools/tx_pool_v2/tx_pool_v2.ts +16 -1
- package/src/mem_pools/tx_pool_v2/tx_pool_v2_impl.ts +101 -94
- package/src/msg_validators/attestation_validator/README.md +49 -0
- package/src/msg_validators/attestation_validator/attestation_validator.ts +41 -9
- package/src/msg_validators/attestation_validator/fisherman_attestation_validator.ts +14 -7
- package/src/msg_validators/clock_tolerance.ts +79 -3
- package/src/msg_validators/proposal_validator/README.md +123 -0
- package/src/msg_validators/proposal_validator/block_proposal_validator.ts +24 -4
- package/src/msg_validators/proposal_validator/checkpoint_proposal_validator.ts +35 -7
- package/src/msg_validators/proposal_validator/proposal_validator.ts +114 -47
- package/src/msg_validators/tx_validator/README.md +15 -3
- package/src/msg_validators/tx_validator/aggregate_tx_validator.ts +3 -12
- package/src/msg_validators/tx_validator/allowed_public_setup.ts +22 -27
- package/src/msg_validators/tx_validator/allowed_setup_helpers.ts +31 -0
- 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/contract_instance_validator.ts +56 -0
- package/src/msg_validators/tx_validator/data_validator.ts +44 -1
- package/src/msg_validators/tx_validator/factory.ts +61 -10
- package/src/msg_validators/tx_validator/fee_payer_balance.ts +6 -2
- package/src/msg_validators/tx_validator/gas_validator.ts +121 -39
- package/src/msg_validators/tx_validator/index.ts +3 -0
- package/src/msg_validators/tx_validator/metadata_validator.ts +12 -4
- package/src/msg_validators/tx_validator/phases_validator.ts +82 -27
- package/src/msg_validators/tx_validator/tx_proof_validator.ts +2 -0
- package/src/msg_validators/tx_validator/tx_validation_cache.ts +102 -0
- package/src/services/data_store.ts +5 -13
- package/src/services/discv5/discV5_service.ts +38 -5
- package/src/services/dummy_service.ts +14 -39
- 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 +321 -276
- package/src/services/peer-manager/metrics.ts +7 -0
- package/src/services/peer-manager/peer_manager.ts +46 -11
- package/src/services/peer-manager/peer_scoring.ts +27 -5
- package/src/services/reqresp/README.md +215 -0
- package/src/services/reqresp/batch-tx-requester/README.md +46 -7
- package/src/services/reqresp/batch-tx-requester/batch_tx_requester.ts +83 -77
- package/src/services/reqresp/batch-tx-requester/interface.ts +13 -5
- 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/batch-tx-requester/tx_validator.ts +12 -25
- package/src/services/reqresp/config.ts +2 -2
- package/src/services/reqresp/interface.ts +21 -47
- package/src/services/reqresp/metrics.ts +0 -1
- package/src/services/reqresp/protocols/block_txs/block_txs_handler.ts +4 -2
- 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 +45 -260
- package/src/services/service.ts +12 -28
- 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/file_store_tx_source.ts +43 -31
- package/src/services/tx_collection/index.ts +1 -6
- package/src/services/tx_collection/instrumentation.ts +1 -7
- package/src/services/tx_collection/request_tracker.ts +127 -0
- package/src/services/tx_collection/tx_collection.ts +331 -176
- package/src/services/tx_collection/tx_collection_sink.ts +2 -2
- package/src/services/tx_collection/tx_source.ts +8 -7
- 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 +4 -1
- package/src/test-helpers/mock-pubsub.ts +46 -60
- package/src/test-helpers/reqresp-nodes.ts +13 -23
- package/src/test-helpers/test_tx_provider.ts +5 -0
- package/src/test-helpers/testbench-utils.ts +53 -28
- package/src/testbench/p2p_client_testbench_worker.ts +89 -55
- package/src/testbench/worker_client_manager.ts +72 -25
- package/src/util.ts +33 -18
- 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 -304
- 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/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 -15
- 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 -400
- package/dest/msg_validators/proposal_validator/proposal_validator_test_suite.d.ts +0 -23
- package/dest/msg_validators/proposal_validator/proposal_validator_test_suite.d.ts.map +0 -1
- package/dest/msg_validators/proposal_validator/proposal_validator_test_suite.js +0 -212
- 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 -54
- package/dest/services/tx_collection/fast_tx_collection.d.ts.map +0 -1
- package/dest/services/tx_collection/fast_tx_collection.js +0 -327
- 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/dest/services/tx_collection/proposal_tx_collector.d.ts +0 -49
- 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 -345
- package/src/client/test/tx_proposal_collector/proposal_tx_collector_worker_protocol.ts +0 -43
- 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 -20
- package/src/mem_pools/tx_pool/tx_pool.ts +0 -141
- package/src/mem_pools/tx_pool/tx_pool_test_suite.ts +0 -319
- package/src/msg_validators/proposal_validator/proposal_validator_test_suite.ts +0 -230
- 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 -387
- package/src/services/tx_collection/missing_txs_tracker.ts +0 -52
- package/src/services/tx_collection/proposal_tx_collector.ts +0 -113
- package/src/services/tx_collection/slow_tx_collection.ts +0 -266
package/dest/config.js
CHANGED
|
@@ -1,15 +1,41 @@
|
|
|
1
|
-
import { booleanConfigHelper, getConfigFromMappings, getDefaultConfig, numberConfigHelper, percentageConfigHelper, pickConfigMappings, secretStringConfigHelper } from '@aztec/foundation/config';
|
|
1
|
+
import { bigintConfigHelper, booleanConfigHelper, getConfigFromMappings, getDefaultConfig, numberConfigHelper, optionalNumberConfigHelper, percentageConfigHelper, pickConfigMappings, secretStringConfigHelper } from '@aztec/foundation/config';
|
|
2
2
|
import { Fr } from '@aztec/foundation/curves/bn254';
|
|
3
|
-
import { dataConfigMappings } from '@aztec/kv-store/config';
|
|
4
3
|
import { FunctionSelector } from '@aztec/stdlib/abi/function-selector';
|
|
5
4
|
import { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
6
5
|
import { chainConfigMappings, sharedSequencerConfigMappings } from '@aztec/stdlib/config';
|
|
6
|
+
import { dataConfigMappings } from '@aztec/stdlib/kv-store';
|
|
7
7
|
import { batchTxRequesterConfigMappings } from './services/reqresp/batch-tx-requester/config.js';
|
|
8
8
|
import { p2pReqRespConfigMappings } from './services/reqresp/config.js';
|
|
9
9
|
import { txCollectionConfigMappings } from './services/tx_collection/config.js';
|
|
10
10
|
import { txFileStoreConfigMappings } from './services/tx_file_store/config.js';
|
|
11
11
|
export const DEFAULT_P2P_PORT = 40400;
|
|
12
|
+
/** Default endpoints used to discover this machine's public IPv4 when `queryForIp` is enabled. */ export const DEFAULT_PUBLIC_IP_SERVICES = [
|
|
13
|
+
'https://api.ipify.org/',
|
|
14
|
+
'https://checkip.amazonaws.com/',
|
|
15
|
+
'https://ifconfig.me/ip',
|
|
16
|
+
'https://icanhazip.com/'
|
|
17
|
+
];
|
|
12
18
|
export const p2pConfigMappings = {
|
|
19
|
+
validateMaxTxsPerBlock: {
|
|
20
|
+
env: 'VALIDATOR_MAX_TX_PER_BLOCK',
|
|
21
|
+
description: 'Maximum transactions per block for validation. Overrides maxTxsPerBlock for gossip validation when set.',
|
|
22
|
+
...optionalNumberConfigHelper()
|
|
23
|
+
},
|
|
24
|
+
validateMaxTxsPerCheckpoint: {
|
|
25
|
+
env: 'VALIDATOR_MAX_TX_PER_CHECKPOINT',
|
|
26
|
+
description: 'Maximum transactions per checkpoint for validation. Used as fallback for maxTxsPerBlock when that is not set.',
|
|
27
|
+
...optionalNumberConfigHelper()
|
|
28
|
+
},
|
|
29
|
+
validateMaxL2BlockGas: {
|
|
30
|
+
env: 'VALIDATOR_MAX_L2_BLOCK_GAS',
|
|
31
|
+
description: 'Maximum L2 gas per block for validation. When set, txs exceeding this limit are rejected.',
|
|
32
|
+
...optionalNumberConfigHelper()
|
|
33
|
+
},
|
|
34
|
+
validateMaxDABlockGas: {
|
|
35
|
+
env: 'VALIDATOR_MAX_DA_BLOCK_GAS',
|
|
36
|
+
description: 'Maximum DA gas per block for validation. When set, txs exceeding this limit are rejected.',
|
|
37
|
+
...optionalNumberConfigHelper()
|
|
38
|
+
},
|
|
13
39
|
p2pEnabled: {
|
|
14
40
|
env: 'P2P_ENABLED',
|
|
15
41
|
description: 'A flag dictating whether the P2P subsystem should be enabled.',
|
|
@@ -40,6 +66,11 @@ export const p2pConfigMappings = {
|
|
|
40
66
|
description: 'The frequency in which to check for new peers.',
|
|
41
67
|
...numberConfigHelper(30_000)
|
|
42
68
|
},
|
|
69
|
+
peerFailedBanTimeMs: {
|
|
70
|
+
env: 'P2P_PEER_FAILED_BAN_TIME_MS',
|
|
71
|
+
description: 'How long to ban a peer after it fails maximum dial attempts.',
|
|
72
|
+
...numberConfigHelper(5 * 60 * 1000)
|
|
73
|
+
},
|
|
43
74
|
l2QueueSize: {
|
|
44
75
|
env: 'P2P_L2_QUEUE_SIZE',
|
|
45
76
|
description: 'Size of queue of L2 blocks to store.',
|
|
@@ -98,6 +129,12 @@ export const p2pConfigMappings = {
|
|
|
98
129
|
description: 'If announceUdpAddress or announceTcpAddress are not provided, query for the IP address of the machine. Default is false.',
|
|
99
130
|
...booleanConfigHelper()
|
|
100
131
|
},
|
|
132
|
+
publicIpServices: {
|
|
133
|
+
env: 'P2P_PUBLIC_IP_SERVICES',
|
|
134
|
+
parseEnv: (val)=>val.split(',').map((s)=>s.trim()).filter(Boolean),
|
|
135
|
+
description: 'Comma-separated HTTPS URLs that return plain-text public IPv4. Used when P2P_QUERY_FOR_IP is true and P2P_IP is unset. Tried in order until one succeeds.',
|
|
136
|
+
defaultValue: DEFAULT_PUBLIC_IP_SERVICES
|
|
137
|
+
},
|
|
101
138
|
gossipsubInterval: {
|
|
102
139
|
env: 'P2P_GOSSIPSUB_INTERVAL_MS',
|
|
103
140
|
description: 'The interval of the gossipsub heartbeat to perform maintenance tasks.',
|
|
@@ -131,7 +168,7 @@ export const p2pConfigMappings = {
|
|
|
131
168
|
gossipsubMcacheLength: {
|
|
132
169
|
env: 'P2P_GOSSIPSUB_MCACHE_LENGTH',
|
|
133
170
|
description: 'The number of gossipsub interval message cache windows to keep.',
|
|
134
|
-
...numberConfigHelper(
|
|
171
|
+
...numberConfigHelper(12)
|
|
135
172
|
},
|
|
136
173
|
gossipsubMcacheGossip: {
|
|
137
174
|
env: 'P2P_GOSSIPSUB_MCACHE_GOSSIP',
|
|
@@ -203,14 +240,14 @@ export const p2pConfigMappings = {
|
|
|
203
240
|
},
|
|
204
241
|
p2pStoreMapSizeKb: {
|
|
205
242
|
env: 'P2P_STORE_MAP_SIZE_KB',
|
|
206
|
-
|
|
243
|
+
...optionalNumberConfigHelper(),
|
|
207
244
|
description: 'The maximum possible size of the P2P DB in KB. Overwrites the general dataStoreMapSizeKb.'
|
|
208
245
|
},
|
|
209
|
-
|
|
246
|
+
txPublicSetupAllowListExtend: {
|
|
210
247
|
env: 'TX_PUBLIC_SETUP_ALLOWLIST',
|
|
211
248
|
parseEnv: (val)=>parseAllowList(val),
|
|
212
|
-
description: '
|
|
213
|
-
printDefault: ()=>'AuthRegistry
|
|
249
|
+
description: 'Additional entries to extend the default setup allow list. Format: I:address:selector[:flags],C:classId:selector[:flags]. Flags: os (onlySelf), rn (rejectNullMsgSender), cl=N (calldataLength), joined with +.',
|
|
250
|
+
printDefault: ()=>'Default: AuthRegistry._set_authorized, AuthRegistry.set_authorized, FeeJuice._increase_public_balance'
|
|
214
251
|
},
|
|
215
252
|
maxPendingTxCount: {
|
|
216
253
|
env: 'P2P_MAX_PENDING_TX_COUNT',
|
|
@@ -224,6 +261,11 @@ export const p2pConfigMappings = {
|
|
|
224
261
|
description: 'The number of messages to keep in the seen message cache',
|
|
225
262
|
...numberConfigHelper(100_000)
|
|
226
263
|
},
|
|
264
|
+
txValidationCacheSize: {
|
|
265
|
+
env: 'P2P_TX_VALIDATION_CACHE_SIZE',
|
|
266
|
+
description: 'Maximum number of items to keep in the tx validation LRU cache.',
|
|
267
|
+
...numberConfigHelper(5_000)
|
|
268
|
+
},
|
|
227
269
|
p2pDisableStatusHandshake: {
|
|
228
270
|
env: 'P2P_DISABLE_STATUS_HANDSHAKE',
|
|
229
271
|
description: 'True to disable the status handshake on peer connected.',
|
|
@@ -259,6 +301,11 @@ export const p2pConfigMappings = {
|
|
|
259
301
|
description: 'Alters the format of p2p messages to include things like broadcast timestamp FOR TESTING ONLY',
|
|
260
302
|
...booleanConfigHelper(false)
|
|
261
303
|
},
|
|
304
|
+
l1PublishingTime: {
|
|
305
|
+
env: 'SEQ_L1_PUBLISHING_TIME_ALLOWANCE_IN_SLOT',
|
|
306
|
+
description: 'How much time (in seconds) we allow in the slot for publishing the L1 tx (defaults to 1 L1 slot).',
|
|
307
|
+
...optionalNumberConfigHelper()
|
|
308
|
+
},
|
|
262
309
|
fishermanMode: {
|
|
263
310
|
env: 'FISHERMAN_MODE',
|
|
264
311
|
description: 'Whether to run in fisherman mode: validates all proposals and attestations but does not broadcast attestations or participate in consensus.',
|
|
@@ -268,11 +315,38 @@ export const p2pConfigMappings = {
|
|
|
268
315
|
description: 'Broadcast block proposals even when a conflicting proposal for the same slot already exists in the pool (for testing purposes only).',
|
|
269
316
|
...booleanConfigHelper(false)
|
|
270
317
|
},
|
|
318
|
+
skipIncomingProposals: {
|
|
319
|
+
description: 'Drop incoming block and checkpoint proposals at the libp2p dispatch layer (for testing only)',
|
|
320
|
+
...booleanConfigHelper(false)
|
|
321
|
+
},
|
|
322
|
+
skipProposalSlotValidation: {
|
|
323
|
+
description: 'Accept proposal gossip regardless of slot timing (for testing only)',
|
|
324
|
+
...booleanConfigHelper(false)
|
|
325
|
+
},
|
|
326
|
+
skipCheckpointProposalValidation: {
|
|
327
|
+
description: 'Skip checkpoint proposal validation and always attest, broadcasting the attestation before processing the embedded last block',
|
|
328
|
+
...booleanConfigHelper(false)
|
|
329
|
+
},
|
|
271
330
|
minTxPoolAgeMs: {
|
|
272
331
|
env: 'P2P_MIN_TX_POOL_AGE_MS',
|
|
273
332
|
description: 'Minimum age (ms) a transaction must have been in the pool before it is eligible for block building.',
|
|
274
333
|
...numberConfigHelper(2_000)
|
|
275
334
|
},
|
|
335
|
+
slashDataWithholdingToleranceSlots: {
|
|
336
|
+
env: 'SLASH_DATA_WITHHOLDING_TOLERANCE_SLOTS',
|
|
337
|
+
description: 'L2 slots to wait after a checkpoint slot before declaring its txs missing. Drives both the data-withholding slasher check and the missing-tx collection deadline.',
|
|
338
|
+
...numberConfigHelper(3)
|
|
339
|
+
},
|
|
340
|
+
p2pMissingTxCollectionDeadlineSlots: {
|
|
341
|
+
env: 'P2P_MISSING_TX_COLLECTION_DEADLINE_SLOTS',
|
|
342
|
+
description: 'Optional deadline (in L2 slots after the block slot) for collecting missing txs for unproven mined blocks. Clamped up to the data-withholding tolerance window so collection never gives up before the slash verdict.',
|
|
343
|
+
...optionalNumberConfigHelper()
|
|
344
|
+
},
|
|
345
|
+
priceBumpPercentage: {
|
|
346
|
+
env: 'P2P_RPC_PRICE_BUMP_PERCENTAGE',
|
|
347
|
+
description: 'Minimum percentage fee increase required to replace an existing tx via RPC. Even at 0%, replacement still requires paying at least 1 unit more.',
|
|
348
|
+
...bigintConfigHelper(10n)
|
|
349
|
+
},
|
|
276
350
|
...sharedSequencerConfigMappings,
|
|
277
351
|
...p2pReqRespConfigMappings,
|
|
278
352
|
...batchTxRequesterConfigMappings,
|
|
@@ -300,20 +374,45 @@ const bootnodeConfigKeys = [
|
|
|
300
374
|
'dataStoreMapSizeKb',
|
|
301
375
|
'bootstrapNodes',
|
|
302
376
|
'l1ChainId',
|
|
303
|
-
'queryForIp'
|
|
377
|
+
'queryForIp',
|
|
378
|
+
'publicIpServices'
|
|
304
379
|
];
|
|
305
380
|
export const bootnodeConfigMappings = pickConfigMappings({
|
|
306
381
|
...p2pConfigMappings,
|
|
307
382
|
...dataConfigMappings,
|
|
308
383
|
...chainConfigMappings
|
|
309
384
|
}, bootnodeConfigKeys);
|
|
385
|
+
/**
|
|
386
|
+
* Parses a `+`-separated flags string into validation properties for an allow list entry.
|
|
387
|
+
* Supported flags: `os` (onlySelf), `rn` (rejectNullMsgSender), `cl=N` (calldataLength).
|
|
388
|
+
*/ function parseFlags(flags, entry) {
|
|
389
|
+
const result = {};
|
|
390
|
+
for (const flag of flags.split('+')){
|
|
391
|
+
if (flag === 'os') {
|
|
392
|
+
result.onlySelf = true;
|
|
393
|
+
} else if (flag === 'rn') {
|
|
394
|
+
result.rejectNullMsgSender = true;
|
|
395
|
+
} else if (flag.startsWith('cl=')) {
|
|
396
|
+
const n = parseInt(flag.slice(3), 10);
|
|
397
|
+
if (isNaN(n) || n < 0) {
|
|
398
|
+
throw new Error(`Invalid allow list entry "${entry}": invalid calldataLength in flag "${flag}". Expected a non-negative integer.`);
|
|
399
|
+
}
|
|
400
|
+
result.calldataLength = n;
|
|
401
|
+
} else {
|
|
402
|
+
throw new Error(`Invalid allow list entry "${entry}": unknown flag "${flag}". Supported flags: os, rn, cl=N.`);
|
|
403
|
+
}
|
|
404
|
+
}
|
|
405
|
+
return result;
|
|
406
|
+
}
|
|
310
407
|
/**
|
|
311
408
|
* Parses a string to a list of allowed elements.
|
|
312
|
-
* Each
|
|
313
|
-
* `I:${address}`
|
|
314
|
-
* `
|
|
315
|
-
*
|
|
316
|
-
*
|
|
409
|
+
* Each entry is expected to be of one of the following formats:
|
|
410
|
+
* `I:${address}:${selector}` — instance (contract address) with function selector
|
|
411
|
+
* `C:${classId}:${selector}` — class with function selector
|
|
412
|
+
*
|
|
413
|
+
* An optional flags segment can be appended after the selector:
|
|
414
|
+
* `I:${address}:${selector}:${flags}` or `C:${classId}:${selector}:${flags}`
|
|
415
|
+
* where flags is a `+`-separated list of: `os` (onlySelf), `rn` (rejectNullMsgSender), `cl=N` (calldataLength).
|
|
317
416
|
*
|
|
318
417
|
* @param value The string to parse
|
|
319
418
|
* @returns A list of allowed elements
|
|
@@ -323,30 +422,30 @@ export const bootnodeConfigMappings = pickConfigMappings({
|
|
|
323
422
|
return entries;
|
|
324
423
|
}
|
|
325
424
|
for (const val of value.split(',')){
|
|
326
|
-
const
|
|
327
|
-
|
|
425
|
+
const trimmed = val.trim();
|
|
426
|
+
if (!trimmed) {
|
|
427
|
+
continue;
|
|
428
|
+
}
|
|
429
|
+
const [typeString, identifierString, selectorString, flagsString] = trimmed.split(':');
|
|
430
|
+
if (!selectorString) {
|
|
431
|
+
throw new Error(`Invalid allow list entry "${trimmed}": selector is required. Expected format: I:address:selector or C:classId:selector`);
|
|
432
|
+
}
|
|
433
|
+
const selector = FunctionSelector.fromString(selectorString);
|
|
434
|
+
const flags = flagsString ? parseFlags(flagsString, trimmed) : {};
|
|
328
435
|
if (typeString === 'I') {
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
} else {
|
|
335
|
-
entries.push({
|
|
336
|
-
address: AztecAddress.fromString(identifierString)
|
|
337
|
-
});
|
|
338
|
-
}
|
|
436
|
+
entries.push({
|
|
437
|
+
address: AztecAddress.fromString(identifierString),
|
|
438
|
+
selector,
|
|
439
|
+
...flags
|
|
440
|
+
});
|
|
339
441
|
} else if (typeString === 'C') {
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
classId: Fr.fromHexString(identifierString)
|
|
348
|
-
});
|
|
349
|
-
}
|
|
442
|
+
entries.push({
|
|
443
|
+
classId: Fr.fromHexString(identifierString),
|
|
444
|
+
selector,
|
|
445
|
+
...flags
|
|
446
|
+
});
|
|
447
|
+
} else {
|
|
448
|
+
throw new Error(`Invalid allow list entry "${trimmed}": unknown type "${typeString}". Expected "I" (instance) or "C" (class).`);
|
|
350
449
|
}
|
|
351
450
|
}
|
|
352
451
|
return entries;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/** Checkpoint Proposal Received Callback Not Registered Error
|
|
2
|
+
*
|
|
3
|
+
* Error triggered if the allNodesCheckpointReceivedCallback is not registered
|
|
4
|
+
* @category Errors
|
|
5
|
+
*/
|
|
6
|
+
export declare class CheckpointProposalReceivedCallbackNotRegisteredError extends Error {
|
|
7
|
+
constructor();
|
|
8
|
+
}
|
|
9
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicDJwLXNlcnZpY2UuZXJyb3IuZC50cyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9lcnJvcnMvcDJwLXNlcnZpY2UuZXJyb3IudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUE7Ozs7R0FJRztBQUNILHFCQUFhLG9EQUFxRCxTQUFRLEtBQUs7SUFDN0UsY0FHQztDQUNGIn0=
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"p2p-service.error.d.ts","sourceRoot":"","sources":["../../src/errors/p2p-service.error.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,qBAAa,oDAAqD,SAAQ,KAAK;IAC7E,cAGC;CACF"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/** Checkpoint Proposal Received Callback Not Registered Error
|
|
2
|
+
*
|
|
3
|
+
* Error triggered if the allNodesCheckpointReceivedCallback is not registered
|
|
4
|
+
* @category Errors
|
|
5
|
+
*/ export class CheckpointProposalReceivedCallbackNotRegisteredError extends Error {
|
|
6
|
+
constructor(){
|
|
7
|
+
super('FATAL (allNodesCheckpointReceivedCallback): All nodes should register a checkpoint proposal handler');
|
|
8
|
+
this.name = 'CheckpointProposalReceivedCallbackNotRegisteredError';
|
|
9
|
+
}
|
|
10
|
+
}
|
|
@@ -6,23 +6,4 @@
|
|
|
6
6
|
export declare class IndividualReqRespTimeoutError extends Error {
|
|
7
7
|
constructor();
|
|
8
8
|
}
|
|
9
|
-
|
|
10
|
-
*
|
|
11
|
-
* This error will be thrown when a req resp request times out regardless of the peer.
|
|
12
|
-
* @category Errors
|
|
13
|
-
*/
|
|
14
|
-
export declare class CollectiveReqRespTimeoutError extends Error {
|
|
15
|
-
constructor();
|
|
16
|
-
}
|
|
17
|
-
/** Invalid response error
|
|
18
|
-
*
|
|
19
|
-
* This error will be thrown when a response is received that is not valid.
|
|
20
|
-
*
|
|
21
|
-
* This error does not need to be punished as message validators will handle punishing invalid
|
|
22
|
-
* requests
|
|
23
|
-
* @category Errors
|
|
24
|
-
*/
|
|
25
|
-
export declare class InvalidResponseError extends Error {
|
|
26
|
-
constructor();
|
|
27
|
-
}
|
|
28
|
-
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicmVxcmVzcC5lcnJvci5kLnRzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vc3JjL2Vycm9ycy9yZXFyZXNwLmVycm9yLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBOzs7O0dBSUc7QUFDSCxxQkFBYSw2QkFBOEIsU0FBUSxLQUFLO0lBQ3RELGNBRUM7Q0FDRjtBQUVEOzs7O0dBSUc7QUFDSCxxQkFBYSw2QkFBOEIsU0FBUSxLQUFLO0lBQ3RELGNBRUM7Q0FDRjtBQUVEOzs7Ozs7O0dBT0c7QUFDSCxxQkFBYSxvQkFBcUIsU0FBUSxLQUFLO0lBQzdDLGNBRUM7Q0FDRiJ9
|
|
9
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicmVxcmVzcC5lcnJvci5kLnRzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vc3JjL2Vycm9ycy9yZXFyZXNwLmVycm9yLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBOzs7O0dBSUc7QUFDSCxxQkFBYSw2QkFBOEIsU0FBUSxLQUFLO0lBQ3RELGNBRUM7Q0FDRiJ9
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"reqresp.error.d.ts","sourceRoot":"","sources":["../../src/errors/reqresp.error.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,qBAAa,6BAA8B,SAAQ,KAAK;IACtD,cAEC;CACF
|
|
1
|
+
{"version":3,"file":"reqresp.error.d.ts","sourceRoot":"","sources":["../../src/errors/reqresp.error.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,qBAAa,6BAA8B,SAAQ,KAAK;IACtD,cAEC;CACF"}
|
|
@@ -7,24 +7,3 @@
|
|
|
7
7
|
super(`Request to peer timed out`);
|
|
8
8
|
}
|
|
9
9
|
}
|
|
10
|
-
/** Collective request timeout error
|
|
11
|
-
*
|
|
12
|
-
* This error will be thrown when a req resp request times out regardless of the peer.
|
|
13
|
-
* @category Errors
|
|
14
|
-
*/ export class CollectiveReqRespTimeoutError extends Error {
|
|
15
|
-
constructor(){
|
|
16
|
-
super(`Request to all peers timed out`);
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
/** Invalid response error
|
|
20
|
-
*
|
|
21
|
-
* This error will be thrown when a response is received that is not valid.
|
|
22
|
-
*
|
|
23
|
-
* This error does not need to be punished as message validators will handle punishing invalid
|
|
24
|
-
* requests
|
|
25
|
-
* @category Errors
|
|
26
|
-
*/ export class InvalidResponseError extends Error {
|
|
27
|
-
constructor(){
|
|
28
|
-
super(`Invalid response received`);
|
|
29
|
-
}
|
|
30
|
-
}
|
package/dest/index.d.ts
CHANGED
|
@@ -5,8 +5,7 @@ export * from './client/index.js';
|
|
|
5
5
|
export * from './enr/index.js';
|
|
6
6
|
export * from './config.js';
|
|
7
7
|
export * from './mem_pools/attestation_pool/index.js';
|
|
8
|
-
export * from './mem_pools/tx_pool/index.js';
|
|
9
8
|
export * from './mem_pools/tx_pool_v2/index.js';
|
|
10
9
|
export * from './msg_validators/index.js';
|
|
11
10
|
export * from './services/index.js';
|
|
12
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
11
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguZC50cyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uL3NyYy9pbmRleC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxPQUFPLEVBQUUscUJBQXFCLEVBQUUsTUFBTSx5QkFBeUIsQ0FBQztBQUNoRSxZQUFZLEVBQUUsTUFBTSxFQUFFLE1BQU0sbUJBQW1CLENBQUM7QUFFaEQsY0FBYywwQkFBMEIsQ0FBQztBQUN6QyxjQUFjLG1CQUFtQixDQUFDO0FBQ2xDLGNBQWMsZ0JBQWdCLENBQUM7QUFDL0IsY0FBYyxhQUFhLENBQUM7QUFDNUIsY0FBYyx1Q0FBdUMsQ0FBQztBQUN0RCxjQUFjLGlDQUFpQyxDQUFDO0FBQ2hELGNBQWMsMkJBQTJCLENBQUM7QUFDMUMsY0FBYyxxQkFBcUIsQ0FBQyJ9
|
package/dest/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AAChE,YAAY,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAEhD,cAAc,0BAA0B,CAAC;AACzC,cAAc,mBAAmB,CAAC;AAClC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,aAAa,CAAC;AAC5B,cAAc,uCAAuC,CAAC;AACtD,cAAc,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AAChE,YAAY,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAEhD,cAAc,0BAA0B,CAAC;AACzC,cAAc,mBAAmB,CAAC;AAClC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,aAAa,CAAC;AAC5B,cAAc,uCAAuC,CAAC;AACtD,cAAc,iCAAiC,CAAC;AAChD,cAAc,2BAA2B,CAAC;AAC1C,cAAc,qBAAqB,CAAC"}
|
package/dest/index.js
CHANGED
|
@@ -4,7 +4,6 @@ export * from './client/index.js';
|
|
|
4
4
|
export * from './enr/index.js';
|
|
5
5
|
export * from './config.js';
|
|
6
6
|
export * from './mem_pools/attestation_pool/index.js';
|
|
7
|
-
export * from './mem_pools/tx_pool/index.js';
|
|
8
7
|
export * from './mem_pools/tx_pool_v2/index.js';
|
|
9
8
|
export * from './msg_validators/index.js';
|
|
10
9
|
export * from './services/index.js';
|
|
@@ -1,91 +1,123 @@
|
|
|
1
|
-
import { SlotNumber } from '@aztec/foundation/branded-types';
|
|
1
|
+
import type { CheckpointProposalHash, SlotNumber } from '@aztec/foundation/branded-types';
|
|
2
2
|
import type { AztecAsyncKVStore } from '@aztec/kv-store';
|
|
3
3
|
import { BlockProposal, CheckpointAttestation, type CheckpointProposalCore } from '@aztec/stdlib/p2p';
|
|
4
4
|
import { type TelemetryClient } from '@aztec/telemetry-client';
|
|
5
5
|
/** Result of trying to add an item (proposal or attestation) to the pool */
|
|
6
6
|
export type TryAddResult = {
|
|
7
|
-
/** Whether the item was
|
|
7
|
+
/** Whether the item was accepted into pool state. False when it already existed, was invalid, or hit a cap. */
|
|
8
8
|
added: boolean;
|
|
9
|
-
/** Whether the exact
|
|
9
|
+
/** Whether the exact signed payload (matched by payload hash) already existed in the pool. */
|
|
10
10
|
alreadyExists: boolean;
|
|
11
|
-
/**
|
|
12
|
-
* - tryAddBlockProposal:
|
|
13
|
-
* - tryAddCheckpointProposal:
|
|
14
|
-
* - tryAddCheckpointAttestation:
|
|
11
|
+
/** Number of distinct signed-payload hashes seen for the position. Meaning varies by method:
|
|
12
|
+
* - tryAddBlockProposal: distinct payload hashes at (slot, indexWithinCheckpoint)
|
|
13
|
+
* - tryAddCheckpointProposal: distinct payload hashes at slot
|
|
14
|
+
* - tryAddCheckpointAttestation: distinct payload hashes by this signer for this slot */
|
|
15
15
|
count: number;
|
|
16
16
|
};
|
|
17
|
-
export
|
|
18
|
-
|
|
17
|
+
export type ProposalsForSlot = {
|
|
18
|
+
blockProposals: BlockProposal[];
|
|
19
|
+
checkpointProposals: CheckpointProposalCore[];
|
|
20
|
+
};
|
|
21
|
+
export declare const MAX_CHECKPOINT_PROPOSALS_PER_SLOT = 2;
|
|
22
|
+
export declare const MAX_BLOCK_PROPOSALS_PER_POSITION = 2;
|
|
19
23
|
/** Maximum attestations a single signer can make per slot before being rejected. */
|
|
20
|
-
export declare const MAX_ATTESTATIONS_PER_SLOT_AND_SIGNER =
|
|
24
|
+
export declare const MAX_ATTESTATIONS_PER_SLOT_AND_SIGNER = 2;
|
|
21
25
|
/** Public API interface for attestation pools. Used for typing mocks and test implementations. */
|
|
22
|
-
export type AttestationPoolApi = Pick<AttestationPool, 'tryAddBlockProposal' | '
|
|
26
|
+
export type AttestationPoolApi = Pick<AttestationPool, 'tryAddBlockProposal' | 'getBlockProposalByArchive' | 'getProposalsForSlot' | 'tryAddCheckpointProposal' | 'getCheckpointProposal' | 'addOwnCheckpointAttestations' | 'tryAddCheckpointAttestation' | 'deleteOlderThan' | 'getCheckpointAttestationsForSlot' | 'getCheckpointAttestationsForSlotAndProposal' | 'hasBlockProposalsForSlot' | 'isEmpty'>;
|
|
23
27
|
/**
|
|
24
28
|
* Pool for storing attestations and proposals collected by a validator.
|
|
25
29
|
*
|
|
26
30
|
* Attestations and proposals observed via the p2p network are stored for requests
|
|
27
31
|
* from the validator to produce a block, or to serve to other peers.
|
|
32
|
+
*
|
|
33
|
+
* Equivocation detection: distinct *signed payload hashes* arriving at the same
|
|
34
|
+
* position are tracked in the matching index multimap so the equivocation count
|
|
35
|
+
* reaches 2 even when archive collides on `feeAssetPriceModifier` variants.
|
|
36
|
+
* Proposal bytes are retained per accepted payload hash, up to the same equivocation
|
|
37
|
+
* caps, for slashing watchers that need signed P2P proposals.
|
|
28
38
|
*/
|
|
29
39
|
export declare class AttestationPool {
|
|
30
40
|
private store;
|
|
31
41
|
private log;
|
|
32
42
|
private metrics;
|
|
33
|
-
private
|
|
34
|
-
private
|
|
35
|
-
private
|
|
36
|
-
private
|
|
37
|
-
private
|
|
38
|
-
private
|
|
43
|
+
private attestationPerSlotAndSigner;
|
|
44
|
+
private attestationHashesPerSlotAndSigner;
|
|
45
|
+
private checkpointProposalsPerSlotAndHash;
|
|
46
|
+
private checkpointProposalHashesPerSlot;
|
|
47
|
+
private blockProposalsPerSlotIndexAndHash;
|
|
48
|
+
private blockProposalHashesPerSlotAndIndex;
|
|
49
|
+
private blockProposalKeysPerArchive;
|
|
39
50
|
constructor(store: AztecAsyncKVStore, telemetry?: TelemetryClient, log?: import("@aztec/foundation/log").Logger);
|
|
40
51
|
private poolStats;
|
|
41
52
|
/** Returns whether the pool is empty. */
|
|
42
53
|
isEmpty(): Promise<boolean>;
|
|
43
|
-
private getProposalKey;
|
|
44
|
-
private getAttestationKey;
|
|
45
|
-
/** Returns range bounds for querying all attestations for a given slot. */
|
|
46
|
-
private getAttestationKeyRangeForSlot;
|
|
47
|
-
/** Returns range bounds for querying all attestations for a given (slot, proposalId). */
|
|
48
|
-
private getAttestationKeyRangeForProposal;
|
|
49
|
-
/** Creates a key for the per-signer-per-slot attestation index. Uses padded slot for lexicographic ordering. */
|
|
50
|
-
private getSlotSignerKey;
|
|
51
54
|
/** Number of bits reserved for indexWithinCheckpoint in position keys. */
|
|
52
55
|
private static readonly INDEX_BITS;
|
|
53
56
|
/** Maximum indexWithinCheckpoint value (2^10 - 1 = 1023). */
|
|
54
57
|
private static readonly MAX_INDEX;
|
|
55
|
-
/**
|
|
58
|
+
/** Decimal digits used to left-pad slot numbers in string keys.
|
|
59
|
+
* 10 digits ≈ 3500 years at 36 s/slot, leaving ample headroom. */
|
|
60
|
+
private static readonly SLOT_PAD_DIGITS;
|
|
61
|
+
/** Fixed-width decimal slot string for use in composite string keys. */
|
|
62
|
+
private slotPaddedKey;
|
|
63
|
+
/** Fixed-width decimal index string for use in composite string keys. */
|
|
64
|
+
private indexPaddedKey;
|
|
65
|
+
/** Key for retained block proposals. */
|
|
66
|
+
private getBlockProposalKey;
|
|
67
|
+
/** Range bounds for all retained block proposals in a slot. */
|
|
68
|
+
private getBlockProposalKeyRangeForSlot;
|
|
69
|
+
/** Key for retained checkpoint proposals. */
|
|
70
|
+
private getCheckpointProposalKey;
|
|
71
|
+
/** Range bounds for all retained checkpoint proposals in a slot. */
|
|
72
|
+
private getCheckpointProposalKeyRangeForSlot;
|
|
73
|
+
/** Key for the per-(slot, signer) attestation main store and equivocation index. */
|
|
74
|
+
private getSlotSignerKey;
|
|
75
|
+
/**
|
|
76
|
+
* Returns range bounds for querying all attestations for a given slot.
|
|
77
|
+
* Fixed-width padding ensures the slot prefix sorts cleanly, so using the next
|
|
78
|
+
* slot's prefix as the upper bound captures exactly the current slot's entries.
|
|
79
|
+
*/
|
|
80
|
+
private getAttestationKeyRangeForSlot;
|
|
81
|
+
/** Creates a position key for block proposals: slot * 1024 + indexWithinCheckpoint.
|
|
82
|
+
* Uses multiplication instead of bit-shift to avoid 32-bit signed integer overflow
|
|
83
|
+
* (bit-shift overflows after slot ~2^21, roughly 278 days of uptime). */
|
|
56
84
|
private getBlockPositionKey;
|
|
85
|
+
private multimapHasValue;
|
|
57
86
|
/**
|
|
58
87
|
* Attempts to add a block proposal to the pool.
|
|
59
88
|
*
|
|
60
|
-
*
|
|
61
|
-
*
|
|
62
|
-
* -
|
|
63
|
-
*
|
|
89
|
+
* - Detects duplicates by signed-payload hash (not archive); a re-broadcast of the
|
|
90
|
+
* exact same signed payload returns `alreadyExists: true`.
|
|
91
|
+
* - Distinct payload hashes at the same `(slot, indexWithinCheckpoint)` are tracked
|
|
92
|
+
* in the equivocation index and retained up to the cap.
|
|
64
93
|
*
|
|
65
94
|
* @param blockProposal - The block proposal to add
|
|
66
95
|
* @returns Result indicating whether the proposal was added and duplicate detection info
|
|
67
96
|
*/
|
|
68
97
|
tryAddBlockProposal(blockProposal: BlockProposal): Promise<TryAddResult>;
|
|
69
|
-
/** Gets the count of block proposals for a given position (slot, indexWithinCheckpoint). */
|
|
70
|
-
private getBlockProposalCountForPosition;
|
|
71
|
-
private addBlockProposal;
|
|
72
98
|
/**
|
|
73
|
-
* Get block proposal by
|
|
99
|
+
* Get block proposal by archive root.
|
|
74
100
|
*
|
|
75
|
-
*
|
|
101
|
+
* Resolves the archive root through the archive index and returns the first
|
|
102
|
+
* retained proposal for that archive. This lookup is used by block-txs req/resp,
|
|
103
|
+
* where any retained proposal for the requested archive gives the tx hash list.
|
|
76
104
|
*
|
|
77
|
-
* @
|
|
105
|
+
* @param archiveRoot - The archive root to look up
|
|
106
|
+
* @return The block proposal if it exists and its archive matches, otherwise undefined.
|
|
78
107
|
*/
|
|
79
|
-
|
|
108
|
+
getBlockProposalByArchive(archiveRoot: string): Promise<BlockProposal | undefined>;
|
|
109
|
+
/** Returns retained signed proposals for a slot. */
|
|
110
|
+
getProposalsForSlot(slot: SlotNumber): Promise<ProposalsForSlot>;
|
|
80
111
|
/** Checks if any block proposals exist for a given slot (at index 0). */
|
|
81
112
|
hasBlockProposalsForSlot(slot: SlotNumber): Promise<boolean>;
|
|
82
113
|
/**
|
|
83
114
|
* Attempts to add a checkpoint proposal to the pool.
|
|
84
115
|
*
|
|
85
|
-
*
|
|
86
|
-
*
|
|
87
|
-
* -
|
|
88
|
-
*
|
|
116
|
+
* - Detects duplicates by signed-payload hash (not archive); a re-broadcast of the
|
|
117
|
+
* exact same signed payload returns `alreadyExists: true`.
|
|
118
|
+
* - Distinct payload hashes at the same slot are tracked in the equivocation index.
|
|
119
|
+
* Distinct payload bytes are retained up to the same cap so slashing watchers
|
|
120
|
+
* can recover signed proposals.
|
|
89
121
|
*
|
|
90
122
|
* Note: This method only handles the CheckpointProposalCore. If the original
|
|
91
123
|
* CheckpointProposal contains a lastBlock, the caller should extract it via
|
|
@@ -95,37 +127,44 @@ export declare class AttestationPool {
|
|
|
95
127
|
* @returns Result indicating whether the proposal was added and duplicate detection info
|
|
96
128
|
*/
|
|
97
129
|
tryAddCheckpointProposal(proposal: CheckpointProposalCore): Promise<TryAddResult>;
|
|
98
|
-
private addCheckpointProposal;
|
|
99
130
|
/**
|
|
100
|
-
* Get checkpoint proposal
|
|
131
|
+
* Get a retained checkpoint proposal stored for the given slot.
|
|
132
|
+
* If multiple proposals were retained for an equivocation, returns the lowest
|
|
133
|
+
* payload hash deterministically.
|
|
101
134
|
*
|
|
102
135
|
* Returns a CheckpointProposalCore (without lastBlock info) since the lastBlock
|
|
103
136
|
* is extracted and stored separately as a BlockProposal when added.
|
|
104
137
|
*
|
|
105
|
-
* @param
|
|
106
|
-
* @return The checkpoint proposal core if
|
|
138
|
+
* @param slot - The slot to look up
|
|
139
|
+
* @return The checkpoint proposal core if one is stored, otherwise undefined.
|
|
107
140
|
*/
|
|
108
|
-
getCheckpointProposal(
|
|
141
|
+
getCheckpointProposal(slot: SlotNumber): Promise<CheckpointProposalCore | undefined>;
|
|
109
142
|
/**
|
|
110
143
|
* Adds own checkpoint attestations to the pool.
|
|
111
|
-
* Skips
|
|
144
|
+
* Skips per-signer cap and equivocation tracking; the caller is trusted.
|
|
145
|
+
* Each (slot, signer) gets a single stored attestation; later additions overwrite.
|
|
112
146
|
*/
|
|
113
147
|
addOwnCheckpointAttestations(attestations: CheckpointAttestation[]): Promise<void>;
|
|
114
148
|
/**
|
|
115
149
|
* Get all checkpoint attestations for a given slot.
|
|
116
150
|
*
|
|
151
|
+
* Returns one attestation per (slot, signer) — the first seen for each signer.
|
|
152
|
+
* Later equivocating attestations from the same signer are tracked in the index
|
|
153
|
+
* but their bytes are not retained.
|
|
154
|
+
*
|
|
117
155
|
* @param slot - The slot to query
|
|
118
156
|
* @return CheckpointAttestations
|
|
119
157
|
*/
|
|
120
158
|
getCheckpointAttestationsForSlot(slot: SlotNumber): Promise<CheckpointAttestation[]>;
|
|
121
159
|
/**
|
|
122
|
-
* Get checkpoint attestations for slot
|
|
160
|
+
* Get checkpoint attestations for a slot whose signed payload matches the given
|
|
161
|
+
* proposal payload hash.
|
|
123
162
|
*
|
|
124
163
|
* @param slot - The slot to query
|
|
125
|
-
* @param
|
|
126
|
-
* @return CheckpointAttestations
|
|
164
|
+
* @param proposalPayloadHash - Hex-encoded keccak256 of the target proposal's signed payload
|
|
165
|
+
* @return CheckpointAttestations whose `getPayloadHash()` matches `proposalPayloadHash`
|
|
127
166
|
*/
|
|
128
|
-
getCheckpointAttestationsForSlotAndProposal(slot: SlotNumber,
|
|
167
|
+
getCheckpointAttestationsForSlotAndProposal(slot: SlotNumber, proposalPayloadHash: CheckpointProposalHash): Promise<CheckpointAttestation[]>;
|
|
129
168
|
/**
|
|
130
169
|
* Delete all pool data (attestations, proposals) older than the given slot.
|
|
131
170
|
*
|
|
@@ -135,18 +174,19 @@ export declare class AttestationPool {
|
|
|
135
174
|
/**
|
|
136
175
|
* Attempts to add a checkpoint attestation to the pool.
|
|
137
176
|
*
|
|
138
|
-
*
|
|
139
|
-
*
|
|
140
|
-
* -
|
|
141
|
-
*
|
|
177
|
+
* - Detects duplicates by signed-payload hash (not archive); a re-broadcast of the
|
|
178
|
+
* exact same signed payload from the same signer returns `alreadyExists: true`.
|
|
179
|
+
* - Distinct payload hashes from the same (slot, signer) are tracked in the
|
|
180
|
+
* equivocation index. The first one's bytes are stored; later distinct hashes
|
|
181
|
+
* bump `count` so libp2p can fire its duplicate callback.
|
|
142
182
|
*
|
|
143
183
|
* @param attestation - The checkpoint attestation to add
|
|
144
|
-
* @returns Result indicating whether the attestation was added, existence info,
|
|
145
|
-
*
|
|
184
|
+
* @returns Result indicating whether the attestation was added, existence info,
|
|
185
|
+
* and number of distinct payload hashes by this signer for this slot
|
|
186
|
+
* (for equivocation detection).
|
|
146
187
|
*/
|
|
147
188
|
tryAddCheckpointAttestation(attestation: CheckpointAttestation): Promise<TryAddResult>;
|
|
148
|
-
private getSignerAttestationCountForSlot;
|
|
149
189
|
}
|
|
150
190
|
/** Creates an AttestationPool backed by a temporary store for testing. */
|
|
151
191
|
export declare function createTestAttestationPool(telemetry?: TelemetryClient): Promise<AttestationPool>;
|
|
152
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
192
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiYXR0ZXN0YXRpb25fcG9vbC5kLnRzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiO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