@aztec/archiver 0.0.1-commit.5914bae → 0.0.1-commit.59a0419c6

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 (95) hide show
  1. package/README.md +12 -6
  2. package/dest/archiver.d.ts +7 -5
  3. package/dest/archiver.d.ts.map +1 -1
  4. package/dest/archiver.js +18 -5
  5. package/dest/config.d.ts +5 -3
  6. package/dest/config.d.ts.map +1 -1
  7. package/dest/config.js +15 -3
  8. package/dest/errors.d.ts +44 -2
  9. package/dest/errors.d.ts.map +1 -1
  10. package/dest/errors.js +58 -2
  11. package/dest/factory.d.ts +2 -2
  12. package/dest/factory.d.ts.map +1 -1
  13. package/dest/factory.js +3 -4
  14. package/dest/index.d.ts +3 -2
  15. package/dest/index.d.ts.map +1 -1
  16. package/dest/index.js +2 -1
  17. package/dest/l1/calldata_retriever.d.ts +1 -1
  18. package/dest/l1/calldata_retriever.d.ts.map +1 -1
  19. package/dest/l1/calldata_retriever.js +2 -1
  20. package/dest/l1/data_retrieval.d.ts +24 -12
  21. package/dest/l1/data_retrieval.d.ts.map +1 -1
  22. package/dest/l1/data_retrieval.js +36 -37
  23. package/dest/l1/validate_historical_logs.d.ts +23 -0
  24. package/dest/l1/validate_historical_logs.d.ts.map +1 -0
  25. package/dest/l1/validate_historical_logs.js +108 -0
  26. package/dest/modules/data_source_base.d.ts +6 -4
  27. package/dest/modules/data_source_base.d.ts.map +1 -1
  28. package/dest/modules/data_source_base.js +10 -4
  29. package/dest/modules/data_store_updater.d.ts +15 -10
  30. package/dest/modules/data_store_updater.d.ts.map +1 -1
  31. package/dest/modules/data_store_updater.js +27 -59
  32. package/dest/modules/instrumentation.d.ts +18 -2
  33. package/dest/modules/instrumentation.d.ts.map +1 -1
  34. package/dest/modules/instrumentation.js +32 -6
  35. package/dest/modules/l1_synchronizer.d.ts +6 -2
  36. package/dest/modules/l1_synchronizer.d.ts.map +1 -1
  37. package/dest/modules/l1_synchronizer.js +248 -149
  38. package/dest/modules/validation.d.ts +1 -1
  39. package/dest/modules/validation.d.ts.map +1 -1
  40. package/dest/modules/validation.js +2 -2
  41. package/dest/store/block_store.d.ts +46 -5
  42. package/dest/store/block_store.d.ts.map +1 -1
  43. package/dest/store/block_store.js +225 -63
  44. package/dest/store/contract_class_store.d.ts +2 -3
  45. package/dest/store/contract_class_store.d.ts.map +1 -1
  46. package/dest/store/contract_class_store.js +1 -65
  47. package/dest/store/kv_archiver_store.d.ts +35 -14
  48. package/dest/store/kv_archiver_store.d.ts.map +1 -1
  49. package/dest/store/kv_archiver_store.js +40 -14
  50. package/dest/store/l2_tips_cache.d.ts +2 -1
  51. package/dest/store/l2_tips_cache.d.ts.map +1 -1
  52. package/dest/store/l2_tips_cache.js +27 -7
  53. package/dest/store/log_store.d.ts +6 -3
  54. package/dest/store/log_store.d.ts.map +1 -1
  55. package/dest/store/log_store.js +47 -10
  56. package/dest/store/message_store.d.ts +5 -1
  57. package/dest/store/message_store.d.ts.map +1 -1
  58. package/dest/store/message_store.js +20 -8
  59. package/dest/test/fake_l1_state.d.ts +7 -3
  60. package/dest/test/fake_l1_state.d.ts.map +1 -1
  61. package/dest/test/fake_l1_state.js +50 -10
  62. package/dest/test/mock_l1_to_l2_message_source.d.ts +1 -1
  63. package/dest/test/mock_l1_to_l2_message_source.d.ts.map +1 -1
  64. package/dest/test/mock_l1_to_l2_message_source.js +2 -1
  65. package/dest/test/mock_l2_block_source.d.ts +7 -2
  66. package/dest/test/mock_l2_block_source.d.ts.map +1 -1
  67. package/dest/test/mock_l2_block_source.js +28 -3
  68. package/dest/test/noop_l1_archiver.d.ts +1 -1
  69. package/dest/test/noop_l1_archiver.d.ts.map +1 -1
  70. package/dest/test/noop_l1_archiver.js +4 -2
  71. package/package.json +13 -13
  72. package/src/archiver.ts +33 -8
  73. package/src/config.ts +22 -2
  74. package/src/errors.ts +94 -2
  75. package/src/factory.ts +2 -3
  76. package/src/index.ts +2 -1
  77. package/src/l1/calldata_retriever.ts +2 -1
  78. package/src/l1/data_retrieval.ts +52 -53
  79. package/src/l1/validate_historical_logs.ts +140 -0
  80. package/src/modules/data_source_base.ts +23 -4
  81. package/src/modules/data_store_updater.ts +43 -85
  82. package/src/modules/instrumentation.ts +47 -7
  83. package/src/modules/l1_synchronizer.ts +321 -185
  84. package/src/modules/validation.ts +2 -2
  85. package/src/store/block_store.ts +295 -73
  86. package/src/store/contract_class_store.ts +1 -103
  87. package/src/store/kv_archiver_store.ts +67 -24
  88. package/src/store/l2_tips_cache.ts +58 -13
  89. package/src/store/log_store.ts +62 -20
  90. package/src/store/message_store.ts +26 -9
  91. package/src/structs/inbox_message.ts +1 -1
  92. package/src/test/fake_l1_state.ts +72 -15
  93. package/src/test/mock_l1_to_l2_message_source.ts +1 -0
  94. package/src/test/mock_l2_block_source.ts +37 -2
  95. package/src/test/noop_l1_archiver.ts +3 -1
@@ -23,4 +23,4 @@ export declare class NoopL1Archiver extends Archiver {
23
23
  export declare function createNoopL1Archiver(dataStore: KVArchiverDataStore, l1Constants: L1RollupConstants & {
24
24
  genesisArchiveRoot: Fr;
25
25
  }, telemetry?: TelemetryClient): Promise<NoopL1Archiver>;
26
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibm9vcF9sMV9hcmNoaXZlci5kLnRzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vc3JjL3Rlc3Qvbm9vcF9sMV9hcmNoaXZlci50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFHQSxPQUFPLEVBQUUsVUFBVSxFQUFFLE1BQU0saUNBQWlDLENBQUM7QUFFN0QsT0FBTyxFQUFFLEVBQUUsRUFBRSxNQUFNLGdDQUFnQyxDQUFDO0FBSXBELE9BQU8sS0FBSyxFQUFFLGlCQUFpQixFQUFFLE1BQU0sNkJBQTZCLENBQUM7QUFDckUsT0FBTyxFQUFFLEtBQUssZUFBZSxFQUFtQyxNQUFNLH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FPLENBQUMsY0FBYyxDQUFDLENBR3pCIn0=
@@ -1 +1 @@
1
- {"version":3,"file":"noop_l1_archiver.d.ts","sourceRoot":"","sources":["../../src/test/noop_l1_archiver.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,UAAU,EAAE,MAAM,iCAAiC,CAAC;AAE7D,OAAO,EAAE,EAAE,EAAE,MAAM,gCAAgC,CAAC;AAIpD,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,6BAA6B,CAAC;AACrE,OAAO,EAAE,KAAK,eAAe,EAAmC,MAAM,yBAAyB,CAAC;AAKhG,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAC1C,OAAO,EAAE,uBAAuB,EAAE,MAAM,+BAA+B,CAAC;AAExE,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,+BAA+B,CAAC;AAyBzE;;;;GAIG;AACH,qBAAa,cAAe,SAAQ,QAAQ;IAC1C,YACE,SAAS,EAAE,mBAAmB,EAC9B,WAAW,EAAE,iBAAiB,GAAG;QAAE,kBAAkB,EAAE,EAAE,CAAA;KAAE,EAC3D,eAAe,EAAE,uBAAuB,EAuCzC;IAED,mDAAmD;IACnC,KAAK,CAAC,iBAAiB,CAAC,EAAE,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC,CAIhE;IAED,6EAA6E;IAC7D,qBAAqB,IAAI,OAAO,CAAC,UAAU,GAAG,SAAS,CAAC,CAEvE;CACF;AAED,mEAAmE;AACnE,wBAAsB,oBAAoB,CACxC,SAAS,EAAE,mBAAmB,EAC9B,WAAW,EAAE,iBAAiB,GAAG;IAAE,kBAAkB,EAAE,EAAE,CAAA;CAAE,EAC3D,SAAS,GAAE,eAAsC,GAChD,OAAO,CAAC,cAAc,CAAC,CAGzB"}
1
+ {"version":3,"file":"noop_l1_archiver.d.ts","sourceRoot":"","sources":["../../src/test/noop_l1_archiver.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,UAAU,EAAE,MAAM,iCAAiC,CAAC;AAE7D,OAAO,EAAE,EAAE,EAAE,MAAM,gCAAgC,CAAC;AAIpD,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,6BAA6B,CAAC;AACrE,OAAO,EAAE,KAAK,eAAe,EAAmC,MAAM,yBAAyB,CAAC;AAKhG,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAC1C,OAAO,EAAE,uBAAuB,EAAE,MAAM,+BAA+B,CAAC;AAExE,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,+BAA+B,CAAC;AAyBzE;;;;GAIG;AACH,qBAAa,cAAe,SAAQ,QAAQ;IAC1C,YACE,SAAS,EAAE,mBAAmB,EAC9B,WAAW,EAAE,iBAAiB,GAAG;QAAE,kBAAkB,EAAE,EAAE,CAAA;KAAE,EAC3D,eAAe,EAAE,uBAAuB,EAyCzC;IAED,mDAAmD;IACnC,KAAK,CAAC,iBAAiB,CAAC,EAAE,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC,CAIhE;IAED,6EAA6E;IAC7D,qBAAqB,IAAI,OAAO,CAAC,UAAU,GAAG,SAAS,CAAC,CAEvE;CACF;AAED,mEAAmE;AACnE,wBAAsB,oBAAoB,CACxC,SAAS,EAAE,mBAAmB,EAC9B,WAAW,EAAE,iBAAiB,GAAG;IAAE,kBAAkB,EAAE,EAAE,CAAA;CAAE,EAC3D,SAAS,GAAE,eAAsC,GAChD,OAAO,CAAC,cAAc,CAAC,CAGzB"}
@@ -42,16 +42,18 @@ import { ArchiverInstrumentation } from '../modules/instrumentation.js';
42
42
  const events = new EventEmitter();
43
43
  const synchronizer = new NoopL1Synchronizer(instrumentation.tracer);
44
44
  super(publicClient, debugClient, rollup, {
45
+ rollupAddress: EthAddress.ZERO,
45
46
  registryAddress: EthAddress.ZERO,
47
+ inboxAddress: EthAddress.ZERO,
46
48
  governanceProposerAddress: EthAddress.ZERO,
47
- slashFactoryAddress: EthAddress.ZERO,
48
49
  slashingProposerAddress: EthAddress.ZERO
49
50
  }, dataStore, {
50
51
  pollingIntervalMs: 1000,
51
52
  batchSize: 100,
52
53
  skipValidateCheckpointAttestations: true,
53
54
  maxAllowedEthClientDriftSeconds: 300,
54
- ethereumAllowNoDebugHosts: true
55
+ ethereumAllowNoDebugHosts: true,
56
+ skipHistoricalLogsCheck: true
55
57
  }, blobClient, instrumentation, {
56
58
  ...l1Constants,
57
59
  l1StartBlockHash: Buffer32.random()
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aztec/archiver",
3
- "version": "0.0.1-commit.5914bae",
3
+ "version": "0.0.1-commit.59a0419c6",
4
4
  "type": "module",
5
5
  "exports": {
6
6
  ".": "./dest/index.js",
@@ -65,18 +65,18 @@
65
65
  ]
66
66
  },
67
67
  "dependencies": {
68
- "@aztec/blob-client": "0.0.1-commit.5914bae",
69
- "@aztec/blob-lib": "0.0.1-commit.5914bae",
70
- "@aztec/constants": "0.0.1-commit.5914bae",
71
- "@aztec/epoch-cache": "0.0.1-commit.5914bae",
72
- "@aztec/ethereum": "0.0.1-commit.5914bae",
73
- "@aztec/foundation": "0.0.1-commit.5914bae",
74
- "@aztec/kv-store": "0.0.1-commit.5914bae",
75
- "@aztec/l1-artifacts": "0.0.1-commit.5914bae",
76
- "@aztec/noir-protocol-circuits-types": "0.0.1-commit.5914bae",
77
- "@aztec/protocol-contracts": "0.0.1-commit.5914bae",
78
- "@aztec/stdlib": "0.0.1-commit.5914bae",
79
- "@aztec/telemetry-client": "0.0.1-commit.5914bae",
68
+ "@aztec/blob-client": "0.0.1-commit.59a0419c6",
69
+ "@aztec/blob-lib": "0.0.1-commit.59a0419c6",
70
+ "@aztec/constants": "0.0.1-commit.59a0419c6",
71
+ "@aztec/epoch-cache": "0.0.1-commit.59a0419c6",
72
+ "@aztec/ethereum": "0.0.1-commit.59a0419c6",
73
+ "@aztec/foundation": "0.0.1-commit.59a0419c6",
74
+ "@aztec/kv-store": "0.0.1-commit.59a0419c6",
75
+ "@aztec/l1-artifacts": "0.0.1-commit.59a0419c6",
76
+ "@aztec/noir-protocol-circuits-types": "0.0.1-commit.59a0419c6",
77
+ "@aztec/protocol-contracts": "0.0.1-commit.59a0419c6",
78
+ "@aztec/stdlib": "0.0.1-commit.59a0419c6",
79
+ "@aztec/telemetry-client": "0.0.1-commit.59a0419c6",
80
80
  "lodash.groupby": "^4.6.0",
81
81
  "lodash.omit": "^4.5.0",
82
82
  "tslib": "^2.5.0",
package/src/archiver.ts CHANGED
@@ -11,7 +11,7 @@ import { EthAddress } from '@aztec/foundation/eth-address';
11
11
  import { type Logger, createLogger } from '@aztec/foundation/log';
12
12
  import { type PromiseWithResolvers, promiseWithResolvers } from '@aztec/foundation/promise';
13
13
  import { RunningPromise, makeLoggingErrorHandler } from '@aztec/foundation/running-promise';
14
- import { DateProvider } from '@aztec/foundation/timer';
14
+ import { DateProvider, elapsed } from '@aztec/foundation/timer';
15
15
  import {
16
16
  type ArchiverEmitter,
17
17
  L2Block,
@@ -19,7 +19,7 @@ import {
19
19
  type L2Tips,
20
20
  type ValidateCheckpointResult,
21
21
  } from '@aztec/stdlib/block';
22
- import { PublishedCheckpoint } from '@aztec/stdlib/checkpoint';
22
+ import { type ProposedCheckpointInput, PublishedCheckpoint } from '@aztec/stdlib/checkpoint';
23
23
  import {
24
24
  type L1RollupConstants,
25
25
  getEpochAtSlot,
@@ -31,6 +31,7 @@ import { type TelemetryClient, type Traceable, type Tracer, trackSpan } from '@a
31
31
 
32
32
  import { type ArchiverConfig, mapArchiverConfig } from './config.js';
33
33
  import { BlockAlreadyCheckpointedError, NoBlobBodiesFoundError } from './errors.js';
34
+ import { validateAndLogHistoricalLogsAvailability } from './l1/validate_historical_logs.js';
34
35
  import { validateAndLogTraceAvailability } from './l1/validate_trace.js';
35
36
  import { ArchiverDataSourceBase } from './modules/data_source_base.js';
36
37
  import { ArchiverDataStoreUpdater } from './modules/data_store_updater.js';
@@ -85,17 +86,18 @@ export class Archiver extends ArchiverDataSourceBase implements L2BlockSink, Tra
85
86
 
86
87
  public readonly tracer: Tracer;
87
88
 
89
+ private readonly instrumentation: ArchiverInstrumentation;
90
+
88
91
  /**
89
92
  * Creates a new instance of the Archiver.
90
93
  * @param publicClient - A client for interacting with the Ethereum node.
91
94
  * @param debugClient - A client for interacting with the Ethereum node for debug/trace methods.
92
95
  * @param rollup - Rollup contract instance.
93
96
  * @param inbox - Inbox contract instance.
94
- * @param l1Addresses - L1 contract addresses (registry, governance proposer, slash factory, slashing proposer).
97
+ * @param l1Addresses - L1 contract addresses (registry, governance proposer, slashing proposer).
95
98
  * @param dataStore - An archiver data store for storage & retrieval of blocks, encrypted logs & contract data.
96
99
  * @param config - Archiver configuration options.
97
100
  * @param blobClient - Client for retrieving blob data.
98
- * @param epochCache - Cache for epoch-related data.
99
101
  * @param dateProvider - Provider for current date/time.
100
102
  * @param instrumentation - Instrumentation for metrics and tracing.
101
103
  * @param l1Constants - L1 rollup constants.
@@ -107,8 +109,10 @@ export class Archiver extends ArchiverDataSourceBase implements L2BlockSink, Tra
107
109
  private readonly rollup: RollupContract,
108
110
  private readonly l1Addresses: Pick<
109
111
  L1ContractAddresses,
110
- 'registryAddress' | 'governanceProposerAddress' | 'slashFactoryAddress'
111
- > & { slashingProposerAddress: EthAddress },
112
+ 'rollupAddress' | 'registryAddress' | 'inboxAddress' | 'governanceProposerAddress'
113
+ > & {
114
+ slashingProposerAddress: EthAddress;
115
+ },
112
116
  readonly dataStore: KVArchiverDataStore,
113
117
  private config: {
114
118
  pollingIntervalMs: number;
@@ -116,6 +120,7 @@ export class Archiver extends ArchiverDataSourceBase implements L2BlockSink, Tra
116
120
  skipValidateCheckpointAttestations?: boolean;
117
121
  maxAllowedEthClientDriftSeconds: number;
118
122
  ethereumAllowNoDebugHosts?: boolean;
123
+ skipHistoricalLogsCheck?: boolean;
119
124
  },
120
125
  private readonly blobClient: BlobClientInterface,
121
126
  instrumentation: ArchiverInstrumentation,
@@ -131,6 +136,7 @@ export class Archiver extends ArchiverDataSourceBase implements L2BlockSink, Tra
131
136
  super(dataStore, l1Constants);
132
137
 
133
138
  this.tracer = instrumentation.tracer;
139
+ this.instrumentation = instrumentation;
134
140
  this.initialSyncPromise = promiseWithResolvers();
135
141
  this.synchronizer = synchronizer;
136
142
  this.events = events;
@@ -171,6 +177,17 @@ export class Archiver extends ArchiverDataSourceBase implements L2BlockSink, Tra
171
177
  this.config.ethereumAllowNoDebugHosts ?? false,
172
178
  this.log.getBindings(),
173
179
  );
180
+ await validateAndLogHistoricalLogsAvailability(
181
+ this.publicClient,
182
+ {
183
+ rollupAddress: this.l1Addresses.rollupAddress,
184
+ inboxAddress: this.l1Addresses.inboxAddress,
185
+ registryAddress: this.l1Addresses.registryAddress,
186
+ governanceProposerAddress: this.l1Addresses.governanceProposerAddress,
187
+ },
188
+ this.config.skipHistoricalLogsCheck ?? false,
189
+ this.log.getBindings(),
190
+ );
174
191
 
175
192
  // Log initial state for the archiver
176
193
  const { l1StartBlock } = this.l1Constants;
@@ -210,6 +227,10 @@ export class Archiver extends ArchiverDataSourceBase implements L2BlockSink, Tra
210
227
  });
211
228
  }
212
229
 
230
+ public async setProposedCheckpoint(pending: ProposedCheckpointInput): Promise<void> {
231
+ await this.updater.setProposedCheckpoint(pending);
232
+ }
233
+
213
234
  /**
214
235
  * Processes all queued blocks, adding them to the store.
215
236
  * Called at the beginning of each sync iteration.
@@ -242,7 +263,8 @@ export class Archiver extends ArchiverDataSourceBase implements L2BlockSink, Tra
242
263
  }
243
264
 
244
265
  try {
245
- await this.updater.addProposedBlock(block);
266
+ const [durationMs] = await elapsed(() => this.updater.addProposedBlock(block));
267
+ this.instrumentation.processNewProposedBlock(durationMs, block);
246
268
  this.log.debug(`Added block ${block.number} to store`);
247
269
  resolve();
248
270
  } catch (err: any) {
@@ -487,7 +509,10 @@ export class Archiver extends ArchiverDataSourceBase implements L2BlockSink, Tra
487
509
  await this.store.rollbackL1ToL2MessagesToCheckpoint(targetCheckpointNumber);
488
510
  this.log.info(`Setting L1 syncpoints to ${targetL1BlockNumber}`);
489
511
  await this.store.setCheckpointSynchedL1BlockNumber(targetL1BlockNumber);
490
- await this.store.setMessageSynchedL1Block({ l1BlockNumber: targetL1BlockNumber, l1BlockHash: targetL1BlockHash });
512
+ await this.store.setMessageSyncState(
513
+ { l1BlockNumber: targetL1BlockNumber, l1BlockHash: targetL1BlockHash },
514
+ undefined,
515
+ );
491
516
  if (targetL2BlockNumber < currentProvenBlock) {
492
517
  this.log.info(`Rolling back proven L2 checkpoint to ${targetCheckpointNumber}`);
493
518
  await this.updater.setProvenCheckpointNumber(targetCheckpointNumber);
package/src/config.ts CHANGED
@@ -8,7 +8,12 @@ import {
8
8
  getConfigFromMappings,
9
9
  numberConfigHelper,
10
10
  } from '@aztec/foundation/config';
11
- import { type ChainConfig, chainConfigMappings } from '@aztec/stdlib/config';
11
+ import {
12
+ type ChainConfig,
13
+ type PipelineConfig,
14
+ chainConfigMappings,
15
+ pipelineConfigMappings,
16
+ } from '@aztec/stdlib/config';
12
17
  import type { ArchiverSpecificConfig } from '@aztec/stdlib/interfaces/server';
13
18
 
14
19
  /**
@@ -21,11 +26,13 @@ import type { ArchiverSpecificConfig } from '@aztec/stdlib/interfaces/server';
21
26
  export type ArchiverConfig = ArchiverSpecificConfig &
22
27
  L1ReaderConfig &
23
28
  L1ContractsConfig &
29
+ PipelineConfig & // required to pass through to epoch cache
24
30
  BlobClientConfig &
25
31
  ChainConfig;
26
32
 
27
33
  export const archiverConfigMappings: ConfigMappingsType<ArchiverConfig> = {
28
34
  ...blobClientConfigMapping,
35
+ ...pipelineConfigMappings,
29
36
  archiverPollingIntervalMS: {
30
37
  env: 'ARCHIVER_POLLING_INTERVAL_MS',
31
38
  description: 'The polling interval in ms for retrieving new L2 blocks and encrypted logs.',
@@ -43,13 +50,17 @@ export const archiverConfigMappings: ConfigMappingsType<ArchiverConfig> = {
43
50
  },
44
51
  archiverStoreMapSizeKb: {
45
52
  env: 'ARCHIVER_STORE_MAP_SIZE_KB',
46
- parseEnv: (val: string | undefined) => (val ? +val : undefined),
53
+ parseEnv: (val: string) => +val,
47
54
  description: 'The maximum possible size of the archiver DB in KB. Overwrites the general dataStoreMapSizeKb.',
48
55
  },
49
56
  skipValidateCheckpointAttestations: {
50
57
  description: 'Skip validating checkpoint attestations (for testing purposes only)',
51
58
  ...booleanConfigHelper(false),
52
59
  },
60
+ skipPromoteProposedCheckpointDuringL1Sync: {
61
+ description: 'Skip promoting proposed checkpoints during L1 sync (for testing purposes only)',
62
+ ...booleanConfigHelper(false),
63
+ },
53
64
  maxAllowedEthClientDriftSeconds: {
54
65
  env: 'MAX_ALLOWED_ETH_CLIENT_DRIFT_SECONDS',
55
66
  description: 'Maximum allowed drift in seconds between the Ethereum client and current time.',
@@ -60,6 +71,13 @@ export const archiverConfigMappings: ConfigMappingsType<ArchiverConfig> = {
60
71
  description: 'Whether to allow starting the archiver without debug/trace method support on Ethereum hosts',
61
72
  ...booleanConfigHelper(true),
62
73
  },
74
+ archiverSkipHistoricalLogsCheck: {
75
+ env: 'ARCHIVER_SKIP_HISTORICAL_LOGS_CHECK',
76
+ description:
77
+ 'Skip the startup check that probes the L1 RPC for historical Rollup contract logs. ' +
78
+ 'Set to true to bypass the check when the connected RPC node is known to prune old logs.',
79
+ ...booleanConfigHelper(false),
80
+ },
63
81
  ...chainConfigMappings,
64
82
  ...l1ReaderConfigMappings,
65
83
  viemPollingIntervalMS: {
@@ -89,7 +107,9 @@ export function mapArchiverConfig(config: Partial<ArchiverConfig>) {
89
107
  pollingIntervalMs: config.archiverPollingIntervalMS,
90
108
  batchSize: config.archiverBatchSize,
91
109
  skipValidateCheckpointAttestations: config.skipValidateCheckpointAttestations,
110
+ skipPromoteProposedCheckpointDuringL1Sync: config.skipPromoteProposedCheckpointDuringL1Sync,
92
111
  maxAllowedEthClientDriftSeconds: config.maxAllowedEthClientDriftSeconds,
93
112
  ethereumAllowNoDebugHosts: config.ethereumAllowNoDebugHosts,
113
+ skipHistoricalLogsCheck: config.archiverSkipHistoricalLogsCheck,
94
114
  };
95
115
  }
package/src/errors.ts CHANGED
@@ -26,9 +26,13 @@ export class InitialCheckpointNumberNotSequentialError extends Error {
26
26
  }
27
27
 
28
28
  export class CheckpointNumberNotSequentialError extends Error {
29
- constructor(newCheckpointNumber: number, previous: number | undefined) {
29
+ constructor(
30
+ newCheckpointNumber: number,
31
+ previous: number | undefined,
32
+ source: 'confirmed' | 'proposed' = 'confirmed',
33
+ ) {
30
34
  super(
31
- `Cannot insert new checkpoint ${newCheckpointNumber} given previous checkpoint number in batch is ${previous ?? 'undefined'}`,
35
+ `Cannot insert new checkpoint ${newCheckpointNumber} given previous ${source} checkpoint number is ${previous ?? 'undefined'}`,
32
36
  );
33
37
  }
34
38
  }
@@ -74,6 +78,94 @@ export class BlockAlreadyCheckpointedError extends Error {
74
78
  }
75
79
  }
76
80
 
81
+ /** Thrown when logs are added for a tag whose last stored log has a higher block number than the new log. */
82
+ export class OutOfOrderLogInsertionError extends Error {
83
+ constructor(
84
+ public readonly logType: 'private' | 'public',
85
+ public readonly tag: string,
86
+ public readonly lastBlockNumber: number,
87
+ public readonly newBlockNumber: number,
88
+ ) {
89
+ super(
90
+ `Out-of-order ${logType} log insertion for tag ${tag}: ` +
91
+ `last existing log is from block ${lastBlockNumber} but new log is from block ${newBlockNumber}`,
92
+ );
93
+ this.name = 'OutOfOrderLogInsertionError';
94
+ }
95
+ }
96
+
97
+ /** Thrown when L1 to L2 messages are requested for a checkpoint whose message tree hasn't been sealed yet. */
98
+ export class L1ToL2MessagesNotReadyError extends Error {
99
+ constructor(
100
+ public readonly checkpointNumber: number,
101
+ public readonly inboxTreeInProgress: bigint,
102
+ ) {
103
+ super(
104
+ `Cannot get L1 to L2 messages for checkpoint ${checkpointNumber}: ` +
105
+ `inbox tree in progress is ${inboxTreeInProgress}, messages not yet sealed`,
106
+ );
107
+ this.name = 'L1ToL2MessagesNotReadyError';
108
+ }
109
+ }
110
+
111
+ /** Thrown when a proposed checkpoint number is stale (already processed). */
112
+ export class ProposedCheckpointStaleError extends Error {
113
+ constructor(
114
+ public readonly proposedCheckpointNumber: number,
115
+ public readonly currentProposedNumber: number,
116
+ ) {
117
+ super(`Stale proposed checkpoint ${proposedCheckpointNumber}: current proposed is ${currentProposedNumber}`);
118
+ this.name = 'ProposedCheckpointStaleError';
119
+ }
120
+ }
121
+
122
+ /** Thrown when a proposed checkpoint number is not the expected confirmed + 1. */
123
+ export class ProposedCheckpointNotSequentialError extends Error {
124
+ constructor(
125
+ public readonly proposedCheckpointNumber: number,
126
+ public readonly confirmedCheckpointNumber: number,
127
+ ) {
128
+ super(
129
+ `Proposed checkpoint ${proposedCheckpointNumber} is not sequential: expected ${confirmedCheckpointNumber + 1} (confirmed + 1)`,
130
+ );
131
+ this.name = 'ProposedCheckpointNotSequentialError';
132
+ }
133
+ }
134
+
135
+ /** Thrown when attempting to promote a proposed checkpoint but no proposed checkpoint exists in the store. */
136
+ export class NoProposedCheckpointToPromoteError extends Error {
137
+ constructor() {
138
+ super('Cannot promote proposed checkpoint: no proposed checkpoint exists');
139
+ this.name = 'NoProposedCheckpointToPromoteError';
140
+ }
141
+ }
142
+
143
+ /** Thrown when the archive root of the proposed checkpoint does not match the expected one. */
144
+ export class ProposedCheckpointArchiveRootMismatchError extends Error {
145
+ constructor(
146
+ public readonly expectedArchiveRoot: Fr,
147
+ public readonly actualArchiveRoot: Fr,
148
+ ) {
149
+ super(
150
+ `Cannot promote proposed checkpoint: archive root mismatch (expected ${expectedArchiveRoot}, got ${actualArchiveRoot})`,
151
+ );
152
+ this.name = 'ProposedCheckpointArchiveRootMismatchError';
153
+ }
154
+ }
155
+
156
+ /** Thrown when the proposed checkpoint does not directly follow the latest confirmed checkpoint. */
157
+ export class ProposedCheckpointPromotionNotSequentialError extends Error {
158
+ constructor(
159
+ public readonly proposedCheckpointNumber: number,
160
+ public readonly latestCheckpointNumber: number,
161
+ ) {
162
+ super(
163
+ `Cannot promote proposed checkpoint: not sequential (latest ${latestCheckpointNumber}, proposed ${proposedCheckpointNumber})`,
164
+ );
165
+ this.name = 'ProposedCheckpointPromotionNotSequentialError';
166
+ }
167
+ }
168
+
77
169
  /** Thrown when a proposed block conflicts with an already checkpointed block (different content). */
78
170
  export class CannotOverwriteCheckpointedBlockError extends Error {
79
171
  constructor(
package/src/factory.ts CHANGED
@@ -8,13 +8,13 @@ import { Buffer32 } from '@aztec/foundation/buffer';
8
8
  import { merge } from '@aztec/foundation/collection';
9
9
  import { Fr } from '@aztec/foundation/curves/bn254';
10
10
  import { DateProvider } from '@aztec/foundation/timer';
11
- import type { DataStoreConfig } from '@aztec/kv-store/config';
12
11
  import { createStore } from '@aztec/kv-store/lmdb-v2';
13
12
  import { protocolContractNames } from '@aztec/protocol-contracts';
14
13
  import { BundledProtocolContractsProvider } from '@aztec/protocol-contracts/providers/bundle';
15
14
  import { FunctionType, decodeFunctionSignature } from '@aztec/stdlib/abi';
16
15
  import type { ArchiverEmitter } from '@aztec/stdlib/block';
17
16
  import { type ContractClassPublicWithCommitment, computePublicBytecodeCommitment } from '@aztec/stdlib/contract';
17
+ import type { DataStoreConfig } from '@aztec/stdlib/kv-store';
18
18
  import { getTelemetryClient } from '@aztec/telemetry-client';
19
19
 
20
20
  import { EventEmitter } from 'events';
@@ -121,6 +121,7 @@ export async function createArchiver(
121
121
  batchSize: 100,
122
122
  maxAllowedEthClientDriftSeconds: 300,
123
123
  ethereumAllowNoDebugHosts: false,
124
+ skipHistoricalLogsCheck: false,
124
125
  },
125
126
  mapArchiverConfig(config),
126
127
  );
@@ -189,8 +190,6 @@ export async function registerProtocolContracts(store: KVArchiverDataStore) {
189
190
  const contractClassPublic: ContractClassPublicWithCommitment = {
190
191
  ...contract.contractClass,
191
192
  publicBytecodeCommitment,
192
- privateFunctions: [],
193
- utilityFunctions: [],
194
193
  };
195
194
 
196
195
  const publicFunctionSignatures = contract.artifact.functions
package/src/index.ts CHANGED
@@ -10,4 +10,5 @@ export { KVArchiverDataStore, ARCHIVER_DB_VERSION } from './store/kv_archiver_st
10
10
  export { ContractInstanceStore } from './store/contract_instance_store.js';
11
11
  export { L2TipsCache } from './store/l2_tips_cache.js';
12
12
 
13
- export { retrieveCheckpointsFromRollup, retrieveL2ProofVerifiedEvents } from './l1/data_retrieval.js';
13
+ export { retrieveL2ProofVerifiedEvents } from './l1/data_retrieval.js';
14
+ export { CalldataRetriever } from './l1/calldata_retriever.js';
@@ -1,6 +1,7 @@
1
1
  import { MULTI_CALL_3_ADDRESS, type ViemCommitteeAttestations, type ViemHeader } from '@aztec/ethereum/contracts';
2
2
  import type { ViemPublicClient, ViemPublicDebugClient } from '@aztec/ethereum/types';
3
3
  import { CheckpointNumber } from '@aztec/foundation/branded-types';
4
+ import { LruSet } from '@aztec/foundation/collection';
4
5
  import { Fr } from '@aztec/foundation/curves/bn254';
5
6
  import { EthAddress } from '@aztec/foundation/eth-address';
6
7
  import type { Logger } from '@aztec/foundation/log';
@@ -44,7 +45,7 @@ type CheckpointData = {
44
45
  */
45
46
  export class CalldataRetriever {
46
47
  /** Tx hashes we've already logged for trace+debug failure (log once per tx per process). */
47
- private static readonly traceFailureWarnedTxHashes = new Set<string>();
48
+ private static readonly traceFailureWarnedTxHashes = new LruSet<string>(1000);
48
49
 
49
50
  /** Clears the trace-failure warned set. For testing only. */
50
51
  static resetTraceFailureWarnedForTesting(): void {