@aztec/p2p 0.0.1-commit.993d240 → 0.0.1-commit.9a89641
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +7 -6
- package/dest/bootstrap/bootstrap.d.ts +1 -1
- package/dest/bootstrap/bootstrap.d.ts.map +1 -1
- package/dest/bootstrap/bootstrap.js +20 -12
- package/dest/client/factory.d.ts +2 -2
- package/dest/client/factory.d.ts.map +1 -1
- package/dest/client/factory.js +10 -5
- package/dest/client/interface.d.ts +40 -9
- package/dest/client/interface.d.ts.map +1 -1
- package/dest/client/p2p_client.d.ts +23 -12
- package/dest/client/p2p_client.d.ts.map +1 -1
- package/dest/client/p2p_client.js +38 -35
- package/dest/config.d.ts +19 -13
- package/dest/config.d.ts.map +1 -1
- package/dest/config.js +27 -26
- package/dest/errors/reqresp.error.d.ts +13 -1
- package/dest/errors/reqresp.error.d.ts.map +1 -1
- package/dest/errors/reqresp.error.js +14 -0
- package/dest/mem_pools/attestation_pool/attestation_pool.d.ts +4 -2
- package/dest/mem_pools/attestation_pool/attestation_pool.d.ts.map +1 -1
- package/dest/mem_pools/attestation_pool/attestation_pool.js +9 -2
- 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 +43 -0
- package/dest/mem_pools/instrumentation.d.ts +9 -4
- package/dest/mem_pools/instrumentation.d.ts.map +1 -1
- package/dest/mem_pools/instrumentation.js +11 -8
- package/dest/mem_pools/tx_pool_v2/archive/tx_archive.d.ts +1 -5
- package/dest/mem_pools/tx_pool_v2/archive/tx_archive.d.ts.map +1 -1
- package/dest/mem_pools/tx_pool_v2/archive/tx_archive.js +1 -7
- package/dest/mem_pools/tx_pool_v2/deleted_pool.d.ts +3 -3
- package/dest/mem_pools/tx_pool_v2/deleted_pool.d.ts.map +1 -1
- package/dest/mem_pools/tx_pool_v2/deleted_pool.js +6 -6
- package/dest/mem_pools/tx_pool_v2/eviction/fee_payer_balance_eviction_rule.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 +3 -3
- package/dest/mem_pools/tx_pool_v2/eviction/fee_payer_balance_pre_add_rule.d.ts +1 -1
- package/dest/mem_pools/tx_pool_v2/eviction/fee_payer_balance_pre_add_rule.d.ts.map +1 -1
- package/dest/mem_pools/tx_pool_v2/eviction/fee_payer_balance_pre_add_rule.js +3 -1
- package/dest/mem_pools/tx_pool_v2/eviction/insufficient_fee_per_gas_eviction_rule.d.ts +1 -1
- package/dest/mem_pools/tx_pool_v2/eviction/insufficient_fee_per_gas_eviction_rule.d.ts.map +1 -1
- package/dest/mem_pools/tx_pool_v2/eviction/insufficient_fee_per_gas_eviction_rule.js +3 -1
- package/dest/mem_pools/tx_pool_v2/eviction/invalid_txs_after_mining_rule.d.ts +1 -1
- package/dest/mem_pools/tx_pool_v2/eviction/invalid_txs_after_mining_rule.d.ts.map +1 -1
- package/dest/mem_pools/tx_pool_v2/eviction/invalid_txs_after_mining_rule.js +3 -4
- package/dest/mem_pools/tx_pool_v2/eviction/invalid_txs_after_reorg_rule.d.ts +1 -1
- package/dest/mem_pools/tx_pool_v2/eviction/invalid_txs_after_reorg_rule.d.ts.map +1 -1
- package/dest/mem_pools/tx_pool_v2/eviction/invalid_txs_after_reorg_rule.js +4 -5
- package/dest/mem_pools/tx_pool_v2/eviction/low_priority_eviction_rule.d.ts +1 -1
- package/dest/mem_pools/tx_pool_v2/eviction/low_priority_eviction_rule.d.ts.map +1 -1
- package/dest/mem_pools/tx_pool_v2/eviction/low_priority_eviction_rule.js +6 -5
- package/dest/mem_pools/tx_pool_v2/interfaces.d.ts +30 -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_pool_indices.d.ts +15 -1
- package/dest/mem_pools/tx_pool_v2/tx_pool_indices.d.ts.map +1 -1
- package/dest/mem_pools/tx_pool_v2/tx_pool_indices.js +31 -0
- package/dest/mem_pools/tx_pool_v2/tx_pool_v2.d.ts +9 -3
- package/dest/mem_pools/tx_pool_v2/tx_pool_v2.d.ts.map +1 -1
- package/dest/mem_pools/tx_pool_v2/tx_pool_v2.js +19 -8
- package/dest/mem_pools/tx_pool_v2/tx_pool_v2_impl.d.ts +17 -4
- package/dest/mem_pools/tx_pool_v2/tx_pool_v2_impl.d.ts.map +1 -1
- package/dest/mem_pools/tx_pool_v2/tx_pool_v2_impl.js +133 -34
- package/dest/msg_validators/attestation_validator/attestation_validator.d.ts +6 -5
- package/dest/msg_validators/attestation_validator/attestation_validator.d.ts.map +1 -1
- package/dest/msg_validators/attestation_validator/attestation_validator.js +24 -26
- package/dest/msg_validators/attestation_validator/fisherman_attestation_validator.d.ts +4 -4
- package/dest/msg_validators/attestation_validator/fisherman_attestation_validator.d.ts.map +1 -1
- package/dest/msg_validators/attestation_validator/fisherman_attestation_validator.js +2 -2
- package/dest/msg_validators/proposal_validator/block_proposal_validator.d.ts +4 -3
- package/dest/msg_validators/proposal_validator/block_proposal_validator.d.ts.map +1 -1
- package/dest/msg_validators/proposal_validator/block_proposal_validator.js +2 -2
- package/dest/msg_validators/proposal_validator/checkpoint_proposal_validator.d.ts +4 -3
- package/dest/msg_validators/proposal_validator/checkpoint_proposal_validator.d.ts.map +1 -1
- package/dest/msg_validators/proposal_validator/checkpoint_proposal_validator.js +8 -2
- package/dest/msg_validators/proposal_validator/proposal_validator.d.ts +19 -5
- package/dest/msg_validators/proposal_validator/proposal_validator.d.ts.map +1 -1
- package/dest/msg_validators/proposal_validator/proposal_validator.js +66 -30
- package/dest/msg_validators/tx_validator/factory.d.ts +9 -11
- package/dest/msg_validators/tx_validator/factory.d.ts.map +1 -1
- package/dest/msg_validators/tx_validator/factory.js +15 -6
- package/dest/msg_validators/tx_validator/gas_validator.d.ts +12 -7
- package/dest/msg_validators/tx_validator/gas_validator.d.ts.map +1 -1
- package/dest/msg_validators/tx_validator/gas_validator.js +15 -15
- package/dest/msg_validators/tx_validator/phases_validator.js +2 -2
- package/dest/msg_validators/tx_validator/timestamp_validator.js +1 -1
- package/dest/msg_validators/tx_validator/tx_validation_cache.d.ts +2 -2
- package/dest/msg_validators/tx_validator/tx_validation_cache.d.ts.map +1 -1
- package/dest/msg_validators/tx_validator/tx_validation_cache.js +6 -7
- package/dest/services/discv5/discV5_service.d.ts +12 -2
- package/dest/services/discv5/discV5_service.d.ts.map +1 -1
- package/dest/services/discv5/discV5_service.js +84 -15
- package/dest/services/discv5/persisted_enr_store.d.ts +38 -0
- package/dest/services/discv5/persisted_enr_store.d.ts.map +1 -0
- package/dest/services/discv5/persisted_enr_store.js +145 -0
- package/dest/services/dummy_service.d.ts +6 -2
- package/dest/services/dummy_service.d.ts.map +1 -1
- package/dest/services/dummy_service.js +3 -0
- package/dest/services/encoding.d.ts +19 -6
- package/dest/services/encoding.d.ts.map +1 -1
- package/dest/services/encoding.js +25 -15
- package/dest/services/gossipsub/topic_score_params.d.ts +6 -23
- package/dest/services/gossipsub/topic_score_params.d.ts.map +1 -1
- package/dest/services/gossipsub/topic_score_params.js +4 -31
- package/dest/services/libp2p/libp2p_service.d.ts +12 -3
- package/dest/services/libp2p/libp2p_service.d.ts.map +1 -1
- package/dest/services/libp2p/libp2p_service.js +204 -114
- package/dest/services/peer-manager/peer_manager.d.ts +15 -2
- package/dest/services/peer-manager/peer_manager.d.ts.map +1 -1
- package/dest/services/peer-manager/peer_manager.js +46 -18
- package/dest/services/peer-manager/peer_scoring.d.ts +28 -1
- package/dest/services/peer-manager/peer_scoring.d.ts.map +1 -1
- package/dest/services/peer-manager/peer_scoring.js +70 -3
- package/dest/services/reqresp/batch-tx-requester/batch_tx_requester.d.ts +1 -8
- package/dest/services/reqresp/batch-tx-requester/batch_tx_requester.d.ts.map +1 -1
- package/dest/services/reqresp/batch-tx-requester/batch_tx_requester.js +21 -39
- package/dest/services/reqresp/config.d.ts +13 -1
- package/dest/services/reqresp/config.d.ts.map +1 -1
- package/dest/services/reqresp/config.js +11 -0
- package/dest/services/reqresp/protocols/block_txs/bitvector.d.ts +4 -3
- package/dest/services/reqresp/protocols/block_txs/bitvector.d.ts.map +1 -1
- package/dest/services/reqresp/protocols/block_txs/bitvector.js +3 -2
- package/dest/services/reqresp/protocols/block_txs/block_txs_handler.d.ts +1 -1
- package/dest/services/reqresp/protocols/block_txs/block_txs_handler.d.ts.map +1 -1
- package/dest/services/reqresp/protocols/block_txs/block_txs_handler.js +29 -28
- package/dest/services/reqresp/protocols/block_txs/block_txs_reqresp.d.ts +12 -7
- package/dest/services/reqresp/protocols/block_txs/block_txs_reqresp.d.ts.map +1 -1
- package/dest/services/reqresp/protocols/block_txs/block_txs_reqresp.js +42 -24
- package/dest/services/reqresp/rate-limiter/rate_limits.js +3 -3
- 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 +34 -3
- package/dest/services/service.d.ts +21 -1
- package/dest/services/service.d.ts.map +1 -1
- package/dest/services/tx_collection/tx_source.d.ts +1 -1
- package/dest/services/tx_collection/tx_source.d.ts.map +1 -1
- package/dest/services/tx_collection/tx_source.js +4 -1
- package/dest/test-helpers/testbench-utils.d.ts +4 -1
- package/dest/test-helpers/testbench-utils.d.ts.map +1 -1
- package/dest/test-helpers/testbench-utils.js +11 -3
- package/dest/testbench/p2p_client_testbench_worker.d.ts +1 -1
- package/dest/testbench/p2p_client_testbench_worker.d.ts.map +1 -1
- package/dest/testbench/p2p_client_testbench_worker.js +19 -2
- package/package.json +15 -17
- package/src/bootstrap/bootstrap.ts +15 -9
- package/src/client/factory.ts +9 -5
- package/src/client/interface.ts +33 -7
- package/src/client/p2p_client.ts +46 -48
- package/src/config.ts +50 -38
- package/src/errors/reqresp.error.ts +19 -0
- package/src/mem_pools/attestation_pool/attestation_pool.ts +12 -2
- package/src/mem_pools/attestation_pool/attestation_pool_test_suite.ts +40 -1
- package/src/mem_pools/instrumentation.ts +13 -11
- package/src/mem_pools/tx_pool_v2/archive/tx_archive.ts +1 -9
- package/src/mem_pools/tx_pool_v2/deleted_pool.ts +7 -7
- package/src/mem_pools/tx_pool_v2/eviction/fee_payer_balance_eviction_rule.ts +2 -4
- package/src/mem_pools/tx_pool_v2/eviction/fee_payer_balance_pre_add_rule.ts +3 -2
- package/src/mem_pools/tx_pool_v2/eviction/insufficient_fee_per_gas_eviction_rule.ts +3 -1
- package/src/mem_pools/tx_pool_v2/eviction/invalid_txs_after_mining_rule.ts +1 -3
- package/src/mem_pools/tx_pool_v2/eviction/invalid_txs_after_reorg_rule.ts +2 -4
- package/src/mem_pools/tx_pool_v2/eviction/low_priority_eviction_rule.ts +5 -6
- package/src/mem_pools/tx_pool_v2/interfaces.ts +28 -4
- package/src/mem_pools/tx_pool_v2/tx_pool_indices.ts +35 -0
- package/src/mem_pools/tx_pool_v2/tx_pool_v2.ts +22 -8
- package/src/mem_pools/tx_pool_v2/tx_pool_v2_impl.ts +158 -33
- package/src/msg_validators/attestation_validator/attestation_validator.ts +26 -26
- package/src/msg_validators/attestation_validator/fisherman_attestation_validator.ts +4 -3
- package/src/msg_validators/proposal_validator/block_proposal_validator.ts +4 -2
- package/src/msg_validators/proposal_validator/checkpoint_proposal_validator.ts +10 -2
- package/src/msg_validators/proposal_validator/proposal_validator.ts +69 -30
- package/src/msg_validators/tx_validator/README.md +2 -0
- package/src/msg_validators/tx_validator/factory.ts +19 -13
- package/src/msg_validators/tx_validator/gas_validator.ts +16 -20
- package/src/msg_validators/tx_validator/phases_validator.ts +2 -2
- package/src/msg_validators/tx_validator/timestamp_validator.ts +1 -1
- package/src/msg_validators/tx_validator/tx_validation_cache.ts +6 -7
- package/src/services/discv5/discV5_service.ts +88 -9
- package/src/services/discv5/persisted_enr_store.ts +158 -0
- package/src/services/dummy_service.ts +6 -0
- package/src/services/encoding.ts +28 -20
- package/src/services/gossipsub/README.md +33 -11
- package/src/services/gossipsub/topic_score_params.ts +9 -50
- package/src/services/libp2p/libp2p_service.ts +234 -125
- package/src/services/peer-manager/peer_manager.ts +48 -17
- package/src/services/peer-manager/peer_scoring.ts +75 -3
- package/src/services/reqresp/README.md +2 -23
- package/src/services/reqresp/batch-tx-requester/batch_tx_requester.ts +21 -45
- package/src/services/reqresp/config.ts +17 -0
- package/src/services/reqresp/protocols/block_txs/bitvector.ts +3 -2
- package/src/services/reqresp/protocols/block_txs/block_txs_handler.ts +33 -31
- package/src/services/reqresp/protocols/block_txs/block_txs_reqresp.ts +47 -20
- package/src/services/reqresp/rate-limiter/rate_limits.ts +3 -3
- package/src/services/reqresp/reqresp.ts +42 -2
- package/src/services/service.ts +23 -0
- package/src/services/tx_collection/tx_source.ts +2 -1
- package/src/test-helpers/testbench-utils.ts +13 -2
- package/src/testbench/p2p_client_testbench_worker.ts +22 -2
- package/dest/msg_validators/clock_tolerance.d.ts +0 -32
- package/dest/msg_validators/clock_tolerance.d.ts.map +0 -1
- package/dest/msg_validators/clock_tolerance.js +0 -95
- package/src/msg_validators/clock_tolerance.ts +0 -127
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"testbench-utils.d.ts","sourceRoot":"","sources":["../../src/test-helpers/testbench-utils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AAC9D,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,iCAAiC,CAAC;AAC9E,OAAO,EAAe,UAAU,EAAE,MAAM,iCAAiC,CAAC;AAC1E,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AACpD,OAAO,KAAK,EAAE,OAAO,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAC9D,OAAO,KA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AE,CAsBN;AAED;;;GAGG;AACH,wBAAgB,wBAAwB,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,CAElE"}
|
|
@@ -101,6 +101,9 @@ import { RateLimitStatus } from '../services/reqresp/rate-limiter/rate_limiter.j
|
|
|
101
101
|
prepareForSlot(_slotNumber) {
|
|
102
102
|
return Promise.resolve();
|
|
103
103
|
}
|
|
104
|
+
unprotectTxs(_txHashes, _slotNumber) {
|
|
105
|
+
return Promise.resolve();
|
|
106
|
+
}
|
|
104
107
|
handlePrunedBlocks(_latestBlock, _options) {
|
|
105
108
|
return Promise.resolve();
|
|
106
109
|
}
|
|
@@ -140,6 +143,9 @@ import { RateLimitStatus } from '../services/reqresp/rate-limiter/rate_limiter.j
|
|
|
140
143
|
getPendingTxCount() {
|
|
141
144
|
return Promise.resolve(this.txsByHash.size);
|
|
142
145
|
}
|
|
146
|
+
async hasEligiblePendingTxs(minCount) {
|
|
147
|
+
return await this.getPendingTxCount() >= minCount;
|
|
148
|
+
}
|
|
143
149
|
getMinedTxHashes() {
|
|
144
150
|
return Promise.resolve([]);
|
|
145
151
|
}
|
|
@@ -206,6 +212,9 @@ import { RateLimitStatus } from '../services/reqresp/rate-limiter/rate_limiter.j
|
|
|
206
212
|
getCheckpointProposal(slot) {
|
|
207
213
|
return Promise.resolve(this.checkpoints.get(slot)?.[0]);
|
|
208
214
|
}
|
|
215
|
+
hasCheckpointProposalForSlot(slot) {
|
|
216
|
+
return Promise.resolve(this.checkpoints.has(slot));
|
|
217
|
+
}
|
|
209
218
|
getProposalsForSlot(slot) {
|
|
210
219
|
return Promise.resolve({
|
|
211
220
|
blockProposals: [
|
|
@@ -261,8 +270,6 @@ import { RateLimitStatus } from '../services/reqresp/rate-limiter/rate_limiter.j
|
|
|
261
270
|
ts: 0n,
|
|
262
271
|
nowMs: 0n
|
|
263
272
|
}),
|
|
264
|
-
isProposerPipeliningEnabled: ()=>false,
|
|
265
|
-
pipeliningOffset: ()=>0,
|
|
266
273
|
computeProposerIndex: ()=>0n,
|
|
267
274
|
getCurrentAndNextSlot: ()=>({
|
|
268
275
|
currentSlot: SlotNumber.ZERO,
|
|
@@ -299,7 +306,8 @@ import { RateLimitStatus } from '../services/reqresp/rate-limiter/rate_limiter.j
|
|
|
299
306
|
proofSubmissionEpochs: 1,
|
|
300
307
|
targetCommitteeSize: 48,
|
|
301
308
|
rollupManaLimit: Number.MAX_SAFE_INTEGER
|
|
302
|
-
})
|
|
309
|
+
}),
|
|
310
|
+
getLagInEpochsForValidatorSet: ()=>2
|
|
303
311
|
};
|
|
304
312
|
return cache;
|
|
305
313
|
}
|
|
@@ -23,4 +23,4 @@ export interface BenchResultMessage {
|
|
|
23
23
|
export interface BenchReadyMessage {
|
|
24
24
|
type: 'BENCH_READY';
|
|
25
25
|
}
|
|
26
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
26
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicDJwX2NsaWVudF90ZXN0YmVuY2hfd29ya2VyLmQudHMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9zcmMvdGVzdGJlbmNoL3AycF9jbGllbnRfdGVzdGJlbmNoX3dvcmtlci50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUE4Q0EsT0FBTyxFQUVMLEtBQUssbUJBQW1CLEVBT3pCLE1BQU0sMEJBQTBCLENBQUM7QUFHbEMsWUFBWSxFQUFFLG1CQUFtQixFQUFFLE1BQU0sb0NBQW9DLENBQUM7QUFFOUUsTUFBTSxXQUFXLG1CQUFtQjtJQUNsQyxJQUFJLEVBQUUsZUFBZSxDQUFDO0lBQ3RCLE9BQU8sRUFBRSxNQUFNLENBQUM7SUFDaEIsU0FBUyxFQUFFLE1BQU0sQ0FBQztJQUNsQixZQUFZLEVBQUUsbUJBQW1CLENBQUM7SUFDbEMsU0FBUyxFQUFFLE1BQU0sQ0FBQztJQUNsQixZQUFZLEVBQUUsT0FBTyxDQUFDO0lBQ3RCLFNBQVMsRUFBRSxNQUFNLENBQUM7SUFDbEIsZUFBZSxDQUFDLEVBQUUsTUFBTSxDQUFDO0lBQ3pCLFlBQVksQ0FBQyxFQUFFLE1BQU0sQ0FBQztJQUN0QixXQUFXLEVBQUUsTUFBTSxDQUFDO0lBQ3BCLElBQUksRUFBRSxNQUFNLENBQUM7Q0FDZDtBQUVELE1BQU0sV0FBVyxrQkFBa0I7SUFDakMsSUFBSSxFQUFFLGNBQWMsQ0FBQztJQUNyQixVQUFVLEVBQUUsTUFBTSxDQUFDO0lBQ25CLFlBQVksRUFBRSxNQUFNLENBQUM7SUFDckIsT0FBTyxFQUFFLE9BQU8sQ0FBQztJQUNqQixLQUFLLENBQUMsRUFBRSxNQUFNLENBQUM7Q0FDaEI7QUFFRCxNQUFNLFdBQVcsaUJBQWlCO0lBQ2hDLElBQUksRUFBRSxhQUFhLENBQUM7Q0FDckIifQ==
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"p2p_client_testbench_worker.d.ts","sourceRoot":"","sources":["../../src/testbench/p2p_client_testbench_worker.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"p2p_client_testbench_worker.d.ts","sourceRoot":"","sources":["../../src/testbench/p2p_client_testbench_worker.ts"],"names":[],"mappings":"AA8CA,OAAO,EAEL,KAAK,mBAAmB,EAOzB,MAAM,0BAA0B,CAAC;AAGlC,YAAY,EAAE,mBAAmB,EAAE,MAAM,oCAAoC,CAAC;AAE9E,MAAM,WAAW,mBAAmB;IAClC,IAAI,EAAE,eAAe,CAAC;IACtB,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,MAAM,CAAC;IAClB,YAAY,EAAE,mBAAmB,CAAC;IAClC,SAAS,EAAE,MAAM,CAAC;IAClB,YAAY,EAAE,OAAO,CAAC;IACtB,SAAS,EAAE,MAAM,CAAC;IAClB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,WAAW,EAAE,MAAM,CAAC;IACpB,IAAI,EAAE,MAAM,CAAC;CACd;AAED,MAAM,WAAW,kBAAkB;IACjC,IAAI,EAAE,cAAc,CAAC;IACrB,UAAU,EAAE,MAAM,CAAC;IACnB,YAAY,EAAE,MAAM,CAAC;IACrB,OAAO,EAAE,OAAO,CAAC;IACjB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,iBAAiB;IAChC,IAAI,EAAE,aAAa,CAAC;CACrB"}
|
|
@@ -13,6 +13,7 @@ import { DateProvider, Timer } from '@aztec/foundation/timer';
|
|
|
13
13
|
import { openTmpStore } from '@aztec/kv-store/lmdb-v2';
|
|
14
14
|
import { getVKTreeRoot } from '@aztec/noir-protocol-circuits-types/vk-tree';
|
|
15
15
|
import { protocolContractsHash } from '@aztec/protocol-contracts';
|
|
16
|
+
import { EmptyL1RollupConstants } from '@aztec/stdlib/epoch-helpers';
|
|
16
17
|
import { GasFees } from '@aztec/stdlib/gas';
|
|
17
18
|
import { P2PMessage } from '@aztec/stdlib/p2p';
|
|
18
19
|
import { ChonkProof } from '@aztec/stdlib/proofs';
|
|
@@ -29,6 +30,22 @@ import { RequestTracker } from '../services/tx_collection/request_tracker.js';
|
|
|
29
30
|
import { AlwaysTrueCircuitVerifier } from '../test-helpers/index.js';
|
|
30
31
|
import { BENCHMARK_CONSTANTS, InMemoryAttestationPool, InMemoryTxPool, UNLIMITED_RATE_LIMIT_QUOTA, createMockEpochCache, createMockWorldStateSynchronizer, filterTxsByDistribution } from '../test-helpers/index.js';
|
|
31
32
|
const txCache = new Map();
|
|
33
|
+
const BENCH_L1_CONSTANTS = {
|
|
34
|
+
...EmptyL1RollupConstants,
|
|
35
|
+
slotDuration: 12,
|
|
36
|
+
ethereumSlotDuration: 4
|
|
37
|
+
};
|
|
38
|
+
class TestbenchL2BlockSource extends MockL2BlockSource {
|
|
39
|
+
getL1Constants() {
|
|
40
|
+
return Promise.resolve(BENCH_L1_CONSTANTS);
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
function createBenchmarkEpochCache() {
|
|
44
|
+
return {
|
|
45
|
+
...createMockEpochCache(),
|
|
46
|
+
getL1Constants: ()=>BENCH_L1_CONSTANTS
|
|
47
|
+
};
|
|
48
|
+
}
|
|
32
49
|
class TestLibP2PService extends LibP2PService {
|
|
33
50
|
disableTxValidation;
|
|
34
51
|
gossipMessageCount = 0;
|
|
@@ -237,9 +254,9 @@ process.on('message', async (msg)=>{
|
|
|
237
254
|
workerConfig = config;
|
|
238
255
|
workerTxPool = new InMemoryTxPool();
|
|
239
256
|
workerAttestationPool = new InMemoryAttestationPool();
|
|
240
|
-
const epochCache =
|
|
257
|
+
const epochCache = createBenchmarkEpochCache();
|
|
241
258
|
const worldState = createMockWorldStateSynchronizer();
|
|
242
|
-
const l2BlockSource = new
|
|
259
|
+
const l2BlockSource = new TestbenchL2BlockSource();
|
|
243
260
|
const proofVerifier = new AlwaysTrueCircuitVerifier();
|
|
244
261
|
kvStore = await openTmpStore(`test-${clientIndex}`, true, BENCHMARK_CONSTANTS.KV_STORE_MAP_SIZE_KB);
|
|
245
262
|
workerLogger = createLogger(`p2p:${clientIndex}`);
|
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.9a89641",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"exports": {
|
|
6
6
|
".": "./dest/index.js",
|
|
@@ -67,18 +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-
|
|
76
|
-
"@aztec/
|
|
77
|
-
"@aztec/
|
|
78
|
-
"@aztec/
|
|
79
|
-
"@aztec/
|
|
80
|
-
"@aztec/
|
|
81
|
-
"@aztec/telemetry-client": "0.0.1-commit.993d240",
|
|
70
|
+
"@aztec/constants": "0.0.1-commit.9a89641",
|
|
71
|
+
"@aztec/epoch-cache": "0.0.1-commit.9a89641",
|
|
72
|
+
"@aztec/ethereum": "0.0.1-commit.9a89641",
|
|
73
|
+
"@aztec/foundation": "0.0.1-commit.9a89641",
|
|
74
|
+
"@aztec/kv-store": "0.0.1-commit.9a89641",
|
|
75
|
+
"@aztec/noir-protocol-circuits-types": "0.0.1-commit.9a89641",
|
|
76
|
+
"@aztec/protocol-contracts": "0.0.1-commit.9a89641",
|
|
77
|
+
"@aztec/simulator": "0.0.1-commit.9a89641",
|
|
78
|
+
"@aztec/standard-contracts": "0.0.1-commit.9a89641",
|
|
79
|
+
"@aztec/stdlib": "0.0.1-commit.9a89641",
|
|
80
|
+
"@aztec/telemetry-client": "0.0.1-commit.9a89641",
|
|
82
81
|
"@chainsafe/libp2p-gossipsub": "13.0.0",
|
|
83
82
|
"@chainsafe/libp2p-noise": "^15.0.0",
|
|
84
83
|
"@chainsafe/libp2p-yamux": "^6.0.2",
|
|
@@ -101,12 +100,11 @@
|
|
|
101
100
|
"semver": "^7.6.0",
|
|
102
101
|
"sha3": "^2.1.4",
|
|
103
102
|
"snappy": "^7.2.2",
|
|
104
|
-
"tslib": "^2.4.0"
|
|
105
|
-
"xxhash-wasm": "^1.1.0"
|
|
103
|
+
"tslib": "^2.4.0"
|
|
106
104
|
},
|
|
107
105
|
"devDependencies": {
|
|
108
|
-
"@aztec/archiver": "0.0.1-commit.
|
|
109
|
-
"@aztec/world-state": "0.0.1-commit.
|
|
106
|
+
"@aztec/archiver": "0.0.1-commit.9a89641",
|
|
107
|
+
"@aztec/world-state": "0.0.1-commit.9a89641",
|
|
110
108
|
"@jest/globals": "^30.0.0",
|
|
111
109
|
"@types/jest": "^30.0.0",
|
|
112
110
|
"@types/node": "^22.15.17",
|
|
@@ -84,15 +84,21 @@ export class BootstrapNode implements P2PBootstrapApi {
|
|
|
84
84
|
this.logger.info('Advertised socket address updated', { addr: addr.toString() });
|
|
85
85
|
});
|
|
86
86
|
this.node.on('discovered', async (enr: SignableENR) => {
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
87
|
+
try {
|
|
88
|
+
const addr = await enr.getFullMultiaddr('udp');
|
|
89
|
+
this.logger.verbose(`Discovered new peer`, { enr: enr.encodeTxt(), addr: addr?.toString() });
|
|
90
|
+
// discv5's discovered() only updates routing table entries that already exist. Nodes that
|
|
91
|
+
// established a session with an empty-IP ENR are never inserted, so even after their ENR
|
|
92
|
+
// gains a valid socket address the routing table stays empty and FINDNODE always returns 0
|
|
93
|
+
// peers. Calling addEnr() here does an insertOrUpdate regardless of prior state, fixing
|
|
94
|
+
// the routing table so these nodes become discoverable to other peers.
|
|
95
|
+
if (addr) {
|
|
96
|
+
this.node.addEnr(enr);
|
|
97
|
+
}
|
|
98
|
+
} catch (err) {
|
|
99
|
+
// A malformed ENR address field makes the parser throw. As an async listener this would crash
|
|
100
|
+
// the bootnode on an unhandled rejection — catch, log, and drop the ENR instead.
|
|
101
|
+
this.logger.warn(`Dropping discovered ENR with unparseable address`, { err });
|
|
96
102
|
}
|
|
97
103
|
});
|
|
98
104
|
|
package/src/client/factory.ts
CHANGED
|
@@ -7,7 +7,7 @@ import { AztecLMDBStoreV2, createStore } from '@aztec/kv-store/lmdb-v2';
|
|
|
7
7
|
import type { BlockHash, L2BlockSource } from '@aztec/stdlib/block';
|
|
8
8
|
import type { ChainConfig } from '@aztec/stdlib/config';
|
|
9
9
|
import type { ContractDataSource } from '@aztec/stdlib/contract';
|
|
10
|
-
import type
|
|
10
|
+
import { type BlockMinFeesProvider, getNetworkTxGasLimits } from '@aztec/stdlib/gas';
|
|
11
11
|
import type { AztecNode, ClientProtocolCircuitVerifier, WorldStateSynchronizer } from '@aztec/stdlib/interfaces/server';
|
|
12
12
|
import type { DataStoreConfig } from '@aztec/stdlib/kv-store';
|
|
13
13
|
import { type TelemetryClient, getTelemetryClient } from '@aztec/telemetry-client';
|
|
@@ -75,7 +75,10 @@ export async function createP2PClient(
|
|
|
75
75
|
}
|
|
76
76
|
|
|
77
77
|
const bindings = logger.getBindings();
|
|
78
|
-
|
|
78
|
+
// Schema version 4: L2 tips store resolves checkpoint tips from per-tip ids in l2_tip_checkpoints; the
|
|
79
|
+
// block->checkpoint mapping and checkpoint maps were dropped. Bumped to wipe stores whose tips predate
|
|
80
|
+
// per-tip ids, which would otherwise make getL2Tips throw on every read.
|
|
81
|
+
const store = deps.store ?? (await createStore(P2P_STORE_NAME, 4, config, bindings));
|
|
79
82
|
const archive = await createStore(P2P_ARCHIVE_STORE_NAME, 1, config, bindings);
|
|
80
83
|
const peerStore = await createStore(P2P_PEER_STORE_NAME, 1, config, bindings);
|
|
81
84
|
const attestationStore = await createStore(P2P_ATTESTATION_STORE_NAME, 2, config, bindings);
|
|
@@ -108,14 +111,14 @@ export async function createP2PClient(
|
|
|
108
111
|
const { ts: nextSlotTimestamp } = epochCache.getEpochAndSlotInNextL1Slot();
|
|
109
112
|
const l1Constants = await archiver.getL1Constants();
|
|
110
113
|
const gasFees = await blockMinFeesProvider.getCurrentMinFees();
|
|
114
|
+
const networkTxGasLimits = getNetworkTxGasLimits(config, l1Constants);
|
|
111
115
|
return createTxValidatorForTransactionsEnteringPendingTxPool(
|
|
112
116
|
worldStateSynchronizer,
|
|
113
117
|
nextSlotTimestamp,
|
|
114
118
|
BlockNumber(currentBlockNumber + 1),
|
|
115
119
|
{
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
maxBlockDAGas: config.validateMaxDABlockGas,
|
|
120
|
+
maxTxL2Gas: networkTxGasLimits.l2Gas,
|
|
121
|
+
maxTxDAGas: networkTxGasLimits.daGas,
|
|
119
122
|
},
|
|
120
123
|
gasFees,
|
|
121
124
|
);
|
|
@@ -129,6 +132,7 @@ export async function createP2PClient(
|
|
|
129
132
|
minTxPoolAgeMs: config.minTxPoolAgeMs,
|
|
130
133
|
dropTransactionsProbability: config.dropTransactionsProbability,
|
|
131
134
|
priceBumpPercentage: config.priceBumpPercentage,
|
|
135
|
+
keepFinalizedTxsForSlots: config.keepFinalizedTxsForSlots,
|
|
132
136
|
},
|
|
133
137
|
dateProvider,
|
|
134
138
|
);
|
package/src/client/interface.ts
CHANGED
|
@@ -13,6 +13,7 @@ import type { ReqRespSubProtocol, ReqRespSubProtocolHandler } from '../services/
|
|
|
13
13
|
import type {
|
|
14
14
|
DuplicateAttestationInfo,
|
|
15
15
|
DuplicateProposalInfo,
|
|
16
|
+
OversizedProposalInfo,
|
|
16
17
|
P2PBlockReceivedCallback,
|
|
17
18
|
P2PCheckpointAttestationCallback,
|
|
18
19
|
P2PCheckpointReceivedCallback,
|
|
@@ -97,6 +98,14 @@ export type P2P = P2PClient & {
|
|
|
97
98
|
*/
|
|
98
99
|
registerDuplicateProposalCallback(callback: (info: DuplicateProposalInfo) => void): void;
|
|
99
100
|
|
|
101
|
+
/**
|
|
102
|
+
* Registers a callback invoked when an oversized block proposal (index at or beyond the consensus
|
|
103
|
+
* per-checkpoint block limit) is stored and re-broadcast as slashing evidence.
|
|
104
|
+
*
|
|
105
|
+
* @param callback - Function called with info about the oversized proposal
|
|
106
|
+
*/
|
|
107
|
+
registerOversizedProposalCallback(callback: (info: OversizedProposalInfo) => void): void;
|
|
108
|
+
|
|
100
109
|
/**
|
|
101
110
|
* Registers a callback invoked when a duplicate attestation is detected (equivocation).
|
|
102
111
|
* A validator signing attestations for different proposals at the same slot.
|
|
@@ -124,16 +133,18 @@ export type P2P = P2PClient & {
|
|
|
124
133
|
/**
|
|
125
134
|
* Returns a transaction in the transaction pool by its hash.
|
|
126
135
|
* @param txHash - Hash of tx to return.
|
|
136
|
+
* @param opts - Set `includeProof: false` to skip loading the tx proof from the DB.
|
|
127
137
|
* @returns A single tx or undefined.
|
|
128
138
|
*/
|
|
129
|
-
getTxByHashFromPool(txHash: TxHash): Promise<Tx | undefined>;
|
|
139
|
+
getTxByHashFromPool(txHash: TxHash, opts?: { includeProof?: boolean }): Promise<Tx | undefined>;
|
|
130
140
|
|
|
131
141
|
/**
|
|
132
142
|
* Returns transactions in the transaction pool by hash.
|
|
133
143
|
* @param txHashes - Hashes of txs to return.
|
|
144
|
+
* @param opts - Set `includeProof: false` to skip loading tx proofs from the DB.
|
|
134
145
|
* @returns An array of txs or undefined.
|
|
135
146
|
*/
|
|
136
|
-
getTxsByHashFromPool(txHashes: TxHash[]): Promise<(Tx | undefined)[]>;
|
|
147
|
+
getTxsByHashFromPool(txHashes: TxHash[], opts?: { includeProof?: boolean }): Promise<(Tx | undefined)[]>;
|
|
137
148
|
|
|
138
149
|
/**
|
|
139
150
|
* Checks if transactions exist in the pool
|
|
@@ -156,15 +167,27 @@ export type P2P = P2PClient & {
|
|
|
156
167
|
*/
|
|
157
168
|
getTxStatus(txHash: TxHash): Promise<'pending' | 'mined' | 'deleted' | undefined>;
|
|
158
169
|
|
|
159
|
-
/**
|
|
160
|
-
|
|
170
|
+
/**
|
|
171
|
+
* Returns an iterator over pending txs on the mempool.
|
|
172
|
+
* Set `includeProof: false` to skip loading tx proofs from the DB.
|
|
173
|
+
*/
|
|
174
|
+
iteratePendingTxs(opts?: { includeProof?: boolean }): AsyncIterableIterator<Tx>;
|
|
161
175
|
|
|
162
|
-
/**
|
|
163
|
-
|
|
176
|
+
/**
|
|
177
|
+
* Returns an iterator over pending txs that have been in the pool long enough to be eligible for block building.
|
|
178
|
+
* Set `includeProof: false` to skip loading tx proofs from the DB.
|
|
179
|
+
*/
|
|
180
|
+
iterateEligiblePendingTxs(opts?: { includeProof?: boolean }): AsyncIterableIterator<Tx>;
|
|
164
181
|
|
|
165
182
|
/** Returns the number of pending txs in the mempool. */
|
|
166
183
|
getPendingTxCount(): Promise<number>;
|
|
167
184
|
|
|
185
|
+
/**
|
|
186
|
+
* Returns whether at least `minCount` pending txs have been in the pool long enough to be eligible for block
|
|
187
|
+
* building. Early-exits once the threshold is met instead of counting every eligible tx.
|
|
188
|
+
*/
|
|
189
|
+
hasEligiblePendingTxs(minCount: number): Promise<boolean>;
|
|
190
|
+
|
|
168
191
|
/**
|
|
169
192
|
* Protects existing transactions by hash for a given slot.
|
|
170
193
|
* Returns hashes of transactions that weren't found in the pool.
|
|
@@ -218,7 +241,10 @@ export type P2P = P2PClient & {
|
|
|
218
241
|
|
|
219
242
|
updateP2PConfig(config: Partial<P2PConfig>): Promise<void>;
|
|
220
243
|
|
|
221
|
-
/**
|
|
244
|
+
/**
|
|
245
|
+
* Validates a set of txs received in a block proposal.
|
|
246
|
+
* @throws InvalidBlockProposalTxsError - If any tx fails minimum integrity validation.
|
|
247
|
+
*/
|
|
222
248
|
validateTxsReceivedInBlockProposal(txs: Tx[]): Promise<void>;
|
|
223
249
|
|
|
224
250
|
/** Clears the db. */
|
package/src/client/p2p_client.ts
CHANGED
|
@@ -6,7 +6,6 @@ import {
|
|
|
6
6
|
SlotNumber,
|
|
7
7
|
} from '@aztec/foundation/branded-types';
|
|
8
8
|
import { createLogger } from '@aztec/foundation/log';
|
|
9
|
-
import { RunningPromise } from '@aztec/foundation/promise';
|
|
10
9
|
import { DateProvider } from '@aztec/foundation/timer';
|
|
11
10
|
import type { AztecAsyncKVStore, AztecAsyncSingleton } from '@aztec/kv-store';
|
|
12
11
|
import { L2TipsKVStore } from '@aztec/kv-store/stores';
|
|
@@ -15,17 +14,17 @@ import {
|
|
|
15
14
|
type BlockHash,
|
|
16
15
|
type CheckpointId,
|
|
17
16
|
type EthAddress,
|
|
17
|
+
EventDrivenL2BlockStream,
|
|
18
18
|
type L2Block,
|
|
19
19
|
type L2BlockId,
|
|
20
20
|
type L2BlockSource,
|
|
21
|
-
L2BlockStream,
|
|
22
21
|
type L2BlockStreamEvent,
|
|
23
|
-
type L2Tips,
|
|
24
22
|
type L2TipsStore,
|
|
23
|
+
type LocalL2Tips,
|
|
25
24
|
} from '@aztec/stdlib/block';
|
|
26
25
|
import type { ContractDataSource } from '@aztec/stdlib/contract';
|
|
27
26
|
import { getTimestampForSlot } from '@aztec/stdlib/epoch-helpers';
|
|
28
|
-
import { type PeerInfo, tryStop } from '@aztec/stdlib/interfaces/server';
|
|
27
|
+
import { type GetTxByHashOptions, type PeerInfo, tryStop } from '@aztec/stdlib/interfaces/server';
|
|
29
28
|
import { type BlockProposal, CheckpointAttestation, type CheckpointProposal, type TopicType } from '@aztec/stdlib/p2p';
|
|
30
29
|
import type { BlockHeader, Tx, TxHash } from '@aztec/stdlib/tx';
|
|
31
30
|
import { Attributes, type TelemetryClient, WithTracer, getTelemetryClient, trackSpan } from '@aztec/telemetry-client';
|
|
@@ -43,6 +42,7 @@ import { ReqRespSubProtocol, type ReqRespSubProtocolHandler } from '../services/
|
|
|
43
42
|
import type {
|
|
44
43
|
DuplicateAttestationInfo,
|
|
45
44
|
DuplicateProposalInfo,
|
|
45
|
+
OversizedProposalInfo,
|
|
46
46
|
P2PBlockReceivedCallback,
|
|
47
47
|
P2PCheckpointReceivedCallback,
|
|
48
48
|
P2PService,
|
|
@@ -74,7 +74,7 @@ export class P2PClient extends WithTracer implements P2P {
|
|
|
74
74
|
|
|
75
75
|
private config: P2PConfig;
|
|
76
76
|
|
|
77
|
-
private blockStream:
|
|
77
|
+
private blockStream: EventDrivenL2BlockStream | undefined;
|
|
78
78
|
|
|
79
79
|
private txProvider: TxProvider;
|
|
80
80
|
|
|
@@ -83,9 +83,6 @@ export class P2PClient extends WithTracer implements P2P {
|
|
|
83
83
|
/** Tracks the last slot for which we called prepareForSlot */
|
|
84
84
|
private lastSlotProcessed: SlotNumber = SlotNumber.ZERO;
|
|
85
85
|
|
|
86
|
-
/** Polls for slot changes and calls prepareForSlot on the tx pool */
|
|
87
|
-
private slotMonitor: RunningPromise | undefined;
|
|
88
|
-
|
|
89
86
|
constructor(
|
|
90
87
|
private store: AztecAsyncKVStore,
|
|
91
88
|
private l2BlockSource: L2BlockSource & ContractDataSource,
|
|
@@ -152,7 +149,7 @@ export class P2PClient extends WithTracer implements P2P {
|
|
|
152
149
|
this.p2pService.updateConfig(config);
|
|
153
150
|
}
|
|
154
151
|
|
|
155
|
-
public getL2Tips(): Promise<
|
|
152
|
+
public getL2Tips(): Promise<LocalL2Tips> {
|
|
156
153
|
return this.l2Tips.getL2Tips();
|
|
157
154
|
}
|
|
158
155
|
|
|
@@ -178,10 +175,12 @@ export class P2PClient extends WithTracer implements P2P {
|
|
|
178
175
|
break;
|
|
179
176
|
case 'chain-pruned':
|
|
180
177
|
this.txCollection.stopCollectingForBlocksAfter(event.block.number);
|
|
181
|
-
await this.handlePruneL2Blocks(event.block, event.checkpoint);
|
|
178
|
+
await this.handlePruneL2Blocks(event.block, event.checkpointed.checkpoint);
|
|
182
179
|
break;
|
|
183
180
|
case 'chain-checkpointed':
|
|
184
181
|
break;
|
|
182
|
+
case 'chain-proposed':
|
|
183
|
+
break;
|
|
185
184
|
default: {
|
|
186
185
|
const _: never = event;
|
|
187
186
|
break;
|
|
@@ -268,14 +267,6 @@ export class P2PClient extends WithTracer implements P2P {
|
|
|
268
267
|
this.blockStream.start();
|
|
269
268
|
this.txFileStore?.start();
|
|
270
269
|
|
|
271
|
-
// Start slot monitor to call prepareForSlot when the slot changes
|
|
272
|
-
this.slotMonitor = new RunningPromise(
|
|
273
|
-
() => this.maybeCallPrepareForSlot(),
|
|
274
|
-
this.log,
|
|
275
|
-
this.config.slotCheckIntervalMS,
|
|
276
|
-
);
|
|
277
|
-
this.slotMonitor.start();
|
|
278
|
-
|
|
279
270
|
return this.syncPromise;
|
|
280
271
|
}
|
|
281
272
|
|
|
@@ -286,7 +277,7 @@ export class P2PClient extends WithTracer implements P2P {
|
|
|
286
277
|
private initBlockStream(startingBlock?: BlockNumber) {
|
|
287
278
|
if (!this.blockStream) {
|
|
288
279
|
const { blockRequestBatchSize: batchSize, blockCheckIntervalMS: pollIntervalMS } = this.config;
|
|
289
|
-
this.blockStream = new
|
|
280
|
+
this.blockStream = new EventDrivenL2BlockStream(
|
|
290
281
|
this.l2BlockSource,
|
|
291
282
|
this,
|
|
292
283
|
this,
|
|
@@ -302,8 +293,6 @@ export class P2PClient extends WithTracer implements P2P {
|
|
|
302
293
|
*/
|
|
303
294
|
public async stop() {
|
|
304
295
|
this.log.debug('Stopping p2p client...');
|
|
305
|
-
await this.slotMonitor?.stop();
|
|
306
|
-
this.log.debug('Stopped slot monitor');
|
|
307
296
|
await tryStop(this.txCollection);
|
|
308
297
|
this.log.debug('Stopped tx collection service');
|
|
309
298
|
await this.txFileStore?.stop();
|
|
@@ -406,6 +395,10 @@ export class P2PClient extends WithTracer implements P2P {
|
|
|
406
395
|
return this.attestationPool.hasBlockProposalsForSlot(slot);
|
|
407
396
|
}
|
|
408
397
|
|
|
398
|
+
public hasCheckpointProposalForSlot(slot: SlotNumber): Promise<boolean> {
|
|
399
|
+
return this.attestationPool.hasCheckpointProposalForSlot(slot);
|
|
400
|
+
}
|
|
401
|
+
|
|
409
402
|
// REVIEW: https://github.com/AztecProtocol/aztec-packages/issues/7963
|
|
410
403
|
// ^ This pattern is not my favorite (md)
|
|
411
404
|
public registerBlockProposalHandler(handler: P2PBlockReceivedCallback): void {
|
|
@@ -424,6 +417,10 @@ export class P2PClient extends WithTracer implements P2P {
|
|
|
424
417
|
this.p2pService.registerDuplicateProposalCallback(callback);
|
|
425
418
|
}
|
|
426
419
|
|
|
420
|
+
public registerOversizedProposalCallback(callback: (info: OversizedProposalInfo) => void): void {
|
|
421
|
+
this.p2pService.registerOversizedProposalCallback(callback);
|
|
422
|
+
}
|
|
423
|
+
|
|
427
424
|
public registerDuplicateAttestationCallback(callback: (info: DuplicateAttestationInfo) => void): void {
|
|
428
425
|
this.p2pService.registerDuplicateAttestationCallback(callback);
|
|
429
426
|
}
|
|
@@ -432,7 +429,7 @@ export class P2PClient extends WithTracer implements P2P {
|
|
|
432
429
|
this.p2pService.registerCheckpointAttestationCallback(callback);
|
|
433
430
|
}
|
|
434
431
|
|
|
435
|
-
public async getPendingTxs(limit?: number, after?: TxHash): Promise<Tx[]> {
|
|
432
|
+
public async getPendingTxs(limit?: number, after?: TxHash, options?: GetTxByHashOptions): Promise<Tx[]> {
|
|
436
433
|
if (limit !== undefined && limit <= 0) {
|
|
437
434
|
throw new TypeError('limit must be greater than 0');
|
|
438
435
|
}
|
|
@@ -451,7 +448,9 @@ export class P2PClient extends WithTracer implements P2P {
|
|
|
451
448
|
const endIndex = limit !== undefined ? startIndex + limit : undefined;
|
|
452
449
|
txHashes = txHashes.slice(startIndex, endIndex);
|
|
453
450
|
|
|
454
|
-
|
|
451
|
+
// This is a public-facing API (exposed via both the node and the p2p RPC), so proofs are opt-in.
|
|
452
|
+
const includeProof = !!options?.includeProof;
|
|
453
|
+
const maybeTxs = await Promise.all(txHashes.map(txHash => this.txPool.getTxByHash(txHash, { includeProof })));
|
|
455
454
|
return maybeTxs.filter((tx): tx is Tx => !!tx);
|
|
456
455
|
}
|
|
457
456
|
|
|
@@ -459,18 +458,22 @@ export class P2PClient extends WithTracer implements P2P {
|
|
|
459
458
|
return this.txPool.getPendingTxCount();
|
|
460
459
|
}
|
|
461
460
|
|
|
462
|
-
public
|
|
461
|
+
public hasEligiblePendingTxs(minCount: number): Promise<boolean> {
|
|
462
|
+
return this.txPool.hasEligiblePendingTxs(minCount);
|
|
463
|
+
}
|
|
464
|
+
|
|
465
|
+
public async *iteratePendingTxs(opts?: { includeProof?: boolean }): AsyncIterableIterator<Tx> {
|
|
463
466
|
for (const txHash of await this.txPool.getPendingTxHashes()) {
|
|
464
|
-
const tx = await this.txPool.getTxByHash(txHash);
|
|
467
|
+
const tx = await this.txPool.getTxByHash(txHash, opts);
|
|
465
468
|
if (tx) {
|
|
466
469
|
yield tx;
|
|
467
470
|
}
|
|
468
471
|
}
|
|
469
472
|
}
|
|
470
473
|
|
|
471
|
-
public async *iterateEligiblePendingTxs(): AsyncIterableIterator<Tx> {
|
|
474
|
+
public async *iterateEligiblePendingTxs(opts?: { includeProof?: boolean }): AsyncIterableIterator<Tx> {
|
|
472
475
|
for (const txHash of await this.txPool.getEligiblePendingTxHashes()) {
|
|
473
|
-
const tx = await this.txPool.getTxByHash(txHash);
|
|
476
|
+
const tx = await this.txPool.getTxByHash(txHash, opts);
|
|
474
477
|
if (tx) {
|
|
475
478
|
yield tx;
|
|
476
479
|
}
|
|
@@ -480,19 +483,21 @@ export class P2PClient extends WithTracer implements P2P {
|
|
|
480
483
|
/**
|
|
481
484
|
* Returns a transaction in the transaction pool by its hash.
|
|
482
485
|
* @param txHash - Hash of the transaction to look for in the pool.
|
|
486
|
+
* @param opts - Set `includeProof: false` to skip loading the tx proof from the DB.
|
|
483
487
|
* @returns A single tx or undefined.
|
|
484
488
|
*/
|
|
485
|
-
getTxByHashFromPool(txHash: TxHash): Promise<Tx | undefined> {
|
|
486
|
-
return this.txPool.getTxByHash(txHash);
|
|
489
|
+
getTxByHashFromPool(txHash: TxHash, opts?: { includeProof?: boolean }): Promise<Tx | undefined> {
|
|
490
|
+
return this.txPool.getTxByHash(txHash, opts);
|
|
487
491
|
}
|
|
488
492
|
|
|
489
493
|
/**
|
|
490
494
|
* Returns transactions in the transaction pool by hash.
|
|
491
495
|
* @param txHashes - Hashes of the transactions to look for.
|
|
496
|
+
* @param opts - Set `includeProof: false` to skip loading tx proofs from the DB.
|
|
492
497
|
* @returns The txs found, in the same order as the requested hashes. If a tx is not found, it will be undefined.
|
|
493
498
|
*/
|
|
494
|
-
getTxsByHashFromPool(txHashes: TxHash[]): Promise<(Tx | undefined)[]> {
|
|
495
|
-
return this.txPool.getTxsByHash(txHashes);
|
|
499
|
+
getTxsByHashFromPool(txHashes: TxHash[], opts?: { includeProof?: boolean }): Promise<(Tx | undefined)[]> {
|
|
500
|
+
return this.txPool.getTxsByHash(txHashes, opts);
|
|
496
501
|
}
|
|
497
502
|
|
|
498
503
|
hasTxsInPool(txHashes: TxHash[]): Promise<boolean[]> {
|
|
@@ -634,11 +639,16 @@ export class P2PClient extends WithTracer implements P2P {
|
|
|
634
639
|
return;
|
|
635
640
|
}
|
|
636
641
|
|
|
642
|
+
const lastBlock = blocks.at(-1)!;
|
|
643
|
+
const lastSlot = lastBlock.header.getSlot();
|
|
644
|
+
|
|
645
|
+
// Mark txs mined before releasing protections: a block landing at this slot supersedes any
|
|
646
|
+
// protection for txs it includes, so mined-marking must run first to keep just-landed txs from
|
|
647
|
+
// being unprotected into pending where they could be evicted before they are recorded as mined.
|
|
637
648
|
await this.handleMinedBlocks(blocks);
|
|
638
|
-
await this.maybeCallPrepareForSlot();
|
|
649
|
+
await this.maybeCallPrepareForSlot(lastSlot);
|
|
639
650
|
await this.collectingMissingTxs(blocks);
|
|
640
|
-
|
|
641
|
-
await this.synchedLatestSlot.set(BigInt(lastBlock.header.getSlot()));
|
|
651
|
+
await this.synchedLatestSlot.set(BigInt(lastSlot));
|
|
642
652
|
}
|
|
643
653
|
|
|
644
654
|
/** Request txs for unproven blocks so the prover node can prove. */
|
|
@@ -733,20 +743,8 @@ export class P2PClient extends WithTracer implements P2P {
|
|
|
733
743
|
return isEpochPrune;
|
|
734
744
|
}
|
|
735
745
|
|
|
736
|
-
/**
|
|
737
|
-
private async maybeCallPrepareForSlot(): Promise<void> {
|
|
738
|
-
// If we have a proposed checkpoint available, we want to prepare the target slot - otherwise we prepare the current slot
|
|
739
|
-
const l2Tips = await this.l2Tips.getL2Tips();
|
|
740
|
-
const hasProposedCheckpoint = l2Tips.proposedCheckpoint.checkpoint.number > l2Tips.checkpointed.checkpoint.number;
|
|
741
|
-
|
|
742
|
-
let slot;
|
|
743
|
-
if (this.epochCache.isProposerPipeliningEnabled() && hasProposedCheckpoint) {
|
|
744
|
-
const { targetSlot } = this.epochCache.getTargetAndNextSlot();
|
|
745
|
-
slot = targetSlot;
|
|
746
|
-
} else {
|
|
747
|
-
const { currentSlot } = this.epochCache.getCurrentAndNextSlot();
|
|
748
|
-
slot = currentSlot;
|
|
749
|
-
}
|
|
746
|
+
/** Calls prepareForSlot for the given slot if it advances past the last slot we prepared for. */
|
|
747
|
+
private async maybeCallPrepareForSlot(slot: SlotNumber): Promise<void> {
|
|
750
748
|
if (slot <= this.lastSlotProcessed) {
|
|
751
749
|
return;
|
|
752
750
|
}
|