@aztec/archiver 3.0.0-nightly.20251209 → 3.0.0-nightly.20251211

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 (108) hide show
  1. package/dest/archiver/archiver.d.ts +16 -14
  2. package/dest/archiver/archiver.d.ts.map +1 -1
  3. package/dest/archiver/archiver.js +59 -28
  4. package/dest/archiver/archiver_store.d.ts +9 -9
  5. package/dest/archiver/archiver_store.d.ts.map +1 -1
  6. package/dest/archiver/archiver_store_test_suite.d.ts +1 -1
  7. package/dest/archiver/archiver_store_test_suite.d.ts.map +1 -1
  8. package/dest/archiver/archiver_store_test_suite.js +47 -46
  9. package/dest/archiver/config.d.ts +3 -2
  10. package/dest/archiver/config.d.ts.map +1 -1
  11. package/dest/archiver/config.js +8 -1
  12. package/dest/archiver/instrumentation.d.ts +3 -1
  13. package/dest/archiver/instrumentation.d.ts.map +1 -1
  14. package/dest/archiver/instrumentation.js +11 -0
  15. package/dest/archiver/kv_archiver_store/block_store.d.ts +2 -2
  16. package/dest/archiver/kv_archiver_store/block_store.d.ts.map +1 -1
  17. package/dest/archiver/kv_archiver_store/block_store.js +1 -1
  18. package/dest/archiver/kv_archiver_store/contract_class_store.d.ts +2 -2
  19. package/dest/archiver/kv_archiver_store/contract_class_store.d.ts.map +1 -1
  20. package/dest/archiver/kv_archiver_store/contract_class_store.js +1 -1
  21. package/dest/archiver/kv_archiver_store/contract_instance_store.d.ts +2 -2
  22. package/dest/archiver/kv_archiver_store/contract_instance_store.d.ts.map +1 -1
  23. package/dest/archiver/kv_archiver_store/kv_archiver_store.d.ts +8 -8
  24. package/dest/archiver/kv_archiver_store/kv_archiver_store.d.ts.map +1 -1
  25. package/dest/archiver/kv_archiver_store/kv_archiver_store.js +6 -6
  26. package/dest/archiver/kv_archiver_store/log_store.d.ts +2 -2
  27. package/dest/archiver/kv_archiver_store/log_store.d.ts.map +1 -1
  28. package/dest/archiver/kv_archiver_store/message_store.d.ts +6 -5
  29. package/dest/archiver/kv_archiver_store/message_store.d.ts.map +1 -1
  30. package/dest/archiver/kv_archiver_store/message_store.js +15 -14
  31. package/dest/archiver/l1/bin/retrieve-calldata.d.ts +3 -0
  32. package/dest/archiver/l1/bin/retrieve-calldata.d.ts.map +1 -0
  33. package/dest/archiver/l1/bin/retrieve-calldata.js +147 -0
  34. package/dest/archiver/l1/calldata_retriever.d.ts +98 -0
  35. package/dest/archiver/l1/calldata_retriever.d.ts.map +1 -0
  36. package/dest/archiver/l1/calldata_retriever.js +403 -0
  37. package/dest/archiver/l1/data_retrieval.d.ts +87 -0
  38. package/dest/archiver/l1/data_retrieval.d.ts.map +1 -0
  39. package/dest/archiver/{data_retrieval.js → l1/data_retrieval.js} +26 -95
  40. package/dest/archiver/l1/debug_tx.d.ts +19 -0
  41. package/dest/archiver/l1/debug_tx.d.ts.map +1 -0
  42. package/dest/archiver/l1/debug_tx.js +73 -0
  43. package/dest/archiver/l1/spire_proposer.d.ts +70 -0
  44. package/dest/archiver/l1/spire_proposer.d.ts.map +1 -0
  45. package/dest/archiver/l1/spire_proposer.js +157 -0
  46. package/dest/archiver/l1/trace_tx.d.ts +97 -0
  47. package/dest/archiver/l1/trace_tx.d.ts.map +1 -0
  48. package/dest/archiver/l1/trace_tx.js +91 -0
  49. package/dest/archiver/l1/types.d.ts +12 -0
  50. package/dest/archiver/l1/types.d.ts.map +1 -0
  51. package/dest/archiver/l1/types.js +3 -0
  52. package/dest/archiver/l1/validate_trace.d.ts +29 -0
  53. package/dest/archiver/l1/validate_trace.d.ts.map +1 -0
  54. package/dest/archiver/l1/validate_trace.js +150 -0
  55. package/dest/archiver/structs/inbox_message.d.ts +4 -4
  56. package/dest/archiver/structs/inbox_message.d.ts.map +1 -1
  57. package/dest/archiver/structs/inbox_message.js +6 -6
  58. package/dest/index.d.ts +2 -2
  59. package/dest/index.d.ts.map +1 -1
  60. package/dest/index.js +1 -1
  61. package/dest/test/mock_archiver.d.ts +4 -5
  62. package/dest/test/mock_archiver.d.ts.map +1 -1
  63. package/dest/test/mock_archiver.js +5 -9
  64. package/dest/test/mock_l1_to_l2_message_source.d.ts +5 -6
  65. package/dest/test/mock_l1_to_l2_message_source.d.ts.map +1 -1
  66. package/dest/test/mock_l1_to_l2_message_source.js +7 -11
  67. package/dest/test/mock_l2_block_source.d.ts +2 -2
  68. package/dest/test/mock_l2_block_source.d.ts.map +1 -1
  69. package/dest/test/mock_l2_block_source.js +2 -2
  70. package/dest/test/mock_structs.d.ts +3 -2
  71. package/dest/test/mock_structs.d.ts.map +1 -1
  72. package/dest/test/mock_structs.js +9 -9
  73. package/package.json +15 -14
  74. package/src/archiver/archiver.ts +79 -40
  75. package/src/archiver/archiver_store.ts +8 -8
  76. package/src/archiver/archiver_store_test_suite.ts +56 -48
  77. package/src/archiver/config.ts +8 -7
  78. package/src/archiver/instrumentation.ts +14 -0
  79. package/src/archiver/kv_archiver_store/block_store.ts +1 -1
  80. package/src/archiver/kv_archiver_store/contract_class_store.ts +1 -1
  81. package/src/archiver/kv_archiver_store/contract_instance_store.ts +1 -1
  82. package/src/archiver/kv_archiver_store/kv_archiver_store.ts +9 -9
  83. package/src/archiver/kv_archiver_store/log_store.ts +1 -1
  84. package/src/archiver/kv_archiver_store/message_store.ts +21 -18
  85. package/src/archiver/l1/README.md +98 -0
  86. package/src/archiver/l1/bin/retrieve-calldata.ts +182 -0
  87. package/src/archiver/l1/calldata_retriever.ts +531 -0
  88. package/src/archiver/{data_retrieval.ts → l1/data_retrieval.ts} +57 -143
  89. package/src/archiver/l1/debug_tx.ts +99 -0
  90. package/src/archiver/l1/spire_proposer.ts +160 -0
  91. package/src/archiver/l1/trace_tx.ts +128 -0
  92. package/src/archiver/l1/types.ts +13 -0
  93. package/src/archiver/l1/validate_trace.ts +211 -0
  94. package/src/archiver/structs/inbox_message.ts +7 -8
  95. package/src/index.ts +1 -1
  96. package/src/test/fixtures/debug_traceTransaction-multicall3.json +88 -0
  97. package/src/test/fixtures/debug_traceTransaction-multiplePropose.json +153 -0
  98. package/src/test/fixtures/debug_traceTransaction-proxied.json +122 -0
  99. package/src/test/fixtures/trace_transaction-multicall3.json +65 -0
  100. package/src/test/fixtures/trace_transaction-multiplePropose.json +319 -0
  101. package/src/test/fixtures/trace_transaction-proxied.json +128 -0
  102. package/src/test/fixtures/trace_transaction-randomRevert.json +216 -0
  103. package/src/test/mock_archiver.ts +6 -11
  104. package/src/test/mock_l1_to_l2_message_source.ts +6 -11
  105. package/src/test/mock_l2_block_source.ts +2 -2
  106. package/src/test/mock_structs.ts +10 -10
  107. package/dest/archiver/data_retrieval.d.ts +0 -80
  108. package/dest/archiver/data_retrieval.d.ts.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"mock_structs.d.ts","sourceRoot":"","sources":["../../src/test/mock_structs.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAY,MAAM,0BAA0B,CAAC;AAK9D,OAAO,EAAE,KAAK,YAAY,EAAqB,MAAM,sCAAsC,CAAC;AAE5F,wBAAgB,gBAAgB,CAC9B,mBAAmB,WAAgB,EACnC,SAAS,GAAE,OAAO,CAAC,YAAY,CAAM,GACpC,YAAY,CAgBd;AAED,wBAAgB,iBAAiB,CAC/B,KAAK,EAAE,MAAM,EACb,IAAI,GAAE;IACJ,WAAW,CAAC,EAAE,QAAQ,CAAC;IACvB,oBAAoB,CAAC,EAAE,MAAM,CAAC;IAC9B,UAAU,CAAC,EAAE,CAAC,GAAG,EAAE,YAAY,EAAE,KAAK,EAAE,MAAM,KAAK,YAAY,CAAC;CAC5D,GACL,YAAY,EAAE,CAahB"}
1
+ {"version":3,"file":"mock_structs.d.ts","sourceRoot":"","sources":["../../src/test/mock_structs.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,iCAAiC,CAAC;AACnE,OAAO,EAAE,QAAQ,EAAY,MAAM,0BAA0B,CAAC;AAK9D,OAAO,EAAE,KAAK,YAAY,EAAqB,MAAM,sCAAsC,CAAC;AAE5F,wBAAgB,gBAAgB,CAC9B,mBAAmB,WAAgB,EACnC,SAAS,GAAE,OAAO,CAAC,YAAY,CAAM,GACpC,YAAY,CAgBd;AAED,wBAAgB,iBAAiB,CAC/B,KAAK,EAAE,MAAM,EACb,IAAI,GAAE;IACJ,WAAW,CAAC,EAAE,QAAQ,CAAC;IACvB,uBAAuB,CAAC,EAAE,gBAAgB,CAAC;IAC3C,UAAU,CAAC,EAAE,CAAC,GAAG,EAAE,YAAY,EAAE,KAAK,EAAE,MAAM,KAAK,YAAY,CAAC;CAC5D,GACL,YAAY,EAAE,CAahB"}
@@ -1,35 +1,35 @@
1
- import { BlockNumber } from '@aztec/foundation/branded-types';
1
+ import { CheckpointNumber } from '@aztec/foundation/branded-types';
2
2
  import { Buffer16, Buffer32 } from '@aztec/foundation/buffer';
3
- import { randomBigInt, randomInt } from '@aztec/foundation/crypto';
4
- import { Fr } from '@aztec/foundation/fields';
3
+ import { randomBigInt, randomInt } from '@aztec/foundation/crypto/random';
4
+ import { Fr } from '@aztec/foundation/curves/bn254';
5
5
  import { InboxLeaf } from '@aztec/stdlib/messaging';
6
6
  import { updateRollingHash } from '../archiver/structs/inbox_message.js';
7
7
  export function makeInboxMessage(previousRollingHash = Buffer16.ZERO, overrides = {}) {
8
- const { l2BlockNumber = randomInt(100) + 1 } = overrides;
8
+ const { checkpointNumber = CheckpointNumber(randomInt(100) + 1) } = overrides;
9
9
  const { l1BlockNumber = randomBigInt(100n) + 1n } = overrides;
10
10
  const { l1BlockHash = Buffer32.random() } = overrides;
11
11
  const { leaf = Fr.random() } = overrides;
12
12
  const { rollingHash = updateRollingHash(previousRollingHash, leaf) } = overrides;
13
- const { index = InboxLeaf.smallestIndexFromL2Block(l2BlockNumber) } = overrides;
13
+ const { index = InboxLeaf.smallestIndexForCheckpoint(checkpointNumber) } = overrides;
14
14
  return {
15
15
  index,
16
16
  leaf,
17
- l2BlockNumber: BlockNumber(l2BlockNumber),
17
+ checkpointNumber,
18
18
  l1BlockNumber,
19
19
  l1BlockHash,
20
20
  rollingHash
21
21
  };
22
22
  }
23
23
  export function makeInboxMessages(count, opts = {}) {
24
- const { initialHash = Buffer16.ZERO, overrideFn = (msg)=>msg, initialL2BlockNumber = 1 } = opts;
24
+ const { initialHash = Buffer16.ZERO, overrideFn = (msg)=>msg, initialCheckpointNumber = 1 } = opts;
25
25
  const messages = [];
26
26
  let rollingHash = initialHash;
27
27
  for(let i = 0; i < count; i++){
28
28
  const leaf = Fr.random();
29
- const l2BlockNumber = BlockNumber(i + initialL2BlockNumber);
29
+ const checkpointNumber = CheckpointNumber(i + initialCheckpointNumber);
30
30
  const message = overrideFn(makeInboxMessage(rollingHash, {
31
31
  leaf,
32
- l2BlockNumber
32
+ checkpointNumber
33
33
  }), i);
34
34
  rollingHash = message.rollingHash;
35
35
  messages.push(message);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aztec/archiver",
3
- "version": "3.0.0-nightly.20251209",
3
+ "version": "3.0.0-nightly.20251211",
4
4
  "type": "module",
5
5
  "exports": {
6
6
  ".": "./dest/index.js",
@@ -66,22 +66,23 @@
66
66
  ]
67
67
  },
68
68
  "dependencies": {
69
- "@aztec/blob-lib": "3.0.0-nightly.20251209",
70
- "@aztec/blob-sink": "3.0.0-nightly.20251209",
71
- "@aztec/constants": "3.0.0-nightly.20251209",
72
- "@aztec/epoch-cache": "3.0.0-nightly.20251209",
73
- "@aztec/ethereum": "3.0.0-nightly.20251209",
74
- "@aztec/foundation": "3.0.0-nightly.20251209",
75
- "@aztec/kv-store": "3.0.0-nightly.20251209",
76
- "@aztec/l1-artifacts": "3.0.0-nightly.20251209",
77
- "@aztec/noir-protocol-circuits-types": "3.0.0-nightly.20251209",
78
- "@aztec/protocol-contracts": "3.0.0-nightly.20251209",
79
- "@aztec/stdlib": "3.0.0-nightly.20251209",
80
- "@aztec/telemetry-client": "3.0.0-nightly.20251209",
69
+ "@aztec/blob-lib": "3.0.0-nightly.20251211",
70
+ "@aztec/blob-sink": "3.0.0-nightly.20251211",
71
+ "@aztec/constants": "3.0.0-nightly.20251211",
72
+ "@aztec/epoch-cache": "3.0.0-nightly.20251211",
73
+ "@aztec/ethereum": "3.0.0-nightly.20251211",
74
+ "@aztec/foundation": "3.0.0-nightly.20251211",
75
+ "@aztec/kv-store": "3.0.0-nightly.20251211",
76
+ "@aztec/l1-artifacts": "3.0.0-nightly.20251211",
77
+ "@aztec/noir-protocol-circuits-types": "3.0.0-nightly.20251211",
78
+ "@aztec/protocol-contracts": "3.0.0-nightly.20251211",
79
+ "@aztec/stdlib": "3.0.0-nightly.20251211",
80
+ "@aztec/telemetry-client": "3.0.0-nightly.20251211",
81
81
  "lodash.groupby": "^4.6.0",
82
82
  "lodash.omit": "^4.5.0",
83
83
  "tslib": "^2.5.0",
84
- "viem": "npm:@aztec/viem@2.38.2"
84
+ "viem": "npm:@aztec/viem@2.38.2",
85
+ "zod": "^3.23.8"
85
86
  },
86
87
  "devDependencies": {
87
88
  "@jest/globals": "^30.0.0",
@@ -1,20 +1,17 @@
1
1
  import type { BlobSinkClientInterface } from '@aztec/blob-sink/client';
2
2
  import { GENESIS_BLOCK_HEADER_HASH } from '@aztec/constants';
3
3
  import { EpochCache } from '@aztec/epoch-cache';
4
- import {
5
- BlockTagTooOldError,
6
- InboxContract,
7
- type L1BlockId,
8
- RollupContract,
9
- type ViemPublicClient,
10
- createEthereumChain,
11
- } from '@aztec/ethereum';
4
+ import { createEthereumChain } from '@aztec/ethereum/chain';
5
+ import { BlockTagTooOldError, InboxContract, RollupContract } from '@aztec/ethereum/contracts';
6
+ import type { L1ContractAddresses } from '@aztec/ethereum/l1-contract-addresses';
7
+ import type { L1BlockId } from '@aztec/ethereum/l1-types';
8
+ import type { ViemPublicClient, ViemPublicDebugClient } from '@aztec/ethereum/types';
12
9
  import { maxBigint } from '@aztec/foundation/bigint';
13
10
  import { BlockNumber, CheckpointNumber, EpochNumber, SlotNumber } from '@aztec/foundation/branded-types';
14
11
  import { Buffer16, Buffer32 } from '@aztec/foundation/buffer';
15
12
  import { merge, pick } from '@aztec/foundation/collection';
13
+ import { Fr } from '@aztec/foundation/curves/bn254';
16
14
  import type { EthAddress } from '@aztec/foundation/eth-address';
17
- import { Fr } from '@aztec/foundation/fields';
18
15
  import { type Logger, createLogger } from '@aztec/foundation/log';
19
16
  import { type PromiseWithResolvers, promiseWithResolvers } from '@aztec/foundation/promise';
20
17
  import { RunningPromise, makeLoggingErrorHandler } from '@aztec/foundation/running-promise';
@@ -63,7 +60,7 @@ import {
63
60
  import type { GetContractClassLogsResponse, GetPublicLogsResponse } from '@aztec/stdlib/interfaces/client';
64
61
  import type { L2LogsSource } from '@aztec/stdlib/interfaces/server';
65
62
  import { ContractClassLog, type LogFilter, type PrivateLog, type PublicLog, TxScopedL2Log } from '@aztec/stdlib/logs';
66
- import type { L1ToL2MessageSource } from '@aztec/stdlib/messaging';
63
+ import { type L1ToL2MessageSource, computeInHashFromL1ToL2Messages } from '@aztec/stdlib/messaging';
67
64
  import type { CheckpointHeader } from '@aztec/stdlib/rollup';
68
65
  import { type BlockHeader, type IndexedTxEffect, TxHash, TxReceipt } from '@aztec/stdlib/tx';
69
66
  import type { UInt64 } from '@aztec/stdlib/types';
@@ -81,14 +78,15 @@ import { type GetContractReturnType, type Hex, createPublicClient, fallback, htt
81
78
 
82
79
  import type { ArchiverDataStore, ArchiverL1SynchPoint } from './archiver_store.js';
83
80
  import type { ArchiverConfig } from './config.js';
81
+ import { InitialBlockNumberNotSequentialError, NoBlobBodiesFoundError } from './errors.js';
82
+ import { ArchiverInstrumentation } from './instrumentation.js';
84
83
  import {
85
84
  retrieveCheckpointsFromRollup,
86
85
  retrieveL1ToL2Message,
87
86
  retrieveL1ToL2Messages,
88
87
  retrievedToPublishedCheckpoint,
89
- } from './data_retrieval.js';
90
- import { InitialBlockNumberNotSequentialError, NoBlobBodiesFoundError } from './errors.js';
91
- import { ArchiverInstrumentation } from './instrumentation.js';
88
+ } from './l1/data_retrieval.js';
89
+ import { validateAndLogTraceAvailability } from './l1/validate_trace.js';
92
90
  import type { InboxMessage } from './structs/inbox_message.js';
93
91
  import { type ValidateBlockResult, validateCheckpointAttestations } from './validation.js';
94
92
 
@@ -110,6 +108,7 @@ function mapArchiverConfig(config: Partial<ArchiverConfig>) {
110
108
  batchSize: config.archiverBatchSize,
111
109
  skipValidateBlockAttestations: config.skipValidateBlockAttestations,
112
110
  maxAllowedEthClientDriftSeconds: config.maxAllowedEthClientDriftSeconds,
111
+ ethereumAllowNoDebugHosts: config.ethereumAllowNoDebugHosts,
113
112
  };
114
113
  }
115
114
 
@@ -147,6 +146,7 @@ export class Archiver extends (EventEmitter as new () => ArchiverEmitter) implem
147
146
  /**
148
147
  * Creates a new instance of the Archiver.
149
148
  * @param publicClient - A client for interacting with the Ethereum node.
149
+ * @param debugClient - A client for interacting with the Ethereum node for debug/trace methods.
150
150
  * @param rollupAddress - Ethereum address of the rollup contract.
151
151
  * @param inboxAddress - Ethereum address of the inbox contract.
152
152
  * @param registryAddress - Ethereum address of the registry contract.
@@ -156,13 +156,18 @@ export class Archiver extends (EventEmitter as new () => ArchiverEmitter) implem
156
156
  */
157
157
  constructor(
158
158
  private readonly publicClient: ViemPublicClient,
159
- private readonly l1Addresses: { rollupAddress: EthAddress; inboxAddress: EthAddress; registryAddress: EthAddress },
159
+ private readonly debugClient: ViemPublicDebugClient,
160
+ private readonly l1Addresses: Pick<
161
+ L1ContractAddresses,
162
+ 'rollupAddress' | 'inboxAddress' | 'registryAddress' | 'governanceProposerAddress' | 'slashFactoryAddress'
163
+ > & { slashingProposerAddress: EthAddress },
160
164
  readonly dataStore: ArchiverDataStore,
161
165
  private config: {
162
166
  pollingIntervalMs: number;
163
167
  batchSize: number;
164
168
  skipValidateBlockAttestations?: boolean;
165
169
  maxAllowedEthClientDriftSeconds: number;
170
+ ethereumAllowNoDebugHosts?: boolean;
166
171
  },
167
172
  private readonly blobSinkClient: BlobSinkClientInterface,
168
173
  private readonly epochCache: EpochCache,
@@ -210,14 +215,24 @@ export class Archiver extends (EventEmitter as new () => ArchiverEmitter) implem
210
215
  pollingInterval: config.viemPollingIntervalMS,
211
216
  });
212
217
 
218
+ // Create debug client using debug RPC URLs if available, otherwise fall back to regular RPC URLs
219
+ const debugRpcUrls = config.l1DebugRpcUrls.length > 0 ? config.l1DebugRpcUrls : config.l1RpcUrls;
220
+ const debugClient = createPublicClient({
221
+ chain: chain.chainInfo,
222
+ transport: fallback(debugRpcUrls.map(url => http(url))),
223
+ pollingInterval: config.viemPollingIntervalMS,
224
+ }) as ViemPublicDebugClient;
225
+
213
226
  const rollup = new RollupContract(publicClient, config.l1Contracts.rollupAddress);
214
227
 
215
- const [l1StartBlock, l1GenesisTime, proofSubmissionEpochs, genesisArchiveRoot] = await Promise.all([
216
- rollup.getL1StartBlock(),
217
- rollup.getL1GenesisTime(),
218
- rollup.getProofSubmissionEpochs(),
219
- rollup.getGenesisArchiveTreeRoot(),
220
- ] as const);
228
+ const [l1StartBlock, l1GenesisTime, proofSubmissionEpochs, genesisArchiveRoot, slashingProposerAddress] =
229
+ await Promise.all([
230
+ rollup.getL1StartBlock(),
231
+ rollup.getL1GenesisTime(),
232
+ rollup.getProofSubmissionEpochs(),
233
+ rollup.getGenesisArchiveTreeRoot(),
234
+ rollup.getSlashingProposerAddress(),
235
+ ] as const);
221
236
 
222
237
  const l1StartBlockHash = await publicClient
223
238
  .getBlock({ blockNumber: l1StartBlock, includeTransactions: false })
@@ -237,7 +252,12 @@ export class Archiver extends (EventEmitter as new () => ArchiverEmitter) implem
237
252
  };
238
253
 
239
254
  const opts = merge(
240
- { pollingIntervalMs: 10_000, batchSize: 100, maxAllowedEthClientDriftSeconds: 300 },
255
+ {
256
+ pollingIntervalMs: 10_000,
257
+ batchSize: 100,
258
+ maxAllowedEthClientDriftSeconds: 300,
259
+ ethereumAllowNoDebugHosts: false,
260
+ },
241
261
  mapArchiverConfig(config),
242
262
  );
243
263
 
@@ -246,7 +266,8 @@ export class Archiver extends (EventEmitter as new () => ArchiverEmitter) implem
246
266
 
247
267
  const archiver = new Archiver(
248
268
  publicClient,
249
- config.l1Contracts,
269
+ debugClient,
270
+ { ...config.l1Contracts, slashingProposerAddress },
250
271
  archiverStore,
251
272
  opts,
252
273
  deps.blobSinkClient,
@@ -275,6 +296,7 @@ export class Archiver extends (EventEmitter as new () => ArchiverEmitter) implem
275
296
 
276
297
  await this.blobSinkClient.testSources();
277
298
  await this.testEthereumNodeSynced();
299
+ await validateAndLogTraceAvailability(this.debugClient, this.config.ethereumAllowNoDebugHosts ?? false);
278
300
 
279
301
  // Log initial state for the archiver
280
302
  const { l1StartBlock } = this.l1constants;
@@ -594,7 +616,7 @@ export class Archiver extends (EventEmitter as new () => ArchiverEmitter) implem
594
616
  // Log stats for messages retrieved (if any).
595
617
  if (messageCount > 0) {
596
618
  this.log.info(
597
- `Retrieved ${messageCount} new L1 to L2 messages up to message with index ${lastMessage?.index} for L2 block ${lastMessage?.l2BlockNumber}`,
619
+ `Retrieved ${messageCount} new L1 to L2 messages up to message with index ${lastMessage?.index} for checkpoint ${lastMessage?.checkpointNumber}`,
598
620
  { lastMessage, messageCount },
599
621
  );
600
622
  }
@@ -853,9 +875,12 @@ export class Archiver extends (EventEmitter as new () => ArchiverEmitter) implem
853
875
  const retrievedCheckpoints = await retrieveCheckpointsFromRollup(
854
876
  this.rollup.getContract() as GetContractReturnType<typeof RollupAbi, ViemPublicClient>,
855
877
  this.publicClient,
878
+ this.debugClient,
856
879
  this.blobSinkClient,
857
880
  searchStartBlock, // TODO(palla/reorg): If the L2 reorg was due to an L1 reorg, we need to start search earlier
858
881
  searchEndBlock,
882
+ this.l1Addresses,
883
+ this.instrumentation,
859
884
  this.log,
860
885
  );
861
886
 
@@ -916,6 +941,25 @@ export class Archiver extends (EventEmitter as new () => ArchiverEmitter) implem
916
941
  continue;
917
942
  }
918
943
 
944
+ // Check the inHash of the checkpoint against the l1->l2 messages.
945
+ // The messages should've been synced up to the currentL1BlockNumber and must be available for the published
946
+ // checkpoints we just retrieved.
947
+ const l1ToL2Messages = await this.getL1ToL2Messages(published.checkpoint.number);
948
+ const computedInHash = computeInHashFromL1ToL2Messages(l1ToL2Messages);
949
+ const publishedInHash = published.checkpoint.header.contentCommitment.inHash;
950
+ if (!computedInHash.equals(publishedInHash)) {
951
+ this.log.fatal(`Mismatch inHash for checkpoint ${published.checkpoint.number}`, {
952
+ checkpointHash: published.checkpoint.hash(),
953
+ l1BlockNumber: published.l1.blockNumber,
954
+ computedInHash,
955
+ publishedInHash,
956
+ });
957
+ // Throwing an error since this is most likely caused by a bug.
958
+ throw new Error(
959
+ `Mismatch inHash for checkpoint ${published.checkpoint.number}. Expected ${computedInHash} but got ${publishedInHash}`,
960
+ );
961
+ }
962
+
919
963
  validCheckpoints.push(published);
920
964
  this.log.debug(
921
965
  `Ingesting new checkpoint ${published.checkpoint.number} with ${published.checkpoint.blocks.length} blocks`,
@@ -969,7 +1013,7 @@ export class Archiver extends (EventEmitter as new () => ArchiverEmitter) implem
969
1013
  });
970
1014
  }
971
1015
  lastRetrievedCheckpoint = validCheckpoints.at(-1) ?? lastRetrievedCheckpoint;
972
- lastL1BlockWithCheckpoint = publishedCheckpoints.at(-1)?.l1.blockNumber ?? lastL1BlockWithCheckpoint;
1016
+ lastL1BlockWithCheckpoint = retrievedCheckpoints.at(-1)?.l1.blockNumber ?? lastL1BlockWithCheckpoint;
973
1017
  } while (searchEndBlock < currentL1BlockNumber);
974
1018
 
975
1019
  // Important that we update AFTER inserting the blocks.
@@ -1247,12 +1291,6 @@ export class Archiver extends (EventEmitter as new () => ArchiverEmitter) implem
1247
1291
  return blocks.map(b => b.toCheckpoint());
1248
1292
  }
1249
1293
 
1250
- public getL1ToL2MessagesForCheckpoint(checkpointNumber: CheckpointNumber): Promise<Fr[]> {
1251
- // TODO: Create dedicated api for checkpoints.
1252
- // This only works when we have one block per checkpoint.
1253
- return this.getL1ToL2Messages(BlockNumber.fromCheckpointNumber(checkpointNumber));
1254
- }
1255
-
1256
1294
  /**
1257
1295
  * Gets up to `limit` amount of L2 blocks starting from `from`.
1258
1296
  * @param from - Number of the first block to return (inclusive).
@@ -1404,12 +1442,12 @@ export class Archiver extends (EventEmitter as new () => ArchiverEmitter) implem
1404
1442
  }
1405
1443
 
1406
1444
  /**
1407
- * Gets L1 to L2 message (to be) included in a given block.
1408
- * @param blockNumber - L2 block number to get messages for.
1445
+ * Gets L1 to L2 message (to be) included in a given checkpoint.
1446
+ * @param checkpointNumber - Checkpoint number to get messages for.
1409
1447
  * @returns The L1 to L2 messages/leaves of the messages subtree (throws if not found).
1410
1448
  */
1411
- getL1ToL2Messages(blockNumber: BlockNumber): Promise<Fr[]> {
1412
- return this.store.getL1ToL2Messages(blockNumber);
1449
+ getL1ToL2Messages(checkpointNumber: CheckpointNumber): Promise<Fr[]> {
1450
+ return this.store.getL1ToL2Messages(checkpointNumber);
1413
1451
  }
1414
1452
 
1415
1453
  /**
@@ -1500,11 +1538,12 @@ export class Archiver extends (EventEmitter as new () => ArchiverEmitter) implem
1500
1538
  throw new Error(`Target L2 block ${targetL2BlockNumber} not found`);
1501
1539
  }
1502
1540
  const targetL1BlockNumber = targetL2Block.l1.blockNumber;
1541
+ const targetCheckpointNumber = CheckpointNumber.fromBlockNumber(targetL2BlockNumber);
1503
1542
  const targetL1BlockHash = await this.getL1BlockHash(targetL1BlockNumber);
1504
1543
  this.log.info(`Unwinding ${blocksToUnwind} blocks from L2 block ${currentL2Block}`);
1505
1544
  await this.store.unwindBlocks(BlockNumber(currentL2Block), blocksToUnwind);
1506
- this.log.info(`Unwinding L1 to L2 messages to ${targetL2BlockNumber}`);
1507
- await this.store.rollbackL1ToL2MessagesToL2Block(targetL2BlockNumber);
1545
+ this.log.info(`Unwinding L1 to L2 messages to checkpoint ${targetCheckpointNumber}`);
1546
+ await this.store.rollbackL1ToL2MessagesToCheckpoint(targetCheckpointNumber);
1508
1547
  this.log.info(`Setting L1 syncpoints to ${targetL1BlockNumber}`);
1509
1548
  await this.store.setBlockSynchedL1BlockNumber(targetL1BlockNumber);
1510
1549
  await this.store.setMessageSynchedL1Block({ l1BlockNumber: targetL1BlockNumber, l1BlockHash: targetL1BlockHash });
@@ -1798,8 +1837,8 @@ export class ArchiverStoreHelper
1798
1837
  addL1ToL2Messages(messages: InboxMessage[]): Promise<void> {
1799
1838
  return this.store.addL1ToL2Messages(messages);
1800
1839
  }
1801
- getL1ToL2Messages(blockNumber: BlockNumber): Promise<Fr[]> {
1802
- return this.store.getL1ToL2Messages(blockNumber);
1840
+ getL1ToL2Messages(checkpointNumber: CheckpointNumber): Promise<Fr[]> {
1841
+ return this.store.getL1ToL2Messages(checkpointNumber);
1803
1842
  }
1804
1843
  getL1ToL2MessageIndex(l1ToL2Message: Fr): Promise<bigint | undefined> {
1805
1844
  return this.store.getL1ToL2MessageIndex(l1ToL2Message);
@@ -1858,8 +1897,8 @@ export class ArchiverStoreHelper
1858
1897
  estimateSize(): Promise<{ mappingSize: number; physicalFileSize: number; actualSize: number; numItems: number }> {
1859
1898
  return this.store.estimateSize();
1860
1899
  }
1861
- rollbackL1ToL2MessagesToL2Block(targetBlockNumber: BlockNumber): Promise<void> {
1862
- return this.store.rollbackL1ToL2MessagesToL2Block(targetBlockNumber);
1900
+ rollbackL1ToL2MessagesToCheckpoint(targetCheckpointNumber: CheckpointNumber): Promise<void> {
1901
+ return this.store.rollbackL1ToL2MessagesToCheckpoint(targetCheckpointNumber);
1863
1902
  }
1864
1903
  iterateL1ToL2Messages(range: CustomRange<bigint> = {}): AsyncIterableIterator<InboxMessage> {
1865
1904
  return this.store.iterateL1ToL2Messages(range);
@@ -1,6 +1,6 @@
1
- import type { L1BlockId } from '@aztec/ethereum';
2
- import { BlockNumber } from '@aztec/foundation/branded-types';
3
- import type { Fr } from '@aztec/foundation/fields';
1
+ import type { L1BlockId } from '@aztec/ethereum/l1-types';
2
+ import type { BlockNumber, CheckpointNumber } from '@aztec/foundation/branded-types';
3
+ import type { Fr } from '@aztec/foundation/curves/bn254';
4
4
  import type { CustomRange } from '@aztec/kv-store';
5
5
  import type { FunctionSelector } from '@aztec/stdlib/abi';
6
6
  import type { AztecAddress } from '@aztec/stdlib/aztec-address';
@@ -132,11 +132,11 @@ export interface ArchiverDataStore {
132
132
  addL1ToL2Messages(messages: InboxMessage[]): Promise<void>;
133
133
 
134
134
  /**
135
- * Gets L1 to L2 message (to be) included in a given block.
136
- * @param blockNumber - L2 block number to get messages for.
135
+ * Gets L1 to L2 message (to be) included in a given checkpoint.
136
+ * @param checkpointNumber - Checkpoint number to get messages for.
137
137
  * @returns The L1 to L2 messages/leaves of the messages subtree (throws if not found).
138
138
  */
139
- getL1ToL2Messages(blockNumber: BlockNumber): Promise<Fr[]>;
139
+ getL1ToL2Messages(checkpointNumber: CheckpointNumber): Promise<Fr[]>;
140
140
 
141
141
  /**
142
142
  * Gets the L1 to L2 message index in the L1 to L2 message tree.
@@ -290,8 +290,8 @@ export interface ArchiverDataStore {
290
290
  /** Closes the underlying data store. */
291
291
  close(): Promise<void>;
292
292
 
293
- /** Deletes all L1 to L2 messages up until (excluding) the target L2 block number. */
294
- rollbackL1ToL2MessagesToL2Block(targetBlockNumber: BlockNumber): Promise<void>;
293
+ /** Deletes all L1 to L2 messages up until (excluding) the target checkpoint number. */
294
+ rollbackL1ToL2MessagesToCheckpoint(targetCheckpointNumber: CheckpointNumber): Promise<void>;
295
295
 
296
296
  /** Returns an async iterator to all L1 to L2 messages on the range. */
297
297
  iterateL1ToL2Messages(range?: CustomRange<bigint>): AsyncIterableIterator<InboxMessage>;