@aztec/archiver 0.0.1-commit.d3ec352c → 0.0.1-commit.d58ff9d0

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 (236) hide show
  1. package/README.md +164 -22
  2. package/dest/archiver.d.ts +194 -0
  3. package/dest/archiver.d.ts.map +1 -0
  4. package/dest/archiver.js +949 -0
  5. package/dest/config.d.ts +34 -0
  6. package/dest/config.d.ts.map +1 -0
  7. package/dest/config.js +95 -0
  8. package/dest/errors.d.ts +87 -0
  9. package/dest/errors.d.ts.map +1 -0
  10. package/dest/errors.js +129 -0
  11. package/dest/factory.d.ts +16 -10
  12. package/dest/factory.d.ts.map +1 -1
  13. package/dest/factory.js +117 -20
  14. package/dest/index.d.ts +19 -4
  15. package/dest/index.d.ts.map +1 -1
  16. package/dest/index.js +17 -3
  17. package/dest/interfaces.d.ts +9 -0
  18. package/dest/interfaces.d.ts.map +1 -0
  19. package/dest/interfaces.js +3 -0
  20. package/dest/l1/bin/retrieve-calldata.d.ts +3 -0
  21. package/dest/l1/bin/retrieve-calldata.d.ts.map +1 -0
  22. package/dest/l1/bin/retrieve-calldata.js +152 -0
  23. package/dest/l1/calldata_retriever.d.ts +143 -0
  24. package/dest/l1/calldata_retriever.d.ts.map +1 -0
  25. package/dest/l1/calldata_retriever.js +413 -0
  26. package/dest/l1/data_retrieval.d.ts +102 -0
  27. package/dest/l1/data_retrieval.d.ts.map +1 -0
  28. package/dest/{archiver → l1}/data_retrieval.js +85 -165
  29. package/dest/l1/debug_tx.d.ts +19 -0
  30. package/dest/l1/debug_tx.d.ts.map +1 -0
  31. package/dest/l1/debug_tx.js +73 -0
  32. package/dest/l1/spire_proposer.d.ts +70 -0
  33. package/dest/l1/spire_proposer.d.ts.map +1 -0
  34. package/dest/l1/spire_proposer.js +149 -0
  35. package/dest/l1/trace_tx.d.ts +43 -0
  36. package/dest/l1/trace_tx.d.ts.map +1 -0
  37. package/dest/l1/trace_tx.js +91 -0
  38. package/dest/l1/types.d.ts +12 -0
  39. package/dest/l1/types.d.ts.map +1 -0
  40. package/dest/l1/types.js +3 -0
  41. package/dest/l1/validate_historical_logs.d.ts +23 -0
  42. package/dest/l1/validate_historical_logs.d.ts.map +1 -0
  43. package/dest/l1/validate_historical_logs.js +108 -0
  44. package/dest/l1/validate_trace.d.ts +32 -0
  45. package/dest/l1/validate_trace.d.ts.map +1 -0
  46. package/dest/l1/validate_trace.js +154 -0
  47. package/dest/modules/contract_data_source_adapter.d.ts +25 -0
  48. package/dest/modules/contract_data_source_adapter.d.ts.map +1 -0
  49. package/dest/modules/contract_data_source_adapter.js +32 -0
  50. package/dest/modules/data_source_base.d.ts +112 -0
  51. package/dest/modules/data_source_base.d.ts.map +1 -0
  52. package/dest/modules/data_source_base.js +322 -0
  53. package/dest/modules/data_store_updater.d.ts +105 -0
  54. package/dest/modules/data_store_updater.d.ts.map +1 -0
  55. package/dest/modules/data_store_updater.js +393 -0
  56. package/dest/modules/instrumentation.d.ts +63 -0
  57. package/dest/modules/instrumentation.d.ts.map +1 -0
  58. package/dest/modules/instrumentation.js +166 -0
  59. package/dest/modules/l1_synchronizer.d.ts +77 -0
  60. package/dest/modules/l1_synchronizer.d.ts.map +1 -0
  61. package/dest/modules/l1_synchronizer.js +1381 -0
  62. package/dest/modules/outbox_trees_resolver.d.ts +62 -0
  63. package/dest/modules/outbox_trees_resolver.d.ts.map +1 -0
  64. package/dest/modules/outbox_trees_resolver.js +162 -0
  65. package/dest/modules/validation.d.ts +40 -0
  66. package/dest/modules/validation.d.ts.map +1 -0
  67. package/dest/{archiver → modules}/validation.js +41 -17
  68. package/dest/store/block_store.d.ts +303 -0
  69. package/dest/store/block_store.d.ts.map +1 -0
  70. package/dest/store/block_store.js +1206 -0
  71. package/dest/store/contract_class_store.d.ts +31 -0
  72. package/dest/store/contract_class_store.d.ts.map +1 -0
  73. package/dest/store/contract_class_store.js +98 -0
  74. package/dest/store/contract_instance_store.d.ts +51 -0
  75. package/dest/store/contract_instance_store.d.ts.map +1 -0
  76. package/dest/{archiver/kv_archiver_store → store}/contract_instance_store.js +55 -3
  77. package/dest/store/data_stores.d.ts +68 -0
  78. package/dest/store/data_stores.d.ts.map +1 -0
  79. package/dest/store/data_stores.js +54 -0
  80. package/dest/store/function_names_cache.d.ts +17 -0
  81. package/dest/store/function_names_cache.d.ts.map +1 -0
  82. package/dest/store/function_names_cache.js +30 -0
  83. package/dest/store/l2_tips_cache.d.ts +25 -0
  84. package/dest/store/l2_tips_cache.d.ts.map +1 -0
  85. package/dest/store/l2_tips_cache.js +26 -0
  86. package/dest/store/log_store.d.ts +59 -0
  87. package/dest/store/log_store.d.ts.map +1 -0
  88. package/dest/store/log_store.js +310 -0
  89. package/dest/store/log_store_codec.d.ts +78 -0
  90. package/dest/store/log_store_codec.d.ts.map +1 -0
  91. package/dest/store/log_store_codec.js +110 -0
  92. package/dest/store/message_store.d.ts +50 -0
  93. package/dest/store/message_store.d.ts.map +1 -0
  94. package/dest/{archiver/kv_archiver_store → store}/message_store.js +66 -23
  95. package/dest/{archiver/structs → structs}/data_retrieval.d.ts +1 -1
  96. package/dest/structs/data_retrieval.d.ts.map +1 -0
  97. package/dest/structs/inbox_message.d.ts +15 -0
  98. package/dest/structs/inbox_message.d.ts.map +1 -0
  99. package/dest/{archiver/structs → structs}/inbox_message.js +6 -6
  100. package/dest/structs/published.d.ts +2 -0
  101. package/dest/structs/published.d.ts.map +1 -0
  102. package/dest/test/fake_l1_state.d.ts +214 -0
  103. package/dest/test/fake_l1_state.d.ts.map +1 -0
  104. package/dest/test/fake_l1_state.js +517 -0
  105. package/dest/test/index.d.ts +2 -1
  106. package/dest/test/index.d.ts.map +1 -1
  107. package/dest/test/index.js +4 -1
  108. package/dest/test/mock_archiver.d.ts +5 -6
  109. package/dest/test/mock_archiver.d.ts.map +1 -1
  110. package/dest/test/mock_archiver.js +8 -12
  111. package/dest/test/mock_l1_to_l2_message_source.d.ts +6 -7
  112. package/dest/test/mock_l1_to_l2_message_source.d.ts.map +1 -1
  113. package/dest/test/mock_l1_to_l2_message_source.js +19 -14
  114. package/dest/test/mock_l2_block_source.d.ts +68 -40
  115. package/dest/test/mock_l2_block_source.d.ts.map +1 -1
  116. package/dest/test/mock_l2_block_source.js +347 -145
  117. package/dest/test/mock_structs.d.ts +83 -4
  118. package/dest/test/mock_structs.d.ts.map +1 -1
  119. package/dest/test/mock_structs.js +157 -12
  120. package/dest/test/noop_l1_archiver.d.ts +34 -0
  121. package/dest/test/noop_l1_archiver.d.ts.map +1 -0
  122. package/dest/test/noop_l1_archiver.js +88 -0
  123. package/package.json +18 -18
  124. package/src/archiver.ts +785 -0
  125. package/src/config.ts +125 -0
  126. package/src/errors.ts +203 -0
  127. package/src/factory.ts +185 -22
  128. package/src/index.ts +27 -3
  129. package/src/interfaces.ts +9 -0
  130. package/src/l1/README.md +55 -0
  131. package/src/l1/bin/retrieve-calldata.ts +194 -0
  132. package/src/l1/calldata_retriever.ts +529 -0
  133. package/src/{archiver → l1}/data_retrieval.ts +157 -243
  134. package/src/l1/debug_tx.ts +99 -0
  135. package/src/l1/spire_proposer.ts +152 -0
  136. package/src/l1/trace_tx.ts +128 -0
  137. package/src/l1/types.ts +13 -0
  138. package/src/l1/validate_historical_logs.ts +140 -0
  139. package/src/l1/validate_trace.ts +229 -0
  140. package/src/modules/contract_data_source_adapter.ts +46 -0
  141. package/src/modules/data_source_base.ts +466 -0
  142. package/src/modules/data_store_updater.ts +519 -0
  143. package/src/modules/instrumentation.ts +217 -0
  144. package/src/modules/l1_synchronizer.ts +1320 -0
  145. package/src/modules/outbox_trees_resolver.ts +199 -0
  146. package/src/modules/validation.ts +186 -0
  147. package/src/store/block_store.ts +1551 -0
  148. package/src/store/contract_class_store.ts +126 -0
  149. package/src/{archiver/kv_archiver_store → store}/contract_instance_store.ts +70 -7
  150. package/src/store/data_stores.ts +104 -0
  151. package/src/store/function_names_cache.ts +37 -0
  152. package/src/store/l2_tips_cache.ts +35 -0
  153. package/src/store/log_store.ts +380 -0
  154. package/src/store/log_store_codec.ts +143 -0
  155. package/src/{archiver/kv_archiver_store → store}/message_store.ts +81 -28
  156. package/src/{archiver/structs → structs}/inbox_message.ts +8 -9
  157. package/src/{archiver/structs → structs}/published.ts +0 -1
  158. package/src/test/fake_l1_state.ts +770 -0
  159. package/src/test/fixtures/debug_traceTransaction-multicall3.json +88 -0
  160. package/src/test/fixtures/debug_traceTransaction-multiplePropose.json +153 -0
  161. package/src/test/fixtures/debug_traceTransaction-proxied.json +122 -0
  162. package/src/test/fixtures/trace_transaction-multicall3.json +65 -0
  163. package/src/test/fixtures/trace_transaction-multiplePropose.json +319 -0
  164. package/src/test/fixtures/trace_transaction-proxied.json +128 -0
  165. package/src/test/fixtures/trace_transaction-randomRevert.json +216 -0
  166. package/src/test/index.ts +4 -0
  167. package/src/test/mock_archiver.ts +10 -14
  168. package/src/test/mock_l1_to_l2_message_source.ts +16 -15
  169. package/src/test/mock_l2_block_source.ts +416 -161
  170. package/src/test/mock_structs.ts +292 -14
  171. package/src/test/noop_l1_archiver.ts +158 -0
  172. package/dest/archiver/archiver.d.ts +0 -290
  173. package/dest/archiver/archiver.d.ts.map +0 -1
  174. package/dest/archiver/archiver.js +0 -1434
  175. package/dest/archiver/archiver_store.d.ts +0 -256
  176. package/dest/archiver/archiver_store.d.ts.map +0 -1
  177. package/dest/archiver/archiver_store.js +0 -4
  178. package/dest/archiver/archiver_store_test_suite.d.ts +0 -8
  179. package/dest/archiver/archiver_store_test_suite.d.ts.map +0 -1
  180. package/dest/archiver/archiver_store_test_suite.js +0 -1289
  181. package/dest/archiver/config.d.ts +0 -21
  182. package/dest/archiver/config.d.ts.map +0 -1
  183. package/dest/archiver/config.js +0 -55
  184. package/dest/archiver/data_retrieval.d.ts +0 -80
  185. package/dest/archiver/data_retrieval.d.ts.map +0 -1
  186. package/dest/archiver/errors.d.ts +0 -12
  187. package/dest/archiver/errors.d.ts.map +0 -1
  188. package/dest/archiver/errors.js +0 -17
  189. package/dest/archiver/index.d.ts +0 -7
  190. package/dest/archiver/index.d.ts.map +0 -1
  191. package/dest/archiver/index.js +0 -4
  192. package/dest/archiver/instrumentation.d.ts +0 -35
  193. package/dest/archiver/instrumentation.d.ts.map +0 -1
  194. package/dest/archiver/instrumentation.js +0 -140
  195. package/dest/archiver/kv_archiver_store/block_store.d.ts +0 -125
  196. package/dest/archiver/kv_archiver_store/block_store.d.ts.map +0 -1
  197. package/dest/archiver/kv_archiver_store/block_store.js +0 -371
  198. package/dest/archiver/kv_archiver_store/contract_class_store.d.ts +0 -18
  199. package/dest/archiver/kv_archiver_store/contract_class_store.d.ts.map +0 -1
  200. package/dest/archiver/kv_archiver_store/contract_class_store.js +0 -120
  201. package/dest/archiver/kv_archiver_store/contract_instance_store.d.ts +0 -24
  202. package/dest/archiver/kv_archiver_store/contract_instance_store.d.ts.map +0 -1
  203. package/dest/archiver/kv_archiver_store/kv_archiver_store.d.ts +0 -169
  204. package/dest/archiver/kv_archiver_store/kv_archiver_store.d.ts.map +0 -1
  205. package/dest/archiver/kv_archiver_store/kv_archiver_store.js +0 -296
  206. package/dest/archiver/kv_archiver_store/log_store.d.ts +0 -49
  207. package/dest/archiver/kv_archiver_store/log_store.d.ts.map +0 -1
  208. package/dest/archiver/kv_archiver_store/log_store.js +0 -337
  209. package/dest/archiver/kv_archiver_store/message_store.d.ts +0 -39
  210. package/dest/archiver/kv_archiver_store/message_store.d.ts.map +0 -1
  211. package/dest/archiver/structs/data_retrieval.d.ts.map +0 -1
  212. package/dest/archiver/structs/inbox_message.d.ts +0 -15
  213. package/dest/archiver/structs/inbox_message.d.ts.map +0 -1
  214. package/dest/archiver/structs/published.d.ts +0 -3
  215. package/dest/archiver/structs/published.d.ts.map +0 -1
  216. package/dest/archiver/validation.d.ts +0 -17
  217. package/dest/archiver/validation.d.ts.map +0 -1
  218. package/dest/rpc/index.d.ts +0 -9
  219. package/dest/rpc/index.d.ts.map +0 -1
  220. package/dest/rpc/index.js +0 -15
  221. package/src/archiver/archiver.ts +0 -1880
  222. package/src/archiver/archiver_store.ts +0 -310
  223. package/src/archiver/archiver_store_test_suite.ts +0 -1295
  224. package/src/archiver/config.ts +0 -79
  225. package/src/archiver/errors.ts +0 -26
  226. package/src/archiver/index.ts +0 -6
  227. package/src/archiver/instrumentation.ts +0 -187
  228. package/src/archiver/kv_archiver_store/block_store.ts +0 -482
  229. package/src/archiver/kv_archiver_store/contract_class_store.ts +0 -176
  230. package/src/archiver/kv_archiver_store/kv_archiver_store.ts +0 -423
  231. package/src/archiver/kv_archiver_store/log_store.ts +0 -407
  232. package/src/archiver/validation.ts +0 -124
  233. package/src/rpc/index.ts +0 -16
  234. /package/dest/{archiver/structs → structs}/data_retrieval.js +0 -0
  235. /package/dest/{archiver/structs → structs}/published.js +0 -0
  236. /package/src/{archiver/structs → structs}/data_retrieval.ts +0 -0
@@ -0,0 +1,229 @@
1
+ import type { ViemPublicDebugClient } from '@aztec/ethereum/types';
2
+ import { type Logger, type LoggerBindings, createLogger } from '@aztec/foundation/log';
3
+
4
+ import type { Hex } from 'viem';
5
+ import type { ZodSchema } from 'zod';
6
+
7
+ import { callTraceSchema } from './debug_tx.js';
8
+ import { traceTransactionResponseSchema } from './trace_tx.js';
9
+
10
+ /**
11
+ * Helper function to test a trace method with validation
12
+ *
13
+ * @param client - The Viem public debug client
14
+ * @param txHash - Transaction hash to trace
15
+ * @param schema - Zod schema to validate the response
16
+ * @param method - Name of the RPC method ('debug_traceTransaction' or 'trace_transaction')
17
+ * @param blockType - Type of block being tested ('recent' or 'old')
18
+ * @param logger - Logger instance
19
+ * @returns true if the method works and validation passes, false otherwise
20
+ */
21
+ async function testTraceMethod(
22
+ client: ViemPublicDebugClient,
23
+ txHash: Hex,
24
+ schema: ZodSchema,
25
+ method: 'debug_traceTransaction' | 'trace_transaction',
26
+ blockType: string,
27
+ logger: Logger,
28
+ ): Promise<boolean> {
29
+ try {
30
+ // Make request with appropriate params based on method name
31
+ const result = await client.request(
32
+ method === 'debug_traceTransaction'
33
+ ? { method, params: [txHash, { tracer: 'callTracer' }] }
34
+ : { method, params: [txHash] },
35
+ );
36
+
37
+ schema.parse(result);
38
+ logger.debug(`${method} works for ${blockType} blocks`);
39
+ return true;
40
+ } catch (error) {
41
+ logger.warn(`${method} failed for ${blockType} blocks: ${error}`);
42
+ return false;
43
+ }
44
+ }
45
+
46
+ /** Result of trace availability checks */
47
+ export interface TraceAvailability {
48
+ /** Whether debug_traceTransaction works for recent blocks */
49
+ debugTraceRecent: boolean;
50
+ /** Whether trace_transaction works for recent blocks */
51
+ traceTransactionRecent: boolean;
52
+ /** Whether debug_traceTransaction works for old blocks (512 blocks ago) */
53
+ debugTraceOld: boolean;
54
+ /** Whether trace_transaction works for old blocks (512 blocks ago) */
55
+ traceTransactionOld: boolean;
56
+ }
57
+
58
+ /**
59
+ * Validates the availability of debug/trace methods on the Ethereum client.
60
+ *
61
+ * @param client - The Viem public debug client
62
+ * @param bindings - Optional logger bindings for context
63
+ * @returns Object indicating which trace methods are available for recent and old blocks
64
+ */
65
+ export async function validateTraceAvailability(
66
+ client: ViemPublicDebugClient,
67
+ bindings?: LoggerBindings,
68
+ ): Promise<TraceAvailability> {
69
+ const logger = createLogger('archiver:validate_trace', bindings);
70
+ const result: TraceAvailability = {
71
+ debugTraceRecent: false,
72
+ traceTransactionRecent: false,
73
+ debugTraceOld: false,
74
+ traceTransactionOld: false,
75
+ };
76
+
77
+ try {
78
+ // Get the latest block
79
+ let latestBlock = await client.getBlock({ blockTag: 'latest' });
80
+ let attempts = 10;
81
+
82
+ // Loop back to find a block with transactions (handles dev/test scenarios)
83
+ while (!hasTxs(latestBlock) && latestBlock.number && latestBlock.number > 0n && --attempts > 0) {
84
+ logger.debug(`Block ${latestBlock.number} has no transactions, checking previous block`);
85
+ latestBlock = await client.getBlock({ blockNumber: latestBlock.number - 1n });
86
+ }
87
+
88
+ if (!hasTxs(latestBlock)) {
89
+ logger.warn('No blocks with transactions found from latest back to genesis, cannot validate trace availability');
90
+ return result;
91
+ }
92
+
93
+ // Get a transaction from the found block
94
+ const recentTxHash = latestBlock.transactions[0] as Hex;
95
+
96
+ // Test debug_traceTransaction with recent block
97
+ result.debugTraceRecent = await testTraceMethod(
98
+ client,
99
+ recentTxHash,
100
+ callTraceSchema,
101
+ 'debug_traceTransaction',
102
+ 'recent',
103
+ logger,
104
+ );
105
+
106
+ // Test trace_transaction with recent block
107
+ result.traceTransactionRecent = await testTraceMethod(
108
+ client,
109
+ recentTxHash,
110
+ traceTransactionResponseSchema,
111
+ 'trace_transaction',
112
+ 'recent',
113
+ logger,
114
+ );
115
+
116
+ // Get a block from 512 blocks ago
117
+ const oldBlockNumber = latestBlock.number ? latestBlock.number - 512n : null;
118
+ if (!oldBlockNumber || oldBlockNumber < 0n) {
119
+ logger.debug('Cannot test old blocks, blockchain too short');
120
+ return result;
121
+ }
122
+
123
+ let oldBlock = await client.getBlock({ blockNumber: oldBlockNumber });
124
+ attempts = 10;
125
+
126
+ // Loop back to find a block with transactions (handles dev/test scenarios)
127
+ while (!hasTxs(oldBlock) && oldBlock.number && oldBlock.number > 0n && --attempts > 0) {
128
+ logger.debug(`Block ${oldBlock.number} has no transactions, checking previous block`);
129
+ oldBlock = await client.getBlock({ blockNumber: oldBlock.number - 1n });
130
+ }
131
+
132
+ if (!hasTxs(oldBlock)) {
133
+ logger.debug(
134
+ 'No blocks with transactions found from old block back to genesis, cannot validate trace availability for old blocks',
135
+ );
136
+ return result;
137
+ }
138
+
139
+ const oldTxHash = oldBlock.transactions[0] as Hex;
140
+
141
+ // Test debug_traceTransaction with old block
142
+ result.debugTraceOld = await testTraceMethod(
143
+ client,
144
+ oldTxHash,
145
+ callTraceSchema,
146
+ 'debug_traceTransaction',
147
+ 'old',
148
+ logger,
149
+ );
150
+
151
+ // Test trace_transaction with old block
152
+ result.traceTransactionOld = await testTraceMethod(
153
+ client,
154
+ oldTxHash,
155
+ traceTransactionResponseSchema,
156
+ 'trace_transaction',
157
+ 'old',
158
+ logger,
159
+ );
160
+ } catch (error) {
161
+ logger.warn(`Error validating debug_traceTransaction and trace_transaction availability: ${error}`);
162
+ }
163
+
164
+ return result;
165
+ }
166
+
167
+ function hasTxs(block: { transactions?: Hex[] }): boolean {
168
+ return Array.isArray(block.transactions) && block.transactions.length > 0;
169
+ }
170
+
171
+ /**
172
+ * Validates trace availability and logs appropriate messages based on the results.
173
+ * Optionally throws an error if no trace methods are available and ethereumAllowNoDebugHosts is false.
174
+ *
175
+ * @param client - The Viem public debug client
176
+ * @param ethereumAllowNoDebugHosts - If false, throws an error when no trace methods are available
177
+ * @param bindings - Optional logger bindings for context
178
+ * @throws Error if ethereumAllowNoDebugHosts is false and no trace methods are available
179
+ */
180
+ export async function validateAndLogTraceAvailability(
181
+ client: ViemPublicDebugClient,
182
+ ethereumAllowNoDebugHosts: boolean,
183
+ bindings?: LoggerBindings,
184
+ ): Promise<void> {
185
+ const logger = createLogger('archiver:validate_trace', bindings);
186
+ logger.debug('Validating trace/debug method availability...');
187
+
188
+ const availability = await validateTraceAvailability(client, bindings);
189
+
190
+ // Check if we have support for old blocks (either debug or trace)
191
+ const hasOldBlockSupport = availability.debugTraceOld || availability.traceTransactionOld;
192
+
193
+ if (hasOldBlockSupport) {
194
+ // Ideal case: we have trace support for old blocks
195
+ const methods: string[] = [];
196
+ if (availability.debugTraceOld) {
197
+ methods.push('debug_traceTransaction');
198
+ }
199
+ if (availability.traceTransactionOld) {
200
+ methods.push('trace_transaction');
201
+ }
202
+ logger.info(
203
+ `Ethereum client supports trace methods for old blocks (${methods.join(', ')}). Archiver can retrieve historical transaction traces.`,
204
+ );
205
+ } else if (availability.debugTraceRecent || availability.traceTransactionRecent) {
206
+ // Warning case: only recent block support
207
+ const methods: string[] = [];
208
+ if (availability.debugTraceRecent) {
209
+ methods.push('debug_traceTransaction');
210
+ }
211
+ if (availability.traceTransactionRecent) {
212
+ methods.push('trace_transaction');
213
+ }
214
+ logger.warn(
215
+ `Ethereum client only supports trace methods for recent blocks (${methods.join(', ')}). Historical transaction traces may not be available.`,
216
+ );
217
+ } else {
218
+ // Error case: no support at all
219
+ const errorMessage =
220
+ 'Ethereum debug client does not support debug_traceTransaction or trace_transaction methods. Transaction tracing will not be available. This may impact archiver syncing.';
221
+
222
+ if (ethereumAllowNoDebugHosts) {
223
+ logger.warn(`${errorMessage} Continuing because ETHEREUM_ALLOW_NO_DEBUG_HOSTS is set to true.`);
224
+ } else {
225
+ logger.error(errorMessage);
226
+ throw new Error(`${errorMessage} Set ETHEREUM_ALLOW_NO_DEBUG_HOSTS=true to bypass this check.`);
227
+ }
228
+ }
229
+ }
@@ -0,0 +1,46 @@
1
+ import type { BlockNumber } from '@aztec/foundation/branded-types';
2
+ import type { Fr } from '@aztec/foundation/curves/bn254';
3
+ import type { FunctionSelector } from '@aztec/stdlib/abi';
4
+ import type { AztecAddress } from '@aztec/stdlib/aztec-address';
5
+ import type { ContractClassPublic, ContractDataSource, ContractInstanceWithAddress } from '@aztec/stdlib/contract';
6
+ import type { UInt64 } from '@aztec/stdlib/types';
7
+
8
+ import type { ArchiverDataStores } from '../store/data_stores.js';
9
+
10
+ /**
11
+ * Thin {@link ContractDataSource} adapter over {@link ArchiverDataStores}.
12
+ *
13
+ * Used by contexts (e.g. offline epoch re-prover tools) that need a ContractDataSource
14
+ * but do not need a full archiver instance.
15
+ */
16
+ export class ArchiverContractDataSourceAdapter implements ContractDataSource {
17
+ constructor(private readonly stores: ArchiverDataStores) {}
18
+
19
+ public getBlockNumber(): Promise<BlockNumber> {
20
+ return this.stores.blocks.getLatestL2BlockNumber();
21
+ }
22
+
23
+ public getContractClass(id: Fr): Promise<ContractClassPublic | undefined> {
24
+ return this.stores.contractClasses.getContractClass(id);
25
+ }
26
+
27
+ public getBytecodeCommitment(id: Fr): Promise<Fr | undefined> {
28
+ return this.stores.contractClasses.getBytecodeCommitment(id);
29
+ }
30
+
31
+ public getContract(address: AztecAddress, timestamp: UInt64): Promise<ContractInstanceWithAddress | undefined> {
32
+ return this.stores.contractInstances.getContractInstance(address, timestamp);
33
+ }
34
+
35
+ public getContractClassIds(): Promise<Fr[]> {
36
+ return this.stores.contractClasses.getContractClassIds();
37
+ }
38
+
39
+ public getDebugFunctionName(_address: AztecAddress, selector: FunctionSelector): Promise<string | undefined> {
40
+ return Promise.resolve(this.stores.functionNames.get(selector));
41
+ }
42
+
43
+ public registerContractFunctionSignatures(signatures: string[]): Promise<void> {
44
+ return this.stores.functionNames.register(signatures);
45
+ }
46
+ }