@aztec-labs/archiver 6.0.0-rc.2 → 6.0.0-rc.4

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.
Files changed (62) hide show
  1. package/dest/archiver.d.ts +11 -2
  2. package/dest/archiver.d.ts.map +1 -1
  3. package/dest/archiver.js +94 -2
  4. package/dest/config.js +1 -1
  5. package/dest/errors.d.ts +12 -1
  6. package/dest/errors.d.ts.map +1 -1
  7. package/dest/errors.js +12 -0
  8. package/dest/l1/bin/retrieve-calldata.js +7 -5
  9. package/dest/l1/calldata_retriever.d.ts +5 -2
  10. package/dest/l1/calldata_retriever.d.ts.map +1 -1
  11. package/dest/l1/calldata_retriever.js +8 -3
  12. package/dest/l1/data_retrieval.d.ts +2 -1
  13. package/dest/l1/data_retrieval.d.ts.map +1 -1
  14. package/dest/l1/data_retrieval.js +14 -9
  15. package/dest/l1/validate_trace.d.ts +3 -1
  16. package/dest/l1/validate_trace.d.ts.map +1 -1
  17. package/dest/l1/validate_trace.js +8 -3
  18. package/dest/modules/checkpoint_ingestor.d.ts +71 -0
  19. package/dest/modules/checkpoint_ingestor.d.ts.map +1 -0
  20. package/dest/modules/checkpoint_ingestor.js +516 -0
  21. package/dest/modules/data_store_updater.d.ts +6 -11
  22. package/dest/modules/data_store_updater.d.ts.map +1 -1
  23. package/dest/modules/data_store_updater.js +4 -3
  24. package/dest/modules/instrumentation.d.ts +8 -4
  25. package/dest/modules/instrumentation.d.ts.map +1 -1
  26. package/dest/modules/instrumentation.js +8 -2
  27. package/dest/modules/l1_synchronizer.d.ts +3 -7
  28. package/dest/modules/l1_synchronizer.d.ts.map +1 -1
  29. package/dest/modules/l1_synchronizer.js +84 -420
  30. package/dest/modules/pending_chain_validation_tracker.d.ts +21 -0
  31. package/dest/modules/pending_chain_validation_tracker.d.ts.map +1 -0
  32. package/dest/modules/pending_chain_validation_tracker.js +32 -0
  33. package/dest/modules/validation.d.ts +2 -2
  34. package/dest/modules/validation.d.ts.map +1 -1
  35. package/dest/modules/validation.js +17 -11
  36. package/dest/store/block_store.d.ts +1 -1
  37. package/dest/store/block_store.d.ts.map +1 -1
  38. package/dest/store/block_store.js +8 -2
  39. package/dest/store/log_store_codec.d.ts +2 -1
  40. package/dest/store/log_store_codec.d.ts.map +1 -1
  41. package/dest/store/log_store_codec.js +1 -0
  42. package/dest/test/fake_l1_state.d.ts +21 -1
  43. package/dest/test/fake_l1_state.d.ts.map +1 -1
  44. package/dest/test/fake_l1_state.js +82 -30
  45. package/package.json +15 -15
  46. package/src/archiver.ts +112 -3
  47. package/src/config.ts +1 -1
  48. package/src/errors.ts +21 -0
  49. package/src/l1/README.md +5 -0
  50. package/src/l1/bin/retrieve-calldata.ts +5 -3
  51. package/src/l1/calldata_retriever.ts +8 -3
  52. package/src/l1/data_retrieval.ts +13 -11
  53. package/src/l1/validate_trace.ts +11 -2
  54. package/src/modules/checkpoint_ingestor.ts +742 -0
  55. package/src/modules/data_store_updater.ts +7 -13
  56. package/src/modules/instrumentation.ts +17 -3
  57. package/src/modules/l1_synchronizer.ts +116 -563
  58. package/src/modules/pending_chain_validation_tracker.ts +43 -0
  59. package/src/modules/validation.ts +13 -9
  60. package/src/store/block_store.ts +6 -0
  61. package/src/store/log_store_codec.ts +1 -0
  62. package/src/test/fake_l1_state.ts +94 -31
@@ -1,5 +1,4 @@
1
1
  import { INITIAL_L2_BLOCK_NUM } from '@aztec-labs/constants';
2
- import type { ViemCommitteeAttestations } from '@aztec-labs/ethereum/contracts';
3
2
  import { BlockNumber, CheckpointNumber } from '@aztec-labs/foundation/branded-types';
4
3
  import { filterAsync } from '@aztec-labs/foundation/collection';
5
4
  import { createLogger } from '@aztec-labs/foundation/log';
@@ -8,9 +7,8 @@ import {
8
7
  ContractInstancePublishedEvent,
9
8
  ContractInstanceUpdatedEvent,
10
9
  } from '@aztec-labs/protocol-contracts/instance-registry';
11
- import type { BlockData, CommitteeAttestation, L2Block, ValidateCheckpointResult } from '@aztec-labs/stdlib/block';
10
+ import type { BlockData, L2Block, ValidateCheckpointResult } from '@aztec-labs/stdlib/block';
12
11
  import {
13
- type L1PublishedData,
14
12
  type ProposedCheckpointInput,
15
13
  type PublishedCheckpoint,
16
14
  validateCheckpoint,
@@ -196,18 +194,14 @@ export class ArchiverDataStoreUpdater {
196
194
  *
197
195
  * @param checkpoints - The published checkpoints to add (excluding any being promoted from proposed).
198
196
  * @param pendingChainValidationStatus - Optional validation status to set.
199
- * @param promoteProposed - Optional promotion of the current proposed checkpoint (fast path when blocks are already local).
197
+ * @param promoteProposed - Optional proposed checkpoint to promote, published with the L1 data and attestations L1
198
+ * carries for it (fast path when blocks are already local).
200
199
  * @returns Result with information about any pruned blocks.
201
200
  */
202
201
  public async addCheckpoints(
203
202
  checkpoints: PublishedCheckpoint[],
204
203
  pendingChainValidationStatus?: ValidateCheckpointResult,
205
- promoteProposed?: {
206
- l1: L1PublishedData;
207
- attestations: CommitteeAttestation[];
208
- verbatimAttestations: ViemCommitteeAttestations;
209
- checkpoint: PublishedCheckpoint;
210
- },
204
+ promoteProposed?: PublishedCheckpoint,
211
205
  evictProposedFrom?: CheckpointNumber,
212
206
  ): Promise<ReconcileCheckpointsResult> {
213
207
  const validateOpts = { rollupManaLimit: this.opts?.rollupManaLimit };
@@ -215,7 +209,7 @@ export class ArchiverDataStoreUpdater {
215
209
  validateCheckpoint(checkpoint.checkpoint, validateOpts);
216
210
  }
217
211
  if (promoteProposed) {
218
- validateCheckpoint(promoteProposed.checkpoint.checkpoint, validateOpts);
212
+ validateCheckpoint(promoteProposed.checkpoint, validateOpts);
219
213
  }
220
214
 
221
215
  await prepareBlockTxEffectsTreeData(checkpoints.flatMap(published => published.checkpoint.blocks));
@@ -242,11 +236,11 @@ export class ArchiverDataStoreUpdater {
242
236
  // Promote the proposed checkpoint if requested (uses explicit checkpoint number)
243
237
  promoteProposed
244
238
  ? this.stores.blocks.promoteProposedToCheckpointed(
245
- promoteProposed.checkpoint.checkpoint.number,
239
+ promoteProposed.checkpoint.number,
246
240
  promoteProposed.l1,
247
241
  promoteProposed.attestations,
248
242
  promoteProposed.verbatimAttestations,
249
- promoteProposed.checkpoint.checkpoint.archive.root,
243
+ promoteProposed.checkpoint.archive.root,
250
244
  )
251
245
  : undefined,
252
246
  // Evict pending checkpoints that diverged from what L1 mined
@@ -41,6 +41,7 @@ export class ArchiverInstrumentation {
41
41
  private syncMessageCount: UpDownCounter;
42
42
 
43
43
  private blockProposalTxTargetCount: UpDownCounter;
44
+ private checkpointCalldataUnavailableCount: UpDownCounter;
44
45
 
45
46
  private checkpointL1InclusionDelay: Histogram;
46
47
  private checkpointPromotedCount: UpDownCounter;
@@ -96,6 +97,11 @@ export class ArchiverInstrumentation {
96
97
  },
97
98
  );
98
99
 
100
+ this.checkpointCalldataUnavailableCount = createUpDownCounterWithDefault(
101
+ meter,
102
+ Metrics.ARCHIVER_CHECKPOINT_CALLDATA_UNAVAILABLE_COUNT,
103
+ );
104
+
99
105
  this.checkpointL1InclusionDelay = meter.createHistogram(Metrics.ARCHIVER_CHECKPOINT_L1_INCLUSION_DELAY);
100
106
 
101
107
  this.checkpointPromotedCount = createUpDownCounterWithDefault(meter, Metrics.ARCHIVER_CHECKPOINT_PROMOTED_COUNT);
@@ -159,11 +165,14 @@ export class ArchiverInstrumentation {
159
165
  /**
160
166
  * Records a pending-chain reorg, where the archiver dropped proposed blocks (and world-state follows by pruning). The
161
167
  * type distinguishes the cause: 'uncheckpointed' (slot ended without a checkpoint), 'l1_conflict' (proposed blocks
162
- * conflicting with an L1 checkpoint), 'orphan' (no matching proposed checkpoint arrived before the deadline), or
163
- * 'l1_mismatch' (the local checkpointed tip diverged from L1 — an L1 reorg or a pruned/missed-proof checkpoint — so
168
+ * conflicting with an L1 checkpoint), 'orphan' (no matching proposed checkpoint arrived before the deadline),
169
+ * 'abandoned' (this node's own sequencer gave up the checkpoint before proposing it), or 'l1_mismatch' (the local
170
+ * checkpointed tip diverged from L1 — an L1 reorg or a pruned/missed-proof checkpoint — so
164
171
  * already-checkpointed blocks were rewound).
165
172
  */
166
- public recordPrune(pruneType: 'uncheckpointed' | 'l1_conflict' | 'orphan' | 'l1_mismatch' | 'inbox_reorg') {
173
+ public recordPrune(
174
+ pruneType: 'uncheckpointed' | 'l1_conflict' | 'orphan' | 'abandoned' | 'l1_mismatch' | 'inbox_reorg',
175
+ ) {
167
176
  this.pruneCount.add(1, { [Attributes.PRUNE_TYPE]: pruneType });
168
177
  }
169
178
 
@@ -197,6 +206,11 @@ export class ArchiverInstrumentation {
197
206
  });
198
207
  }
199
208
 
209
+ /** Records a failed attempt to extract a checkpoint's propose calldata because the L1 tx could not be traced. */
210
+ public recordCheckpointCalldataUnavailable() {
211
+ this.checkpointCalldataUnavailableCount.add(1);
212
+ }
213
+
200
214
  /** Records a checkpoint promoted from proposed (blob fetch skipped). */
201
215
  public processCheckpointPromoted() {
202
216
  this.checkpointPromotedCount.add(1);