@aztec/telemetry-client 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/dest/attributes.d.ts +5 -1
- package/dest/attributes.d.ts.map +1 -1
- package/dest/attributes.js +2 -0
- package/dest/config.js +1 -1
- package/dest/lmdb_metrics.d.ts +2 -2
- package/dest/lmdb_metrics.d.ts.map +1 -1
- package/dest/metrics.d.ts +12 -4
- package/dest/metrics.d.ts.map +1 -1
- package/dest/metrics.js +56 -17
- package/dest/monitored_batch_span_processor.d.ts +1 -1
- package/dest/monitored_batch_span_processor.d.ts.map +1 -1
- package/dest/monitored_batch_span_processor.js +7 -2
- package/dest/otel.d.ts +6 -1
- package/dest/otel.d.ts.map +1 -1
- package/dest/otel.js +37 -1
- package/dest/wrappers/index.d.ts +1 -2
- package/dest/wrappers/index.d.ts.map +1 -1
- package/dest/wrappers/index.js +0 -1
- package/package.json +3 -3
- package/src/attributes.ts +4 -0
- package/src/config.ts +1 -1
- package/src/metrics.ts +67 -17
- package/src/monitored_batch_span_processor.ts +9 -2
- package/src/otel.ts +31 -1
- package/src/wrappers/index.ts +0 -1
- package/dest/wrappers/l2_block_stream.d.ts +0 -16
- package/dest/wrappers/l2_block_stream.d.ts.map +0 -1
- package/dest/wrappers/l2_block_stream.js +0 -400
- package/src/wrappers/l2_block_stream.ts +0 -38
package/src/attributes.ts
CHANGED
|
@@ -63,6 +63,8 @@ export const EPOCH_SIZE = 'aztec.epoch.size';
|
|
|
63
63
|
export const BLOCK_PROPOSER = 'aztec.block.proposer';
|
|
64
64
|
/** The epoch number */
|
|
65
65
|
export const EPOCH_NUMBER = 'aztec.epoch.number';
|
|
66
|
+
/** Kind of an EpochSession: 'full' or 'partial'. */
|
|
67
|
+
export const EPOCH_SESSION_KIND = 'aztec.epoch_session.kind';
|
|
66
68
|
/** The tx hash */
|
|
67
69
|
export const TX_HASH = 'aztec.tx.hash';
|
|
68
70
|
/** Generic attribute representing whether the action was successful or not */
|
|
@@ -71,6 +73,8 @@ export const OK = 'aztec.ok';
|
|
|
71
73
|
export const STATUS = 'aztec.status';
|
|
72
74
|
/** Generic error type attribute */
|
|
73
75
|
export const ERROR_TYPE = 'aztec.error_type';
|
|
76
|
+
/** The cause of an archiver prune (unproven / uncheckpointed / l1_conflict / orphan / l1_mismatch) */
|
|
77
|
+
export const PRUNE_TYPE = 'aztec.archiver.prune_type';
|
|
74
78
|
/** The type of the transaction */
|
|
75
79
|
export const L1_TX_TYPE = 'aztec.l1.tx_type';
|
|
76
80
|
/** The L1 address of the entity that sent a transaction to L1 */
|
package/src/config.ts
CHANGED
|
@@ -67,7 +67,7 @@ export const telemetryClientConfigMappings: ConfigMappingsType<TelemetryClientCo
|
|
|
67
67
|
otelBspMaxQueueSize: {
|
|
68
68
|
env: 'OTEL_BSP_MAX_QUEUE_SIZE',
|
|
69
69
|
description: 'The maximum number of completed spans to queue before export.',
|
|
70
|
-
...numberConfigHelper(
|
|
70
|
+
...numberConfigHelper(16384),
|
|
71
71
|
},
|
|
72
72
|
otelIncludeMetrics: {
|
|
73
73
|
env: 'OTEL_INCLUDE_METRICS',
|
package/src/metrics.ts
CHANGED
|
@@ -162,7 +162,7 @@ export const MEMPOOL_TX_ADDED_COUNT: MetricDefinition = {
|
|
|
162
162
|
};
|
|
163
163
|
export const MEMPOOL_TX_MINED_DELAY: MetricDefinition = {
|
|
164
164
|
name: 'aztec.mempool.tx_mined_delay',
|
|
165
|
-
description: 'Delay
|
|
165
|
+
description: 'Delay (ms) from a transaction being received into the pool to being mined',
|
|
166
166
|
unit: 'ms',
|
|
167
167
|
valueType: ValueType.INT,
|
|
168
168
|
};
|
|
@@ -340,7 +340,8 @@ export const ARCHIVER_PRUNE_DURATION: MetricDefinition = {
|
|
|
340
340
|
};
|
|
341
341
|
export const ARCHIVER_PRUNE_COUNT: MetricDefinition = {
|
|
342
342
|
name: 'aztec.archiver.prune_count',
|
|
343
|
-
description:
|
|
343
|
+
description:
|
|
344
|
+
'Number of prunes detected, dimensioned by prune_type: unproven (epoch prune of checkpoints that will not be proven), uncheckpointed (proposed blocks whose slot ended without a checkpoint), l1_conflict (proposed blocks conflicting with an L1 checkpoint), orphan (proposed blocks whose matching proposed checkpoint never arrived before the deadline), and l1_mismatch (the local checkpointed tip diverged from L1 — an L1 reorg or a pruned/missed-proof checkpoint — rewinding already-checkpointed blocks).',
|
|
344
345
|
valueType: ValueType.INT,
|
|
345
346
|
};
|
|
346
347
|
|
|
@@ -542,6 +543,46 @@ export const SEQUENCER_SLASHING_ATTEMPTS_COUNT: MetricDefinition = {
|
|
|
542
543
|
description: 'The number of slashing action attempts',
|
|
543
544
|
valueType: ValueType.INT,
|
|
544
545
|
};
|
|
546
|
+
export const SLASHER_ROUND_EXECUTED_COUNT: MetricDefinition = {
|
|
547
|
+
name: 'aztec.slasher.round.executed_count',
|
|
548
|
+
description: 'The number of slashing rounds executed',
|
|
549
|
+
valueType: ValueType.INT,
|
|
550
|
+
};
|
|
551
|
+
export const SLASHER_OWN_VALIDATOR_TARGETED_COUNT: MetricDefinition = {
|
|
552
|
+
name: 'aztec.slasher.own_validator.targeted_count',
|
|
553
|
+
description:
|
|
554
|
+
"The number of times one of the node's own validators was named as a slash target by an onchain vote, counted " +
|
|
555
|
+
'once per vote per validator. Votes cast while the node is offline or starting up are not counted, and L1 ' +
|
|
556
|
+
'reorgs can cause small drift within a round.',
|
|
557
|
+
valueType: ValueType.INT,
|
|
558
|
+
};
|
|
559
|
+
export const SLASHER_OWN_VALIDATOR_CURRENT_ROUND_VOTES_MAX: MetricDefinition = {
|
|
560
|
+
name: 'aztec.slasher.own_validator.current_round_votes_max',
|
|
561
|
+
description:
|
|
562
|
+
"Highest number of votes cast against any committee position held by the node's own validators in the current " +
|
|
563
|
+
'slashing round, to compare against aztec.slasher.quorum_size (the contract tallies quorum per position). ' +
|
|
564
|
+
'Resets to zero when a new round starts. Votes cast while the node is offline or starting up are not counted, ' +
|
|
565
|
+
'and L1 reorgs can cause small drift within a round.',
|
|
566
|
+
valueType: ValueType.INT,
|
|
567
|
+
};
|
|
568
|
+
export const SLASHER_QUORUM_SIZE: MetricDefinition = {
|
|
569
|
+
name: 'aztec.slasher.quorum_size',
|
|
570
|
+
description: 'The number of votes a validator must receive in a round to be slashed',
|
|
571
|
+
valueType: ValueType.INT,
|
|
572
|
+
};
|
|
573
|
+
export const SLASHER_OWN_VALIDATOR_SLASHED_COUNT: MetricDefinition = {
|
|
574
|
+
name: 'aztec.slasher.own_validator.slashed_count',
|
|
575
|
+
description: "The number of times one of the node's own validators was slashed, from executed Slashed events",
|
|
576
|
+
valueType: ValueType.INT,
|
|
577
|
+
};
|
|
578
|
+
export const SLASHER_OWN_VALIDATOR_SLASHED_AMOUNT: MetricDefinition = {
|
|
579
|
+
name: 'aztec.slasher.own_validator.slashed_amount',
|
|
580
|
+
description:
|
|
581
|
+
"Cumulative amount slashed from the node's own validators in whole staking-asset tokens, from executed " +
|
|
582
|
+
'Slashed events',
|
|
583
|
+
unit: 'tokens',
|
|
584
|
+
valueType: ValueType.DOUBLE,
|
|
585
|
+
};
|
|
545
586
|
export const SEQUENCER_CHECKPOINT_SUCCESS_COUNT: MetricDefinition = {
|
|
546
587
|
name: 'aztec.sequencer.checkpoint.success_count',
|
|
547
588
|
description: 'The number of times checkpoint publishing succeeded',
|
|
@@ -1199,12 +1240,6 @@ export const PROVING_AGENT_IDLE: MetricDefinition = {
|
|
|
1199
1240
|
valueType: ValueType.DOUBLE,
|
|
1200
1241
|
};
|
|
1201
1242
|
|
|
1202
|
-
export const PROVER_NODE_EXECUTION_DURATION: MetricDefinition = {
|
|
1203
|
-
name: 'aztec.prover_node.execution.duration',
|
|
1204
|
-
description: 'Duration of execution of an epoch by the prover',
|
|
1205
|
-
unit: 'ms',
|
|
1206
|
-
valueType: ValueType.INT,
|
|
1207
|
-
};
|
|
1208
1243
|
export const PROVER_NODE_JOB_DURATION: MetricDefinition = {
|
|
1209
1244
|
name: 'aztec.prover_node.job_duration',
|
|
1210
1245
|
description: 'Duration of proving job',
|
|
@@ -1232,12 +1267,6 @@ export const PROVER_NODE_BLOB_PROCESSING_LAST_DURATION: MetricDefinition = {
|
|
|
1232
1267
|
unit: 'ms',
|
|
1233
1268
|
valueType: ValueType.INT,
|
|
1234
1269
|
};
|
|
1235
|
-
export const PROVER_NODE_CHONK_VERIFIER_LAST_DURATION: MetricDefinition = {
|
|
1236
|
-
name: 'aztec.prover_node.chonk_verifier.last_duration',
|
|
1237
|
-
description: 'Duration of chonk verifier enqueuing in epoch proving job',
|
|
1238
|
-
unit: 'ms',
|
|
1239
|
-
valueType: ValueType.INT,
|
|
1240
|
-
};
|
|
1241
1270
|
export const PROVER_NODE_BLOCK_PROCESSING_DURATION: MetricDefinition = {
|
|
1242
1271
|
name: 'aztec.prover_node.block_processing.duration',
|
|
1243
1272
|
description: 'Duration of processing a single block in epoch proving job',
|
|
@@ -1250,12 +1279,33 @@ export const PROVER_NODE_CHECKPOINT_PROCESSING_DURATION: MetricDefinition = {
|
|
|
1250
1279
|
unit: 'ms',
|
|
1251
1280
|
valueType: ValueType.INT,
|
|
1252
1281
|
};
|
|
1253
|
-
export const
|
|
1254
|
-
name: 'aztec.prover_node.
|
|
1255
|
-
description: '
|
|
1282
|
+
export const PROVER_NODE_CHECKPOINT_BLOCKS: MetricDefinition = {
|
|
1283
|
+
name: 'aztec.prover_node.checkpoint_blocks',
|
|
1284
|
+
description: 'Number of blocks in a proven checkpoint',
|
|
1285
|
+
valueType: ValueType.INT,
|
|
1286
|
+
};
|
|
1287
|
+
export const PROVER_NODE_CHECKPOINT_TRANSACTIONS: MetricDefinition = {
|
|
1288
|
+
name: 'aztec.prover_node.checkpoint_transactions',
|
|
1289
|
+
description: 'Number of transactions in a proven checkpoint',
|
|
1290
|
+
valueType: ValueType.INT,
|
|
1291
|
+
};
|
|
1292
|
+
export const PROVER_NODE_CHECKPOINT_PROVING_DURATION: MetricDefinition = {
|
|
1293
|
+
name: 'aztec.prover_node.checkpoint_proving.duration',
|
|
1294
|
+
description:
|
|
1295
|
+
'Duration from the start of checkpoint processing to its block proofs being ready (excludes tx gathering)',
|
|
1256
1296
|
unit: 'ms',
|
|
1257
1297
|
valueType: ValueType.INT,
|
|
1258
1298
|
};
|
|
1299
|
+
export const PROVER_NODE_ACTIVE_CHECKPOINTS: MetricDefinition = {
|
|
1300
|
+
name: 'aztec.prover_node.active_checkpoints',
|
|
1301
|
+
description: 'Current number of canonical CheckpointProvers in the store (i.e. checkpoints currently being proven)',
|
|
1302
|
+
valueType: ValueType.INT,
|
|
1303
|
+
};
|
|
1304
|
+
export const PROVER_NODE_ACTIVE_EPOCH_SESSIONS: MetricDefinition = {
|
|
1305
|
+
name: 'aztec.prover_node.active_epoch_sessions',
|
|
1306
|
+
description: 'Current number of live EpochSessions, broken down by kind (full|partial)',
|
|
1307
|
+
valueType: ValueType.INT,
|
|
1308
|
+
};
|
|
1259
1309
|
export const PROVER_NODE_REWARDS_TOTAL: MetricDefinition = {
|
|
1260
1310
|
name: 'aztec.prover_node.rewards_total',
|
|
1261
1311
|
description: 'The rewards earned (total)',
|
|
@@ -10,6 +10,12 @@ const DROP_WARNING_INTERVAL_MS = 30_000;
|
|
|
10
10
|
|
|
11
11
|
const DEFAULT_MIN_TRACE_DURATION_MS = 10;
|
|
12
12
|
|
|
13
|
+
const DEFAULT_MAX_QUEUE_SIZE = 16384;
|
|
14
|
+
|
|
15
|
+
/** Cap on the per-export batch size, so a large queue can actually be drained instead of dribbling out
|
|
16
|
+
* at the SDK default of 512 spans per scheduled export. Kept <= maxQueueSize per the BatchSpanProcessor contract. */
|
|
17
|
+
const DEFAULT_MAX_EXPORT_BATCH_SIZE = 2048;
|
|
18
|
+
|
|
13
19
|
export type MonitoredBatchSpanProcessorConfig = BufferConfig & {
|
|
14
20
|
minTraceDurationMs?: number;
|
|
15
21
|
};
|
|
@@ -30,8 +36,9 @@ export class MonitoredBatchSpanProcessor extends BatchSpanProcessor {
|
|
|
30
36
|
private lastWarningTime = 0;
|
|
31
37
|
|
|
32
38
|
constructor(exporter: SpanExporter, log: Logger, config?: MonitoredBatchSpanProcessorConfig) {
|
|
33
|
-
const maxQueueSize = config?.maxQueueSize ??
|
|
34
|
-
|
|
39
|
+
const maxQueueSize = config?.maxQueueSize ?? DEFAULT_MAX_QUEUE_SIZE;
|
|
40
|
+
const maxExportBatchSize = Math.min(config?.maxExportBatchSize ?? DEFAULT_MAX_EXPORT_BATCH_SIZE, maxQueueSize);
|
|
41
|
+
super(exporter, { ...config, maxQueueSize, maxExportBatchSize });
|
|
35
42
|
this.maxQueueSize = maxQueueSize;
|
|
36
43
|
this.minTraceDurationMs = Math.max(0, config?.minTraceDurationMs ?? DEFAULT_MIN_TRACE_DURATION_MS);
|
|
37
44
|
this.log = log;
|
package/src/otel.ts
CHANGED
|
@@ -96,6 +96,11 @@ export class OpenTelemetryClient implements TelemetryClient {
|
|
|
96
96
|
private meters: Map<string, WrappedMeter> = new Map<string, WrappedMeter>();
|
|
97
97
|
private tracers: Map<string, Tracer> = new Map<string, Tracer>();
|
|
98
98
|
|
|
99
|
+
/** Memoized shutdown promise. The telemetry client is shared between the aztec-node and an embedded prover-node,
|
|
100
|
+
* so stop() can be invoked more than once; the providers throw "shutdown may only be called once" and
|
|
101
|
+
* "invalid attempt to force flush after shutdown" if that happens. Guarding here makes stop()/flush() idempotent. */
|
|
102
|
+
private stopPromise: Promise<void> | undefined;
|
|
103
|
+
|
|
99
104
|
protected constructor(
|
|
100
105
|
private resource: IResource,
|
|
101
106
|
private meterProvider: MeterProvider,
|
|
@@ -169,6 +174,10 @@ export class OpenTelemetryClient implements TelemetryClient {
|
|
|
169
174
|
}
|
|
170
175
|
|
|
171
176
|
public async flush() {
|
|
177
|
+
// Flushing after the providers have been shut down throws "invalid attempt to force flush after shutdown".
|
|
178
|
+
if (this.stopPromise) {
|
|
179
|
+
return;
|
|
180
|
+
}
|
|
172
181
|
await Promise.all([
|
|
173
182
|
this.meterProvider.forceFlush(),
|
|
174
183
|
this.loggerProvider?.forceFlush(),
|
|
@@ -176,7 +185,11 @@ export class OpenTelemetryClient implements TelemetryClient {
|
|
|
176
185
|
]);
|
|
177
186
|
}
|
|
178
187
|
|
|
179
|
-
public
|
|
188
|
+
public stop() {
|
|
189
|
+
return (this.stopPromise ??= this.doStop());
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
private async doStop() {
|
|
180
193
|
this.nodejsMetricsMonitor?.stop();
|
|
181
194
|
|
|
182
195
|
const flushAndShutdown = async (provider?: { forceFlush: () => Promise<void>; shutdown: () => Promise<void> }) => {
|
|
@@ -242,6 +255,23 @@ export class OpenTelemetryClient implements TelemetryClient {
|
|
|
242
255
|
true,
|
|
243
256
|
),
|
|
244
257
|
}),
|
|
258
|
+
// Pending-to-mined delay routinely exceeds the 1-minute ceiling of the generic `ms`
|
|
259
|
+
// view below under load, so it would saturate at 60s. Give this one metric wider
|
|
260
|
+
// buckets (1s to 10min). This must precede the generic `ms` view: when multiple views
|
|
261
|
+
// match an instrument, the SDK keeps the first-registered compatible storage, so the
|
|
262
|
+
// first view in this list wins the bucket boundaries.
|
|
263
|
+
new View({
|
|
264
|
+
instrumentType: InstrumentType.HISTOGRAM,
|
|
265
|
+
instrumentName: 'aztec.mempool.tx_mined_delay',
|
|
266
|
+
instrumentUnit: 'ms',
|
|
267
|
+
aggregation: new ExplicitBucketHistogramAggregation(
|
|
268
|
+
[
|
|
269
|
+
1_000, 2_500, 5_000, 7_500, 10_000, 15_000, 30_000, 45_000, 60_000, 90_000, 120_000, 180_000, 300_000,
|
|
270
|
+
600_000,
|
|
271
|
+
],
|
|
272
|
+
true,
|
|
273
|
+
),
|
|
274
|
+
}),
|
|
245
275
|
new View({
|
|
246
276
|
instrumentType: InstrumentType.HISTOGRAM,
|
|
247
277
|
instrumentUnit: 'ms',
|
package/src/wrappers/index.ts
CHANGED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { BlockNumber } from '@aztec/foundation/branded-types';
|
|
2
|
-
import { type L2BlockSource, L2BlockStream, type L2BlockStreamEventHandler, type L2BlockStreamLocalDataProvider } from '@aztec/stdlib/block';
|
|
3
|
-
import { type Traceable, type Tracer } from '@aztec/telemetry-client';
|
|
4
|
-
/** Extends an L2BlockStream with a tracer to create a new trace per iteration. */
|
|
5
|
-
export declare class TraceableL2BlockStream extends L2BlockStream implements Traceable {
|
|
6
|
-
readonly tracer: Tracer;
|
|
7
|
-
private readonly name;
|
|
8
|
-
constructor(l2BlockSource: Pick<L2BlockSource, 'getBlocks' | 'getBlockData' | 'getL2Tips' | 'getCheckpoints'>, localData: L2BlockStreamLocalDataProvider, handler: L2BlockStreamEventHandler, tracer: Tracer, name?: string, log?: import("@aztec/foundation/log").Logger, opts?: {
|
|
9
|
-
proven?: boolean;
|
|
10
|
-
pollIntervalMS?: number;
|
|
11
|
-
batchSize?: number;
|
|
12
|
-
startingBlock?: BlockNumber;
|
|
13
|
-
});
|
|
14
|
-
work(): Promise<void>;
|
|
15
|
-
}
|
|
16
|
-
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibDJfYmxvY2tfc3RyZWFtLmQudHMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9zcmMvd3JhcHBlcnMvbDJfYmxvY2tfc3RyZWFtLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLE9BQU8sRUFBRSxXQUFXLEVBQUUsTUFBTSxpQ0FBaUMsQ0FBQztBQUU5RCxPQUFPLEVBQ0wsS0FBSyxhQUFhLEVBQ2xCLGFBQWEsRUFDYixLQUFLLHlCQUF5QixFQUM5QixLQUFLLDhCQUE4QixFQUNwQyxNQUFNLHFCQUFxQixDQUFDO0FBQzdCLE9BQU8sRUFBRSxLQUFLLFNBQVMsRUFBRSxLQUFLLE1BQU0sRUFBYSxNQUFNLHlCQUF5QixDQUFDO0FBRWpGLGtGQUFrRjtBQUNsRixxQkFBYSxzQkFBdUIsU0FBUSxhQUFjLFlBQVcsU0FBUzthQUsxRCxNQUFNLEVBQUUsTUFBTTtJQUM5QixPQUFPLENBQUMsUUFBUSxDQUFDLElBQUk7SUFMdkIsWUFDRSxhQUFhLEVBQUUsSUFBSSxDQUFDLGFBQWEsRUFBRSxXQUFXLEdBQUcsY0FBYyxHQUFHLFdBQVcsR0FBRyxnQkFBZ0IsQ0FBQyxFQUNqRyxTQUFTLEVBQUUsOEJBQThCLEVBQ3pDLE9BQU8sRUFBRSx5QkFBeUIsRUFDbEIsTUFBTSxFQUFFLE1BQU0sRUFDYixJQUFJLEdBQUUsTUFBd0IsRUFDL0MsR0FBRyx5Q0FBcUMsRUFDeEMsSUFBSSxHQUFFO1FBQ0osTUFBTSxDQUFDLEVBQUUsT0FBTyxDQUFDO1FBQ2pCLGNBQWMsQ0FBQyxFQUFFLE1BQU0sQ0FBQztRQUN4QixTQUFTLENBQUMsRUFBRSxNQUFNLENBQUM7UUFDbkIsYUFBYSxDQUFDLEVBQUUsV0FBVyxDQUFDO0tBQ3hCLEVBR1A7SUFPUSxJQUFJLGtCQUVaO0NBQ0YifQ==
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"l2_block_stream.d.ts","sourceRoot":"","sources":["../../src/wrappers/l2_block_stream.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,iCAAiC,CAAC;AAE9D,OAAO,EACL,KAAK,aAAa,EAClB,aAAa,EACb,KAAK,yBAAyB,EAC9B,KAAK,8BAA8B,EACpC,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,KAAK,SAAS,EAAE,KAAK,MAAM,EAAa,MAAM,yBAAyB,CAAC;AAEjF,kFAAkF;AAClF,qBAAa,sBAAuB,SAAQ,aAAc,YAAW,SAAS;aAK1D,MAAM,EAAE,MAAM;IAC9B,OAAO,CAAC,QAAQ,CAAC,IAAI;IALvB,YACE,aAAa,EAAE,IAAI,CAAC,aAAa,EAAE,WAAW,GAAG,cAAc,GAAG,WAAW,GAAG,gBAAgB,CAAC,EACjG,SAAS,EAAE,8BAA8B,EACzC,OAAO,EAAE,yBAAyB,EAClB,MAAM,EAAE,MAAM,EACb,IAAI,GAAE,MAAwB,EAC/C,GAAG,yCAAqC,EACxC,IAAI,GAAE;QACJ,MAAM,CAAC,EAAE,OAAO,CAAC;QACjB,cAAc,CAAC,EAAE,MAAM,CAAC;QACxB,SAAS,CAAC,EAAE,MAAM,CAAC;QACnB,aAAa,CAAC,EAAE,WAAW,CAAC;KACxB,EAGP;IAOQ,IAAI,kBAEZ;CACF"}
|
|
@@ -1,400 +0,0 @@
|
|
|
1
|
-
function applyDecs2203RFactory() {
|
|
2
|
-
function createAddInitializerMethod(initializers, decoratorFinishedRef) {
|
|
3
|
-
return function addInitializer(initializer) {
|
|
4
|
-
assertNotFinished(decoratorFinishedRef, "addInitializer");
|
|
5
|
-
assertCallable(initializer, "An initializer");
|
|
6
|
-
initializers.push(initializer);
|
|
7
|
-
};
|
|
8
|
-
}
|
|
9
|
-
function memberDec(dec, name, desc, initializers, kind, isStatic, isPrivate, metadata, value) {
|
|
10
|
-
var kindStr;
|
|
11
|
-
switch(kind){
|
|
12
|
-
case 1:
|
|
13
|
-
kindStr = "accessor";
|
|
14
|
-
break;
|
|
15
|
-
case 2:
|
|
16
|
-
kindStr = "method";
|
|
17
|
-
break;
|
|
18
|
-
case 3:
|
|
19
|
-
kindStr = "getter";
|
|
20
|
-
break;
|
|
21
|
-
case 4:
|
|
22
|
-
kindStr = "setter";
|
|
23
|
-
break;
|
|
24
|
-
default:
|
|
25
|
-
kindStr = "field";
|
|
26
|
-
}
|
|
27
|
-
var ctx = {
|
|
28
|
-
kind: kindStr,
|
|
29
|
-
name: isPrivate ? "#" + name : name,
|
|
30
|
-
static: isStatic,
|
|
31
|
-
private: isPrivate,
|
|
32
|
-
metadata: metadata
|
|
33
|
-
};
|
|
34
|
-
var decoratorFinishedRef = {
|
|
35
|
-
v: false
|
|
36
|
-
};
|
|
37
|
-
ctx.addInitializer = createAddInitializerMethod(initializers, decoratorFinishedRef);
|
|
38
|
-
var get, set;
|
|
39
|
-
if (kind === 0) {
|
|
40
|
-
if (isPrivate) {
|
|
41
|
-
get = desc.get;
|
|
42
|
-
set = desc.set;
|
|
43
|
-
} else {
|
|
44
|
-
get = function() {
|
|
45
|
-
return this[name];
|
|
46
|
-
};
|
|
47
|
-
set = function(v) {
|
|
48
|
-
this[name] = v;
|
|
49
|
-
};
|
|
50
|
-
}
|
|
51
|
-
} else if (kind === 2) {
|
|
52
|
-
get = function() {
|
|
53
|
-
return desc.value;
|
|
54
|
-
};
|
|
55
|
-
} else {
|
|
56
|
-
if (kind === 1 || kind === 3) {
|
|
57
|
-
get = function() {
|
|
58
|
-
return desc.get.call(this);
|
|
59
|
-
};
|
|
60
|
-
}
|
|
61
|
-
if (kind === 1 || kind === 4) {
|
|
62
|
-
set = function(v) {
|
|
63
|
-
desc.set.call(this, v);
|
|
64
|
-
};
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
ctx.access = get && set ? {
|
|
68
|
-
get: get,
|
|
69
|
-
set: set
|
|
70
|
-
} : get ? {
|
|
71
|
-
get: get
|
|
72
|
-
} : {
|
|
73
|
-
set: set
|
|
74
|
-
};
|
|
75
|
-
try {
|
|
76
|
-
return dec(value, ctx);
|
|
77
|
-
} finally{
|
|
78
|
-
decoratorFinishedRef.v = true;
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
function assertNotFinished(decoratorFinishedRef, fnName) {
|
|
82
|
-
if (decoratorFinishedRef.v) {
|
|
83
|
-
throw new Error("attempted to call " + fnName + " after decoration was finished");
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
function assertCallable(fn, hint) {
|
|
87
|
-
if (typeof fn !== "function") {
|
|
88
|
-
throw new TypeError(hint + " must be a function");
|
|
89
|
-
}
|
|
90
|
-
}
|
|
91
|
-
function assertValidReturnValue(kind, value) {
|
|
92
|
-
var type = typeof value;
|
|
93
|
-
if (kind === 1) {
|
|
94
|
-
if (type !== "object" || value === null) {
|
|
95
|
-
throw new TypeError("accessor decorators must return an object with get, set, or init properties or void 0");
|
|
96
|
-
}
|
|
97
|
-
if (value.get !== undefined) {
|
|
98
|
-
assertCallable(value.get, "accessor.get");
|
|
99
|
-
}
|
|
100
|
-
if (value.set !== undefined) {
|
|
101
|
-
assertCallable(value.set, "accessor.set");
|
|
102
|
-
}
|
|
103
|
-
if (value.init !== undefined) {
|
|
104
|
-
assertCallable(value.init, "accessor.init");
|
|
105
|
-
}
|
|
106
|
-
} else if (type !== "function") {
|
|
107
|
-
var hint;
|
|
108
|
-
if (kind === 0) {
|
|
109
|
-
hint = "field";
|
|
110
|
-
} else if (kind === 10) {
|
|
111
|
-
hint = "class";
|
|
112
|
-
} else {
|
|
113
|
-
hint = "method";
|
|
114
|
-
}
|
|
115
|
-
throw new TypeError(hint + " decorators must return a function or void 0");
|
|
116
|
-
}
|
|
117
|
-
}
|
|
118
|
-
function applyMemberDec(ret, base, decInfo, name, kind, isStatic, isPrivate, initializers, metadata) {
|
|
119
|
-
var decs = decInfo[0];
|
|
120
|
-
var desc, init, value;
|
|
121
|
-
if (isPrivate) {
|
|
122
|
-
if (kind === 0 || kind === 1) {
|
|
123
|
-
desc = {
|
|
124
|
-
get: decInfo[3],
|
|
125
|
-
set: decInfo[4]
|
|
126
|
-
};
|
|
127
|
-
} else if (kind === 3) {
|
|
128
|
-
desc = {
|
|
129
|
-
get: decInfo[3]
|
|
130
|
-
};
|
|
131
|
-
} else if (kind === 4) {
|
|
132
|
-
desc = {
|
|
133
|
-
set: decInfo[3]
|
|
134
|
-
};
|
|
135
|
-
} else {
|
|
136
|
-
desc = {
|
|
137
|
-
value: decInfo[3]
|
|
138
|
-
};
|
|
139
|
-
}
|
|
140
|
-
} else if (kind !== 0) {
|
|
141
|
-
desc = Object.getOwnPropertyDescriptor(base, name);
|
|
142
|
-
}
|
|
143
|
-
if (kind === 1) {
|
|
144
|
-
value = {
|
|
145
|
-
get: desc.get,
|
|
146
|
-
set: desc.set
|
|
147
|
-
};
|
|
148
|
-
} else if (kind === 2) {
|
|
149
|
-
value = desc.value;
|
|
150
|
-
} else if (kind === 3) {
|
|
151
|
-
value = desc.get;
|
|
152
|
-
} else if (kind === 4) {
|
|
153
|
-
value = desc.set;
|
|
154
|
-
}
|
|
155
|
-
var newValue, get, set;
|
|
156
|
-
if (typeof decs === "function") {
|
|
157
|
-
newValue = memberDec(decs, name, desc, initializers, kind, isStatic, isPrivate, metadata, value);
|
|
158
|
-
if (newValue !== void 0) {
|
|
159
|
-
assertValidReturnValue(kind, newValue);
|
|
160
|
-
if (kind === 0) {
|
|
161
|
-
init = newValue;
|
|
162
|
-
} else if (kind === 1) {
|
|
163
|
-
init = newValue.init;
|
|
164
|
-
get = newValue.get || value.get;
|
|
165
|
-
set = newValue.set || value.set;
|
|
166
|
-
value = {
|
|
167
|
-
get: get,
|
|
168
|
-
set: set
|
|
169
|
-
};
|
|
170
|
-
} else {
|
|
171
|
-
value = newValue;
|
|
172
|
-
}
|
|
173
|
-
}
|
|
174
|
-
} else {
|
|
175
|
-
for(var i = decs.length - 1; i >= 0; i--){
|
|
176
|
-
var dec = decs[i];
|
|
177
|
-
newValue = memberDec(dec, name, desc, initializers, kind, isStatic, isPrivate, metadata, value);
|
|
178
|
-
if (newValue !== void 0) {
|
|
179
|
-
assertValidReturnValue(kind, newValue);
|
|
180
|
-
var newInit;
|
|
181
|
-
if (kind === 0) {
|
|
182
|
-
newInit = newValue;
|
|
183
|
-
} else if (kind === 1) {
|
|
184
|
-
newInit = newValue.init;
|
|
185
|
-
get = newValue.get || value.get;
|
|
186
|
-
set = newValue.set || value.set;
|
|
187
|
-
value = {
|
|
188
|
-
get: get,
|
|
189
|
-
set: set
|
|
190
|
-
};
|
|
191
|
-
} else {
|
|
192
|
-
value = newValue;
|
|
193
|
-
}
|
|
194
|
-
if (newInit !== void 0) {
|
|
195
|
-
if (init === void 0) {
|
|
196
|
-
init = newInit;
|
|
197
|
-
} else if (typeof init === "function") {
|
|
198
|
-
init = [
|
|
199
|
-
init,
|
|
200
|
-
newInit
|
|
201
|
-
];
|
|
202
|
-
} else {
|
|
203
|
-
init.push(newInit);
|
|
204
|
-
}
|
|
205
|
-
}
|
|
206
|
-
}
|
|
207
|
-
}
|
|
208
|
-
}
|
|
209
|
-
if (kind === 0 || kind === 1) {
|
|
210
|
-
if (init === void 0) {
|
|
211
|
-
init = function(instance, init) {
|
|
212
|
-
return init;
|
|
213
|
-
};
|
|
214
|
-
} else if (typeof init !== "function") {
|
|
215
|
-
var ownInitializers = init;
|
|
216
|
-
init = function(instance, init) {
|
|
217
|
-
var value = init;
|
|
218
|
-
for(var i = 0; i < ownInitializers.length; i++){
|
|
219
|
-
value = ownInitializers[i].call(instance, value);
|
|
220
|
-
}
|
|
221
|
-
return value;
|
|
222
|
-
};
|
|
223
|
-
} else {
|
|
224
|
-
var originalInitializer = init;
|
|
225
|
-
init = function(instance, init) {
|
|
226
|
-
return originalInitializer.call(instance, init);
|
|
227
|
-
};
|
|
228
|
-
}
|
|
229
|
-
ret.push(init);
|
|
230
|
-
}
|
|
231
|
-
if (kind !== 0) {
|
|
232
|
-
if (kind === 1) {
|
|
233
|
-
desc.get = value.get;
|
|
234
|
-
desc.set = value.set;
|
|
235
|
-
} else if (kind === 2) {
|
|
236
|
-
desc.value = value;
|
|
237
|
-
} else if (kind === 3) {
|
|
238
|
-
desc.get = value;
|
|
239
|
-
} else if (kind === 4) {
|
|
240
|
-
desc.set = value;
|
|
241
|
-
}
|
|
242
|
-
if (isPrivate) {
|
|
243
|
-
if (kind === 1) {
|
|
244
|
-
ret.push(function(instance, args) {
|
|
245
|
-
return value.get.call(instance, args);
|
|
246
|
-
});
|
|
247
|
-
ret.push(function(instance, args) {
|
|
248
|
-
return value.set.call(instance, args);
|
|
249
|
-
});
|
|
250
|
-
} else if (kind === 2) {
|
|
251
|
-
ret.push(value);
|
|
252
|
-
} else {
|
|
253
|
-
ret.push(function(instance, args) {
|
|
254
|
-
return value.call(instance, args);
|
|
255
|
-
});
|
|
256
|
-
}
|
|
257
|
-
} else {
|
|
258
|
-
Object.defineProperty(base, name, desc);
|
|
259
|
-
}
|
|
260
|
-
}
|
|
261
|
-
}
|
|
262
|
-
function applyMemberDecs(Class, decInfos, metadata) {
|
|
263
|
-
var ret = [];
|
|
264
|
-
var protoInitializers;
|
|
265
|
-
var staticInitializers;
|
|
266
|
-
var existingProtoNonFields = new Map();
|
|
267
|
-
var existingStaticNonFields = new Map();
|
|
268
|
-
for(var i = 0; i < decInfos.length; i++){
|
|
269
|
-
var decInfo = decInfos[i];
|
|
270
|
-
if (!Array.isArray(decInfo)) continue;
|
|
271
|
-
var kind = decInfo[1];
|
|
272
|
-
var name = decInfo[2];
|
|
273
|
-
var isPrivate = decInfo.length > 3;
|
|
274
|
-
var isStatic = kind >= 5;
|
|
275
|
-
var base;
|
|
276
|
-
var initializers;
|
|
277
|
-
if (isStatic) {
|
|
278
|
-
base = Class;
|
|
279
|
-
kind = kind - 5;
|
|
280
|
-
staticInitializers = staticInitializers || [];
|
|
281
|
-
initializers = staticInitializers;
|
|
282
|
-
} else {
|
|
283
|
-
base = Class.prototype;
|
|
284
|
-
protoInitializers = protoInitializers || [];
|
|
285
|
-
initializers = protoInitializers;
|
|
286
|
-
}
|
|
287
|
-
if (kind !== 0 && !isPrivate) {
|
|
288
|
-
var existingNonFields = isStatic ? existingStaticNonFields : existingProtoNonFields;
|
|
289
|
-
var existingKind = existingNonFields.get(name) || 0;
|
|
290
|
-
if (existingKind === true || existingKind === 3 && kind !== 4 || existingKind === 4 && kind !== 3) {
|
|
291
|
-
throw new Error("Attempted to decorate a public method/accessor that has the same name as a previously decorated public method/accessor. This is not currently supported by the decorators plugin. Property name was: " + name);
|
|
292
|
-
} else if (!existingKind && kind > 2) {
|
|
293
|
-
existingNonFields.set(name, kind);
|
|
294
|
-
} else {
|
|
295
|
-
existingNonFields.set(name, true);
|
|
296
|
-
}
|
|
297
|
-
}
|
|
298
|
-
applyMemberDec(ret, base, decInfo, name, kind, isStatic, isPrivate, initializers, metadata);
|
|
299
|
-
}
|
|
300
|
-
pushInitializers(ret, protoInitializers);
|
|
301
|
-
pushInitializers(ret, staticInitializers);
|
|
302
|
-
return ret;
|
|
303
|
-
}
|
|
304
|
-
function pushInitializers(ret, initializers) {
|
|
305
|
-
if (initializers) {
|
|
306
|
-
ret.push(function(instance) {
|
|
307
|
-
for(var i = 0; i < initializers.length; i++){
|
|
308
|
-
initializers[i].call(instance);
|
|
309
|
-
}
|
|
310
|
-
return instance;
|
|
311
|
-
});
|
|
312
|
-
}
|
|
313
|
-
}
|
|
314
|
-
function applyClassDecs(targetClass, classDecs, metadata) {
|
|
315
|
-
if (classDecs.length > 0) {
|
|
316
|
-
var initializers = [];
|
|
317
|
-
var newClass = targetClass;
|
|
318
|
-
var name = targetClass.name;
|
|
319
|
-
for(var i = classDecs.length - 1; i >= 0; i--){
|
|
320
|
-
var decoratorFinishedRef = {
|
|
321
|
-
v: false
|
|
322
|
-
};
|
|
323
|
-
try {
|
|
324
|
-
var nextNewClass = classDecs[i](newClass, {
|
|
325
|
-
kind: "class",
|
|
326
|
-
name: name,
|
|
327
|
-
addInitializer: createAddInitializerMethod(initializers, decoratorFinishedRef),
|
|
328
|
-
metadata
|
|
329
|
-
});
|
|
330
|
-
} finally{
|
|
331
|
-
decoratorFinishedRef.v = true;
|
|
332
|
-
}
|
|
333
|
-
if (nextNewClass !== undefined) {
|
|
334
|
-
assertValidReturnValue(10, nextNewClass);
|
|
335
|
-
newClass = nextNewClass;
|
|
336
|
-
}
|
|
337
|
-
}
|
|
338
|
-
return [
|
|
339
|
-
defineMetadata(newClass, metadata),
|
|
340
|
-
function() {
|
|
341
|
-
for(var i = 0; i < initializers.length; i++){
|
|
342
|
-
initializers[i].call(newClass);
|
|
343
|
-
}
|
|
344
|
-
}
|
|
345
|
-
];
|
|
346
|
-
}
|
|
347
|
-
}
|
|
348
|
-
function defineMetadata(Class, metadata) {
|
|
349
|
-
return Object.defineProperty(Class, Symbol.metadata || Symbol.for("Symbol.metadata"), {
|
|
350
|
-
configurable: true,
|
|
351
|
-
enumerable: true,
|
|
352
|
-
value: metadata
|
|
353
|
-
});
|
|
354
|
-
}
|
|
355
|
-
return function applyDecs2203R(targetClass, memberDecs, classDecs, parentClass) {
|
|
356
|
-
if (parentClass !== void 0) {
|
|
357
|
-
var parentMetadata = parentClass[Symbol.metadata || Symbol.for("Symbol.metadata")];
|
|
358
|
-
}
|
|
359
|
-
var metadata = Object.create(parentMetadata === void 0 ? null : parentMetadata);
|
|
360
|
-
var e = applyMemberDecs(targetClass, memberDecs, metadata);
|
|
361
|
-
if (!classDecs.length) defineMetadata(targetClass, metadata);
|
|
362
|
-
return {
|
|
363
|
-
e: e,
|
|
364
|
-
get c () {
|
|
365
|
-
return applyClassDecs(targetClass, classDecs, metadata);
|
|
366
|
-
}
|
|
367
|
-
};
|
|
368
|
-
};
|
|
369
|
-
}
|
|
370
|
-
function _apply_decs_2203_r(targetClass, memberDecs, classDecs, parentClass) {
|
|
371
|
-
return (_apply_decs_2203_r = applyDecs2203RFactory())(targetClass, memberDecs, classDecs, parentClass);
|
|
372
|
-
}
|
|
373
|
-
var _dec, _initProto;
|
|
374
|
-
import { createLogger } from '@aztec/foundation/log';
|
|
375
|
-
import { L2BlockStream } from '@aztec/stdlib/block';
|
|
376
|
-
import { trackSpan } from '@aztec/telemetry-client';
|
|
377
|
-
_dec = trackSpan(function() {
|
|
378
|
-
return `${this.name}.work`;
|
|
379
|
-
});
|
|
380
|
-
/** Extends an L2BlockStream with a tracer to create a new trace per iteration. */ export class TraceableL2BlockStream extends L2BlockStream {
|
|
381
|
-
tracer;
|
|
382
|
-
name;
|
|
383
|
-
static{
|
|
384
|
-
({ e: [_initProto] } = _apply_decs_2203_r(this, [
|
|
385
|
-
[
|
|
386
|
-
_dec,
|
|
387
|
-
2,
|
|
388
|
-
"work"
|
|
389
|
-
]
|
|
390
|
-
], []));
|
|
391
|
-
}
|
|
392
|
-
constructor(l2BlockSource, localData, handler, tracer, name = 'L2BlockStream', log = createLogger('types:block_stream'), opts = {}){
|
|
393
|
-
super(l2BlockSource, localData, handler, log, opts), this.tracer = tracer, this.name = name, _initProto(this);
|
|
394
|
-
}
|
|
395
|
-
// We need to use a non-arrow function to be able to access `this`
|
|
396
|
-
// See https://www.typescriptlang.org/docs/handbook/2/functions.html#declaring-this-in-a-function
|
|
397
|
-
work() {
|
|
398
|
-
return super.work();
|
|
399
|
-
}
|
|
400
|
-
}
|