@aztec/archiver 0.0.1-commit.7b97ef96e → 0.0.1-commit.7cbc774
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 +19 -11
- package/dest/archiver.d.ts +36 -17
- package/dest/archiver.d.ts.map +1 -1
- package/dest/archiver.js +257 -75
- package/dest/config.d.ts +6 -3
- package/dest/config.d.ts.map +1 -1
- package/dest/config.js +23 -15
- package/dest/errors.d.ts +55 -9
- package/dest/errors.d.ts.map +1 -1
- package/dest/errors.js +81 -14
- package/dest/factory.d.ts +13 -9
- package/dest/factory.d.ts.map +1 -1
- package/dest/factory.js +48 -39
- package/dest/index.d.ts +11 -3
- package/dest/index.d.ts.map +1 -1
- package/dest/index.js +10 -2
- package/dest/l1/bin/retrieve-calldata.js +32 -28
- package/dest/l1/calldata_retriever.d.ts +71 -53
- package/dest/l1/calldata_retriever.d.ts.map +1 -1
- package/dest/l1/calldata_retriever.js +190 -262
- package/dest/l1/data_retrieval.d.ts +24 -16
- package/dest/l1/data_retrieval.d.ts.map +1 -1
- package/dest/l1/data_retrieval.js +39 -45
- package/dest/l1/spire_proposer.d.ts +5 -5
- package/dest/l1/spire_proposer.d.ts.map +1 -1
- package/dest/l1/spire_proposer.js +9 -17
- package/dest/l1/trace_tx.d.ts +12 -66
- package/dest/l1/trace_tx.d.ts.map +1 -1
- package/dest/l1/validate_historical_logs.d.ts +23 -0
- package/dest/l1/validate_historical_logs.d.ts.map +1 -0
- package/dest/l1/validate_historical_logs.js +108 -0
- package/dest/modules/contract_data_source_adapter.d.ts +25 -0
- package/dest/modules/contract_data_source_adapter.d.ts.map +1 -0
- package/dest/modules/contract_data_source_adapter.js +40 -0
- package/dest/modules/data_source_base.d.ts +70 -46
- package/dest/modules/data_source_base.d.ts.map +1 -1
- package/dest/modules/data_source_base.js +270 -135
- package/dest/modules/data_store_updater.d.ts +42 -17
- package/dest/modules/data_store_updater.d.ts.map +1 -1
- package/dest/modules/data_store_updater.js +191 -122
- package/dest/modules/instrumentation.d.ts +18 -2
- package/dest/modules/instrumentation.d.ts.map +1 -1
- package/dest/modules/instrumentation.js +35 -7
- package/dest/modules/l1_synchronizer.d.ts +12 -11
- package/dest/modules/l1_synchronizer.d.ts.map +1 -1
- package/dest/modules/l1_synchronizer.js +439 -207
- package/dest/modules/validation.d.ts +4 -3
- package/dest/modules/validation.d.ts.map +1 -1
- package/dest/modules/validation.js +6 -6
- package/dest/store/block_store.d.ts +174 -70
- package/dest/store/block_store.d.ts.map +1 -1
- package/dest/store/block_store.js +696 -250
- package/dest/store/contract_class_store.d.ts +17 -4
- package/dest/store/contract_class_store.d.ts.map +1 -1
- package/dest/store/contract_class_store.js +24 -68
- package/dest/store/contract_instance_store.d.ts +28 -1
- package/dest/store/contract_instance_store.d.ts.map +1 -1
- package/dest/store/contract_instance_store.js +37 -2
- package/dest/store/data_stores.d.ts +68 -0
- package/dest/store/data_stores.d.ts.map +1 -0
- package/dest/store/data_stores.js +54 -0
- package/dest/store/function_names_cache.d.ts +17 -0
- package/dest/store/function_names_cache.d.ts.map +1 -0
- package/dest/store/function_names_cache.js +30 -0
- package/dest/store/l2_tips_cache.d.ts +13 -7
- package/dest/store/l2_tips_cache.d.ts.map +1 -1
- package/dest/store/l2_tips_cache.js +13 -76
- package/dest/store/log_store.d.ts +42 -37
- package/dest/store/log_store.d.ts.map +1 -1
- package/dest/store/log_store.js +262 -408
- package/dest/store/log_store_codec.d.ts +70 -0
- package/dest/store/log_store_codec.d.ts.map +1 -0
- package/dest/store/log_store_codec.js +101 -0
- package/dest/store/message_store.d.ts +11 -1
- package/dest/store/message_store.d.ts.map +1 -1
- package/dest/store/message_store.js +51 -9
- package/dest/test/fake_l1_state.d.ts +22 -1
- package/dest/test/fake_l1_state.d.ts.map +1 -1
- package/dest/test/fake_l1_state.js +152 -24
- package/dest/test/mock_l1_to_l2_message_source.d.ts +1 -1
- package/dest/test/mock_l1_to_l2_message_source.d.ts.map +1 -1
- package/dest/test/mock_l1_to_l2_message_source.js +2 -1
- package/dest/test/mock_l2_block_source.d.ts +52 -46
- package/dest/test/mock_l2_block_source.d.ts.map +1 -1
- package/dest/test/mock_l2_block_source.js +246 -170
- package/dest/test/mock_structs.d.ts +4 -1
- package/dest/test/mock_structs.d.ts.map +1 -1
- package/dest/test/mock_structs.js +13 -1
- package/dest/test/noop_l1_archiver.d.ts +12 -6
- package/dest/test/noop_l1_archiver.d.ts.map +1 -1
- package/dest/test/noop_l1_archiver.js +26 -9
- package/package.json +14 -14
- package/src/archiver.ts +313 -75
- package/src/config.ts +32 -12
- package/src/errors.ts +122 -21
- package/src/factory.ts +54 -30
- package/src/index.ts +18 -2
- package/src/l1/README.md +25 -68
- package/src/l1/bin/retrieve-calldata.ts +40 -27
- package/src/l1/calldata_retriever.ts +243 -384
- package/src/l1/data_retrieval.ts +55 -69
- package/src/l1/spire_proposer.ts +7 -15
- package/src/l1/validate_historical_logs.ts +140 -0
- package/src/modules/contract_data_source_adapter.ts +55 -0
- package/src/modules/data_source_base.ts +336 -171
- package/src/modules/data_store_updater.ts +224 -154
- package/src/modules/instrumentation.ts +48 -8
- package/src/modules/l1_synchronizer.ts +579 -254
- package/src/modules/validation.ts +10 -9
- package/src/store/block_store.ts +865 -290
- package/src/store/contract_class_store.ts +31 -103
- package/src/store/contract_instance_store.ts +51 -5
- package/src/store/data_stores.ts +104 -0
- package/src/store/function_names_cache.ts +37 -0
- package/src/store/l2_tips_cache.ts +16 -70
- package/src/store/log_store.ts +301 -559
- package/src/store/log_store_codec.ts +132 -0
- package/src/store/message_store.ts +60 -10
- package/src/structs/inbox_message.ts +1 -1
- package/src/test/fake_l1_state.ts +198 -35
- package/src/test/mock_l1_to_l2_message_source.ts +1 -0
- package/src/test/mock_l2_block_source.ts +309 -205
- package/src/test/mock_structs.ts +20 -6
- package/src/test/noop_l1_archiver.ts +39 -9
- package/dest/store/kv_archiver_store.d.ts +0 -354
- package/dest/store/kv_archiver_store.d.ts.map +0 -1
- package/dest/store/kv_archiver_store.js +0 -464
- package/src/store/kv_archiver_store.ts +0 -671
|
@@ -1,6 +1,9 @@
|
|
|
1
|
+
import type { SlotNumber } from '@aztec/foundation/branded-types';
|
|
1
2
|
import { createLogger } from '@aztec/foundation/log';
|
|
2
3
|
import type { L2Block } from '@aztec/stdlib/block';
|
|
3
4
|
import type { CheckpointData } from '@aztec/stdlib/checkpoint';
|
|
5
|
+
import type { L1RollupConstants } from '@aztec/stdlib/epoch-helpers';
|
|
6
|
+
import { getTimestampForSlot } from '@aztec/stdlib/epoch-helpers';
|
|
4
7
|
import {
|
|
5
8
|
Attributes,
|
|
6
9
|
type Gauge,
|
|
@@ -29,6 +32,7 @@ export class ArchiverInstrumentation {
|
|
|
29
32
|
private pruneCount: UpDownCounter;
|
|
30
33
|
|
|
31
34
|
private syncDurationPerBlock: Histogram;
|
|
35
|
+
private syncDurationPerCheckpoint: Histogram;
|
|
32
36
|
private syncBlockCount: UpDownCounter;
|
|
33
37
|
private manaPerBlock: Histogram;
|
|
34
38
|
private txsPerBlock: Histogram;
|
|
@@ -38,6 +42,9 @@ export class ArchiverInstrumentation {
|
|
|
38
42
|
|
|
39
43
|
private blockProposalTxTargetCount: UpDownCounter;
|
|
40
44
|
|
|
45
|
+
private checkpointL1InclusionDelay: Histogram;
|
|
46
|
+
private checkpointPromotedCount: UpDownCounter;
|
|
47
|
+
|
|
41
48
|
private log = createLogger('archiver:instrumentation');
|
|
42
49
|
|
|
43
50
|
private constructor(
|
|
@@ -63,6 +70,8 @@ export class ArchiverInstrumentation {
|
|
|
63
70
|
|
|
64
71
|
this.syncDurationPerBlock = meter.createHistogram(Metrics.ARCHIVER_SYNC_PER_BLOCK);
|
|
65
72
|
|
|
73
|
+
this.syncDurationPerCheckpoint = meter.createHistogram(Metrics.ARCHIVER_SYNC_PER_CHECKPOINT);
|
|
74
|
+
|
|
66
75
|
this.syncBlockCount = createUpDownCounterWithDefault(meter, Metrics.ARCHIVER_SYNC_BLOCK_COUNT);
|
|
67
76
|
|
|
68
77
|
this.manaPerBlock = meter.createHistogram(Metrics.ARCHIVER_MANA_PER_BLOCK);
|
|
@@ -85,6 +94,10 @@ export class ArchiverInstrumentation {
|
|
|
85
94
|
},
|
|
86
95
|
);
|
|
87
96
|
|
|
97
|
+
this.checkpointL1InclusionDelay = meter.createHistogram(Metrics.ARCHIVER_CHECKPOINT_L1_INCLUSION_DELAY);
|
|
98
|
+
|
|
99
|
+
this.checkpointPromotedCount = createUpDownCounterWithDefault(meter, Metrics.ARCHIVER_CHECKPOINT_PROMOTED_COUNT);
|
|
100
|
+
|
|
88
101
|
this.dbMetrics = new LmdbMetrics(
|
|
89
102
|
meter,
|
|
90
103
|
{
|
|
@@ -106,17 +119,26 @@ export class ArchiverInstrumentation {
|
|
|
106
119
|
return this.telemetry.isEnabled();
|
|
107
120
|
}
|
|
108
121
|
|
|
109
|
-
public
|
|
122
|
+
public processNewProposedBlock(syncTimePerBlock: number, block: L2Block) {
|
|
123
|
+
const attrs = { [Attributes.STATUS]: 'proposed' };
|
|
124
|
+
this.blockHeight.record(block.number, attrs);
|
|
110
125
|
this.syncDurationPerBlock.record(Math.ceil(syncTimePerBlock));
|
|
111
|
-
this.blockHeight.record(Math.max(...blocks.map(b => b.number)));
|
|
112
|
-
this.checkpointHeight.record(Math.max(...blocks.map(b => b.checkpointNumber)));
|
|
113
|
-
this.syncBlockCount.add(blocks.length);
|
|
114
126
|
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
127
|
+
// Per block metrics
|
|
128
|
+
this.txCount.add(block.body.txEffects.length);
|
|
129
|
+
this.txsPerBlock.record(block.body.txEffects.length);
|
|
130
|
+
this.manaPerBlock.record(block.header.totalManaUsed.toNumber() / 1e6);
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
public processNewCheckpointedBlocks(syncTimePerCheckpoint: number, blocks: L2Block[]) {
|
|
134
|
+
if (blocks.length === 0) {
|
|
135
|
+
return;
|
|
119
136
|
}
|
|
137
|
+
|
|
138
|
+
this.syncDurationPerCheckpoint.record(Math.ceil(syncTimePerCheckpoint));
|
|
139
|
+
this.blockHeight.record(Math.max(...blocks.map(b => b.number)), { [Attributes.STATUS]: 'checkpointed' });
|
|
140
|
+
this.checkpointHeight.record(Math.max(...blocks.map(b => b.checkpointNumber)));
|
|
141
|
+
this.syncBlockCount.add(blocks.length);
|
|
120
142
|
}
|
|
121
143
|
|
|
122
144
|
public processNewMessages(count: number, syncPerMessageMs: number) {
|
|
@@ -161,4 +183,22 @@ export class ArchiverInstrumentation {
|
|
|
161
183
|
[Attributes.L1_BLOCK_PROPOSAL_USED_TRACE]: usedTrace,
|
|
162
184
|
});
|
|
163
185
|
}
|
|
186
|
+
|
|
187
|
+
/** Records a checkpoint promoted from proposed (blob fetch skipped). */
|
|
188
|
+
public processCheckpointPromoted() {
|
|
189
|
+
this.checkpointPromotedCount.add(1);
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
/**
|
|
193
|
+
* Records L1 inclusion timing for a checkpoint observed on L1 (seconds into the L2 slot).
|
|
194
|
+
*/
|
|
195
|
+
public processCheckpointL1Timing(data: {
|
|
196
|
+
slotNumber: SlotNumber;
|
|
197
|
+
l1Timestamp: bigint;
|
|
198
|
+
l1Constants: Pick<L1RollupConstants, 'l1GenesisTime' | 'slotDuration'>;
|
|
199
|
+
}): void {
|
|
200
|
+
const slotStartTs = getTimestampForSlot(data.slotNumber, data.l1Constants);
|
|
201
|
+
const inclusionDelaySeconds = Number(data.l1Timestamp - slotStartTs);
|
|
202
|
+
this.checkpointL1InclusionDelay.record(inclusionDelaySeconds);
|
|
203
|
+
}
|
|
164
204
|
}
|