@aztec/p2p 0.0.1-commit.88e6f9396 → 0.0.1-commit.8c0b8ff
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/dest/client/factory.d.ts +2 -2
- package/dest/client/factory.d.ts.map +1 -1
- package/dest/client/factory.js +5 -5
- 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 +4 -6
- package/dest/client/test/tx_proposal_collector/proposal_tx_collector_worker.js +5 -6
- package/dest/config.d.ts +6 -6
- package/dest/config.d.ts.map +1 -1
- package/dest/config.js +6 -6
- 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 +4 -8
- package/dest/mem_pools/attestation_pool/attestation_pool_test_suite.js +6 -6
- package/dest/mem_pools/instrumentation.d.ts +2 -4
- package/dest/mem_pools/instrumentation.d.ts.map +1 -1
- package/dest/mem_pools/instrumentation.js +14 -16
- package/dest/mem_pools/tx_pool_v2/interfaces.d.ts +5 -7
- package/dest/mem_pools/tx_pool_v2/interfaces.d.ts.map +1 -1
- package/dest/mem_pools/tx_pool_v2/interfaces.js +0 -1
- package/dest/mem_pools/tx_pool_v2/tx_metadata.d.ts +6 -5
- package/dest/mem_pools/tx_pool_v2/tx_metadata.d.ts.map +1 -1
- 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 +43 -26
- package/dest/mem_pools/tx_pool_v2/tx_pool_v2.d.ts +1 -1
- 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 +0 -3
- package/dest/mem_pools/tx_pool_v2/tx_pool_v2_impl.d.ts +1 -2
- 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 +1 -18
- 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 +4 -5
- 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 +3 -4
- package/dest/msg_validators/proposal_validator/proposal_validator.d.ts +1 -1
- package/dest/msg_validators/proposal_validator/proposal_validator.d.ts.map +1 -1
- package/dest/msg_validators/proposal_validator/proposal_validator.js +5 -5
- 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 +1 -1
- package/dest/msg_validators/tx_validator/factory.d.ts.map +1 -1
- package/dest/msg_validators/tx_validator/factory.js +8 -2
- 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.js +1 -1
- package/dest/services/libp2p/libp2p_service.d.ts +9 -2
- package/dest/services/libp2p/libp2p_service.d.ts.map +1 -1
- package/dest/services/libp2p/libp2p_service.js +25 -22
- package/dest/services/peer-manager/metrics.d.ts +1 -3
- package/dest/services/peer-manager/metrics.d.ts.map +1 -1
- package/dest/services/peer-manager/metrics.js +0 -6
- 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 +3 -6
- package/dest/services/reqresp/batch-tx-requester/batch_tx_requester.d.ts +8 -11
- 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 +101 -79
- package/dest/services/reqresp/batch-tx-requester/interface.d.ts +2 -3
- package/dest/services/reqresp/batch-tx-requester/interface.d.ts.map +1 -1
- package/dest/services/reqresp/batch-tx-requester/missing_txs.d.ts +4 -5
- package/dest/services/reqresp/batch-tx-requester/missing_txs.d.ts.map +1 -1
- package/dest/services/reqresp/batch-tx-requester/missing_txs.js +7 -13
- package/dest/services/reqresp/batch-tx-requester/peer_collection.d.ts +11 -19
- package/dest/services/reqresp/batch-tx-requester/peer_collection.d.ts.map +1 -1
- package/dest/services/reqresp/batch-tx-requester/peer_collection.js +15 -52
- package/dest/services/reqresp/rate-limiter/rate_limiter.d.ts +5 -4
- package/dest/services/reqresp/rate-limiter/rate_limiter.d.ts.map +1 -1
- package/dest/services/reqresp/rate-limiter/rate_limiter.js +10 -8
- package/dest/services/reqresp/reqresp.d.ts +1 -1
- package/dest/services/reqresp/reqresp.d.ts.map +1 -1
- package/dest/services/reqresp/reqresp.js +3 -4
- package/dest/services/tx_collection/fast_tx_collection.d.ts +4 -1
- package/dest/services/tx_collection/fast_tx_collection.d.ts.map +1 -1
- package/dest/services/tx_collection/fast_tx_collection.js +73 -57
- package/dest/services/tx_collection/file_store_tx_source.d.ts +5 -4
- package/dest/services/tx_collection/file_store_tx_source.d.ts.map +1 -1
- package/dest/services/tx_collection/file_store_tx_source.js +39 -29
- package/dest/services/tx_collection/missing_txs_tracker.d.ts +32 -0
- package/dest/services/tx_collection/missing_txs_tracker.d.ts.map +1 -0
- package/dest/services/tx_collection/missing_txs_tracker.js +27 -0
- package/dest/services/tx_collection/proposal_tx_collector.d.ts +7 -6
- 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/slow_tx_collection.js +1 -1
- package/dest/services/tx_collection/tx_collection.d.ts +6 -3
- package/dest/services/tx_collection/tx_collection.d.ts.map +1 -1
- package/dest/services/tx_collection/tx_source.d.ts +6 -5
- package/dest/services/tx_collection/tx_source.d.ts.map +1 -1
- package/dest/services/tx_collection/tx_source.js +9 -7
- package/dest/test-helpers/make-test-p2p-clients.d.ts +1 -1
- package/dest/test-helpers/make-test-p2p-clients.d.ts.map +1 -1
- package/dest/test-helpers/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 +2 -20
- 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 +5 -6
- package/dest/testbench/worker_client_manager.d.ts +1 -1
- package/dest/testbench/worker_client_manager.d.ts.map +1 -1
- package/dest/testbench/worker_client_manager.js +1 -2
- package/dest/util.d.ts +1 -1
- package/package.json +14 -14
- package/src/client/factory.ts +8 -4
- package/src/client/p2p_client.ts +4 -6
- package/src/client/test/tx_proposal_collector/proposal_tx_collector_worker.ts +8 -7
- package/src/config.ts +10 -10
- package/src/mem_pools/attestation_pool/attestation_pool.ts +7 -8
- package/src/mem_pools/attestation_pool/attestation_pool_test_suite.ts +6 -6
- package/src/mem_pools/instrumentation.ts +13 -17
- package/src/mem_pools/tx_pool_v2/interfaces.ts +4 -7
- package/src/mem_pools/tx_pool_v2/tx_metadata.ts +4 -4
- package/src/mem_pools/tx_pool_v2/tx_pool_indices.ts +43 -29
- package/src/mem_pools/tx_pool_v2/tx_pool_v2.ts +0 -3
- package/src/mem_pools/tx_pool_v2/tx_pool_v2_impl.ts +1 -19
- package/src/msg_validators/attestation_validator/README.md +1 -1
- package/src/msg_validators/attestation_validator/attestation_validator.ts +4 -5
- package/src/msg_validators/clock_tolerance.ts +3 -4
- package/src/msg_validators/proposal_validator/README.md +3 -3
- package/src/msg_validators/proposal_validator/proposal_validator.ts +5 -6
- 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 +7 -0
- package/src/msg_validators/tx_validator/metadata_validator.ts +4 -12
- package/src/msg_validators/tx_validator/phases_validator.ts +1 -1
- package/src/services/libp2p/libp2p_service.ts +28 -18
- package/src/services/peer-manager/metrics.ts +0 -7
- package/src/services/peer-manager/peer_manager.ts +3 -7
- package/src/services/reqresp/batch-tx-requester/README.md +7 -46
- package/src/services/reqresp/batch-tx-requester/batch_tx_requester.ts +111 -75
- package/src/services/reqresp/batch-tx-requester/interface.ts +1 -2
- package/src/services/reqresp/batch-tx-requester/missing_txs.ts +6 -13
- package/src/services/reqresp/batch-tx-requester/peer_collection.ts +24 -68
- package/src/services/reqresp/rate-limiter/rate_limiter.ts +13 -9
- package/src/services/reqresp/reqresp.ts +3 -5
- package/src/services/tx_collection/fast_tx_collection.ts +83 -57
- package/src/services/tx_collection/file_store_tx_source.ts +43 -31
- package/src/services/tx_collection/missing_txs_tracker.ts +52 -0
- package/src/services/tx_collection/proposal_tx_collector.ts +13 -8
- package/src/services/tx_collection/slow_tx_collection.ts +1 -1
- package/src/services/tx_collection/tx_collection.ts +5 -3
- package/src/services/tx_collection/tx_source.ts +8 -7
- package/src/test-helpers/make-test-p2p-clients.ts +1 -1
- package/src/test-helpers/reqresp-nodes.ts +1 -1
- package/src/test-helpers/testbench-utils.ts +3 -28
- package/src/testbench/p2p_client_testbench_worker.ts +9 -7
- package/src/testbench/worker_client_manager.ts +1 -2
- package/src/util.ts +1 -1
- package/dest/services/tx_collection/request_tracker.d.ts +0 -53
- package/dest/services/tx_collection/request_tracker.d.ts.map +0 -1
- package/dest/services/tx_collection/request_tracker.js +0 -84
- package/src/services/tx_collection/request_tracker.ts +0 -127
|
@@ -230,7 +230,7 @@ import { RateLimitStatus } from '../services/reqresp/rate-limiter/rate_limiter.j
|
|
|
230
230
|
/**
|
|
231
231
|
* Creates a mock EpochCache for testing.
|
|
232
232
|
*/ export function createMockEpochCache() {
|
|
233
|
-
|
|
233
|
+
return {
|
|
234
234
|
getCommittee: ()=>Promise.resolve({
|
|
235
235
|
committee: [],
|
|
236
236
|
seed: 1n,
|
|
@@ -238,44 +238,27 @@ import { RateLimitStatus } from '../services/reqresp/rate-limiter/rate_limiter.j
|
|
|
238
238
|
isEscapeHatchOpen: false
|
|
239
239
|
}),
|
|
240
240
|
getProposerIndexEncoding: ()=>'0x',
|
|
241
|
-
getSlotNow: ()=>SlotNumber.ZERO,
|
|
242
|
-
getTargetSlot: ()=>SlotNumber.ZERO,
|
|
243
|
-
getEpochNow: ()=>EpochNumber.ZERO,
|
|
244
|
-
getTargetEpoch: ()=>EpochNumber.ZERO,
|
|
245
241
|
getEpochAndSlotNow: ()=>({
|
|
246
242
|
epoch: EpochNumber.ZERO,
|
|
247
243
|
slot: SlotNumber.ZERO,
|
|
248
244
|
ts: 0n,
|
|
249
245
|
nowMs: 0n
|
|
250
246
|
}),
|
|
251
|
-
isProposerPipeliningEnabled: ()=>false,
|
|
252
247
|
computeProposerIndex: ()=>0n,
|
|
253
248
|
getCurrentAndNextSlot: ()=>({
|
|
254
249
|
currentSlot: SlotNumber.ZERO,
|
|
255
250
|
nextSlot: SlotNumber.ZERO
|
|
256
251
|
}),
|
|
257
|
-
getTargetAndNextSlot: ()=>({
|
|
258
|
-
targetSlot: SlotNumber.ZERO,
|
|
259
|
-
nextSlot: SlotNumber.ZERO
|
|
260
|
-
}),
|
|
261
252
|
getProposerAttesterAddressInSlot: ()=>Promise.resolve(undefined),
|
|
262
253
|
getEpochAndSlotInNextL1Slot: ()=>({
|
|
263
254
|
epoch: EpochNumber.ZERO,
|
|
264
255
|
slot: SlotNumber.ZERO,
|
|
265
256
|
ts: 0n,
|
|
266
|
-
|
|
267
|
-
}),
|
|
268
|
-
getTargetEpochAndSlotInNextL1Slot: ()=>({
|
|
269
|
-
epoch: EpochNumber.ZERO,
|
|
270
|
-
slot: SlotNumber.ZERO,
|
|
271
|
-
ts: 0n,
|
|
272
|
-
nowSeconds: 0n
|
|
257
|
+
now: 0n
|
|
273
258
|
}),
|
|
274
259
|
isInCommittee: ()=>Promise.resolve(false),
|
|
275
260
|
getRegisteredValidators: ()=>Promise.resolve([]),
|
|
276
261
|
filterInCommittee: ()=>Promise.resolve([]),
|
|
277
|
-
isEscapeHatchOpen: ()=>Promise.resolve(false),
|
|
278
|
-
isEscapeHatchOpenAtSlot: ()=>Promise.resolve(false),
|
|
279
262
|
getL1Constants: ()=>({
|
|
280
263
|
l1StartBlock: 0n,
|
|
281
264
|
l1GenesisTime: 0n,
|
|
@@ -287,7 +270,6 @@ import { RateLimitStatus } from '../services/reqresp/rate-limiter/rate_limiter.j
|
|
|
287
270
|
rollupManaLimit: Number.MAX_SAFE_INTEGER
|
|
288
271
|
})
|
|
289
272
|
};
|
|
290
|
-
return cache;
|
|
291
273
|
}
|
|
292
274
|
/**
|
|
293
275
|
* Creates a mock WorldStateSynchronizer for testing.
|
|
@@ -25,4 +25,4 @@ export interface BenchResultMessage {
|
|
|
25
25
|
export interface BenchReadyMessage {
|
|
26
26
|
type: 'BENCH_READY';
|
|
27
27
|
}
|
|
28
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
28
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicDJwX2NsaWVudF90ZXN0YmVuY2hfd29ya2VyLmQudHMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9zcmMvdGVzdGJlbmNoL3AycF9jbGllbnRfdGVzdGJlbmNoX3dvcmtlci50cyJdLCJuYW1lcyI6W10sIm1hcH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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":"AA4CA,OAAO,EAEL,KAAK,aAAa,EAClB,KAAK,mBAAmB,EAOzB,MAAM,0BAA0B,CAAC;AAGlC,YAAY,EAAE,mBAAmB,EAAE,aAAa,EAAE,MAAM,oCAAoC,CAAC;AAC7F,OAAO,EAAE,uBAAuB,EAAE,MAAM,oCAAoC,CAAC;AAE7E,MAAM,WAAW,mBAAmB;IAClC,IAAI,EAAE,eAAe,CAAC;IACtB,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,MAAM,CAAC;IAClB,YAAY,EAAE,mBAAmB,CAAC;IAClC,aAAa,EAAE,aAAa,CAAC;IAC7B,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"}
|
|
@@ -20,13 +20,12 @@ import { Tx } from '@aztec/stdlib/tx';
|
|
|
20
20
|
import { getTelemetryClient } from '@aztec/telemetry-client';
|
|
21
21
|
import { TopicValidatorResult } from '@libp2p/interface';
|
|
22
22
|
import { peerIdFromString } from '@libp2p/peer-id';
|
|
23
|
-
import { mock } from 'jest-mock-extended';
|
|
24
23
|
import { createP2PClient } from '../index.js';
|
|
25
24
|
import { BatchTxRequesterCollector, LibP2PService, SendBatchRequestCollector } from '../services/index.js';
|
|
26
25
|
import { RateLimitStatus } from '../services/reqresp/rate-limiter/rate_limiter.js';
|
|
27
|
-
import {
|
|
26
|
+
import { MissingTxsTracker } from '../services/tx_collection/missing_txs_tracker.js';
|
|
28
27
|
import { AlwaysTrueCircuitVerifier } from '../test-helpers/index.js';
|
|
29
|
-
import { BENCHMARK_CONSTANTS, InMemoryAttestationPool, InMemoryTxPool, UNLIMITED_RATE_LIMIT_QUOTA, createMockWorldStateSynchronizer, filterTxsByDistribution } from '../test-helpers/index.js';
|
|
28
|
+
import { BENCHMARK_CONSTANTS, InMemoryAttestationPool, InMemoryTxPool, UNLIMITED_RATE_LIMIT_QUOTA, createMockEpochCache, createMockWorldStateSynchronizer, filterTxsByDistribution } from '../test-helpers/index.js';
|
|
30
29
|
export { COLLECTOR_DISPLAY_NAMES } from '../test-helpers/testbench-utils.js';
|
|
31
30
|
const txCache = new Map();
|
|
32
31
|
class TestLibP2PService extends LibP2PService {
|
|
@@ -155,7 +154,7 @@ async function runAggregatorBenchmark(client, blockProposal, collectorType, time
|
|
|
155
154
|
timer = new Timer();
|
|
156
155
|
if (collectorType === 'batch-requester') {
|
|
157
156
|
const collector = new BatchTxRequesterCollector(batchTxRequesterService, logger, new DateProvider(), noopTxValidator);
|
|
158
|
-
const fetchedTxs = await collector.collectTxs(
|
|
157
|
+
const fetchedTxs = await collector.collectTxs(MissingTxsTracker.fromArray(txHashes), blockProposal, pinnedPeer, timeoutMs);
|
|
159
158
|
const durationMs = timer.ms();
|
|
160
159
|
return {
|
|
161
160
|
type: 'BENCH_RESULT',
|
|
@@ -165,7 +164,7 @@ async function runAggregatorBenchmark(client, blockProposal, collectorType, time
|
|
|
165
164
|
};
|
|
166
165
|
}
|
|
167
166
|
const collector = new SendBatchRequestCollector(batchTxRequesterService, BENCHMARK_CONSTANTS.FIXED_MAX_PEERS, BENCHMARK_CONSTANTS.FIXED_MAX_RETRY_ATTEMPTS);
|
|
168
|
-
const fetchedTxs = await collector.collectTxs(
|
|
167
|
+
const fetchedTxs = await collector.collectTxs(MissingTxsTracker.fromArray(txHashes), blockProposal, pinnedPeer, timeoutMs);
|
|
169
168
|
const durationMs = timer.ms();
|
|
170
169
|
return {
|
|
171
170
|
type: 'BENCH_RESULT',
|
|
@@ -202,7 +201,7 @@ process.on('message', async (msg)=>{
|
|
|
202
201
|
workerConfig = config;
|
|
203
202
|
workerTxPool = new InMemoryTxPool();
|
|
204
203
|
workerAttestationPool = new InMemoryAttestationPool();
|
|
205
|
-
const epochCache =
|
|
204
|
+
const epochCache = createMockEpochCache();
|
|
206
205
|
const worldState = createMockWorldStateSynchronizer();
|
|
207
206
|
const l2BlockSource = new MockL2BlockSource();
|
|
208
207
|
const proofVerifier = new AlwaysTrueCircuitVerifier();
|
|
@@ -95,4 +95,4 @@ declare class WorkerClientManager {
|
|
|
95
95
|
export { WorkerClientManager, testChainConfig };
|
|
96
96
|
export type { DistributionPattern, CollectorType } from './p2p_client_testbench_worker.js';
|
|
97
97
|
export { COLLECTOR_DISPLAY_NAMES } from './p2p_client_testbench_worker.js';
|
|
98
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
98
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoid29ya2VyX2NsaWVudF9tYW5hZ2VyLmQudHMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9zcmMvdGVzdGJlbmNoL3dvcmtlcl9jbGllbnRfbWFuYWdlci50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFDQSxPQUFPLEtBQUssRUFBRSxNQUFNLEVBQUUsTUFBTSx1QkFBdUIsQ0FBQztBQUVwRCxPQUFPLEtBQUssRUFBRSxXQUFXLEVBQUUsTUFBTSxzQkFBc0IsQ0FBQztBQUV4RCxPQU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jtBQUVELE9BQU8sRUFBRSxtQkFBbUIsRUFBRSxlQUFlLEVBQUUsQ0FBQztBQUNoRCxZQUFZLEVBQUUsbUJBQW1CLEVBQUUsYUFBYSxFQUFFLE1BQU0sa0NBQWtDLENBQUM7QUFDM0YsT0FBTyxFQUFFLHVCQUF1QixFQUFFLE1BQU0sa0NBQWtDLENBQUMifQ==
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"worker_client_manager.d.ts","sourceRoot":"","sources":["../../src/testbench/worker_client_manager.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AAEpD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAExD,OAAO,EAAE,KAAK,YAAY,EAAQ,MAAM,eAAe,CAAC;AAKxD,OAAO,EAAE,KAAK,SAAS,EAAuB,MAAM,cAAc,CAAC;AAKnE,OAAO,KAAK,EAGV,aAAa,EACb,mBAAmB,EACpB,MAAM,kCAAkC,CAAC;AAQ1C,QAAA,MAAM,eAAe,EAAE,WAMtB,CAAC;AAEF,MAAM,WAAW,sBAAsB;IACrC,OAAO,EAAE,MAAM,CAAC;IAChB,YAAY,EAAE,mBAAmB,CAAC;IAClC,aAAa,EAAE,aAAa,CAAC;IAC7B,SAAS,EAAE,MAAM,CAAC;IAClB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,sBAAsB;IACrC,OAAO,EAAE,MAAM,CAAC;IAChB,YAAY,EAAE,mBAAmB,CAAC;IAClC,SAAS,EAAE,aAAa,CAAC;IACzB,UAAU,EAAE,MAAM,CAAC;IACnB,YAAY,EAAE,MAAM,CAAC;IACrB,OAAO,EAAE,OAAO,CAAC;IACjB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,cAAM,mBAAmB;IAChB,SAAS,EAAE,YAAY,EAAE,CAAM;IAC/B,iBAAiB,EAAE,MAAM,EAAE,CAAM;IACjC,QAAQ,EAAE,MAAM,EAAE,CAAM;IACxB,KAAK,EAAE,MAAM,EAAE,CAAM;IACrB,OAAO,EAAE,MAAM,EAAE,CAAM;IAC9B,OAAO,CAAC,SAAS,CAAqB;IACtC,OAAO,CAAC,MAAM,CAAS;IACvB,OAAO,CAAC,uBAAuB,CAAgB;IAE/C,YAAY,MAAM,EAAE,MAAM,EAAE,SAAS,EAAE,OAAO,CAAC,SAAS,CAAC,EAGxD;IAED,OAAO,SAKN;IAED;;;;;;;OAOG;IACH,OAAO,CAAC,kBAAkB;IAoB1B;;;OAGG;IACH,OAAO,CAAC,kBAAkB;IAkG1B;;;;;;;OAOG;IACG,iBAAiB,CACrB,eAAe,EAAE,MAAM,EACvB,OAAO,GAAE;QACP,aAAa,CAAC,EAAE,QAAQ,GAAG,KAAK,CAAC;QACjC,aAAa,CAAC,EAAE,MAAM,CAAC;QACvB,SAAS,CAAC,EAAE,MAAM,CAAC;QACnB,YAAY,CAAC,EAAE,MAAM,CAAC;KAClB,qBA+DP;IAED,4BAA4B,SAE3B;IAED,kCAAkC,WAEjC;IAED;;;;;OAKG;IACG,UAAU,CAAC,WAAW,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,iBA8CpD;IAED;;OAEG;IACH,OAAO,CAAC,gBAAgB;IAqCxB;;OAEG;IACG,OAAO,kBAgCZ;IAED;;;;;;;;;OASG;IACG,mBAAmB,CAAC,MAAM,EAAE,sBAAsB,GAAG,OAAO,CAAC,sBAAsB,CAAC,
|
|
1
|
+
{"version":3,"file":"worker_client_manager.d.ts","sourceRoot":"","sources":["../../src/testbench/worker_client_manager.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AAEpD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAExD,OAAO,EAAE,KAAK,YAAY,EAAQ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AAe,EAAE,MAAM,EACvB,OAAO,GAAE;QACP,aAAa,CAAC,EAAE,QAAQ,GAAG,KAAK,CAAC;QACjC,aAAa,CAAC,EAAE,MAAM,CAAC;QACvB,SAAS,CAAC,EAAE,MAAM,CAAC;QACnB,YAAY,CAAC,EAAE,MAAM,CAAC;KAClB,qBA+DP;IAED,4BAA4B,SAE3B;IAED,kCAAkC,WAEjC;IAED;;;;;OAKG;IACG,UAAU,CAAC,WAAW,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,iBA8CpD;IAED;;OAEG;IACH,OAAO,CAAC,gBAAgB;IAqCxB;;OAEG;IACG,OAAO,kBAgCZ;IAED;;;;;;;;;OASG;IACG,mBAAmB,CAAC,MAAM,EAAE,sBAAsB,GAAG,OAAO,CAAC,sBAAsB,CAAC,CAsEzF;IAED,OAAO,CAAC,iBAAiB;IAkCzB,OAAO,CAAC,kBAAkB;CAiC3B;AAED,OAAO,EAAE,mBAAmB,EAAE,eAAe,EAAE,CAAC;AAChD,YAAY,EAAE,mBAAmB,EAAE,aAAa,EAAE,MAAM,kCAAkC,CAAC;AAC3F,OAAO,EAAE,uBAAuB,EAAE,MAAM,kCAAkC,CAAC"}
|
|
@@ -371,8 +371,7 @@ class WorkerClientManager {
|
|
|
371
371
|
seed
|
|
372
372
|
};
|
|
373
373
|
this.processes[0].send(aggregatorCmd);
|
|
374
|
-
const
|
|
375
|
-
const result = await this.waitForBenchResult(0, aggregatorBudgetMs);
|
|
374
|
+
const result = await this.waitForBenchResult(0, config.timeoutMs + 30000);
|
|
376
375
|
this.logger.info(`Benchmark complete: fetched=${result.fetchedCount}/${config.txCount}, duration=${result.durationMs.toFixed(0)}ms, success=${result.success}`);
|
|
377
376
|
return {
|
|
378
377
|
txCount: config.txCount,
|
package/dest/util.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { SecretValue } from '@aztec/foundation/config';
|
|
2
2
|
import type { Logger } from '@aztec/foundation/log';
|
|
3
3
|
import type { AztecAsyncKVStore } from '@aztec/kv-store';
|
|
4
|
-
import type { DataStoreConfig } from '@aztec/
|
|
4
|
+
import type { DataStoreConfig } from '@aztec/kv-store/config';
|
|
5
5
|
import type { GossipSub } from '@chainsafe/libp2p-gossipsub';
|
|
6
6
|
import type { Identify } from '@libp2p/identify';
|
|
7
7
|
import type { PeerId } from '@libp2p/interface';
|
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.8c0b8ff",
|
|
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.8c0b8ff",
|
|
71
|
+
"@aztec/epoch-cache": "0.0.1-commit.8c0b8ff",
|
|
72
|
+
"@aztec/ethereum": "0.0.1-commit.8c0b8ff",
|
|
73
|
+
"@aztec/foundation": "0.0.1-commit.8c0b8ff",
|
|
74
|
+
"@aztec/kv-store": "0.0.1-commit.8c0b8ff",
|
|
75
|
+
"@aztec/noir-contracts.js": "0.0.1-commit.8c0b8ff",
|
|
76
|
+
"@aztec/noir-protocol-circuits-types": "0.0.1-commit.8c0b8ff",
|
|
77
|
+
"@aztec/protocol-contracts": "0.0.1-commit.8c0b8ff",
|
|
78
|
+
"@aztec/simulator": "0.0.1-commit.8c0b8ff",
|
|
79
|
+
"@aztec/stdlib": "0.0.1-commit.8c0b8ff",
|
|
80
|
+
"@aztec/telemetry-client": "0.0.1-commit.8c0b8ff",
|
|
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.8c0b8ff",
|
|
108
|
+
"@aztec/world-state": "0.0.1-commit.8c0b8ff",
|
|
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';
|
|
6
7
|
import { AztecLMDBStoreV2, createStore } from '@aztec/kv-store/lmdb-v2';
|
|
7
8
|
import type { L2BlockSource } from '@aztec/stdlib/block';
|
|
8
9
|
import type { ChainConfig } from '@aztec/stdlib/config';
|
|
9
10
|
import type { ContractDataSource } from '@aztec/stdlib/contract';
|
|
10
11
|
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';
|
|
@@ -19,6 +19,7 @@ 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
20
|
import {
|
|
21
21
|
createCheckAllowedSetupCalls,
|
|
22
|
+
createTxValidatorForReqResponseReceivedTxs,
|
|
22
23
|
createTxValidatorForTransactionsEnteringPendingTxPool,
|
|
23
24
|
getDefaultAllowedSetupFunctions,
|
|
24
25
|
} from '../msg_validators/index.js';
|
|
@@ -122,7 +123,6 @@ export async function createP2PClient(
|
|
|
122
123
|
maxPendingTxCount: config.maxPendingTxCount,
|
|
123
124
|
archivedTxLimit: config.archivedTxLimit,
|
|
124
125
|
minTxPoolAgeMs: config.minTxPoolAgeMs,
|
|
125
|
-
dropTransactionsProbability: config.dropTransactionsProbability,
|
|
126
126
|
priceBumpPercentage: config.priceBumpPercentage,
|
|
127
127
|
},
|
|
128
128
|
dateProvider,
|
|
@@ -148,9 +148,12 @@ export async function createP2PClient(
|
|
|
148
148
|
telemetry,
|
|
149
149
|
);
|
|
150
150
|
|
|
151
|
+
const txValidatorForTxCollection = createTxValidatorForReqResponseReceivedTxs(proofVerifier, config);
|
|
151
152
|
const nodeSources = [
|
|
152
|
-
...createNodeRpcTxSources(config.txCollectionNodeRpcUrls, config),
|
|
153
|
-
...(deps.rpcTxProviders ?? []).map(
|
|
153
|
+
...createNodeRpcTxSources(config.txCollectionNodeRpcUrls, txValidatorForTxCollection, config),
|
|
154
|
+
...(deps.rpcTxProviders ?? []).map(
|
|
155
|
+
(node, i) => new NodeRpcTxSource(node, txValidatorForTxCollection, `node-rpc-provider-${i}`),
|
|
156
|
+
),
|
|
154
157
|
...(deps.txCollectionNodeSources ?? []),
|
|
155
158
|
];
|
|
156
159
|
if (nodeSources.length > 0) {
|
|
@@ -162,6 +165,7 @@ export async function createP2PClient(
|
|
|
162
165
|
const fileStoreSources = await createFileStoreTxSources(
|
|
163
166
|
config.txCollectionFileStoreUrls,
|
|
164
167
|
txFileStoreBasePath,
|
|
168
|
+
txValidatorForTxCollection,
|
|
165
169
|
logger.createChild('file-store-tx-source'),
|
|
166
170
|
telemetry,
|
|
167
171
|
);
|
package/src/client/p2p_client.ts
CHANGED
|
@@ -696,14 +696,12 @@ export class P2PClient extends WithTracer implements P2P {
|
|
|
696
696
|
|
|
697
697
|
/** Checks if the slot has changed and calls prepareForSlot if so. */
|
|
698
698
|
private async maybeCallPrepareForSlot(): Promise<void> {
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
const { targetSlot } = this.epochCache.getTargetAndNextSlot();
|
|
702
|
-
if (targetSlot <= this.lastSlotProcessed) {
|
|
699
|
+
const { currentSlot } = this.epochCache.getCurrentAndNextSlot();
|
|
700
|
+
if (currentSlot <= this.lastSlotProcessed) {
|
|
703
701
|
return;
|
|
704
702
|
}
|
|
705
|
-
this.lastSlotProcessed =
|
|
706
|
-
await this.txPool.prepareForSlot(
|
|
703
|
+
this.lastSlotProcessed = currentSlot;
|
|
704
|
+
await this.txPool.prepareForSlot(currentSlot);
|
|
707
705
|
}
|
|
708
706
|
|
|
709
707
|
private async startServiceIfSynched() {
|
|
@@ -1,27 +1,25 @@
|
|
|
1
1
|
import { MockL2BlockSource } from '@aztec/archiver/test';
|
|
2
|
-
import type { EpochCache } from '@aztec/epoch-cache';
|
|
3
2
|
import { SecretValue } from '@aztec/foundation/config';
|
|
4
3
|
import { createLogger } from '@aztec/foundation/log';
|
|
5
4
|
import { sleep } from '@aztec/foundation/sleep';
|
|
6
5
|
import { DateProvider, Timer, executeTimeout } from '@aztec/foundation/timer';
|
|
6
|
+
import type { DataStoreConfig } from '@aztec/kv-store/config';
|
|
7
7
|
import { openTmpStore } from '@aztec/kv-store/lmdb-v2';
|
|
8
8
|
import type { L2BlockSource } from '@aztec/stdlib/block';
|
|
9
9
|
import type { ContractDataSource } from '@aztec/stdlib/contract';
|
|
10
10
|
import type { ClientProtocolCircuitVerifier } from '@aztec/stdlib/interfaces/server';
|
|
11
|
-
import type { DataStoreConfig } from '@aztec/stdlib/kv-store';
|
|
12
11
|
import { PeerErrorSeverity } from '@aztec/stdlib/p2p';
|
|
13
12
|
import type { Tx, TxValidationResult } from '@aztec/stdlib/tx';
|
|
14
13
|
import { type TelemetryClient, getTelemetryClient } from '@aztec/telemetry-client';
|
|
15
14
|
|
|
16
15
|
import type { PeerId } from '@libp2p/interface';
|
|
17
16
|
import { peerIdFromString } from '@libp2p/peer-id';
|
|
18
|
-
import { mock } from 'jest-mock-extended';
|
|
19
17
|
|
|
20
18
|
import type { P2PConfig } from '../../../config.js';
|
|
21
19
|
import { BatchTxRequesterCollector, SendBatchRequestCollector } from '../../../services/index.js';
|
|
22
20
|
import type { IBatchRequestTxValidator } from '../../../services/reqresp/batch-tx-requester/tx_validator.js';
|
|
23
21
|
import { RateLimitStatus } from '../../../services/reqresp/rate-limiter/rate_limiter.js';
|
|
24
|
-
import {
|
|
22
|
+
import { MissingTxsTracker } from '../../../services/tx_collection/missing_txs_tracker.js';
|
|
25
23
|
import {
|
|
26
24
|
AlwaysTrueCircuitVerifier,
|
|
27
25
|
BENCHMARK_CONSTANTS,
|
|
@@ -29,6 +27,7 @@ import {
|
|
|
29
27
|
InMemoryTxPool,
|
|
30
28
|
UNLIMITED_RATE_LIMIT_QUOTA,
|
|
31
29
|
calculateInternalTimeout,
|
|
30
|
+
createMockEpochCache,
|
|
32
31
|
createMockWorldStateSynchronizer,
|
|
33
32
|
} from '../../../test-helpers/index.js';
|
|
34
33
|
import { createP2PClient } from '../../index.js';
|
|
@@ -99,7 +98,7 @@ function sendMessage(message: WorkerResponse): Promise<void> {
|
|
|
99
98
|
async function startClient(config: P2PConfig, clientIndex: number) {
|
|
100
99
|
txPool = new InMemoryTxPool();
|
|
101
100
|
attestationPool = new InMemoryAttestationPool();
|
|
102
|
-
const epochCache =
|
|
101
|
+
const epochCache = createMockEpochCache();
|
|
103
102
|
const worldState = createMockWorldStateSynchronizer();
|
|
104
103
|
const l2BlockSource = new MockL2BlockSource();
|
|
105
104
|
const proofVerifier = new AlwaysTrueCircuitVerifier();
|
|
@@ -214,9 +213,10 @@ async function runCollector(cmd: Extract<WorkerCommand, { type: 'RUN_COLLECTOR'
|
|
|
214
213
|
const fetched = await executeTimeout(
|
|
215
214
|
(_signal: AbortSignal) =>
|
|
216
215
|
collector.collectTxs(
|
|
217
|
-
|
|
216
|
+
MissingTxsTracker.fromArray(parsedTxHashes),
|
|
218
217
|
parsedProposal,
|
|
219
218
|
pinnedPeer,
|
|
219
|
+
internalTimeoutMs,
|
|
220
220
|
),
|
|
221
221
|
timeoutMs,
|
|
222
222
|
() => new Error(`Collector timed out after ${timeoutMs}ms`),
|
|
@@ -231,9 +231,10 @@ async function runCollector(cmd: Extract<WorkerCommand, { type: 'RUN_COLLECTOR'
|
|
|
231
231
|
const fetched = await executeTimeout(
|
|
232
232
|
(_signal: AbortSignal) =>
|
|
233
233
|
collector.collectTxs(
|
|
234
|
-
|
|
234
|
+
MissingTxsTracker.fromArray(parsedTxHashes),
|
|
235
235
|
parsedProposal,
|
|
236
236
|
pinnedPeer,
|
|
237
|
+
internalTimeoutMs,
|
|
237
238
|
),
|
|
238
239
|
timeoutMs,
|
|
239
240
|
() => new Error(`Collector timed out after ${timeoutMs}ms`),
|
package/src/config.ts
CHANGED
|
@@ -11,6 +11,7 @@ import {
|
|
|
11
11
|
secretStringConfigHelper,
|
|
12
12
|
} from '@aztec/foundation/config';
|
|
13
13
|
import { Fr } from '@aztec/foundation/curves/bn254';
|
|
14
|
+
import { type DataStoreConfig, dataConfigMappings } from '@aztec/kv-store/config';
|
|
14
15
|
import { FunctionSelector } from '@aztec/stdlib/abi/function-selector';
|
|
15
16
|
import { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
16
17
|
import {
|
|
@@ -20,7 +21,6 @@ import {
|
|
|
20
21
|
chainConfigMappings,
|
|
21
22
|
sharedSequencerConfigMappings,
|
|
22
23
|
} from '@aztec/stdlib/config';
|
|
23
|
-
import { type DataStoreConfig, dataConfigMappings } from '@aztec/stdlib/kv-store';
|
|
24
24
|
|
|
25
25
|
import {
|
|
26
26
|
type BatchTxRequesterConfig,
|
|
@@ -70,9 +70,6 @@ export interface P2PConfig
|
|
|
70
70
|
/** The frequency in which to check for new peers. */
|
|
71
71
|
peerCheckIntervalMS: number;
|
|
72
72
|
|
|
73
|
-
/** How long to ban a peer after it fails MAX_DIAL_ATTEMPTS dials. */
|
|
74
|
-
peerFailedBanTimeMs: number;
|
|
75
|
-
|
|
76
73
|
/** Size of queue of L2 blocks to store. */
|
|
77
74
|
l2QueueSize: number;
|
|
78
75
|
|
|
@@ -189,7 +186,10 @@ export interface P2PConfig
|
|
|
189
186
|
/** Whether transactions are disabled for this node. This means transactions will be rejected at the RPC and P2P layers. */
|
|
190
187
|
disableTransactions: boolean;
|
|
191
188
|
|
|
192
|
-
/**
|
|
189
|
+
/** True to simulate discarding transactions. - For testing purposes only*/
|
|
190
|
+
dropTransactions: boolean;
|
|
191
|
+
|
|
192
|
+
/** The probability that a transaction is discarded. - For testing purposes only */
|
|
193
193
|
dropTransactionsProbability: number;
|
|
194
194
|
|
|
195
195
|
/** Whether to delete transactions from the pool after a reorg instead of moving them back to pending. */
|
|
@@ -266,11 +266,6 @@ export const p2pConfigMappings: ConfigMappingsType<P2PConfig> = {
|
|
|
266
266
|
description: 'The frequency in which to check for new peers.',
|
|
267
267
|
...numberConfigHelper(30_000),
|
|
268
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
|
-
},
|
|
274
269
|
l2QueueSize: {
|
|
275
270
|
env: 'P2P_L2_QUEUE_SIZE',
|
|
276
271
|
description: 'Size of queue of L2 blocks to store.',
|
|
@@ -474,6 +469,11 @@ export const p2pConfigMappings: ConfigMappingsType<P2PConfig> = {
|
|
|
474
469
|
description: 'Number of auth attempts to allow before peer is banned. Number is inclusive',
|
|
475
470
|
...numberConfigHelper(3),
|
|
476
471
|
},
|
|
472
|
+
dropTransactions: {
|
|
473
|
+
env: 'P2P_DROP_TX',
|
|
474
|
+
description: 'True to simulate discarding transactions. - For testing purposes only',
|
|
475
|
+
...booleanConfigHelper(false),
|
|
476
|
+
},
|
|
477
477
|
dropTransactionsProbability: {
|
|
478
478
|
env: 'P2P_DROP_TX_CHANCE',
|
|
479
479
|
description: 'The probability that a transaction is discarded (0 - 1). - For testing purposes only',
|
|
@@ -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 = 5;
|
|
30
|
+
export const MAX_BLOCK_PROPOSALS_PER_POSITION = 3;
|
|
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 = 3;
|
|
33
33
|
|
|
34
34
|
/** Public API interface for attestation pools. Used for typing mocks and test implementations. */
|
|
35
35
|
export type AttestationPoolApi = Pick<
|
|
@@ -359,10 +359,11 @@ export class AttestationPool {
|
|
|
359
359
|
}
|
|
360
360
|
|
|
361
361
|
const address = sender.toString();
|
|
362
|
-
const ownKey = this.getAttestationKey(slotNumber, proposalId, address);
|
|
363
362
|
|
|
364
|
-
await this.checkpointAttestations.set(
|
|
365
|
-
|
|
363
|
+
await this.checkpointAttestations.set(
|
|
364
|
+
this.getAttestationKey(slotNumber, proposalId, address),
|
|
365
|
+
attestation.toBuffer(),
|
|
366
|
+
);
|
|
366
367
|
|
|
367
368
|
this.log.debug(`Added own checkpoint attestation for slot ${slotNumber} from ${address}`, {
|
|
368
369
|
signature: attestation.signature.toString(),
|
|
@@ -428,7 +429,6 @@ export class AttestationPool {
|
|
|
428
429
|
const attestationEndKey = new Fr(oldestSlot).toString();
|
|
429
430
|
for await (const key of this.checkpointAttestations.keysAsync({ end: attestationEndKey })) {
|
|
430
431
|
await this.checkpointAttestations.delete(key);
|
|
431
|
-
this.metrics.trackMempoolItemRemoved(key);
|
|
432
432
|
numberOfAttestations++;
|
|
433
433
|
}
|
|
434
434
|
|
|
@@ -526,7 +526,6 @@ export class AttestationPool {
|
|
|
526
526
|
|
|
527
527
|
// Add the attestation
|
|
528
528
|
await this.checkpointAttestations.set(key, attestation.toBuffer());
|
|
529
|
-
this.metrics.trackMempoolItemAdded(key);
|
|
530
529
|
|
|
531
530
|
// Track this attestation in the per-signer-per-slot index for duplicate detection
|
|
532
531
|
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
|
+
// Add a third proposal for same position
|
|
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(true);
|
|
454
|
+
expect(result3.count).toBe(3);
|
|
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
|
+
// Add a third proposal for same slot
|
|
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(true);
|
|
674
|
+
expect(result3.count).toBe(3);
|
|
675
675
|
});
|
|
676
676
|
|
|
677
677
|
it('should not count attestations as proposals for duplicate detection', async () => {
|
|
@@ -73,7 +73,7 @@ export class PoolInstrumentation<PoolObject extends Gossipable> {
|
|
|
73
73
|
private defaultAttributes;
|
|
74
74
|
private meter: Meter;
|
|
75
75
|
|
|
76
|
-
private
|
|
76
|
+
private txAddedTimestamp: Map<bigint, number> = new Map<bigint, number>();
|
|
77
77
|
|
|
78
78
|
constructor(
|
|
79
79
|
telemetry: TelemetryClient,
|
|
@@ -114,26 +114,22 @@ export class PoolInstrumentation<PoolObject extends Gossipable> {
|
|
|
114
114
|
}
|
|
115
115
|
|
|
116
116
|
public transactionsAdded(transactions: Tx[]) {
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
public transactionsRemoved(hashes: Iterable<bigint> | Iterable<string>) {
|
|
121
|
-
for (const hash of hashes) {
|
|
122
|
-
this.trackMempoolItemRemoved(BigInt(hash));
|
|
117
|
+
const timestamp = Date.now();
|
|
118
|
+
for (const transaction of transactions) {
|
|
119
|
+
this.txAddedTimestamp.set(transaction.txHash.toBigInt(), timestamp);
|
|
123
120
|
}
|
|
124
121
|
}
|
|
125
122
|
|
|
126
|
-
public
|
|
127
|
-
this.mempoolItemAddedTimestamp.set(key, Date.now());
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
public trackMempoolItemRemoved(key: bigint | string): void {
|
|
123
|
+
public transactionsRemoved(hashes: Iterable<bigint> | Iterable<string>) {
|
|
131
124
|
const timestamp = Date.now();
|
|
132
|
-
const
|
|
133
|
-
|
|
134
|
-
this.
|
|
135
|
-
if (addedAt
|
|
136
|
-
this.
|
|
125
|
+
for (const hash of hashes) {
|
|
126
|
+
const key = BigInt(hash);
|
|
127
|
+
const addedAt = this.txAddedTimestamp.get(key);
|
|
128
|
+
if (addedAt !== undefined) {
|
|
129
|
+
this.txAddedTimestamp.delete(key);
|
|
130
|
+
if (addedAt < timestamp) {
|
|
131
|
+
this.minedDelay.record(timestamp - addedAt);
|
|
132
|
+
}
|
|
137
133
|
}
|
|
138
134
|
}
|
|
139
135
|
}
|
|
@@ -44,8 +44,6 @@ export type TxPoolV2Config = {
|
|
|
44
44
|
minTxPoolAgeMs: number;
|
|
45
45
|
/** Maximum number of evicted tx hashes to remember for metrics tracking */
|
|
46
46
|
evictedTxCacheSize: number;
|
|
47
|
-
/** The probability (0-1) that a transaction is discarded. 0 disables dropping. For testing purposes only. */
|
|
48
|
-
dropTransactionsProbability: number;
|
|
49
47
|
/** Minimum percentage fee increase required to replace an existing tx via RPC (0 = no bump). */
|
|
50
48
|
priceBumpPercentage: bigint;
|
|
51
49
|
};
|
|
@@ -58,7 +56,6 @@ export const DEFAULT_TX_POOL_V2_CONFIG: TxPoolV2Config = {
|
|
|
58
56
|
archivedTxLimit: 0, // 0 = disabled
|
|
59
57
|
minTxPoolAgeMs: 2_000,
|
|
60
58
|
evictedTxCacheSize: 10_000,
|
|
61
|
-
dropTransactionsProbability: 0,
|
|
62
59
|
priceBumpPercentage: 10n,
|
|
63
60
|
};
|
|
64
61
|
|
|
@@ -160,10 +157,10 @@ export interface TxPoolV2 extends TypedEventEmitter<TxPoolV2Events> {
|
|
|
160
157
|
handleMinedBlock(block: L2Block): Promise<void>;
|
|
161
158
|
|
|
162
159
|
/**
|
|
163
|
-
* Prepares the pool for a new slot
|
|
164
|
-
* slots and
|
|
165
|
-
*
|
|
166
|
-
*
|
|
160
|
+
* Prepares the pool for a new slot.
|
|
161
|
+
* Unprotects transactions from earlier slots and validates them before
|
|
162
|
+
* returning to pending state.
|
|
163
|
+
* @param slotNumber - The slot number to prepare for
|
|
167
164
|
*/
|
|
168
165
|
prepareForSlot(slotNumber: SlotNumber): Promise<void>;
|
|
169
166
|
|
|
@@ -166,13 +166,13 @@ export function txHashFromBigInt(value: bigint): string {
|
|
|
166
166
|
}
|
|
167
167
|
|
|
168
168
|
/** Minimal fields required for priority comparison. */
|
|
169
|
-
|
|
169
|
+
type PriorityComparable = Pick<TxMetaData, 'txHashBigInt' | 'priorityFee'>;
|
|
170
170
|
|
|
171
171
|
/**
|
|
172
172
|
* Compares two priority fees in ascending order.
|
|
173
173
|
* Returns negative if a < b, positive if a > b, 0 if equal.
|
|
174
174
|
*/
|
|
175
|
-
export function compareFee(a: bigint, b: bigint):
|
|
175
|
+
export function compareFee(a: bigint, b: bigint): number {
|
|
176
176
|
return a < b ? -1 : a > b ? 1 : 0;
|
|
177
177
|
}
|
|
178
178
|
|
|
@@ -181,7 +181,7 @@ export function compareFee(a: bigint, b: bigint): -1 | 0 | 1 {
|
|
|
181
181
|
* Uses field element comparison for deterministic ordering.
|
|
182
182
|
* Returns negative if a < b, positive if a > b, 0 if equal.
|
|
183
183
|
*/
|
|
184
|
-
export function compareTxHash(a: bigint, b: bigint):
|
|
184
|
+
export function compareTxHash(a: bigint, b: bigint): number {
|
|
185
185
|
return Fr.cmpAsBigInt(a, b);
|
|
186
186
|
}
|
|
187
187
|
|
|
@@ -190,7 +190,7 @@ export function compareTxHash(a: bigint, b: bigint): -1 | 0 | 1 {
|
|
|
190
190
|
* Returns negative if a < b, positive if a > b, 0 if equal.
|
|
191
191
|
* Use with sort() for ascending order, or negate/reverse for descending.
|
|
192
192
|
*/
|
|
193
|
-
export function comparePriority(a: PriorityComparable, b: PriorityComparable):
|
|
193
|
+
export function comparePriority(a: PriorityComparable, b: PriorityComparable): number {
|
|
194
194
|
const feeComparison = compareFee(a.priorityFee, b.priorityFee);
|
|
195
195
|
if (feeComparison !== 0) {
|
|
196
196
|
return feeComparison;
|