@aztec/archiver 0.0.1-commit.96bb3f7 → 0.0.1-commit.993d240

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 (232) hide show
  1. package/README.md +164 -22
  2. package/dest/archiver.d.ts +158 -0
  3. package/dest/archiver.d.ts.map +1 -0
  4. package/dest/archiver.js +881 -0
  5. package/dest/config.d.ts +33 -0
  6. package/dest/config.d.ts.map +1 -0
  7. package/dest/{archiver/config.js → config.js} +31 -14
  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 +112 -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/{archiver/l1 → l1}/bin/retrieve-calldata.d.ts +1 -1
  21. package/dest/l1/bin/retrieve-calldata.d.ts.map +1 -0
  22. package/dest/{archiver/l1 → l1}/bin/retrieve-calldata.js +35 -32
  23. package/dest/l1/calldata_retriever.d.ts +136 -0
  24. package/dest/l1/calldata_retriever.d.ts.map +1 -0
  25. package/dest/l1/calldata_retriever.js +412 -0
  26. package/dest/l1/data_retrieval.d.ts +97 -0
  27. package/dest/l1/data_retrieval.d.ts.map +1 -0
  28. package/dest/{archiver/l1 → l1}/data_retrieval.js +65 -89
  29. package/dest/{archiver/l1 → l1}/debug_tx.d.ts +1 -1
  30. package/dest/l1/debug_tx.d.ts.map +1 -0
  31. package/dest/{archiver/l1 → l1}/spire_proposer.d.ts +5 -5
  32. package/dest/l1/spire_proposer.d.ts.map +1 -0
  33. package/dest/{archiver/l1 → l1}/spire_proposer.js +9 -17
  34. package/dest/l1/trace_tx.d.ts +43 -0
  35. package/dest/l1/trace_tx.d.ts.map +1 -0
  36. package/dest/l1/types.d.ts +12 -0
  37. package/dest/l1/types.d.ts.map +1 -0
  38. package/dest/l1/validate_historical_logs.d.ts +23 -0
  39. package/dest/l1/validate_historical_logs.d.ts.map +1 -0
  40. package/dest/l1/validate_historical_logs.js +108 -0
  41. package/dest/{archiver/l1 → l1}/validate_trace.d.ts +6 -3
  42. package/dest/l1/validate_trace.d.ts.map +1 -0
  43. package/dest/{archiver/l1 → l1}/validate_trace.js +13 -9
  44. package/dest/modules/contract_data_source_adapter.d.ts +25 -0
  45. package/dest/modules/contract_data_source_adapter.d.ts.map +1 -0
  46. package/dest/modules/contract_data_source_adapter.js +40 -0
  47. package/dest/modules/data_source_base.d.ts +113 -0
  48. package/dest/modules/data_source_base.d.ts.map +1 -0
  49. package/dest/modules/data_source_base.js +351 -0
  50. package/dest/modules/data_store_updater.d.ts +105 -0
  51. package/dest/modules/data_store_updater.d.ts.map +1 -0
  52. package/dest/modules/data_store_updater.js +392 -0
  53. package/dest/modules/instrumentation.d.ts +55 -0
  54. package/dest/modules/instrumentation.d.ts.map +1 -0
  55. package/dest/{archiver → modules}/instrumentation.js +61 -19
  56. package/dest/modules/l1_synchronizer.d.ts +77 -0
  57. package/dest/modules/l1_synchronizer.d.ts.map +1 -0
  58. package/dest/modules/l1_synchronizer.js +1344 -0
  59. package/dest/modules/validation.d.ts +18 -0
  60. package/dest/modules/validation.d.ts.map +1 -0
  61. package/dest/{archiver → modules}/validation.js +12 -6
  62. package/dest/store/block_store.d.ts +300 -0
  63. package/dest/store/block_store.d.ts.map +1 -0
  64. package/dest/store/block_store.js +1219 -0
  65. package/dest/store/contract_class_store.d.ts +31 -0
  66. package/dest/store/contract_class_store.d.ts.map +1 -0
  67. package/dest/store/contract_class_store.js +80 -0
  68. package/dest/store/contract_instance_store.d.ts +51 -0
  69. package/dest/store/contract_instance_store.d.ts.map +1 -0
  70. package/dest/{archiver/kv_archiver_store → store}/contract_instance_store.js +38 -3
  71. package/dest/store/data_stores.d.ts +68 -0
  72. package/dest/store/data_stores.d.ts.map +1 -0
  73. package/dest/store/data_stores.js +54 -0
  74. package/dest/store/function_names_cache.d.ts +17 -0
  75. package/dest/store/function_names_cache.d.ts.map +1 -0
  76. package/dest/store/function_names_cache.js +30 -0
  77. package/dest/store/l2_tips_cache.d.ts +25 -0
  78. package/dest/store/l2_tips_cache.d.ts.map +1 -0
  79. package/dest/store/l2_tips_cache.js +26 -0
  80. package/dest/store/log_store.d.ts +59 -0
  81. package/dest/store/log_store.d.ts.map +1 -0
  82. package/dest/store/log_store.js +310 -0
  83. package/dest/store/log_store_codec.d.ts +70 -0
  84. package/dest/store/log_store_codec.d.ts.map +1 -0
  85. package/dest/store/log_store_codec.js +101 -0
  86. package/dest/store/message_store.d.ts +50 -0
  87. package/dest/store/message_store.d.ts.map +1 -0
  88. package/dest/{archiver/kv_archiver_store → store}/message_store.js +51 -9
  89. package/dest/{archiver/structs → structs}/data_retrieval.d.ts +1 -1
  90. package/dest/structs/data_retrieval.d.ts.map +1 -0
  91. package/dest/structs/inbox_message.d.ts +15 -0
  92. package/dest/structs/inbox_message.d.ts.map +1 -0
  93. package/dest/{archiver/structs → structs}/published.d.ts +1 -1
  94. package/dest/structs/published.d.ts.map +1 -0
  95. package/dest/test/fake_l1_state.d.ts +214 -0
  96. package/dest/test/fake_l1_state.d.ts.map +1 -0
  97. package/dest/test/fake_l1_state.js +517 -0
  98. package/dest/test/index.d.ts +2 -1
  99. package/dest/test/index.d.ts.map +1 -1
  100. package/dest/test/index.js +4 -1
  101. package/dest/test/mock_archiver.d.ts +2 -2
  102. package/dest/test/mock_archiver.d.ts.map +1 -1
  103. package/dest/test/mock_archiver.js +3 -3
  104. package/dest/test/mock_l1_to_l2_message_source.d.ts +1 -1
  105. package/dest/test/mock_l1_to_l2_message_source.d.ts.map +1 -1
  106. package/dest/test/mock_l1_to_l2_message_source.js +2 -1
  107. package/dest/test/mock_l2_block_source.d.ts +65 -41
  108. package/dest/test/mock_l2_block_source.d.ts.map +1 -1
  109. package/dest/test/mock_l2_block_source.js +330 -151
  110. package/dest/test/mock_structs.d.ts +81 -3
  111. package/dest/test/mock_structs.d.ts.map +1 -1
  112. package/dest/test/mock_structs.js +152 -7
  113. package/dest/test/noop_l1_archiver.d.ts +29 -0
  114. package/dest/test/noop_l1_archiver.d.ts.map +1 -0
  115. package/dest/test/noop_l1_archiver.js +85 -0
  116. package/package.json +17 -18
  117. package/src/archiver.ts +681 -0
  118. package/src/{archiver/config.ts → config.ts} +43 -12
  119. package/src/errors.ts +203 -0
  120. package/src/factory.ts +175 -22
  121. package/src/index.ts +27 -3
  122. package/src/interfaces.ts +9 -0
  123. package/src/l1/README.md +55 -0
  124. package/src/{archiver/l1 → l1}/bin/retrieve-calldata.ts +45 -33
  125. package/src/l1/calldata_retriever.ts +522 -0
  126. package/src/{archiver/l1 → l1}/data_retrieval.ts +106 -134
  127. package/src/{archiver/l1 → l1}/spire_proposer.ts +7 -15
  128. package/src/l1/validate_historical_logs.ts +140 -0
  129. package/src/{archiver/l1 → l1}/validate_trace.ts +24 -6
  130. package/src/modules/contract_data_source_adapter.ts +55 -0
  131. package/src/modules/data_source_base.ts +493 -0
  132. package/src/modules/data_store_updater.ts +518 -0
  133. package/src/{archiver → modules}/instrumentation.ts +72 -20
  134. package/src/modules/l1_synchronizer.ts +1257 -0
  135. package/src/{archiver → modules}/validation.ts +15 -9
  136. package/src/store/block_store.ts +1590 -0
  137. package/src/store/contract_class_store.ts +108 -0
  138. package/src/{archiver/kv_archiver_store → store}/contract_instance_store.ts +52 -6
  139. package/src/store/data_stores.ts +104 -0
  140. package/src/store/function_names_cache.ts +37 -0
  141. package/src/store/l2_tips_cache.ts +35 -0
  142. package/src/store/log_store.ts +379 -0
  143. package/src/store/log_store_codec.ts +132 -0
  144. package/src/{archiver/kv_archiver_store → store}/message_store.ts +60 -10
  145. package/src/{archiver/structs → structs}/inbox_message.ts +1 -1
  146. package/src/test/fake_l1_state.ts +770 -0
  147. package/src/test/index.ts +4 -0
  148. package/src/test/mock_archiver.ts +4 -3
  149. package/src/test/mock_l1_to_l2_message_source.ts +1 -0
  150. package/src/test/mock_l2_block_source.ts +403 -171
  151. package/src/test/mock_structs.ts +283 -8
  152. package/src/test/noop_l1_archiver.ts +139 -0
  153. package/dest/archiver/archiver.d.ts +0 -307
  154. package/dest/archiver/archiver.d.ts.map +0 -1
  155. package/dest/archiver/archiver.js +0 -2102
  156. package/dest/archiver/archiver_store.d.ts +0 -315
  157. package/dest/archiver/archiver_store.d.ts.map +0 -1
  158. package/dest/archiver/archiver_store.js +0 -4
  159. package/dest/archiver/archiver_store_test_suite.d.ts +0 -8
  160. package/dest/archiver/archiver_store_test_suite.d.ts.map +0 -1
  161. package/dest/archiver/archiver_store_test_suite.js +0 -2770
  162. package/dest/archiver/config.d.ts +0 -22
  163. package/dest/archiver/config.d.ts.map +0 -1
  164. package/dest/archiver/errors.d.ts +0 -36
  165. package/dest/archiver/errors.d.ts.map +0 -1
  166. package/dest/archiver/errors.js +0 -54
  167. package/dest/archiver/index.d.ts +0 -7
  168. package/dest/archiver/index.d.ts.map +0 -1
  169. package/dest/archiver/index.js +0 -4
  170. package/dest/archiver/instrumentation.d.ts +0 -37
  171. package/dest/archiver/instrumentation.d.ts.map +0 -1
  172. package/dest/archiver/kv_archiver_store/block_store.d.ts +0 -164
  173. package/dest/archiver/kv_archiver_store/block_store.d.ts.map +0 -1
  174. package/dest/archiver/kv_archiver_store/block_store.js +0 -626
  175. package/dest/archiver/kv_archiver_store/contract_class_store.d.ts +0 -18
  176. package/dest/archiver/kv_archiver_store/contract_class_store.d.ts.map +0 -1
  177. package/dest/archiver/kv_archiver_store/contract_class_store.js +0 -120
  178. package/dest/archiver/kv_archiver_store/contract_instance_store.d.ts +0 -24
  179. package/dest/archiver/kv_archiver_store/contract_instance_store.d.ts.map +0 -1
  180. package/dest/archiver/kv_archiver_store/kv_archiver_store.d.ts +0 -159
  181. package/dest/archiver/kv_archiver_store/kv_archiver_store.d.ts.map +0 -1
  182. package/dest/archiver/kv_archiver_store/kv_archiver_store.js +0 -316
  183. package/dest/archiver/kv_archiver_store/log_store.d.ts +0 -45
  184. package/dest/archiver/kv_archiver_store/log_store.d.ts.map +0 -1
  185. package/dest/archiver/kv_archiver_store/log_store.js +0 -401
  186. package/dest/archiver/kv_archiver_store/message_store.d.ts +0 -40
  187. package/dest/archiver/kv_archiver_store/message_store.d.ts.map +0 -1
  188. package/dest/archiver/l1/bin/retrieve-calldata.d.ts.map +0 -1
  189. package/dest/archiver/l1/calldata_retriever.d.ts +0 -112
  190. package/dest/archiver/l1/calldata_retriever.d.ts.map +0 -1
  191. package/dest/archiver/l1/calldata_retriever.js +0 -471
  192. package/dest/archiver/l1/data_retrieval.d.ts +0 -90
  193. package/dest/archiver/l1/data_retrieval.d.ts.map +0 -1
  194. package/dest/archiver/l1/debug_tx.d.ts.map +0 -1
  195. package/dest/archiver/l1/spire_proposer.d.ts.map +0 -1
  196. package/dest/archiver/l1/trace_tx.d.ts +0 -97
  197. package/dest/archiver/l1/trace_tx.d.ts.map +0 -1
  198. package/dest/archiver/l1/types.d.ts +0 -12
  199. package/dest/archiver/l1/types.d.ts.map +0 -1
  200. package/dest/archiver/l1/validate_trace.d.ts.map +0 -1
  201. package/dest/archiver/structs/data_retrieval.d.ts.map +0 -1
  202. package/dest/archiver/structs/inbox_message.d.ts +0 -15
  203. package/dest/archiver/structs/inbox_message.d.ts.map +0 -1
  204. package/dest/archiver/structs/published.d.ts.map +0 -1
  205. package/dest/archiver/validation.d.ts +0 -17
  206. package/dest/archiver/validation.d.ts.map +0 -1
  207. package/dest/rpc/index.d.ts +0 -9
  208. package/dest/rpc/index.d.ts.map +0 -1
  209. package/dest/rpc/index.js +0 -15
  210. package/src/archiver/archiver.ts +0 -2265
  211. package/src/archiver/archiver_store.ts +0 -380
  212. package/src/archiver/archiver_store_test_suite.ts +0 -2842
  213. package/src/archiver/errors.ts +0 -90
  214. package/src/archiver/index.ts +0 -6
  215. package/src/archiver/kv_archiver_store/block_store.ts +0 -850
  216. package/src/archiver/kv_archiver_store/contract_class_store.ts +0 -176
  217. package/src/archiver/kv_archiver_store/kv_archiver_store.ts +0 -442
  218. package/src/archiver/kv_archiver_store/log_store.ts +0 -516
  219. package/src/archiver/l1/README.md +0 -98
  220. package/src/archiver/l1/calldata_retriever.ts +0 -641
  221. package/src/rpc/index.ts +0 -16
  222. /package/dest/{archiver/l1 → l1}/debug_tx.js +0 -0
  223. /package/dest/{archiver/l1 → l1}/trace_tx.js +0 -0
  224. /package/dest/{archiver/l1 → l1}/types.js +0 -0
  225. /package/dest/{archiver/structs → structs}/data_retrieval.js +0 -0
  226. /package/dest/{archiver/structs → structs}/inbox_message.js +0 -0
  227. /package/dest/{archiver/structs → structs}/published.js +0 -0
  228. /package/src/{archiver/l1 → l1}/debug_tx.ts +0 -0
  229. /package/src/{archiver/l1 → l1}/trace_tx.ts +0 -0
  230. /package/src/{archiver/l1 → l1}/types.ts +0 -0
  231. /package/src/{archiver/structs → structs}/data_retrieval.ts +0 -0
  232. /package/src/{archiver/structs → structs}/published.ts +0 -0
@@ -6,51 +6,61 @@ import {
6
6
  decodeCheckpointBlobDataFromBlobs,
7
7
  encodeBlockBlobData,
8
8
  } from '@aztec/blob-lib';
9
- import type { EpochProofPublicInputArgs } from '@aztec/ethereum/contracts';
10
- import type { ViemClient, ViemPublicClient, ViemPublicDebugClient } from '@aztec/ethereum/types';
9
+ import type {
10
+ CheckpointProposedLog,
11
+ EpochProofPublicInputArgs,
12
+ InboxContract,
13
+ MessageSentLog,
14
+ RollupContract,
15
+ } from '@aztec/ethereum/contracts';
16
+ import type { ViemPublicClient, ViemPublicDebugClient } from '@aztec/ethereum/types';
11
17
  import { asyncPool } from '@aztec/foundation/async-pool';
12
- import { CheckpointNumber } from '@aztec/foundation/branded-types';
13
- import { Buffer16, Buffer32 } from '@aztec/foundation/buffer';
18
+ import { CheckpointNumber, IndexWithinCheckpoint } from '@aztec/foundation/branded-types';
14
19
  import { Fr } from '@aztec/foundation/curves/bn254';
15
20
  import { EthAddress } from '@aztec/foundation/eth-address';
16
21
  import { type Logger, createLogger } from '@aztec/foundation/log';
17
- import { type InboxAbi, RollupAbi } from '@aztec/l1-artifacts';
18
- import { Body, CommitteeAttestation, L2BlockNew } from '@aztec/stdlib/block';
22
+ import { RollupAbi } from '@aztec/l1-artifacts';
23
+ import { Body, CommitteeAttestation, L2Block } from '@aztec/stdlib/block';
19
24
  import { Checkpoint, L1PublishedData, PublishedCheckpoint } from '@aztec/stdlib/checkpoint';
20
25
  import { Proof } from '@aztec/stdlib/proofs';
21
26
  import { CheckpointHeader } from '@aztec/stdlib/rollup';
22
27
  import { AppendOnlyTreeSnapshot } from '@aztec/stdlib/trees';
23
28
  import { BlockHeader, GlobalVariables, PartialStateReference, StateReference } from '@aztec/stdlib/tx';
24
29
 
25
- import {
26
- type GetContractEventsReturnType,
27
- type GetContractReturnType,
28
- type Hex,
29
- decodeFunctionData,
30
- getAbiItem,
31
- hexToBytes,
32
- } from 'viem';
30
+ import { type Hex, decodeFunctionData, getAbiItem, hexToBytes } from 'viem';
33
31
 
34
32
  import { NoBlobBodiesFoundError } from '../errors.js';
35
- import type { ArchiverInstrumentation } from '../instrumentation.js';
33
+ import type { ArchiverInstrumentation } from '../modules/instrumentation.js';
36
34
  import type { DataRetrieval } from '../structs/data_retrieval.js';
37
35
  import type { InboxMessage } from '../structs/inbox_message.js';
38
36
  import { CalldataRetriever } from './calldata_retriever.js';
39
37
 
40
- export type RetrievedCheckpoint = {
38
+ type RetrievedCheckpointBase = {
41
39
  checkpointNumber: CheckpointNumber;
42
40
  archiveRoot: Fr;
41
+ feeAssetPriceModifier: bigint;
43
42
  header: CheckpointHeader;
44
- checkpointBlobData: CheckpointBlobData;
45
43
  l1: L1PublishedData;
46
44
  chainId: Fr;
47
45
  version: Fr;
48
46
  attestations: CommitteeAttestation[];
49
47
  };
50
48
 
49
+ /** Checkpoint data as retrieved from L1 calldata and blob data. */
50
+ export type RetrievedCheckpoint = RetrievedCheckpointBase & { checkpointBlobData: CheckpointBlobData };
51
+
52
+ /** Checkpoint data retrieved from L1 calldata only, without blob data. */
53
+ export type RetrievedCheckpointFromCalldata = RetrievedCheckpointBase & {
54
+ /** Versioned blob hashes from the checkpoint proposed event. */
55
+ blobHashes: Buffer[];
56
+ /** Parent beacon block root from the L1 block, used for blob fetching. */
57
+ parentBeaconBlockRoot: string | undefined;
58
+ };
59
+
51
60
  export async function retrievedToPublishedCheckpoint({
52
61
  checkpointNumber,
53
62
  archiveRoot,
63
+ feeAssetPriceModifier,
54
64
  header: checkpointHeader,
55
65
  checkpointBlobData,
56
66
  l1,
@@ -71,7 +81,7 @@ export async function retrievedToPublishedCheckpoint({
71
81
  const l1toL2MessageTreeRoot = blocksBlobData[0].l1ToL2MessageRoot!;
72
82
 
73
83
  const spongeBlob = SpongeBlob.init();
74
- const l2Blocks: L2BlockNew[] = [];
84
+ const l2Blocks: L2Block[] = [];
75
85
  for (let i = 0; i < blocksBlobData.length; i++) {
76
86
  const blockBlobData = blocksBlobData[i];
77
87
  const { blockEndMarker, blockEndStateField, lastArchiveRoot, noteHashRoot, nullifierRoot, publicDataRoot } =
@@ -102,7 +112,7 @@ export async function retrievedToPublishedCheckpoint({
102
112
  }),
103
113
  });
104
114
 
105
- const body = Body.fromTxBlobData(checkpointBlobData.blocks[0].txs);
115
+ const body = Body.fromTxBlobData(blockBlobData.txs);
106
116
 
107
117
  const blobFields = encodeBlockBlobData(blockBlobData);
108
118
  await spongeBlob.absorb(blobFields);
@@ -121,7 +131,7 @@ export async function retrievedToPublishedCheckpoint({
121
131
 
122
132
  const newArchive = new AppendOnlyTreeSnapshot(newArchiveRoots[i], l2BlockNumber + 1);
123
133
 
124
- l2Blocks.push(new L2BlockNew(newArchive, header, body, checkpointNumber, i));
134
+ l2Blocks.push(new L2Block(newArchive, header, body, checkpointNumber, IndexWithinCheckpoint(i)));
125
135
  }
126
136
 
127
137
  const lastBlock = l2Blocks.at(-1)!;
@@ -130,42 +140,34 @@ export async function retrievedToPublishedCheckpoint({
130
140
  header: checkpointHeader,
131
141
  blocks: l2Blocks,
132
142
  number: checkpointNumber,
143
+ feeAssetPriceModifier: feeAssetPriceModifier,
133
144
  });
134
145
 
135
146
  return PublishedCheckpoint.from({ checkpoint, l1, attestations });
136
147
  }
137
148
 
138
149
  /**
139
- * Fetches new checkpoints.
140
- * @param rollup - The rollup contract instance.
150
+ * Fetches checkpoint calldata from the rollup contract without fetching blob data.
151
+ * Returns RetrievedCheckpointFromCalldata objects that preserve the information needed for deferred blob fetching.
152
+ * @param rollup - The rollup contract wrapper.
141
153
  * @param publicClient - The viem public client to use for transaction retrieval.
142
154
  * @param debugClient - The viem debug client to use for trace/debug RPC methods (optional).
143
- * @param blobClient - The blob client client for fetching blob data.
144
155
  * @param searchStartBlock - The block number to use for starting the search.
145
156
  * @param searchEndBlock - The highest block number that we should search up to.
146
- * @param contractAddresses - The contract addresses (governanceProposerAddress, slashFactoryAddress, slashingProposerAddress).
147
157
  * @param instrumentation - The archiver instrumentation instance.
148
158
  * @param logger - The logger instance.
149
- * @param isHistoricalSync - Whether this is a historical sync.
150
- * @returns An array of retrieved checkpoints.
159
+ * @returns An array of calldata-only checkpoints.
151
160
  */
152
- export async function retrieveCheckpointsFromRollup(
153
- rollup: GetContractReturnType<typeof RollupAbi, ViemPublicClient>,
161
+ export async function retrieveCheckpointCalldataFromRollup(
162
+ rollup: RollupContract,
154
163
  publicClient: ViemPublicClient,
155
164
  debugClient: ViemPublicDebugClient,
156
- blobClient: BlobClientInterface,
157
165
  searchStartBlock: bigint,
158
166
  searchEndBlock: bigint,
159
- contractAddresses: {
160
- governanceProposerAddress: EthAddress;
161
- slashFactoryAddress?: EthAddress;
162
- slashingProposerAddress: EthAddress;
163
- },
164
167
  instrumentation: ArchiverInstrumentation,
165
168
  logger: Logger = createLogger('archiver'),
166
- isHistoricalSync: boolean = false,
167
- ): Promise<RetrievedCheckpoint[]> {
168
- const retrievedCheckpoints: RetrievedCheckpoint[] = [];
169
+ ): Promise<RetrievedCheckpointFromCalldata[]> {
170
+ const retrievedCheckpoints: RetrievedCheckpointFromCalldata[] = [];
169
171
 
170
172
  let rollupConstants: { chainId: Fr; version: Fr; targetCommitteeSize: number } | undefined;
171
173
 
@@ -173,15 +175,7 @@ export async function retrieveCheckpointsFromRollup(
173
175
  if (searchStartBlock > searchEndBlock) {
174
176
  break;
175
177
  }
176
- const checkpointProposedLogs = (
177
- await rollup.getEvents.CheckpointProposed(
178
- {},
179
- {
180
- fromBlock: searchStartBlock,
181
- toBlock: searchEndBlock,
182
- },
183
- )
184
- ).filter(log => log.blockNumber! >= searchStartBlock && log.blockNumber! <= searchEndBlock);
178
+ const checkpointProposedLogs = await rollup.getCheckpointProposedEvents(searchStartBlock, searchEndBlock);
185
179
 
186
180
  if (checkpointProposedLogs.length === 0) {
187
181
  break;
@@ -189,19 +183,19 @@ export async function retrieveCheckpointsFromRollup(
189
183
 
190
184
  const lastLog = checkpointProposedLogs.at(-1)!;
191
185
  logger.debug(
192
- `Got ${checkpointProposedLogs.length} processed logs for checkpoints ${checkpointProposedLogs[0].args.checkpointNumber}-${lastLog.args.checkpointNumber} between L1 blocks ${searchStartBlock}-${searchEndBlock}`,
186
+ `Got ${checkpointProposedLogs.length} processed logs for checkpoints ${checkpointProposedLogs[0].args.checkpointNumber}-${lastLog.args.checkpointNumber} between L1 blocks ${searchStartBlock}-${searchEndBlock}`,
193
187
  );
194
188
 
195
189
  if (rollupConstants === undefined) {
196
190
  const [chainId, version, targetCommitteeSize] = await Promise.all([
197
191
  publicClient.getChainId(),
198
- rollup.read.getVersion(),
199
- rollup.read.getTargetCommitteeSize(),
192
+ rollup.getVersion(),
193
+ rollup.getTargetCommitteeSize(),
200
194
  ]);
201
195
  rollupConstants = {
202
196
  chainId: new Fr(chainId),
203
197
  version: new Fr(version),
204
- targetCommitteeSize: Number(targetCommitteeSize),
198
+ targetCommitteeSize,
205
199
  };
206
200
  }
207
201
 
@@ -209,108 +203,88 @@ export async function retrieveCheckpointsFromRollup(
209
203
  rollup,
210
204
  publicClient,
211
205
  debugClient,
212
- blobClient,
213
206
  checkpointProposedLogs,
214
207
  rollupConstants,
215
- contractAddresses,
216
208
  instrumentation,
217
209
  logger,
218
- isHistoricalSync,
219
210
  );
220
211
  retrievedCheckpoints.push(...newCheckpoints);
221
- searchStartBlock = lastLog.blockNumber! + 1n;
212
+ searchStartBlock = lastLog.l1BlockNumber + 1n;
222
213
  } while (searchStartBlock <= searchEndBlock);
223
214
 
224
- // The asyncPool from processCheckpointProposedLogs will not necessarily return the checkpoints in order, so we sort them before returning.
225
215
  return retrievedCheckpoints.sort((a, b) => Number(a.l1.blockNumber - b.l1.blockNumber));
226
216
  }
227
217
 
228
218
  /**
229
- * Processes newly received CheckpointProposed logs.
230
- * @param rollup - The rollup contract instance.
219
+ * Processes CheckpointProposed logs, fetching only calldata (no blobs).
220
+ * @param rollup - The rollup contract wrapper.
231
221
  * @param publicClient - The viem public client to use for transaction retrieval.
232
222
  * @param debugClient - The viem debug client to use for trace/debug RPC methods (optional).
233
- * @param blobClient - The blob client client for fetching blob data.
234
223
  * @param logs - CheckpointProposed logs.
235
224
  * @param rollupConstants - The rollup constants (chainId, version, targetCommitteeSize).
236
- * @param contractAddresses - The contract addresses (governanceProposerAddress, slashFactoryAddress, slashingProposerAddress).
237
225
  * @param instrumentation - The archiver instrumentation instance.
238
226
  * @param logger - The logger instance.
239
- * @param isHistoricalSync - Whether this is a historical sync.
240
- * @returns An array of retrieved checkpoints.
227
+ * @returns An array of calldata-only checkpoints.
241
228
  */
242
229
  async function processCheckpointProposedLogs(
243
- rollup: GetContractReturnType<typeof RollupAbi, ViemPublicClient>,
230
+ rollup: RollupContract,
244
231
  publicClient: ViemPublicClient,
245
232
  debugClient: ViemPublicDebugClient,
246
- blobClient: BlobClientInterface,
247
- logs: GetContractEventsReturnType<typeof RollupAbi, 'CheckpointProposed'>,
233
+ logs: CheckpointProposedLog[],
248
234
  { chainId, version, targetCommitteeSize }: { chainId: Fr; version: Fr; targetCommitteeSize: number },
249
- contractAddresses: {
250
- governanceProposerAddress: EthAddress;
251
- slashFactoryAddress?: EthAddress;
252
- slashingProposerAddress: EthAddress;
253
- },
254
235
  instrumentation: ArchiverInstrumentation,
255
236
  logger: Logger,
256
- isHistoricalSync: boolean,
257
- ): Promise<RetrievedCheckpoint[]> {
258
- const retrievedCheckpoints: RetrievedCheckpoint[] = [];
237
+ ): Promise<RetrievedCheckpointFromCalldata[]> {
238
+ const retrievedCheckpoints: RetrievedCheckpointFromCalldata[] = [];
259
239
  const calldataRetriever = new CalldataRetriever(
260
240
  publicClient,
261
241
  debugClient,
262
242
  targetCommitteeSize,
263
243
  instrumentation,
264
244
  logger,
265
- { ...contractAddresses, rollupAddress: EthAddress.fromString(rollup.address) },
245
+ EthAddress.fromString(rollup.address),
266
246
  );
267
247
 
268
248
  await asyncPool(10, logs, async log => {
269
- const checkpointNumber = CheckpointNumber.fromBigInt(log.args.checkpointNumber!);
270
- const archive = log.args.archive!;
271
- const archiveFromChain = await rollup.read.archiveAt([BigInt(checkpointNumber)]);
272
- const blobHashes = log.args.versionedBlobHashes!.map(blobHash => Buffer.from(blobHash.slice(2), 'hex'));
273
-
274
- // The value from the event and contract will match only if the checkpoint is in the chain.
275
- if (archive === archiveFromChain) {
276
- // Build expected hashes object (fields may be undefined for backwards compatibility with older events)
249
+ const checkpointNumber = log.args.checkpointNumber;
250
+ const archive = log.args.archive;
251
+ const archiveFromChain = await rollup.archiveAt(checkpointNumber);
252
+ const blobHashes = log.args.versionedBlobHashes;
253
+
254
+ if (archive.equals(archiveFromChain)) {
277
255
  const expectedHashes = {
278
- attestationsHash: log.args.attestationsHash,
279
- payloadDigest: log.args.payloadDigest,
256
+ attestationsHash: log.args.attestationsHash.toString() as Hex,
257
+ payloadDigest: log.args.payloadDigest.toString() as Hex,
280
258
  };
281
259
 
282
260
  const checkpoint = await calldataRetriever.getCheckpointFromRollupTx(
283
- log.transactionHash!,
261
+ log.l1TransactionHash,
284
262
  blobHashes,
285
263
  checkpointNumber,
286
264
  expectedHashes,
287
265
  );
288
- const checkpointBlobData = await getCheckpointBlobDataFromBlobs(
289
- blobClient,
290
- checkpoint.blockHash,
266
+ const { timestamp, parentBeaconBlockRoot } = await getL1Block(publicClient, log.l1BlockNumber);
267
+ const l1 = new L1PublishedData(log.l1BlockNumber, timestamp, log.l1BlockHash.toString());
268
+
269
+ retrievedCheckpoints.push({
270
+ ...checkpoint,
271
+ l1,
272
+ chainId,
273
+ version,
291
274
  blobHashes,
292
- checkpointNumber,
293
- logger,
294
- isHistoricalSync,
295
- );
296
-
297
- const l1 = new L1PublishedData(
298
- log.blockNumber,
299
- await getL1BlockTime(publicClient, log.blockNumber),
300
- log.blockHash,
301
- );
275
+ parentBeaconBlockRoot,
276
+ });
302
277
 
303
- retrievedCheckpoints.push({ ...checkpoint, checkpointBlobData, l1, chainId, version });
304
- logger.trace(`Retrieved checkpoint ${checkpointNumber} from L1 tx ${log.transactionHash}`, {
305
- l1BlockNumber: log.blockNumber,
278
+ logger.trace(`Retrieved checkpoint calldata ${checkpointNumber} from L1 tx ${log.l1TransactionHash}`, {
279
+ l1BlockNumber: log.l1BlockNumber,
306
280
  checkpointNumber,
307
281
  archive: archive.toString(),
308
282
  attestations: checkpoint.attestations,
309
283
  });
310
284
  } else {
311
285
  logger.warn(`Ignoring checkpoint ${checkpointNumber} due to archive root mismatch`, {
312
- actual: archive,
313
- expected: archiveFromChain,
286
+ actual: archive.toString(),
287
+ expected: archiveFromChain.toString(),
314
288
  });
315
289
  }
316
290
  });
@@ -318,9 +292,12 @@ async function processCheckpointProposedLogs(
318
292
  return retrievedCheckpoints;
319
293
  }
320
294
 
321
- export async function getL1BlockTime(publicClient: ViemPublicClient, blockNumber: bigint): Promise<bigint> {
295
+ export async function getL1Block(
296
+ publicClient: ViemPublicClient,
297
+ blockNumber: bigint,
298
+ ): Promise<{ timestamp: bigint; parentBeaconBlockRoot: string | undefined }> {
322
299
  const block = await publicClient.getBlock({ blockNumber, includeTransactions: false });
323
- return block.timestamp;
300
+ return { timestamp: block.timestamp, parentBeaconBlockRoot: block.parentBeaconBlockRoot };
324
301
  }
325
302
 
326
303
  export async function getCheckpointBlobDataFromBlobs(
@@ -330,8 +307,14 @@ export async function getCheckpointBlobDataFromBlobs(
330
307
  checkpointNumber: CheckpointNumber,
331
308
  logger: Logger,
332
309
  isHistoricalSync: boolean,
310
+ parentBeaconBlockRoot?: string,
311
+ l1BlockTimestamp?: bigint,
333
312
  ): Promise<CheckpointBlobData> {
334
- const blobBodies = await blobClient.getBlobSidecar(blockHash, blobHashes, { isHistoricalSync });
313
+ const blobBodies = await blobClient.getBlobSidecar(blockHash, blobHashes, {
314
+ isHistoricalSync,
315
+ parentBeaconBlockRoot,
316
+ l1BlockTimestamp,
317
+ });
335
318
  if (blobBodies.length === 0) {
336
319
  throw new NoBlobBodiesFoundError(checkpointNumber);
337
320
  }
@@ -355,60 +338,49 @@ export async function getCheckpointBlobDataFromBlobs(
355
338
 
356
339
  /** Given an L1 to L2 message, retrieves its corresponding event from the Inbox within a specific block range. */
357
340
  export async function retrieveL1ToL2Message(
358
- inbox: GetContractReturnType<typeof InboxAbi, ViemClient>,
359
- leaf: Fr,
360
- fromBlock: bigint,
361
- toBlock: bigint,
341
+ inbox: InboxContract,
342
+ message: InboxMessage,
362
343
  ): Promise<InboxMessage | undefined> {
363
- const logs = await inbox.getEvents.MessageSent({ hash: leaf.toString() }, { fromBlock, toBlock });
364
-
365
- const messages = mapLogsInboxMessage(logs);
366
- return messages.length > 0 ? messages[0] : undefined;
344
+ const log = await inbox.getMessageSentEventByHash(message.leaf.toString(), message.l1BlockNumber);
345
+ return log && mapLogInboxMessage(log);
367
346
  }
368
347
 
369
348
  /**
370
349
  * Fetch L1 to L2 messages.
371
- * @param publicClient - The viem public client to use for transaction retrieval.
372
- * @param inboxAddress - The address of the inbox contract to fetch messages from.
373
- * @param blockUntilSynced - If true, blocks until the archiver has fully synced.
350
+ * @param inbox - The inbox contract wrapper.
374
351
  * @param searchStartBlock - The block number to use for starting the search.
375
352
  * @param searchEndBlock - The highest block number that we should search up to.
376
353
  * @returns An array of InboxLeaf and next eth block to search from.
377
354
  */
378
355
  export async function retrieveL1ToL2Messages(
379
- inbox: GetContractReturnType<typeof InboxAbi, ViemClient>,
356
+ inbox: InboxContract,
380
357
  searchStartBlock: bigint,
381
358
  searchEndBlock: bigint,
382
359
  ): Promise<InboxMessage[]> {
383
360
  const retrievedL1ToL2Messages: InboxMessage[] = [];
384
361
  while (searchStartBlock <= searchEndBlock) {
385
- const messageSentLogs = (
386
- await inbox.getEvents.MessageSent({}, { fromBlock: searchStartBlock, toBlock: searchEndBlock })
387
- ).filter(log => log.blockNumber! >= searchStartBlock && log.blockNumber! <= searchEndBlock);
362
+ const messageSentLogs = await inbox.getMessageSentEvents(searchStartBlock, searchEndBlock);
388
363
 
389
364
  if (messageSentLogs.length === 0) {
390
365
  break;
391
366
  }
392
367
 
393
- retrievedL1ToL2Messages.push(...mapLogsInboxMessage(messageSentLogs));
394
- searchStartBlock = messageSentLogs.at(-1)!.blockNumber + 1n;
368
+ retrievedL1ToL2Messages.push(...messageSentLogs.map(mapLogInboxMessage));
369
+ searchStartBlock = messageSentLogs.at(-1)!.l1BlockNumber + 1n;
395
370
  }
396
371
 
397
372
  return retrievedL1ToL2Messages;
398
373
  }
399
374
 
400
- function mapLogsInboxMessage(logs: GetContractEventsReturnType<typeof InboxAbi, 'MessageSent'>): InboxMessage[] {
401
- return logs.map(log => {
402
- const { index, hash, checkpointNumber, rollingHash } = log.args;
403
- return {
404
- index: index!,
405
- leaf: Fr.fromHexString(hash!),
406
- l1BlockNumber: log.blockNumber,
407
- l1BlockHash: Buffer32.fromString(log.blockHash),
408
- checkpointNumber: CheckpointNumber.fromBigInt(checkpointNumber!),
409
- rollingHash: Buffer16.fromString(rollingHash!),
410
- };
411
- });
375
+ function mapLogInboxMessage(log: MessageSentLog): InboxMessage {
376
+ return {
377
+ index: log.args.index,
378
+ leaf: log.args.leaf,
379
+ l1BlockNumber: log.l1BlockNumber,
380
+ l1BlockHash: log.l1BlockHash,
381
+ checkpointNumber: log.args.checkpointNumber,
382
+ rollingHash: log.args.rollingHash,
383
+ };
412
384
  }
413
385
 
414
386
  /** 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 });
@@ -0,0 +1,140 @@
1
+ import { getPublicClient, getRpcUrlsFromClient } from '@aztec/ethereum/client';
2
+ import { RollupContract } from '@aztec/ethereum/contracts';
3
+ import type { L1ContractAddresses } from '@aztec/ethereum/l1-contract-addresses';
4
+ import type { ViemPublicClient } from '@aztec/ethereum/types';
5
+ import { type Logger, type LoggerBindings, createLogger } from '@aztec/foundation/log';
6
+
7
+ /** Subset of L1 contract addresses whose historical logs the Aztec node relies on. */
8
+ export type HistoricalLogsContractAddresses = Pick<
9
+ L1ContractAddresses,
10
+ 'rollupAddress' | 'inboxAddress' | 'registryAddress' | 'governanceProposerAddress'
11
+ >;
12
+
13
+ /** Result of probing a single RPC URL. */
14
+ type ProbeResult = { ok: true } | { ok: false; reason: string; clientVersion: string | undefined };
15
+
16
+ /**
17
+ * Validates that every configured L1 RPC URL returns historical logs for the Rollup contract.
18
+ *
19
+ * Some RPC providers prune old logs, which would cause L1 syncing to silently fail. To detect this,
20
+ * we query for the `OwnershipTransferred` event which every Rollup emits in its constructor (via
21
+ * Ownable) on the block it was deployed (`l1StartBlock`). The `client` is typically a viem fallback
22
+ * transport over several user-configured RPC URLs — checking only the first URL would miss a bad
23
+ * secondary, so we probe each URL independently. The first URL that fails aborts startup, unless
24
+ * the operator has explicitly opted out.
25
+ *
26
+ * @param client - The L1 public client built from the user-configured RPC URLs.
27
+ * @param addresses - The subset of L1 contract addresses we rely on for historical log retrieval.
28
+ * @param skipCheck - If true, log warnings instead of throwing.
29
+ * @param bindings - Optional logger bindings for context.
30
+ * @throws Error if any URL fails the probe and skipCheck is false.
31
+ */
32
+ export async function validateAndLogHistoricalLogsAvailability(
33
+ client: ViemPublicClient,
34
+ addresses: HistoricalLogsContractAddresses,
35
+ skipCheck: boolean,
36
+ bindings?: LoggerBindings,
37
+ ): Promise<void> {
38
+ const logger = createLogger('archiver:validate_historical_logs', bindings);
39
+ logger.debug('Validating historical log availability on L1 RPCs');
40
+
41
+ const urls = getRpcUrlsFromClient(client);
42
+ if (urls.length === 0) {
43
+ logger.warn('Could not determine L1 RPC URLs from the public client; skipping historical logs check.');
44
+ return;
45
+ }
46
+
47
+ const chainId = client.chain?.id;
48
+ if (chainId === undefined) {
49
+ logger.warn('Could not determine L1 chain ID from the public client; skipping historical logs check.');
50
+ return;
51
+ }
52
+
53
+ for (const url of urls) {
54
+ const probeClient = getPublicClient({ l1RpcUrls: [url], l1ChainId: chainId });
55
+ const rollup = new RollupContract(probeClient, addresses.rollupAddress.toString());
56
+ const result = await probeRpcUrl(rollup, probeClient, logger);
57
+
58
+ if (result.ok) {
59
+ logger.debug(`L1 RPC ${url} returned historical OwnershipTransferred log for the Rollup contract.`);
60
+ continue;
61
+ }
62
+
63
+ const errorMessage = buildErrorMessage(url, result, addresses);
64
+ if (skipCheck) {
65
+ logger.warn(`${errorMessage}\nContinuing because ARCHIVER_SKIP_HISTORICAL_LOGS_CHECK is true.`);
66
+ continue;
67
+ }
68
+
69
+ logger.error(errorMessage);
70
+ throw new Error(errorMessage);
71
+ }
72
+ }
73
+
74
+ /** Runs the OwnershipTransferred probe against a single RPC and queries its client version. */
75
+ async function probeRpcUrl(rollup: RollupContract, client: ViemPublicClient, logger: Logger): Promise<ProbeResult> {
76
+ let queryError: unknown;
77
+ try {
78
+ const logs = await rollup.getOwnershipTransferredEventsAtDeploy();
79
+ if (logs.length > 0) {
80
+ return { ok: true };
81
+ }
82
+ } catch (err) {
83
+ queryError = err;
84
+ }
85
+
86
+ const clientVersion = await getClientVersion(client, logger);
87
+
88
+ let reason: string;
89
+ if (queryError instanceof Error) {
90
+ reason = `Query for historical logs failed: ${queryError.message}`;
91
+ } else if (queryError !== undefined) {
92
+ reason = 'Query for historical logs failed with a non-Error value.';
93
+ } else {
94
+ reason = 'No OwnershipTransferred event was returned by the L1 RPC for the Rollup deploy block.';
95
+ }
96
+ return { ok: false, reason, clientVersion };
97
+ }
98
+
99
+ /** Builds the operator-facing error message for a failing RPC URL. */
100
+ function buildErrorMessage(
101
+ url: string,
102
+ result: Extract<ProbeResult, { ok: false }>,
103
+ addresses: HistoricalLogsContractAddresses,
104
+ ): string {
105
+ return [
106
+ `L1 RPC at ${url} does not return historical logs for the Rollup contract. ${result.reason}`,
107
+ `This likely means this Ethereum RPC node prunes old logs, which would cause the archiver ` +
108
+ `to silently miss data during L1 sync.`,
109
+ result.clientVersion
110
+ ? `Detected L1 client version for ${url}: ${result.clientVersion}.`
111
+ : `Could not determine L1 client version for ${url}.`,
112
+ `The following L1 contract addresses must have their historical logs retained by the RPC node:`,
113
+ ` - Rollup: ${addresses.rollupAddress.toString()}`,
114
+ ` - Inbox: ${addresses.inboxAddress.toString()}`,
115
+ ` - Registry: ${addresses.registryAddress.toString()}`,
116
+ ` - GovernanceProposer: ${addresses.governanceProposerAddress.toString()}`,
117
+ isReth(result.clientVersion)
118
+ ? `To retain logs for these contracts, configure reth with a ` +
119
+ `prune.segments.receipts_log_filter entry for each address above ` +
120
+ `so reth does not prune their receipts/logs. See https://reth.rs/run/pruning.html for details.`
121
+ : `Point this RPC endpoint at a node that retains full log history for the addresses above.`,
122
+ `Set ARCHIVER_SKIP_HISTORICAL_LOGS_CHECK=true to bypass this check at your own risk.`,
123
+ ].join('\n');
124
+ }
125
+
126
+ /** Queries `web3_clientVersion` on the L1 RPC. Returns undefined if the call fails or returns a non-string. */
127
+ async function getClientVersion(client: ViemPublicClient, logger: Logger): Promise<string | undefined> {
128
+ try {
129
+ const result = await client.request({ method: 'web3_clientVersion' });
130
+ return typeof result === 'string' ? result : undefined;
131
+ } catch (err) {
132
+ logger.debug(`Failed to query web3_clientVersion: ${err instanceof Error ? err.message : err}`);
133
+ return undefined;
134
+ }
135
+ }
136
+
137
+ /** Heuristic check for reth based on the web3_clientVersion string (reth returns e.g. "reth/v1.0.0-..."). */
138
+ function isReth(clientVersion: string | undefined): boolean {
139
+ return !!clientVersion && /reth/i.test(clientVersion);
140
+ }