@aztec/p2p 0.0.1-commit.c0b82b2 → 0.0.1-commit.c2eed6949
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 +2 -2
- package/dest/client/factory.d.ts.map +1 -1
- package/dest/client/factory.js +22 -9
- package/dest/client/p2p_client.d.ts +1 -1
- package/dest/client/p2p_client.d.ts.map +1 -1
- package/dest/client/p2p_client.js +22 -34
- package/dest/client/test/tx_proposal_collector/proposal_tx_collector_worker.js +3 -3
- package/dest/config.d.ts +32 -11
- package/dest/config.d.ts.map +1 -1
- package/dest/config.js +86 -32
- package/dest/mem_pools/attestation_pool/attestation_pool.d.ts +4 -4
- package/dest/mem_pools/attestation_pool/attestation_pool.d.ts.map +1 -1
- package/dest/mem_pools/attestation_pool/attestation_pool.js +8 -4
- package/dest/mem_pools/attestation_pool/attestation_pool_test_suite.js +6 -6
- 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 +16 -14
- package/dest/mem_pools/tx_pool/eviction/fee_payer_balance_eviction_rule.d.ts +1 -1
- package/dest/mem_pools/tx_pool/eviction/fee_payer_balance_eviction_rule.d.ts.map +1 -1
- package/dest/mem_pools/tx_pool/eviction/fee_payer_balance_eviction_rule.js +2 -1
- package/dest/mem_pools/tx_pool/priority.d.ts +2 -2
- package/dest/mem_pools/tx_pool/priority.d.ts.map +1 -1
- package/dest/mem_pools/tx_pool/priority.js +4 -4
- package/dest/mem_pools/tx_pool/tx_pool_test_suite.d.ts +1 -1
- package/dest/mem_pools/tx_pool/tx_pool_test_suite.d.ts.map +1 -1
- package/dest/mem_pools/tx_pool/tx_pool_test_suite.js +3 -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/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/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 +9 -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 +25 -10
- package/dest/mem_pools/tx_pool_v2/tx_metadata.d.ts.map +1 -1
- package/dest/mem_pools/tx_pool_v2/tx_metadata.js +33 -10
- 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 +24 -6
- package/dest/msg_validators/attestation_validator/attestation_validator.d.ts +1 -1
- package/dest/msg_validators/attestation_validator/attestation_validator.d.ts.map +1 -1
- package/dest/msg_validators/attestation_validator/attestation_validator.js +5 -4
- package/dest/msg_validators/clock_tolerance.d.ts +1 -1
- package/dest/msg_validators/clock_tolerance.d.ts.map +1 -1
- package/dest/msg_validators/clock_tolerance.js +4 -3
- package/dest/msg_validators/proposal_validator/block_proposal_validator.d.ts +6 -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 +6 -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 +13 -8
- package/dest/msg_validators/proposal_validator/proposal_validator.d.ts.map +1 -1
- package/dest/msg_validators/proposal_validator/proposal_validator.js +53 -41
- 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 +24 -20
- 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/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 +23 -4
- package/dest/msg_validators/tx_validator/factory.d.ts.map +1 -1
- package/dest/msg_validators/tx_validator/factory.js +36 -10
- 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 +13 -4
- package/dest/msg_validators/tx_validator/gas_validator.d.ts.map +1 -1
- package/dest/msg_validators/tx_validator/gas_validator.js +39 -9
- package/dest/msg_validators/tx_validator/index.d.ts +2 -1
- package/dest/msg_validators/tx_validator/index.d.ts.map +1 -1
- package/dest/msg_validators/tx_validator/index.js +1 -0
- package/dest/msg_validators/tx_validator/metadata_validator.d.ts +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/services/discv5/discV5_service.d.ts +1 -1
- package/dest/services/discv5/discV5_service.d.ts.map +1 -1
- package/dest/services/discv5/discV5_service.js +4 -2
- 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/libp2p/libp2p_service.d.ts +7 -9
- package/dest/services/libp2p/libp2p_service.d.ts.map +1 -1
- package/dest/services/libp2p/libp2p_service.js +166 -72
- 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 +1 -1
- package/dest/services/peer-manager/peer_manager.d.ts.map +1 -1
- package/dest/services/peer-manager/peer_manager.js +6 -3
- 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/reqresp.d.ts +1 -1
- package/dest/services/reqresp/reqresp.d.ts.map +1 -1
- package/dest/services/reqresp/reqresp.js +17 -9
- package/dest/services/service.d.ts +7 -1
- 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/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/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/mock-pubsub.d.ts +6 -1
- package/dest/test-helpers/mock-pubsub.d.ts.map +1 -1
- package/dest/test-helpers/mock-pubsub.js +9 -1
- 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/testbench-utils.d.ts +1 -1
- package/dest/test-helpers/testbench-utils.d.ts.map +1 -1
- package/dest/test-helpers/testbench-utils.js +22 -3
- package/dest/testbench/p2p_client_testbench_worker.js +5 -4
- package/dest/testbench/worker_client_manager.d.ts +3 -1
- package/dest/testbench/worker_client_manager.d.ts.map +1 -1
- package/dest/testbench/worker_client_manager.js +6 -2
- package/dest/util.d.ts +9 -4
- package/dest/util.d.ts.map +1 -1
- package/dest/util.js +2 -9
- package/package.json +14 -14
- package/src/client/factory.ts +37 -13
- package/src/client/p2p_client.ts +22 -34
- package/src/client/test/tx_proposal_collector/proposal_tx_collector_worker.ts +4 -6
- package/src/config.ts +124 -34
- package/src/mem_pools/attestation_pool/attestation_pool.ts +8 -7
- package/src/mem_pools/attestation_pool/attestation_pool_test_suite.ts +6 -6
- package/src/mem_pools/instrumentation.ts +17 -13
- package/src/mem_pools/tx_pool/eviction/fee_payer_balance_eviction_rule.ts +2 -1
- package/src/mem_pools/tx_pool/priority.ts +4 -4
- package/src/mem_pools/tx_pool/tx_pool_test_suite.ts +3 -1
- 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/interfaces.ts +11 -1
- 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 +9 -4
- package/src/mem_pools/tx_pool_v2/tx_metadata.ts +52 -12
- 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 +28 -6
- package/src/msg_validators/attestation_validator/README.md +49 -0
- package/src/msg_validators/attestation_validator/attestation_validator.ts +5 -4
- package/src/msg_validators/clock_tolerance.ts +4 -3
- package/src/msg_validators/proposal_validator/README.md +123 -0
- package/src/msg_validators/proposal_validator/block_proposal_validator.ts +14 -4
- package/src/msg_validators/proposal_validator/checkpoint_proposal_validator.ts +20 -7
- package/src/msg_validators/proposal_validator/proposal_validator.ts +69 -45
- package/src/msg_validators/tx_validator/README.md +5 -1
- 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/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 +43 -3
- package/src/msg_validators/tx_validator/fee_payer_balance.ts +6 -2
- package/src/msg_validators/tx_validator/gas_validator.ts +41 -8
- package/src/msg_validators/tx_validator/index.ts +1 -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/services/discv5/discV5_service.ts +4 -2
- package/src/services/encoding.ts +9 -1
- package/src/services/libp2p/libp2p_service.ts +164 -80
- package/src/services/peer-manager/metrics.ts +7 -0
- package/src/services/peer-manager/peer_manager.ts +7 -3
- 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/reqresp.ts +19 -11
- package/src/services/service.ts +7 -0
- package/src/services/tx_collection/fast_tx_collection.ts +57 -83
- 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/test-helpers/make-test-p2p-clients.ts +1 -1
- package/src/test-helpers/mock-pubsub.ts +9 -0
- package/src/test-helpers/reqresp-nodes.ts +1 -1
- package/src/test-helpers/testbench-utils.ts +29 -3
- package/src/testbench/p2p_client_testbench_worker.ts +5 -6
- package/src/testbench/worker_client_manager.ts +13 -5
- package/src/util.ts +9 -13
- 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/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/msg_validators/proposal_validator/proposal_validator_test_suite.ts +0 -230
- package/src/services/tx_collection/missing_txs_tracker.ts +0 -52
package/dest/util.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"util.d.ts","sourceRoot":"","sources":["../src/util.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AACvD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AACpD,OAAO,KAAK,EAAE,iBAAiB,EAAuB,MAAM,iBAAiB,CAAC;AAC9E,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAE9D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,6BAA6B,CAAC;AAE7D,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AACjD,OAAO,KAAK,EAAE,MAAM,EAAc,MAAM,mBAAmB,CAAC;AAC5D,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAC;
|
|
1
|
+
{"version":3,"file":"util.d.ts","sourceRoot":"","sources":["../src/util.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AACvD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AACpD,OAAO,KAAK,EAAE,iBAAiB,EAAuB,MAAM,iBAAiB,CAAC;AAC9E,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAE9D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,6BAA6B,CAAC;AAE7D,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AACjD,OAAO,KAAK,EAAE,MAAM,EAAc,MAAM,mBAAmB,CAAC;AAC5D,OAAO,KAAK,EAAE,cAAc,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAC;AAIpF,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAIrC,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAI7C,MAAM,WAAW,YAAa,SAAQ,IAAI,CAAC,MAAM,EAAE,QAAQ,GAAG,OAAO,GAAG,MAAM,GAAG,QAAQ,CAAC;IACxF,QAAQ,EAAE;QACR,MAAM,EAAE,IAAI,CACV,SAAS,EACP,kBAAkB,GAClB,qBAAqB,GACrB,SAAS,GACT,WAAW,GACX,+BAA+B,GAC/B,QAAQ,GACR,cAAc,CACjB,GAAG;YAAE,KAAK,EAAE,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,EAAE,OAAO,CAAC,CAAA;SAAE,CAAC;QACjD,UAAU,EAAE;YACV,iBAAiB,EAAE,iBAAiB,CAAC;YACrC,cAAc,EAAE,cAAc,CAAC;SAChC,CAAC;KACH,CAAC;CACH;AAED,MAAM,MAAM,UAAU,GAAG,MAAM,CAAC;IAC9B,QAAQ,EAAE,QAAQ,CAAC;IACnB,MAAM,EAAE,SAAS,CAAC;IAClB,UAAU,EAAE;QACV,iBAAiB,EAAE,iBAAiB,CAAC;QACrC,cAAc,EAAE,cAAc,CAAC;KAChC,CAAC;CACH,CAAC,CAAC;AAEH;;;;;;;6CAO6C;AAC7C,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,KAAK,GAAG,KAAK,GAAG,MAAM,CAOjG;AAED;;GAEG;AACH,wBAAsB,WAAW,IAAI,OAAO,CAAC,MAAM,CAAC,CAQnD;AAED,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAGzD;AAED,wBAAsB,yBAAyB,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAW9F;AAcD,wBAAgB,2BAA2B,CAAC,OAAO,EAAE,SAAS,GAAG,eAAe,GAAG,SAAS,GAAG,eAAe,CAY7G;AAED;;;;;;;;GAQG;AACH,wBAAsB,mBAAmB,CACvC,MAAM,EAAE;IAAE,gBAAgB,CAAC,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC;IAAC,oBAAoB,CAAC,EAAE,MAAM,CAAC;IAAC,aAAa,CAAC,EAAE,MAAM,CAAA;CAAE,EACzG,KAAK,EAAE,iBAAiB,EACxB,MAAM,EAAE,MAAM,GACb,OAAO,CAAC,WAAW,CAAC,MAAM,CAAC,CAAC,CA2D9B;AAED;;;;GAIG;AACH,wBAAsB,gCAAgC,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAS1F"}
|
package/dest/util.js
CHANGED
|
@@ -58,22 +58,15 @@ function addressToMultiAddressType(address) {
|
|
|
58
58
|
return 'dns';
|
|
59
59
|
}
|
|
60
60
|
}
|
|
61
|
-
export
|
|
61
|
+
export function configureP2PClientAddresses(_config) {
|
|
62
62
|
const config = {
|
|
63
63
|
..._config
|
|
64
64
|
};
|
|
65
|
-
const {
|
|
65
|
+
const { p2pBroadcastPort, p2pPort } = config;
|
|
66
66
|
// If no broadcast port is provided, use the given p2p port as the broadcast port
|
|
67
67
|
if (!p2pBroadcastPort) {
|
|
68
68
|
config.p2pBroadcastPort = p2pPort;
|
|
69
69
|
}
|
|
70
|
-
// check if no announce IP was provided
|
|
71
|
-
if (!p2pIp) {
|
|
72
|
-
if (queryForIp) {
|
|
73
|
-
const publicIp = await getPublicIp();
|
|
74
|
-
config.p2pIp = publicIp;
|
|
75
|
-
}
|
|
76
|
-
}
|
|
77
70
|
// TODO(md): guard against setting a local ip address as the announce ip
|
|
78
71
|
return config;
|
|
79
72
|
}
|
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.c2eed6949",
|
|
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.c2eed6949",
|
|
71
|
+
"@aztec/epoch-cache": "0.0.1-commit.c2eed6949",
|
|
72
|
+
"@aztec/ethereum": "0.0.1-commit.c2eed6949",
|
|
73
|
+
"@aztec/foundation": "0.0.1-commit.c2eed6949",
|
|
74
|
+
"@aztec/kv-store": "0.0.1-commit.c2eed6949",
|
|
75
|
+
"@aztec/noir-contracts.js": "0.0.1-commit.c2eed6949",
|
|
76
|
+
"@aztec/noir-protocol-circuits-types": "0.0.1-commit.c2eed6949",
|
|
77
|
+
"@aztec/protocol-contracts": "0.0.1-commit.c2eed6949",
|
|
78
|
+
"@aztec/simulator": "0.0.1-commit.c2eed6949",
|
|
79
|
+
"@aztec/stdlib": "0.0.1-commit.c2eed6949",
|
|
80
|
+
"@aztec/telemetry-client": "0.0.1-commit.c2eed6949",
|
|
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.c2eed6949",
|
|
108
|
+
"@aztec/world-state": "0.0.1-commit.c2eed6949",
|
|
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
|
@@ -3,12 +3,12 @@ import { BlockNumber } from '@aztec/foundation/branded-types';
|
|
|
3
3
|
import { type Logger, createLogger } from '@aztec/foundation/log';
|
|
4
4
|
import { DateProvider } from '@aztec/foundation/timer';
|
|
5
5
|
import type { AztecAsyncKVStore } from '@aztec/kv-store';
|
|
6
|
-
import type { DataStoreConfig } from '@aztec/kv-store/config';
|
|
7
6
|
import { AztecLMDBStoreV2, createStore } from '@aztec/kv-store/lmdb-v2';
|
|
8
7
|
import type { L2BlockSource } from '@aztec/stdlib/block';
|
|
9
8
|
import type { ChainConfig } from '@aztec/stdlib/config';
|
|
10
9
|
import type { ContractDataSource } from '@aztec/stdlib/contract';
|
|
11
10
|
import type { AztecNode, ClientProtocolCircuitVerifier, WorldStateSynchronizer } from '@aztec/stdlib/interfaces/server';
|
|
11
|
+
import type { DataStoreConfig } from '@aztec/stdlib/kv-store';
|
|
12
12
|
import { type TelemetryClient, getTelemetryClient } from '@aztec/telemetry-client';
|
|
13
13
|
|
|
14
14
|
import { P2PClient } from '../client/p2p_client.js';
|
|
@@ -17,7 +17,11 @@ import { AttestationPool, type AttestationPoolApi } from '../mem_pools/attestati
|
|
|
17
17
|
import type { MemPools } from '../mem_pools/interface.js';
|
|
18
18
|
import type { TxPoolV2 } from '../mem_pools/tx_pool_v2/interfaces.js';
|
|
19
19
|
import { AztecKVTxPoolV2 } from '../mem_pools/tx_pool_v2/tx_pool_v2.js';
|
|
20
|
-
import {
|
|
20
|
+
import {
|
|
21
|
+
createCheckAllowedSetupCalls,
|
|
22
|
+
createTxValidatorForTransactionsEnteringPendingTxPool,
|
|
23
|
+
getDefaultAllowedSetupFunctions,
|
|
24
|
+
} from '../msg_validators/index.js';
|
|
21
25
|
import { DummyP2PService } from '../services/dummy_service.js';
|
|
22
26
|
import { LibP2PService } from '../services/index.js';
|
|
23
27
|
import { createFileStoreTxSources } from '../services/tx_collection/file_store_tx_source.js';
|
|
@@ -52,7 +56,7 @@ export async function createP2PClient(
|
|
|
52
56
|
telemetry: TelemetryClient = getTelemetryClient(),
|
|
53
57
|
deps: P2PClientDeps = {},
|
|
54
58
|
) {
|
|
55
|
-
const config =
|
|
59
|
+
const config = configureP2PClientAddresses({
|
|
56
60
|
...inputConfig,
|
|
57
61
|
dataStoreMapSizeKb: inputConfig.p2pStoreMapSizeKb ?? inputConfig.dataStoreMapSizeKb,
|
|
58
62
|
});
|
|
@@ -75,6 +79,33 @@ export async function createP2PClient(
|
|
|
75
79
|
const rollupAddress = inputConfig.l1Contracts.rollupAddress.toString().toLowerCase().replace(/^0x/, '');
|
|
76
80
|
const txFileStoreBasePath = `aztec-${inputConfig.l1ChainId}-${inputConfig.rollupVersion}-0x${rollupAddress}`;
|
|
77
81
|
|
|
82
|
+
const allowedInSetup = [
|
|
83
|
+
...(await getDefaultAllowedSetupFunctions()),
|
|
84
|
+
...(inputConfig.txPublicSetupAllowListExtend ?? []),
|
|
85
|
+
];
|
|
86
|
+
const checkAllowedSetupCalls = createCheckAllowedSetupCalls(
|
|
87
|
+
archiver,
|
|
88
|
+
allowedInSetup,
|
|
89
|
+
() => epochCache.getEpochAndSlotInNextL1Slot().ts,
|
|
90
|
+
);
|
|
91
|
+
|
|
92
|
+
const createTxValidator = async () => {
|
|
93
|
+
// We accept transactions if they are not expired by the next slot and block number (checked based on the ExpirationTimestamp field)
|
|
94
|
+
const currentBlockNumber = await archiver.getBlockNumber();
|
|
95
|
+
const { ts: nextSlotTimestamp } = epochCache.getEpochAndSlotInNextL1Slot();
|
|
96
|
+
const l1Constants = await archiver.getL1Constants();
|
|
97
|
+
return createTxValidatorForTransactionsEnteringPendingTxPool(
|
|
98
|
+
worldStateSynchronizer,
|
|
99
|
+
nextSlotTimestamp,
|
|
100
|
+
BlockNumber(currentBlockNumber + 1),
|
|
101
|
+
{
|
|
102
|
+
rollupManaLimit: l1Constants.rollupManaLimit,
|
|
103
|
+
maxBlockL2Gas: config.validateMaxL2BlockGas,
|
|
104
|
+
maxBlockDAGas: config.validateMaxDABlockGas,
|
|
105
|
+
},
|
|
106
|
+
);
|
|
107
|
+
};
|
|
108
|
+
|
|
78
109
|
const txPool =
|
|
79
110
|
deps.txPool ??
|
|
80
111
|
new AztecKVTxPoolV2(
|
|
@@ -83,16 +114,8 @@ export async function createP2PClient(
|
|
|
83
114
|
{
|
|
84
115
|
l2BlockSource: archiver,
|
|
85
116
|
worldStateSynchronizer,
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
const currentBlockNumber = await archiver.getBlockNumber();
|
|
89
|
-
const { ts: nextSlotTimestamp } = epochCache.getEpochAndSlotInNextL1Slot();
|
|
90
|
-
return createTxValidatorForTransactionsEnteringPendingTxPool(
|
|
91
|
-
worldStateSynchronizer,
|
|
92
|
-
nextSlotTimestamp,
|
|
93
|
-
BlockNumber(currentBlockNumber + 1),
|
|
94
|
-
);
|
|
95
|
-
},
|
|
117
|
+
checkAllowedSetupCalls,
|
|
118
|
+
createTxValidator,
|
|
96
119
|
},
|
|
97
120
|
telemetry,
|
|
98
121
|
{
|
|
@@ -100,6 +123,7 @@ export async function createP2PClient(
|
|
|
100
123
|
archivedTxLimit: config.archivedTxLimit,
|
|
101
124
|
minTxPoolAgeMs: config.minTxPoolAgeMs,
|
|
102
125
|
dropTransactionsProbability: config.dropTransactionsProbability,
|
|
126
|
+
priceBumpPercentage: config.priceBumpPercentage,
|
|
103
127
|
},
|
|
104
128
|
dateProvider,
|
|
105
129
|
);
|
package/src/client/p2p_client.ts
CHANGED
|
@@ -18,7 +18,6 @@ import {
|
|
|
18
18
|
type L2TipsStore,
|
|
19
19
|
} from '@aztec/stdlib/block';
|
|
20
20
|
import type { ContractDataSource } from '@aztec/stdlib/contract';
|
|
21
|
-
import { getTimestampForSlot } from '@aztec/stdlib/epoch-helpers';
|
|
22
21
|
import { type PeerInfo, tryStop } from '@aztec/stdlib/interfaces/server';
|
|
23
22
|
import { type BlockProposal, CheckpointAttestation, type CheckpointProposal, type TopicType } from '@aztec/stdlib/p2p';
|
|
24
23
|
import type { BlockHeader, Tx, TxHash } from '@aztec/stdlib/tx';
|
|
@@ -111,27 +110,6 @@ export class P2PClient extends WithTracer implements P2P {
|
|
|
111
110
|
this.telemetry,
|
|
112
111
|
);
|
|
113
112
|
|
|
114
|
-
// Default to collecting all txs when we see a valid proposal
|
|
115
|
-
// This can be overridden by the validator client to validate, and it will call getTxsForBlockProposal on its own
|
|
116
|
-
// Note: Validators do NOT attest to individual blocks - attestations are only for checkpoint proposals.
|
|
117
|
-
// TODO(palla/txs): We should not trigger a request for txs on a proposal before fully validating it. We need to bring
|
|
118
|
-
// validator-client code into here so we can validate a proposal is reasonable.
|
|
119
|
-
this.registerBlockProposalHandler(async (block, sender) => {
|
|
120
|
-
this.log.debug(`Received block proposal from ${sender.toString()}`);
|
|
121
|
-
// TODO(palla/txs): Need to subtract validatorReexecuteDeadlineMs from this deadline (see ValidatorClient.getReexecutionDeadline)
|
|
122
|
-
const constants = this.txCollection.getConstants();
|
|
123
|
-
const nextSlotTimestampSeconds = Number(getTimestampForSlot(SlotNumber(block.slotNumber + 1), constants));
|
|
124
|
-
const deadline = new Date(nextSlotTimestampSeconds * 1000);
|
|
125
|
-
const parentBlock = await this.l2BlockSource.getBlockHeaderByArchive(block.blockHeader.lastArchive.root);
|
|
126
|
-
if (!parentBlock) {
|
|
127
|
-
this.log.debug(`Cannot collect txs for proposal as parent block not found`);
|
|
128
|
-
return false;
|
|
129
|
-
}
|
|
130
|
-
const blockNumber = BlockNumber(parentBlock.getBlockNumber() + 1);
|
|
131
|
-
await this.txProvider.getTxsForBlockProposal(block, blockNumber, { pinnedPeer: sender, deadline });
|
|
132
|
-
return true;
|
|
133
|
-
});
|
|
134
|
-
|
|
135
113
|
this.l2Tips = new L2TipsKVStore(store, 'p2p_client');
|
|
136
114
|
this.synchedLatestSlot = store.openSingleton('p2p_pool_last_l2_slot');
|
|
137
115
|
}
|
|
@@ -691,31 +669,41 @@ export class P2PClient extends WithTracer implements P2P {
|
|
|
691
669
|
}
|
|
692
670
|
|
|
693
671
|
/**
|
|
694
|
-
* Returns true if the prune
|
|
695
|
-
* If the
|
|
696
|
-
* If they differ, the prune spans across checkpoints (epoch prune).
|
|
672
|
+
* Returns true if the prune is an epoch prune (new checkpoint number is less than old).
|
|
673
|
+
* If the checkpoint number stays the same or increases, the prune is within a checkpoint.
|
|
697
674
|
*/
|
|
698
675
|
private async isEpochPrune(newCheckpoint: CheckpointId): Promise<boolean> {
|
|
699
676
|
const tips = await this.l2Tips.getL2Tips();
|
|
700
677
|
const oldCheckpointNumber = tips.checkpointed.checkpoint.number;
|
|
701
|
-
if (oldCheckpointNumber <= CheckpointNumber.
|
|
678
|
+
if (oldCheckpointNumber <= CheckpointNumber.INITIAL) {
|
|
702
679
|
return false;
|
|
703
680
|
}
|
|
704
|
-
const
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
681
|
+
const newCheckpointNumber = newCheckpoint.number;
|
|
682
|
+
// We check that the new checkpoint number is less than the old checkpoint number in order to consider it an epoch prune.
|
|
683
|
+
// To be more certain that it is an epoch prune, we will check that at least 2 checkpoints were removed.
|
|
684
|
+
// This means we should avoid thinking checkpoints removed by L1 re-orgs are epoch prunes
|
|
685
|
+
const thresholdForEpochPrune = CheckpointNumber(oldCheckpointNumber - 2);
|
|
686
|
+
const isEpochPrune = newCheckpointNumber <= thresholdForEpochPrune;
|
|
687
|
+
if (isEpochPrune) {
|
|
688
|
+
this.log.info(`Detected epoch prune to ${newCheckpointNumber}`, {
|
|
689
|
+
oldCheckpointNumber,
|
|
690
|
+
newCheckpointNumber,
|
|
691
|
+
thresholdForEpochPrune,
|
|
692
|
+
});
|
|
693
|
+
}
|
|
708
694
|
return isEpochPrune;
|
|
709
695
|
}
|
|
710
696
|
|
|
711
697
|
/** Checks if the slot has changed and calls prepareForSlot if so. */
|
|
712
698
|
private async maybeCallPrepareForSlot(): Promise<void> {
|
|
713
|
-
|
|
714
|
-
|
|
699
|
+
// If we have a pending checkpoint available, we want to prepare the target slot - otherwise we prepare the current slot
|
|
700
|
+
// Knowledege of pending checkpoints is in the PR above
|
|
701
|
+
const { targetSlot } = this.epochCache.getTargetAndNextSlot();
|
|
702
|
+
if (targetSlot <= this.lastSlotProcessed) {
|
|
715
703
|
return;
|
|
716
704
|
}
|
|
717
|
-
this.lastSlotProcessed =
|
|
718
|
-
await this.txPool.prepareForSlot(
|
|
705
|
+
this.lastSlotProcessed = targetSlot;
|
|
706
|
+
await this.txPool.prepareForSlot(targetSlot);
|
|
719
707
|
}
|
|
720
708
|
|
|
721
709
|
private async startServiceIfSynched() {
|
|
@@ -3,11 +3,11 @@ import { SecretValue } from '@aztec/foundation/config';
|
|
|
3
3
|
import { createLogger } from '@aztec/foundation/log';
|
|
4
4
|
import { sleep } from '@aztec/foundation/sleep';
|
|
5
5
|
import { DateProvider, Timer, executeTimeout } from '@aztec/foundation/timer';
|
|
6
|
-
import type { DataStoreConfig } from '@aztec/kv-store/config';
|
|
7
6
|
import { openTmpStore } from '@aztec/kv-store/lmdb-v2';
|
|
8
7
|
import type { L2BlockSource } from '@aztec/stdlib/block';
|
|
9
8
|
import type { ContractDataSource } from '@aztec/stdlib/contract';
|
|
10
9
|
import type { ClientProtocolCircuitVerifier } from '@aztec/stdlib/interfaces/server';
|
|
10
|
+
import type { DataStoreConfig } from '@aztec/stdlib/kv-store';
|
|
11
11
|
import { PeerErrorSeverity } from '@aztec/stdlib/p2p';
|
|
12
12
|
import type { Tx, TxValidationResult } from '@aztec/stdlib/tx';
|
|
13
13
|
import { type TelemetryClient, getTelemetryClient } from '@aztec/telemetry-client';
|
|
@@ -19,7 +19,7 @@ import type { P2PConfig } from '../../../config.js';
|
|
|
19
19
|
import { BatchTxRequesterCollector, SendBatchRequestCollector } from '../../../services/index.js';
|
|
20
20
|
import type { IBatchRequestTxValidator } from '../../../services/reqresp/batch-tx-requester/tx_validator.js';
|
|
21
21
|
import { RateLimitStatus } from '../../../services/reqresp/rate-limiter/rate_limiter.js';
|
|
22
|
-
import {
|
|
22
|
+
import { RequestTracker } from '../../../services/tx_collection/request_tracker.js';
|
|
23
23
|
import {
|
|
24
24
|
AlwaysTrueCircuitVerifier,
|
|
25
25
|
BENCHMARK_CONSTANTS,
|
|
@@ -213,10 +213,9 @@ async function runCollector(cmd: Extract<WorkerCommand, { type: 'RUN_COLLECTOR'
|
|
|
213
213
|
const fetched = await executeTimeout(
|
|
214
214
|
(_signal: AbortSignal) =>
|
|
215
215
|
collector.collectTxs(
|
|
216
|
-
|
|
216
|
+
RequestTracker.create(parsedTxHashes, new Date(Date.now() + internalTimeoutMs)),
|
|
217
217
|
parsedProposal,
|
|
218
218
|
pinnedPeer,
|
|
219
|
-
internalTimeoutMs,
|
|
220
219
|
),
|
|
221
220
|
timeoutMs,
|
|
222
221
|
() => new Error(`Collector timed out after ${timeoutMs}ms`),
|
|
@@ -231,10 +230,9 @@ async function runCollector(cmd: Extract<WorkerCommand, { type: 'RUN_COLLECTOR'
|
|
|
231
230
|
const fetched = await executeTimeout(
|
|
232
231
|
(_signal: AbortSignal) =>
|
|
233
232
|
collector.collectTxs(
|
|
234
|
-
|
|
233
|
+
RequestTracker.create(parsedTxHashes, new Date(Date.now() + internalTimeoutMs)),
|
|
235
234
|
parsedProposal,
|
|
236
235
|
pinnedPeer,
|
|
237
|
-
internalTimeoutMs,
|
|
238
236
|
),
|
|
239
237
|
timeoutMs,
|
|
240
238
|
() => new Error(`Collector timed out after ${timeoutMs}ms`),
|
package/src/config.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
type ConfigMappingsType,
|
|
3
3
|
SecretValue,
|
|
4
|
+
bigintConfigHelper,
|
|
4
5
|
booleanConfigHelper,
|
|
5
6
|
getConfigFromMappings,
|
|
6
7
|
getDefaultConfig,
|
|
@@ -10,7 +11,6 @@ import {
|
|
|
10
11
|
secretStringConfigHelper,
|
|
11
12
|
} from '@aztec/foundation/config';
|
|
12
13
|
import { Fr } from '@aztec/foundation/curves/bn254';
|
|
13
|
-
import { type DataStoreConfig, dataConfigMappings } from '@aztec/kv-store/config';
|
|
14
14
|
import { FunctionSelector } from '@aztec/stdlib/abi/function-selector';
|
|
15
15
|
import { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
16
16
|
import {
|
|
@@ -20,6 +20,7 @@ import {
|
|
|
20
20
|
chainConfigMappings,
|
|
21
21
|
sharedSequencerConfigMappings,
|
|
22
22
|
} from '@aztec/stdlib/config';
|
|
23
|
+
import { type DataStoreConfig, dataConfigMappings } from '@aztec/stdlib/kv-store';
|
|
23
24
|
|
|
24
25
|
import {
|
|
25
26
|
type BatchTxRequesterConfig,
|
|
@@ -38,7 +39,19 @@ export interface P2PConfig
|
|
|
38
39
|
ChainConfig,
|
|
39
40
|
TxCollectionConfig,
|
|
40
41
|
TxFileStoreConfig,
|
|
41
|
-
Pick<SequencerConfig, 'blockDurationMs' | 'expectedBlockProposalsPerSlot'> {
|
|
42
|
+
Pick<SequencerConfig, 'blockDurationMs' | 'expectedBlockProposalsPerSlot' | 'maxTxsPerBlock'> {
|
|
43
|
+
/** Maximum transactions per block for validation. Overrides maxTxsPerBlock for gossip validation when set. */
|
|
44
|
+
validateMaxTxsPerBlock?: number;
|
|
45
|
+
|
|
46
|
+
/** Maximum transactions per checkpoint for validation. Used as fallback for maxTxsPerBlock when that is not set. */
|
|
47
|
+
validateMaxTxsPerCheckpoint?: number;
|
|
48
|
+
|
|
49
|
+
/** Maximum L2 gas per block for validation. When set, txs exceeding this limit are rejected. */
|
|
50
|
+
validateMaxL2BlockGas?: number;
|
|
51
|
+
|
|
52
|
+
/** Maximum DA gas per block for validation. When set, txs exceeding this limit are rejected. */
|
|
53
|
+
validateMaxDABlockGas?: number;
|
|
54
|
+
|
|
42
55
|
/** A flag dictating whether the P2P subsystem should be enabled. */
|
|
43
56
|
p2pEnabled: boolean;
|
|
44
57
|
|
|
@@ -57,6 +70,9 @@ export interface P2PConfig
|
|
|
57
70
|
/** The frequency in which to check for new peers. */
|
|
58
71
|
peerCheckIntervalMS: number;
|
|
59
72
|
|
|
73
|
+
/** How long to ban a peer after it fails MAX_DIAL_ATTEMPTS dials. */
|
|
74
|
+
peerFailedBanTimeMs: number;
|
|
75
|
+
|
|
60
76
|
/** Size of queue of L2 blocks to store. */
|
|
61
77
|
l2QueueSize: number;
|
|
62
78
|
|
|
@@ -150,8 +166,8 @@ export interface P2PConfig
|
|
|
150
166
|
/** The maximum possible size of the P2P DB in KB. Overwrites the general dataStoreMapSizeKb. */
|
|
151
167
|
p2pStoreMapSizeKb?: number;
|
|
152
168
|
|
|
153
|
-
/**
|
|
154
|
-
|
|
169
|
+
/** Additional entries to extend the default setup allow list. */
|
|
170
|
+
txPublicSetupAllowListExtend: AllowedElement[];
|
|
155
171
|
|
|
156
172
|
/** The maximum number of pending txs before evicting lower priority txs. */
|
|
157
173
|
maxPendingTxCount: number;
|
|
@@ -190,11 +206,36 @@ export interface P2PConfig
|
|
|
190
206
|
|
|
191
207
|
/** Minimum age (ms) a transaction must have been in the pool before it's eligible for block building. */
|
|
192
208
|
minTxPoolAgeMs: number;
|
|
209
|
+
|
|
210
|
+
/** Minimum percentage fee increase required to replace an existing tx via RPC (0 = no bump). */
|
|
211
|
+
priceBumpPercentage: bigint;
|
|
193
212
|
}
|
|
194
213
|
|
|
195
214
|
export const DEFAULT_P2P_PORT = 40400;
|
|
196
215
|
|
|
197
216
|
export const p2pConfigMappings: ConfigMappingsType<P2PConfig> = {
|
|
217
|
+
validateMaxTxsPerBlock: {
|
|
218
|
+
env: 'VALIDATOR_MAX_TX_PER_BLOCK',
|
|
219
|
+
description:
|
|
220
|
+
'Maximum transactions per block for validation. Overrides maxTxsPerBlock for gossip validation when set.',
|
|
221
|
+
parseEnv: (val: string) => (val ? parseInt(val, 10) : undefined),
|
|
222
|
+
},
|
|
223
|
+
validateMaxTxsPerCheckpoint: {
|
|
224
|
+
env: 'VALIDATOR_MAX_TX_PER_CHECKPOINT',
|
|
225
|
+
description:
|
|
226
|
+
'Maximum transactions per checkpoint for validation. Used as fallback for maxTxsPerBlock when that is not set.',
|
|
227
|
+
parseEnv: (val: string) => (val ? parseInt(val, 10) : undefined),
|
|
228
|
+
},
|
|
229
|
+
validateMaxL2BlockGas: {
|
|
230
|
+
env: 'VALIDATOR_MAX_L2_BLOCK_GAS',
|
|
231
|
+
description: 'Maximum L2 gas per block for validation. When set, txs exceeding this limit are rejected.',
|
|
232
|
+
parseEnv: (val: string) => (val ? parseInt(val, 10) : undefined),
|
|
233
|
+
},
|
|
234
|
+
validateMaxDABlockGas: {
|
|
235
|
+
env: 'VALIDATOR_MAX_DA_BLOCK_GAS',
|
|
236
|
+
description: 'Maximum DA gas per block for validation. When set, txs exceeding this limit are rejected.',
|
|
237
|
+
parseEnv: (val: string) => (val ? parseInt(val, 10) : undefined),
|
|
238
|
+
},
|
|
198
239
|
p2pEnabled: {
|
|
199
240
|
env: 'P2P_ENABLED',
|
|
200
241
|
description: 'A flag dictating whether the P2P subsystem should be enabled.',
|
|
@@ -225,6 +266,11 @@ export const p2pConfigMappings: ConfigMappingsType<P2PConfig> = {
|
|
|
225
266
|
description: 'The frequency in which to check for new peers.',
|
|
226
267
|
...numberConfigHelper(30_000),
|
|
227
268
|
},
|
|
269
|
+
peerFailedBanTimeMs: {
|
|
270
|
+
env: 'P2P_PEER_FAILED_BAN_TIME_MS',
|
|
271
|
+
description: 'How long to ban a peer after it fails maximum dial attempts.',
|
|
272
|
+
...numberConfigHelper(5 * 60 * 1000),
|
|
273
|
+
},
|
|
228
274
|
l2QueueSize: {
|
|
229
275
|
env: 'P2P_L2_QUEUE_SIZE',
|
|
230
276
|
description: 'Size of queue of L2 blocks to store.',
|
|
@@ -393,12 +439,13 @@ export const p2pConfigMappings: ConfigMappingsType<P2PConfig> = {
|
|
|
393
439
|
parseEnv: (val: string | undefined) => (val ? +val : undefined),
|
|
394
440
|
description: 'The maximum possible size of the P2P DB in KB. Overwrites the general dataStoreMapSizeKb.',
|
|
395
441
|
},
|
|
396
|
-
|
|
442
|
+
txPublicSetupAllowListExtend: {
|
|
397
443
|
env: 'TX_PUBLIC_SETUP_ALLOWLIST',
|
|
398
444
|
parseEnv: (val: string) => parseAllowList(val),
|
|
399
|
-
description:
|
|
445
|
+
description:
|
|
446
|
+
'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 +.',
|
|
400
447
|
printDefault: () =>
|
|
401
|
-
'AuthRegistry
|
|
448
|
+
'Default: AuthRegistry._set_authorized, AuthRegistry.set_authorized, FeeJuice._increase_public_balance',
|
|
402
449
|
},
|
|
403
450
|
maxPendingTxCount: {
|
|
404
451
|
env: 'P2P_MAX_PENDING_TX_COUNT',
|
|
@@ -464,6 +511,12 @@ export const p2pConfigMappings: ConfigMappingsType<P2PConfig> = {
|
|
|
464
511
|
description: 'Minimum age (ms) a transaction must have been in the pool before it is eligible for block building.',
|
|
465
512
|
...numberConfigHelper(2_000),
|
|
466
513
|
},
|
|
514
|
+
priceBumpPercentage: {
|
|
515
|
+
env: 'P2P_RPC_PRICE_BUMP_PERCENTAGE',
|
|
516
|
+
description:
|
|
517
|
+
'Minimum percentage fee increase required to replace an existing tx via RPC. Even at 0%, replacement still requires paying at least 1 unit more.',
|
|
518
|
+
...bigintConfigHelper(10n),
|
|
519
|
+
},
|
|
467
520
|
...sharedSequencerConfigMappings,
|
|
468
521
|
...p2pReqRespConfigMappings,
|
|
469
522
|
...batchTxRequesterConfigMappings,
|
|
@@ -521,13 +574,44 @@ export const bootnodeConfigMappings = pickConfigMappings(
|
|
|
521
574
|
bootnodeConfigKeys,
|
|
522
575
|
);
|
|
523
576
|
|
|
577
|
+
/**
|
|
578
|
+
* Parses a `+`-separated flags string into validation properties for an allow list entry.
|
|
579
|
+
* Supported flags: `os` (onlySelf), `rn` (rejectNullMsgSender), `cl=N` (calldataLength).
|
|
580
|
+
*/
|
|
581
|
+
function parseFlags(
|
|
582
|
+
flags: string,
|
|
583
|
+
entry: string,
|
|
584
|
+
): { onlySelf?: boolean; rejectNullMsgSender?: boolean; calldataLength?: number } {
|
|
585
|
+
const result: { onlySelf?: boolean; rejectNullMsgSender?: boolean; calldataLength?: number } = {};
|
|
586
|
+
for (const flag of flags.split('+')) {
|
|
587
|
+
if (flag === 'os') {
|
|
588
|
+
result.onlySelf = true;
|
|
589
|
+
} else if (flag === 'rn') {
|
|
590
|
+
result.rejectNullMsgSender = true;
|
|
591
|
+
} else if (flag.startsWith('cl=')) {
|
|
592
|
+
const n = parseInt(flag.slice(3), 10);
|
|
593
|
+
if (isNaN(n) || n < 0) {
|
|
594
|
+
throw new Error(
|
|
595
|
+
`Invalid allow list entry "${entry}": invalid calldataLength in flag "${flag}". Expected a non-negative integer.`,
|
|
596
|
+
);
|
|
597
|
+
}
|
|
598
|
+
result.calldataLength = n;
|
|
599
|
+
} else {
|
|
600
|
+
throw new Error(`Invalid allow list entry "${entry}": unknown flag "${flag}". Supported flags: os, rn, cl=N.`);
|
|
601
|
+
}
|
|
602
|
+
}
|
|
603
|
+
return result;
|
|
604
|
+
}
|
|
605
|
+
|
|
524
606
|
/**
|
|
525
607
|
* Parses a string to a list of allowed elements.
|
|
526
|
-
* Each
|
|
527
|
-
* `I:${address}`
|
|
528
|
-
* `
|
|
529
|
-
*
|
|
530
|
-
*
|
|
608
|
+
* Each entry is expected to be of one of the following formats:
|
|
609
|
+
* `I:${address}:${selector}` — instance (contract address) with function selector
|
|
610
|
+
* `C:${classId}:${selector}` — class with function selector
|
|
611
|
+
*
|
|
612
|
+
* An optional flags segment can be appended after the selector:
|
|
613
|
+
* `I:${address}:${selector}:${flags}` or `C:${classId}:${selector}:${flags}`
|
|
614
|
+
* where flags is a `+`-separated list of: `os` (onlySelf), `rn` (rejectNullMsgSender), `cl=N` (calldataLength).
|
|
531
615
|
*
|
|
532
616
|
* @param value The string to parse
|
|
533
617
|
* @returns A list of allowed elements
|
|
@@ -540,31 +624,37 @@ export function parseAllowList(value: string): AllowedElement[] {
|
|
|
540
624
|
}
|
|
541
625
|
|
|
542
626
|
for (const val of value.split(',')) {
|
|
543
|
-
const
|
|
544
|
-
|
|
627
|
+
const trimmed = val.trim();
|
|
628
|
+
if (!trimmed) {
|
|
629
|
+
continue;
|
|
630
|
+
}
|
|
631
|
+
const [typeString, identifierString, selectorString, flagsString] = trimmed.split(':');
|
|
632
|
+
|
|
633
|
+
if (!selectorString) {
|
|
634
|
+
throw new Error(
|
|
635
|
+
`Invalid allow list entry "${trimmed}": selector is required. Expected format: I:address:selector or C:classId:selector`,
|
|
636
|
+
);
|
|
637
|
+
}
|
|
638
|
+
|
|
639
|
+
const selector = FunctionSelector.fromString(selectorString);
|
|
640
|
+
const flags = flagsString ? parseFlags(flagsString, trimmed) : {};
|
|
545
641
|
|
|
546
642
|
if (typeString === 'I') {
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
} else {
|
|
553
|
-
entries.push({
|
|
554
|
-
address: AztecAddress.fromString(identifierString),
|
|
555
|
-
});
|
|
556
|
-
}
|
|
643
|
+
entries.push({
|
|
644
|
+
address: AztecAddress.fromString(identifierString),
|
|
645
|
+
selector,
|
|
646
|
+
...flags,
|
|
647
|
+
});
|
|
557
648
|
} else if (typeString === 'C') {
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
}
|
|
649
|
+
entries.push({
|
|
650
|
+
classId: Fr.fromHexString(identifierString),
|
|
651
|
+
selector,
|
|
652
|
+
...flags,
|
|
653
|
+
});
|
|
654
|
+
} else {
|
|
655
|
+
throw new Error(
|
|
656
|
+
`Invalid allow list entry "${trimmed}": unknown type "${typeString}". Expected "I" (instance) or "C" (class).`,
|
|
657
|
+
);
|
|
568
658
|
}
|
|
569
659
|
}
|
|
570
660
|
|
|
@@ -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<
|
|
@@ -359,11 +359,10 @@ export class AttestationPool {
|
|
|
359
359
|
}
|
|
360
360
|
|
|
361
361
|
const address = sender.toString();
|
|
362
|
+
const ownKey = this.getAttestationKey(slotNumber, proposalId, address);
|
|
362
363
|
|
|
363
|
-
await this.checkpointAttestations.set(
|
|
364
|
-
|
|
365
|
-
attestation.toBuffer(),
|
|
366
|
-
);
|
|
364
|
+
await this.checkpointAttestations.set(ownKey, attestation.toBuffer());
|
|
365
|
+
this.metrics.trackMempoolItemAdded(ownKey);
|
|
367
366
|
|
|
368
367
|
this.log.debug(`Added own checkpoint attestation for slot ${slotNumber} from ${address}`, {
|
|
369
368
|
signature: attestation.signature.toString(),
|
|
@@ -429,6 +428,7 @@ export class AttestationPool {
|
|
|
429
428
|
const attestationEndKey = new Fr(oldestSlot).toString();
|
|
430
429
|
for await (const key of this.checkpointAttestations.keysAsync({ end: attestationEndKey })) {
|
|
431
430
|
await this.checkpointAttestations.delete(key);
|
|
431
|
+
this.metrics.trackMempoolItemRemoved(key);
|
|
432
432
|
numberOfAttestations++;
|
|
433
433
|
}
|
|
434
434
|
|
|
@@ -526,6 +526,7 @@ export class AttestationPool {
|
|
|
526
526
|
|
|
527
527
|
// Add the attestation
|
|
528
528
|
await this.checkpointAttestations.set(key, attestation.toBuffer());
|
|
529
|
+
this.metrics.trackMempoolItemAdded(key);
|
|
529
530
|
|
|
530
531
|
// Track this attestation in the per-signer-per-slot index for duplicate detection
|
|
531
532
|
const slotSignerKey = this.getSlotSignerKey(slotNumber, signerAddress);
|
|
@@ -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 () => {
|