@aztec/archiver 0.0.1-commit.d431d1c → 0.0.1-commit.d939eb5aa

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 (116) hide show
  1. package/README.md +21 -6
  2. package/dest/archiver.d.ts +17 -12
  3. package/dest/archiver.d.ts.map +1 -1
  4. package/dest/archiver.js +108 -127
  5. package/dest/config.d.ts +3 -3
  6. package/dest/config.d.ts.map +1 -1
  7. package/dest/config.js +3 -2
  8. package/dest/errors.d.ts +39 -10
  9. package/dest/errors.d.ts.map +1 -1
  10. package/dest/errors.js +52 -15
  11. package/dest/factory.d.ts +4 -2
  12. package/dest/factory.d.ts.map +1 -1
  13. package/dest/factory.js +29 -23
  14. package/dest/index.d.ts +2 -1
  15. package/dest/index.d.ts.map +1 -1
  16. package/dest/index.js +1 -0
  17. package/dest/l1/bin/retrieve-calldata.js +35 -32
  18. package/dest/l1/calldata_retriever.d.ts +73 -50
  19. package/dest/l1/calldata_retriever.d.ts.map +1 -1
  20. package/dest/l1/calldata_retriever.js +191 -259
  21. package/dest/l1/data_retrieval.d.ts +11 -11
  22. package/dest/l1/data_retrieval.d.ts.map +1 -1
  23. package/dest/l1/data_retrieval.js +38 -37
  24. package/dest/l1/spire_proposer.d.ts +5 -5
  25. package/dest/l1/spire_proposer.d.ts.map +1 -1
  26. package/dest/l1/spire_proposer.js +9 -17
  27. package/dest/l1/validate_trace.d.ts +6 -3
  28. package/dest/l1/validate_trace.d.ts.map +1 -1
  29. package/dest/l1/validate_trace.js +13 -9
  30. package/dest/modules/data_source_base.d.ts +29 -23
  31. package/dest/modules/data_source_base.d.ts.map +1 -1
  32. package/dest/modules/data_source_base.js +55 -124
  33. package/dest/modules/data_store_updater.d.ts +43 -26
  34. package/dest/modules/data_store_updater.d.ts.map +1 -1
  35. package/dest/modules/data_store_updater.js +158 -129
  36. package/dest/modules/instrumentation.d.ts +19 -4
  37. package/dest/modules/instrumentation.d.ts.map +1 -1
  38. package/dest/modules/instrumentation.js +53 -18
  39. package/dest/modules/l1_synchronizer.d.ts +7 -9
  40. package/dest/modules/l1_synchronizer.d.ts.map +1 -1
  41. package/dest/modules/l1_synchronizer.js +186 -145
  42. package/dest/modules/validation.d.ts +1 -1
  43. package/dest/modules/validation.d.ts.map +1 -1
  44. package/dest/modules/validation.js +2 -2
  45. package/dest/store/block_store.d.ts +86 -34
  46. package/dest/store/block_store.d.ts.map +1 -1
  47. package/dest/store/block_store.js +414 -152
  48. package/dest/store/contract_class_store.d.ts +2 -3
  49. package/dest/store/contract_class_store.d.ts.map +1 -1
  50. package/dest/store/contract_class_store.js +16 -72
  51. package/dest/store/contract_instance_store.d.ts +1 -1
  52. package/dest/store/contract_instance_store.d.ts.map +1 -1
  53. package/dest/store/contract_instance_store.js +6 -2
  54. package/dest/store/kv_archiver_store.d.ts +80 -39
  55. package/dest/store/kv_archiver_store.d.ts.map +1 -1
  56. package/dest/store/kv_archiver_store.js +86 -35
  57. package/dest/store/l2_tips_cache.d.ts +20 -0
  58. package/dest/store/l2_tips_cache.d.ts.map +1 -0
  59. package/dest/store/l2_tips_cache.js +109 -0
  60. package/dest/store/log_store.d.ts +9 -6
  61. package/dest/store/log_store.d.ts.map +1 -1
  62. package/dest/store/log_store.js +151 -56
  63. package/dest/store/message_store.d.ts +5 -1
  64. package/dest/store/message_store.d.ts.map +1 -1
  65. package/dest/store/message_store.js +21 -9
  66. package/dest/test/fake_l1_state.d.ts +24 -4
  67. package/dest/test/fake_l1_state.d.ts.map +1 -1
  68. package/dest/test/fake_l1_state.js +133 -26
  69. package/dest/test/index.js +3 -1
  70. package/dest/test/mock_archiver.d.ts +1 -1
  71. package/dest/test/mock_archiver.d.ts.map +1 -1
  72. package/dest/test/mock_archiver.js +3 -2
  73. package/dest/test/mock_l1_to_l2_message_source.d.ts +1 -1
  74. package/dest/test/mock_l1_to_l2_message_source.d.ts.map +1 -1
  75. package/dest/test/mock_l1_to_l2_message_source.js +2 -1
  76. package/dest/test/mock_l2_block_source.d.ts +44 -23
  77. package/dest/test/mock_l2_block_source.d.ts.map +1 -1
  78. package/dest/test/mock_l2_block_source.js +185 -115
  79. package/dest/test/mock_structs.d.ts +6 -2
  80. package/dest/test/mock_structs.d.ts.map +1 -1
  81. package/dest/test/mock_structs.js +24 -10
  82. package/dest/test/noop_l1_archiver.d.ts +26 -0
  83. package/dest/test/noop_l1_archiver.d.ts.map +1 -0
  84. package/dest/test/noop_l1_archiver.js +71 -0
  85. package/package.json +14 -13
  86. package/src/archiver.ts +144 -159
  87. package/src/config.ts +9 -2
  88. package/src/errors.ts +82 -26
  89. package/src/factory.ts +46 -22
  90. package/src/index.ts +1 -0
  91. package/src/l1/README.md +25 -68
  92. package/src/l1/bin/retrieve-calldata.ts +45 -33
  93. package/src/l1/calldata_retriever.ts +250 -379
  94. package/src/l1/data_retrieval.ts +35 -41
  95. package/src/l1/spire_proposer.ts +7 -15
  96. package/src/l1/validate_trace.ts +24 -6
  97. package/src/modules/data_source_base.ts +98 -169
  98. package/src/modules/data_store_updater.ts +178 -160
  99. package/src/modules/instrumentation.ts +64 -20
  100. package/src/modules/l1_synchronizer.ts +212 -182
  101. package/src/modules/validation.ts +2 -2
  102. package/src/store/block_store.ts +533 -207
  103. package/src/store/contract_class_store.ts +16 -110
  104. package/src/store/contract_instance_store.ts +8 -5
  105. package/src/store/kv_archiver_store.ts +141 -59
  106. package/src/store/l2_tips_cache.ts +134 -0
  107. package/src/store/log_store.ts +232 -74
  108. package/src/store/message_store.ts +27 -10
  109. package/src/structs/inbox_message.ts +1 -1
  110. package/src/test/fake_l1_state.ts +180 -32
  111. package/src/test/index.ts +3 -0
  112. package/src/test/mock_archiver.ts +3 -2
  113. package/src/test/mock_l1_to_l2_message_source.ts +1 -0
  114. package/src/test/mock_l2_block_source.ts +247 -130
  115. package/src/test/mock_structs.ts +45 -15
  116. package/src/test/noop_l1_archiver.ts +114 -0
@@ -20,7 +20,7 @@ import { Fr } from '@aztec/foundation/curves/bn254';
20
20
  import { EthAddress } from '@aztec/foundation/eth-address';
21
21
  import { type Logger, createLogger } from '@aztec/foundation/log';
22
22
  import { RollupAbi } from '@aztec/l1-artifacts';
23
- import { Body, CommitteeAttestation, L2BlockNew } from '@aztec/stdlib/block';
23
+ import { Body, CommitteeAttestation, L2Block } from '@aztec/stdlib/block';
24
24
  import { Checkpoint, L1PublishedData, PublishedCheckpoint } from '@aztec/stdlib/checkpoint';
25
25
  import { Proof } from '@aztec/stdlib/proofs';
26
26
  import { CheckpointHeader } from '@aztec/stdlib/rollup';
@@ -38,6 +38,7 @@ import { CalldataRetriever } from './calldata_retriever.js';
38
38
  export type RetrievedCheckpoint = {
39
39
  checkpointNumber: CheckpointNumber;
40
40
  archiveRoot: Fr;
41
+ feeAssetPriceModifier: bigint;
41
42
  header: CheckpointHeader;
42
43
  checkpointBlobData: CheckpointBlobData;
43
44
  l1: L1PublishedData;
@@ -49,6 +50,7 @@ export type RetrievedCheckpoint = {
49
50
  export async function retrievedToPublishedCheckpoint({
50
51
  checkpointNumber,
51
52
  archiveRoot,
53
+ feeAssetPriceModifier,
52
54
  header: checkpointHeader,
53
55
  checkpointBlobData,
54
56
  l1,
@@ -69,7 +71,7 @@ export async function retrievedToPublishedCheckpoint({
69
71
  const l1toL2MessageTreeRoot = blocksBlobData[0].l1ToL2MessageRoot!;
70
72
 
71
73
  const spongeBlob = SpongeBlob.init();
72
- const l2Blocks: L2BlockNew[] = [];
74
+ const l2Blocks: L2Block[] = [];
73
75
  for (let i = 0; i < blocksBlobData.length; i++) {
74
76
  const blockBlobData = blocksBlobData[i];
75
77
  const { blockEndMarker, blockEndStateField, lastArchiveRoot, noteHashRoot, nullifierRoot, publicDataRoot } =
@@ -100,7 +102,7 @@ export async function retrievedToPublishedCheckpoint({
100
102
  }),
101
103
  });
102
104
 
103
- const body = Body.fromTxBlobData(checkpointBlobData.blocks[0].txs);
105
+ const body = Body.fromTxBlobData(blockBlobData.txs);
104
106
 
105
107
  const blobFields = encodeBlockBlobData(blockBlobData);
106
108
  await spongeBlob.absorb(blobFields);
@@ -119,7 +121,7 @@ export async function retrievedToPublishedCheckpoint({
119
121
 
120
122
  const newArchive = new AppendOnlyTreeSnapshot(newArchiveRoots[i], l2BlockNumber + 1);
121
123
 
122
- l2Blocks.push(new L2BlockNew(newArchive, header, body, checkpointNumber, IndexWithinCheckpoint(i)));
124
+ l2Blocks.push(new L2Block(newArchive, header, body, checkpointNumber, IndexWithinCheckpoint(i)));
123
125
  }
124
126
 
125
127
  const lastBlock = l2Blocks.at(-1)!;
@@ -128,6 +130,7 @@ export async function retrievedToPublishedCheckpoint({
128
130
  header: checkpointHeader,
129
131
  blocks: l2Blocks,
130
132
  number: checkpointNumber,
133
+ feeAssetPriceModifier: feeAssetPriceModifier,
131
134
  });
132
135
 
133
136
  return PublishedCheckpoint.from({ checkpoint, l1, attestations });
@@ -141,7 +144,7 @@ export async function retrievedToPublishedCheckpoint({
141
144
  * @param blobClient - The blob client client for fetching blob data.
142
145
  * @param searchStartBlock - The block number to use for starting the search.
143
146
  * @param searchEndBlock - The highest block number that we should search up to.
144
- * @param contractAddresses - The contract addresses (governanceProposerAddress, slashFactoryAddress, slashingProposerAddress).
147
+ * @param contractAddresses - The contract addresses (governanceProposerAddress, slashingProposerAddress).
145
148
  * @param instrumentation - The archiver instrumentation instance.
146
149
  * @param logger - The logger instance.
147
150
  * @param isHistoricalSync - Whether this is a historical sync.
@@ -154,11 +157,6 @@ export async function retrieveCheckpointsFromRollup(
154
157
  blobClient: BlobClientInterface,
155
158
  searchStartBlock: bigint,
156
159
  searchEndBlock: bigint,
157
- contractAddresses: {
158
- governanceProposerAddress: EthAddress;
159
- slashFactoryAddress?: EthAddress;
160
- slashingProposerAddress: EthAddress;
161
- },
162
160
  instrumentation: ArchiverInstrumentation,
163
161
  logger: Logger = createLogger('archiver'),
164
162
  isHistoricalSync: boolean = false,
@@ -202,7 +200,6 @@ export async function retrieveCheckpointsFromRollup(
202
200
  blobClient,
203
201
  checkpointProposedLogs,
204
202
  rollupConstants,
205
- contractAddresses,
206
203
  instrumentation,
207
204
  logger,
208
205
  isHistoricalSync,
@@ -223,7 +220,6 @@ export async function retrieveCheckpointsFromRollup(
223
220
  * @param blobClient - The blob client client for fetching blob data.
224
221
  * @param logs - CheckpointProposed logs.
225
222
  * @param rollupConstants - The rollup constants (chainId, version, targetCommitteeSize).
226
- * @param contractAddresses - The contract addresses (governanceProposerAddress, slashFactoryAddress, slashingProposerAddress).
227
223
  * @param instrumentation - The archiver instrumentation instance.
228
224
  * @param logger - The logger instance.
229
225
  * @param isHistoricalSync - Whether this is a historical sync.
@@ -236,11 +232,6 @@ async function processCheckpointProposedLogs(
236
232
  blobClient: BlobClientInterface,
237
233
  logs: CheckpointProposedLog[],
238
234
  { chainId, version, targetCommitteeSize }: { chainId: Fr; version: Fr; targetCommitteeSize: number },
239
- contractAddresses: {
240
- governanceProposerAddress: EthAddress;
241
- slashFactoryAddress?: EthAddress;
242
- slashingProposerAddress: EthAddress;
243
- },
244
235
  instrumentation: ArchiverInstrumentation,
245
236
  logger: Logger,
246
237
  isHistoricalSync: boolean,
@@ -252,7 +243,7 @@ async function processCheckpointProposedLogs(
252
243
  targetCommitteeSize,
253
244
  instrumentation,
254
245
  logger,
255
- { ...contractAddresses, rollupAddress: EthAddress.fromString(rollup.address) },
246
+ EthAddress.fromString(rollup.address),
256
247
  );
257
248
 
258
249
  await asyncPool(10, logs, async log => {
@@ -263,10 +254,9 @@ async function processCheckpointProposedLogs(
263
254
 
264
255
  // The value from the event and contract will match only if the checkpoint is in the chain.
265
256
  if (archive.equals(archiveFromChain)) {
266
- // Build expected hashes object (fields may be undefined for backwards compatibility with older events)
267
257
  const expectedHashes = {
268
- attestationsHash: log.args.attestationsHash?.toString(),
269
- payloadDigest: log.args.payloadDigest?.toString(),
258
+ attestationsHash: log.args.attestationsHash.toString() as Hex,
259
+ payloadDigest: log.args.payloadDigest.toString() as Hex,
270
260
  };
271
261
 
272
262
  const checkpoint = await calldataRetriever.getCheckpointFromRollupTx(
@@ -275,6 +265,9 @@ async function processCheckpointProposedLogs(
275
265
  checkpointNumber,
276
266
  expectedHashes,
277
267
  );
268
+ const { timestamp, parentBeaconBlockRoot } = await getL1Block(publicClient, log.l1BlockNumber);
269
+ const l1 = new L1PublishedData(log.l1BlockNumber, timestamp, log.l1BlockHash.toString());
270
+
278
271
  const checkpointBlobData = await getCheckpointBlobDataFromBlobs(
279
272
  blobClient,
280
273
  checkpoint.blockHash,
@@ -282,12 +275,8 @@ async function processCheckpointProposedLogs(
282
275
  checkpointNumber,
283
276
  logger,
284
277
  isHistoricalSync,
285
- );
286
-
287
- const l1 = new L1PublishedData(
288
- log.l1BlockNumber,
289
- await getL1BlockTime(publicClient, log.l1BlockNumber),
290
- log.l1BlockHash.toString(),
278
+ parentBeaconBlockRoot,
279
+ timestamp,
291
280
  );
292
281
 
293
282
  retrievedCheckpoints.push({ ...checkpoint, checkpointBlobData, l1, chainId, version });
@@ -308,9 +297,12 @@ async function processCheckpointProposedLogs(
308
297
  return retrievedCheckpoints;
309
298
  }
310
299
 
311
- export async function getL1BlockTime(publicClient: ViemPublicClient, blockNumber: bigint): Promise<bigint> {
300
+ export async function getL1Block(
301
+ publicClient: ViemPublicClient,
302
+ blockNumber: bigint,
303
+ ): Promise<{ timestamp: bigint; parentBeaconBlockRoot: string | undefined }> {
312
304
  const block = await publicClient.getBlock({ blockNumber, includeTransactions: false });
313
- return block.timestamp;
305
+ return { timestamp: block.timestamp, parentBeaconBlockRoot: block.parentBeaconBlockRoot };
314
306
  }
315
307
 
316
308
  export async function getCheckpointBlobDataFromBlobs(
@@ -320,8 +312,14 @@ export async function getCheckpointBlobDataFromBlobs(
320
312
  checkpointNumber: CheckpointNumber,
321
313
  logger: Logger,
322
314
  isHistoricalSync: boolean,
315
+ parentBeaconBlockRoot?: string,
316
+ l1BlockTimestamp?: bigint,
323
317
  ): Promise<CheckpointBlobData> {
324
- const blobBodies = await blobClient.getBlobSidecar(blockHash, blobHashes, { isHistoricalSync });
318
+ const blobBodies = await blobClient.getBlobSidecar(blockHash, blobHashes, {
319
+ isHistoricalSync,
320
+ parentBeaconBlockRoot,
321
+ l1BlockTimestamp,
322
+ });
325
323
  if (blobBodies.length === 0) {
326
324
  throw new NoBlobBodiesFoundError(checkpointNumber);
327
325
  }
@@ -346,14 +344,10 @@ export async function getCheckpointBlobDataFromBlobs(
346
344
  /** Given an L1 to L2 message, retrieves its corresponding event from the Inbox within a specific block range. */
347
345
  export async function retrieveL1ToL2Message(
348
346
  inbox: InboxContract,
349
- leaf: Fr,
350
- fromBlock: bigint,
351
- toBlock: bigint,
347
+ message: InboxMessage,
352
348
  ): Promise<InboxMessage | undefined> {
353
- const logs = await inbox.getMessageSentEventByHash(leaf.toString(), fromBlock, toBlock);
354
-
355
- const messages = mapLogsInboxMessage(logs);
356
- return messages.length > 0 ? messages[0] : undefined;
349
+ const log = await inbox.getMessageSentEventByHash(message.leaf.toString(), message.l1BlockHash.toString());
350
+ return log && mapLogInboxMessage(log);
357
351
  }
358
352
 
359
353
  /**
@@ -376,22 +370,22 @@ export async function retrieveL1ToL2Messages(
376
370
  break;
377
371
  }
378
372
 
379
- retrievedL1ToL2Messages.push(...mapLogsInboxMessage(messageSentLogs));
373
+ retrievedL1ToL2Messages.push(...messageSentLogs.map(mapLogInboxMessage));
380
374
  searchStartBlock = messageSentLogs.at(-1)!.l1BlockNumber + 1n;
381
375
  }
382
376
 
383
377
  return retrievedL1ToL2Messages;
384
378
  }
385
379
 
386
- function mapLogsInboxMessage(logs: MessageSentLog[]): InboxMessage[] {
387
- return logs.map(log => ({
380
+ function mapLogInboxMessage(log: MessageSentLog): InboxMessage {
381
+ return {
388
382
  index: log.args.index,
389
383
  leaf: log.args.leaf,
390
384
  l1BlockNumber: log.l1BlockNumber,
391
385
  l1BlockHash: log.l1BlockHash,
392
386
  checkpointNumber: log.args.checkpointNumber,
393
387
  rollingHash: log.args.rollingHash,
394
- }));
388
+ };
395
389
  }
396
390
 
397
391
  /** Retrieves L2ProofVerified events from the rollup contract. */
@@ -87,17 +87,17 @@ export async function verifyProxyImplementation(
87
87
  /**
88
88
  * Attempts to decode transaction as a Spire Proposer Multicall.
89
89
  * Spire Proposer is a proxy contract that wraps multiple calls.
90
- * Returns the target address and calldata of the wrapped call if validation succeeds and there is a single call.
90
+ * Returns all wrapped calls if validation succeeds (caller handles hash matching to find the propose call).
91
91
  * @param tx - The transaction to decode
92
92
  * @param publicClient - The viem public client for proxy verification
93
93
  * @param logger - Logger instance
94
- * @returns Object with 'to' and 'data' of the wrapped call, or undefined if validation fails
94
+ * @returns Array of wrapped calls with 'to' and 'data', or undefined if not a valid Spire Proposer tx
95
95
  */
96
- export async function getCallFromSpireProposer(
96
+ export async function getCallsFromSpireProposer(
97
97
  tx: Transaction,
98
98
  publicClient: { getStorageAt: (params: { address: Hex; slot: Hex }) => Promise<Hex | undefined> },
99
99
  logger: Logger,
100
- ): Promise<{ to: Hex; data: Hex } | undefined> {
100
+ ): Promise<{ to: Hex; data: Hex }[] | undefined> {
101
101
  const txHash = tx.hash;
102
102
 
103
103
  try {
@@ -141,17 +141,9 @@ export async function getCallFromSpireProposer(
141
141
 
142
142
  const [calls] = spireArgs;
143
143
 
144
- // Validate exactly ONE call (see ./README.md for rationale)
145
- if (calls.length !== 1) {
146
- logger.warn(`Spire Proposer multicall must contain exactly one call (got ${calls.length})`, { txHash });
147
- return undefined;
148
- }
149
-
150
- const call = calls[0];
151
-
152
- // Successfully extracted the single wrapped call
153
- logger.trace(`Decoded Spire Proposer with single call to ${call.target}`, { txHash });
154
- return { to: call.target, data: call.data };
144
+ // Return all wrapped calls (hash matching in the caller determines which is the propose call)
145
+ logger.trace(`Decoded Spire Proposer with ${calls.length} call(s)`, { txHash });
146
+ return calls.map(call => ({ to: call.target, data: call.data }));
155
147
  } catch (err) {
156
148
  // Any decoding error triggers fallback to trace
157
149
  logger.warn(`Failed to decode Spire Proposer: ${err}`, { txHash });
@@ -1,5 +1,5 @@
1
1
  import type { ViemPublicDebugClient } from '@aztec/ethereum/types';
2
- import { createLogger } from '@aztec/foundation/log';
2
+ import { type Logger, type LoggerBindings, createLogger } from '@aztec/foundation/log';
3
3
 
4
4
  import type { Hex } from 'viem';
5
5
  import type { ZodSchema } from 'zod';
@@ -7,8 +7,6 @@ import type { ZodSchema } from 'zod';
7
7
  import { callTraceSchema } from './debug_tx.js';
8
8
  import { traceTransactionResponseSchema } from './trace_tx.js';
9
9
 
10
- const logger = createLogger('aztec:archiver:validate_trace');
11
-
12
10
  /**
13
11
  * Helper function to test a trace method with validation
14
12
  *
@@ -17,6 +15,7 @@ const logger = createLogger('aztec:archiver:validate_trace');
17
15
  * @param schema - Zod schema to validate the response
18
16
  * @param method - Name of the RPC method ('debug_traceTransaction' or 'trace_transaction')
19
17
  * @param blockType - Type of block being tested ('recent' or 'old')
18
+ * @param logger - Logger instance
20
19
  * @returns true if the method works and validation passes, false otherwise
21
20
  */
22
21
  async function testTraceMethod(
@@ -25,6 +24,7 @@ async function testTraceMethod(
25
24
  schema: ZodSchema,
26
25
  method: 'debug_traceTransaction' | 'trace_transaction',
27
26
  blockType: string,
27
+ logger: Logger,
28
28
  ): Promise<boolean> {
29
29
  try {
30
30
  // Make request with appropriate params based on method name
@@ -59,9 +59,14 @@ export interface TraceAvailability {
59
59
  * Validates the availability of debug/trace methods on the Ethereum client.
60
60
  *
61
61
  * @param client - The Viem public debug client
62
+ * @param bindings - Optional logger bindings for context
62
63
  * @returns Object indicating which trace methods are available for recent and old blocks
63
64
  */
64
- export async function validateTraceAvailability(client: ViemPublicDebugClient): Promise<TraceAvailability> {
65
+ export async function validateTraceAvailability(
66
+ client: ViemPublicDebugClient,
67
+ bindings?: LoggerBindings,
68
+ ): Promise<TraceAvailability> {
69
+ const logger = createLogger('archiver:validate_trace', bindings);
65
70
  const result: TraceAvailability = {
66
71
  debugTraceRecent: false,
67
72
  traceTransactionRecent: false,
@@ -95,6 +100,7 @@ export async function validateTraceAvailability(client: ViemPublicDebugClient):
95
100
  callTraceSchema,
96
101
  'debug_traceTransaction',
97
102
  'recent',
103
+ logger,
98
104
  );
99
105
 
100
106
  // Test trace_transaction with recent block
@@ -104,6 +110,7 @@ export async function validateTraceAvailability(client: ViemPublicDebugClient):
104
110
  traceTransactionResponseSchema,
105
111
  'trace_transaction',
106
112
  'recent',
113
+ logger,
107
114
  );
108
115
 
109
116
  // Get a block from 512 blocks ago
@@ -132,7 +139,14 @@ export async function validateTraceAvailability(client: ViemPublicDebugClient):
132
139
  const oldTxHash = oldBlock.transactions[0] as Hex;
133
140
 
134
141
  // Test debug_traceTransaction with old block
135
- result.debugTraceOld = await testTraceMethod(client, oldTxHash, callTraceSchema, 'debug_traceTransaction', 'old');
142
+ result.debugTraceOld = await testTraceMethod(
143
+ client,
144
+ oldTxHash,
145
+ callTraceSchema,
146
+ 'debug_traceTransaction',
147
+ 'old',
148
+ logger,
149
+ );
136
150
 
137
151
  // Test trace_transaction with old block
138
152
  result.traceTransactionOld = await testTraceMethod(
@@ -141,6 +155,7 @@ export async function validateTraceAvailability(client: ViemPublicDebugClient):
141
155
  traceTransactionResponseSchema,
142
156
  'trace_transaction',
143
157
  'old',
158
+ logger,
144
159
  );
145
160
  } catch (error) {
146
161
  logger.warn(`Error validating debug_traceTransaction and trace_transaction availability: ${error}`);
@@ -159,15 +174,18 @@ function hasTxs(block: { transactions?: Hex[] }): boolean {
159
174
  *
160
175
  * @param client - The Viem public debug client
161
176
  * @param ethereumAllowNoDebugHosts - If false, throws an error when no trace methods are available
177
+ * @param bindings - Optional logger bindings for context
162
178
  * @throws Error if ethereumAllowNoDebugHosts is false and no trace methods are available
163
179
  */
164
180
  export async function validateAndLogTraceAvailability(
165
181
  client: ViemPublicDebugClient,
166
182
  ethereumAllowNoDebugHosts: boolean,
183
+ bindings?: LoggerBindings,
167
184
  ): Promise<void> {
185
+ const logger = createLogger('archiver:validate_trace', bindings);
168
186
  logger.debug('Validating trace/debug method availability...');
169
187
 
170
- const availability = await validateTraceAvailability(client);
188
+ const availability = await validateTraceAvailability(client, bindings);
171
189
 
172
190
  // Check if we have support for old blocks (either debug or trace)
173
191
  const hasOldBlockSupport = availability.debugTraceOld || availability.traceTransactionOld;