@aztec/ethereum 0.0.1-commit.fce3e4f → 0.0.1-commit.fffb133c

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 (166) hide show
  1. package/dest/client.js +6 -2
  2. package/dest/config.d.ts +19 -68
  3. package/dest/config.d.ts.map +1 -1
  4. package/dest/config.js +51 -378
  5. package/dest/contracts/empire_base.d.ts +2 -1
  6. package/dest/contracts/empire_base.d.ts.map +1 -1
  7. package/dest/contracts/empire_slashing_proposer.d.ts +2 -1
  8. package/dest/contracts/empire_slashing_proposer.d.ts.map +1 -1
  9. package/dest/contracts/empire_slashing_proposer.js +9 -0
  10. package/dest/contracts/fee_asset_handler.d.ts +6 -5
  11. package/dest/contracts/fee_asset_handler.d.ts.map +1 -1
  12. package/dest/contracts/fee_asset_handler.js +9 -9
  13. package/dest/contracts/governance.d.ts +3 -1
  14. package/dest/contracts/governance.d.ts.map +1 -1
  15. package/dest/contracts/governance.js +9 -1
  16. package/dest/contracts/governance_proposer.d.ts +2 -1
  17. package/dest/contracts/governance_proposer.d.ts.map +1 -1
  18. package/dest/contracts/governance_proposer.js +391 -8
  19. package/dest/contracts/inbox.d.ts +24 -3
  20. package/dest/contracts/inbox.d.ts.map +1 -1
  21. package/dest/contracts/inbox.js +36 -1
  22. package/dest/contracts/index.d.ts +3 -1
  23. package/dest/contracts/index.d.ts.map +1 -1
  24. package/dest/contracts/index.js +2 -0
  25. package/dest/contracts/log.d.ts +13 -0
  26. package/dest/contracts/log.d.ts.map +1 -0
  27. package/dest/contracts/log.js +1 -0
  28. package/dest/contracts/outbox.d.ts +41 -0
  29. package/dest/contracts/outbox.d.ts.map +1 -0
  30. package/dest/contracts/outbox.js +86 -0
  31. package/dest/contracts/rollup.d.ts +176 -96
  32. package/dest/contracts/rollup.d.ts.map +1 -1
  33. package/dest/contracts/rollup.js +698 -141
  34. package/dest/contracts/tally_slashing_proposer.d.ts +3 -2
  35. package/dest/contracts/tally_slashing_proposer.d.ts.map +1 -1
  36. package/dest/contracts/tally_slashing_proposer.js +1 -1
  37. package/dest/deploy_aztec_l1_contracts.d.ts +260 -0
  38. package/dest/deploy_aztec_l1_contracts.d.ts.map +1 -0
  39. package/dest/deploy_aztec_l1_contracts.js +398 -0
  40. package/dest/deploy_l1_contract.d.ts +68 -0
  41. package/dest/deploy_l1_contract.d.ts.map +1 -0
  42. package/dest/deploy_l1_contract.js +312 -0
  43. package/dest/forwarder_proxy.d.ts +32 -0
  44. package/dest/forwarder_proxy.d.ts.map +1 -0
  45. package/dest/forwarder_proxy.js +93 -0
  46. package/dest/generated/l1-contracts-defaults.d.ts +30 -0
  47. package/dest/generated/l1-contracts-defaults.d.ts.map +1 -0
  48. package/dest/generated/l1-contracts-defaults.js +30 -0
  49. package/dest/l1_artifacts.d.ts +4964 -1573
  50. package/dest/l1_artifacts.d.ts.map +1 -1
  51. package/dest/l1_contract_addresses.d.ts +1 -1
  52. package/dest/l1_contract_addresses.d.ts.map +1 -1
  53. package/dest/l1_contract_addresses.js +3 -3
  54. package/dest/l1_reader.d.ts +3 -1
  55. package/dest/l1_reader.d.ts.map +1 -1
  56. package/dest/l1_reader.js +6 -0
  57. package/dest/l1_tx_utils/config.d.ts +3 -3
  58. package/dest/l1_tx_utils/config.d.ts.map +1 -1
  59. package/dest/l1_tx_utils/config.js +17 -3
  60. package/dest/l1_tx_utils/constants.d.ts +7 -1
  61. package/dest/l1_tx_utils/constants.d.ts.map +1 -1
  62. package/dest/l1_tx_utils/constants.js +25 -0
  63. package/dest/l1_tx_utils/fee-strategies/index.d.ts +10 -0
  64. package/dest/l1_tx_utils/fee-strategies/index.d.ts.map +1 -0
  65. package/dest/l1_tx_utils/fee-strategies/index.js +12 -0
  66. package/dest/l1_tx_utils/fee-strategies/p75_competitive.d.ts +8 -0
  67. package/dest/l1_tx_utils/fee-strategies/p75_competitive.d.ts.map +1 -0
  68. package/dest/l1_tx_utils/fee-strategies/p75_competitive.js +129 -0
  69. package/dest/l1_tx_utils/fee-strategies/p75_competitive_blob_txs_only.d.ts +23 -0
  70. package/dest/l1_tx_utils/fee-strategies/p75_competitive_blob_txs_only.d.ts.map +1 -0
  71. package/dest/l1_tx_utils/fee-strategies/p75_competitive_blob_txs_only.js +191 -0
  72. package/dest/l1_tx_utils/fee-strategies/types.d.ts +51 -0
  73. package/dest/l1_tx_utils/fee-strategies/types.d.ts.map +1 -0
  74. package/dest/l1_tx_utils/fee-strategies/types.js +3 -0
  75. package/dest/l1_tx_utils/forwarder_l1_tx_utils.d.ts +41 -0
  76. package/dest/l1_tx_utils/forwarder_l1_tx_utils.d.ts.map +1 -0
  77. package/dest/l1_tx_utils/forwarder_l1_tx_utils.js +48 -0
  78. package/dest/l1_tx_utils/index-blobs.d.ts +3 -0
  79. package/dest/l1_tx_utils/index-blobs.d.ts.map +1 -0
  80. package/dest/l1_tx_utils/index-blobs.js +2 -0
  81. package/dest/l1_tx_utils/index.d.ts +3 -1
  82. package/dest/l1_tx_utils/index.d.ts.map +1 -1
  83. package/dest/l1_tx_utils/index.js +2 -0
  84. package/dest/l1_tx_utils/interfaces.d.ts +2 -2
  85. package/dest/l1_tx_utils/interfaces.d.ts.map +1 -1
  86. package/dest/l1_tx_utils/l1_fee_analyzer.d.ts +233 -0
  87. package/dest/l1_tx_utils/l1_fee_analyzer.d.ts.map +1 -0
  88. package/dest/l1_tx_utils/l1_fee_analyzer.js +506 -0
  89. package/dest/l1_tx_utils/l1_tx_utils.d.ts +1 -1
  90. package/dest/l1_tx_utils/l1_tx_utils.d.ts.map +1 -1
  91. package/dest/l1_tx_utils/l1_tx_utils.js +17 -4
  92. package/dest/l1_tx_utils/readonly_l1_tx_utils.d.ts +4 -15
  93. package/dest/l1_tx_utils/readonly_l1_tx_utils.d.ts.map +1 -1
  94. package/dest/l1_tx_utils/readonly_l1_tx_utils.js +52 -159
  95. package/dest/queries.d.ts +2 -2
  96. package/dest/queries.d.ts.map +1 -1
  97. package/dest/queries.js +12 -4
  98. package/dest/test/chain_monitor.d.ts +15 -13
  99. package/dest/test/chain_monitor.d.ts.map +1 -1
  100. package/dest/test/chain_monitor.js +7 -9
  101. package/dest/test/eth_cheat_codes.d.ts +13 -1
  102. package/dest/test/eth_cheat_codes.d.ts.map +1 -1
  103. package/dest/test/eth_cheat_codes.js +4 -2
  104. package/dest/test/rollup_cheat_codes.d.ts +7 -6
  105. package/dest/test/rollup_cheat_codes.d.ts.map +1 -1
  106. package/dest/test/rollup_cheat_codes.js +23 -6
  107. package/dest/test/start_anvil.d.ts +3 -1
  108. package/dest/test/start_anvil.d.ts.map +1 -1
  109. package/dest/test/tx_delayer.d.ts +1 -1
  110. package/dest/test/tx_delayer.d.ts.map +1 -1
  111. package/dest/test/tx_delayer.js +4 -3
  112. package/dest/types.d.ts +57 -2
  113. package/dest/types.d.ts.map +1 -1
  114. package/dest/utils.d.ts +15 -3
  115. package/dest/utils.d.ts.map +1 -1
  116. package/dest/utils.js +18 -0
  117. package/package.json +33 -14
  118. package/src/client.ts +2 -2
  119. package/src/config.ts +62 -457
  120. package/src/contracts/README.md +157 -0
  121. package/src/contracts/empire_base.ts +1 -1
  122. package/src/contracts/empire_slashing_proposer.ts +6 -1
  123. package/src/contracts/fee_asset_handler.ts +8 -7
  124. package/src/contracts/governance.ts +8 -1
  125. package/src/contracts/governance_proposer.ts +6 -1
  126. package/src/contracts/inbox.ts +55 -3
  127. package/src/contracts/index.ts +2 -0
  128. package/src/contracts/log.ts +13 -0
  129. package/src/contracts/outbox.ts +98 -0
  130. package/src/contracts/rollup.ts +375 -111
  131. package/src/contracts/tally_slashing_proposer.ts +3 -1
  132. package/src/deploy_aztec_l1_contracts.ts +619 -0
  133. package/src/deploy_l1_contract.ts +362 -0
  134. package/src/forwarder_proxy.ts +108 -0
  135. package/src/generated/l1-contracts-defaults.ts +32 -0
  136. package/src/l1_contract_addresses.ts +22 -20
  137. package/src/l1_reader.ts +8 -0
  138. package/src/l1_tx_utils/config.ts +24 -6
  139. package/src/l1_tx_utils/constants.ts +11 -0
  140. package/src/l1_tx_utils/fee-strategies/index.ts +22 -0
  141. package/src/l1_tx_utils/fee-strategies/p75_competitive.ts +163 -0
  142. package/src/l1_tx_utils/fee-strategies/p75_competitive_blob_txs_only.ts +245 -0
  143. package/src/l1_tx_utils/fee-strategies/types.ts +56 -0
  144. package/src/l1_tx_utils/forwarder_l1_tx_utils.ts +119 -0
  145. package/src/l1_tx_utils/index-blobs.ts +2 -0
  146. package/src/l1_tx_utils/index.ts +2 -0
  147. package/src/l1_tx_utils/interfaces.ts +1 -1
  148. package/src/l1_tx_utils/l1_fee_analyzer.ts +803 -0
  149. package/src/l1_tx_utils/l1_tx_utils.ts +24 -4
  150. package/src/l1_tx_utils/readonly_l1_tx_utils.ts +65 -204
  151. package/src/queries.ts +11 -3
  152. package/src/test/chain_monitor.ts +18 -16
  153. package/src/test/eth_cheat_codes.ts +2 -2
  154. package/src/test/rollup_cheat_codes.ts +23 -9
  155. package/src/test/start_anvil.ts +2 -0
  156. package/src/test/tx_delayer.ts +5 -3
  157. package/src/types.ts +62 -0
  158. package/src/utils.ts +30 -1
  159. package/dest/deploy_l1_contracts.d.ts +0 -673
  160. package/dest/deploy_l1_contracts.d.ts.map +0 -1
  161. package/dest/deploy_l1_contracts.js +0 -1491
  162. package/dest/index.d.ts +0 -18
  163. package/dest/index.d.ts.map +0 -1
  164. package/dest/index.js +0 -17
  165. package/src/deploy_l1_contracts.ts +0 -1869
  166. package/src/index.ts +0 -17
@@ -1,7 +1,11 @@
1
- import { EpochNumber, SlotNumber } from '@aztec/foundation/branded-types';
1
+ import { CheckpointNumber, EpochNumber, SlotNumber } from '@aztec/foundation/branded-types';
2
+ import { Buffer32 } from '@aztec/foundation/buffer';
3
+ import { Fr } from '@aztec/foundation/curves/bn254';
2
4
  import { memoize } from '@aztec/foundation/decorators';
3
5
  import { EthAddress } from '@aztec/foundation/eth-address';
4
6
  import type { ViemSignature } from '@aztec/foundation/eth-signature';
7
+ import { makeBackoff, retry } from '@aztec/foundation/retry';
8
+ import { EscapeHatchAbi } from '@aztec/l1-artifacts/EscapeHatchAbi';
5
9
  import { RollupAbi } from '@aztec/l1-artifacts/RollupAbi';
6
10
  import { RollupStorage } from '@aztec/l1-artifacts/RollupStorage';
7
11
 
@@ -19,7 +23,7 @@ import {
19
23
  } from 'viem';
20
24
 
21
25
  import { getPublicClient } from '../client.js';
22
- import type { DeployL1ContractsReturnType } from '../deploy_l1_contracts.js';
26
+ import type { DeployAztecL1ContractsReturnType } from '../deploy_aztec_l1_contracts.js';
23
27
  import type { L1ContractAddresses } from '../l1_contract_addresses.js';
24
28
  import type { L1ReaderConfig } from '../l1_reader.js';
25
29
  import type { L1TxRequest, L1TxUtils } from '../l1_tx_utils/index.js';
@@ -27,6 +31,7 @@ import type { ViemClient } from '../types.js';
27
31
  import { formatViemError } from '../utils.js';
28
32
  import { EmpireSlashingProposerContract } from './empire_slashing_proposer.js';
29
33
  import { GSEContract } from './gse.js';
34
+ import type { L1EventLog } from './log.js';
30
35
  import { SlasherContract } from './slasher_contract.js';
31
36
  import { TallySlashingProposerContract } from './tally_slashing_proposer.js';
32
37
  import { checkBlockTag } from './utils.js';
@@ -57,13 +62,16 @@ export type L1RollupContractAddresses = Pick<
57
62
  export type EpochProofPublicInputArgs = {
58
63
  previousArchive: `0x${string}`;
59
64
  endArchive: `0x${string}`;
65
+ outHash: `0x${string}`;
60
66
  proverId: `0x${string}`;
61
67
  };
62
68
 
63
69
  export type ViemHeader = {
64
70
  lastArchiveRoot: `0x${string}`;
65
71
  blockHeadersHash: `0x${string}`;
66
- contentCommitment: ViemContentCommitment;
72
+ blobsHash: `0x${string}`;
73
+ inHash: `0x${string}`;
74
+ outHash: `0x${string}`;
67
75
  slotNumber: bigint;
68
76
  timestamp: bigint;
69
77
  coinbase: `0x${string}`;
@@ -72,12 +80,6 @@ export type ViemHeader = {
72
80
  totalManaUsed: bigint;
73
81
  };
74
82
 
75
- export type ViemContentCommitment = {
76
- blobsHash: `0x${string}`;
77
- inHash: `0x${string}`;
78
- outHash: `0x${string}`;
79
- };
80
-
81
83
  export type ViemGasFees = {
82
84
  feePerDaGas: bigint;
83
85
  feePerL2Gas: bigint;
@@ -89,10 +91,125 @@ export enum SlashingProposerType {
89
91
  Empire = 2,
90
92
  }
91
93
 
94
+ /**
95
+ * Status of a validator/attester in the staking system.
96
+ * Matches the Status enum in StakingLib.sol
97
+ */
98
+ export enum AttesterStatus {
99
+ NONE = 0,
100
+ VALIDATING = 1,
101
+ ZOMBIE = 2,
102
+ EXITING = 3,
103
+ }
104
+
105
+ /**
106
+ * Fee header data for a checkpoint
107
+ */
108
+ export type FeeHeader = {
109
+ excessMana: bigint;
110
+ manaUsed: bigint;
111
+ ethPerFeeAsset: bigint;
112
+ congestionCost: bigint;
113
+ proverCost: bigint;
114
+ };
115
+
116
+ /**
117
+ * Checkpoint log data returned from the rollup contract
118
+ */
119
+ export type CheckpointLog = {
120
+ archive: Fr;
121
+ headerHash: Buffer32;
122
+ blobCommitmentsHash: Buffer32;
123
+ attestationsHash: Buffer32;
124
+ payloadDigest: Buffer32;
125
+ slotNumber: SlotNumber;
126
+ feeHeader: FeeHeader;
127
+ };
128
+
129
+ /**
130
+ * L1 fee data (base fee and blob fee)
131
+ */
132
+ export type L1FeeData = {
133
+ baseFee: bigint;
134
+ blobFee: bigint;
135
+ };
136
+
137
+ /**
138
+ * Reward configuration for the rollup
139
+ */
140
+ export type RewardConfig = {
141
+ rewardDistributor: EthAddress;
142
+ sequencerBps: bigint;
143
+ booster: EthAddress;
144
+ checkpointReward: bigint;
145
+ };
146
+
147
+ /**
148
+ * Exit information for a validator
149
+ */
150
+ export type Exit = {
151
+ withdrawalId: bigint;
152
+ amount: bigint;
153
+ exitableAt: bigint;
154
+ recipientOrWithdrawer: EthAddress;
155
+ isRecipient: boolean;
156
+ exists: boolean;
157
+ };
158
+
159
+ /**
160
+ * Attester configuration including public key and withdrawer
161
+ */
162
+ export type AttesterConfig = {
163
+ publicKey: {
164
+ x: bigint;
165
+ y: bigint;
166
+ };
167
+ withdrawer: EthAddress;
168
+ };
169
+
170
+ /**
171
+ * Complete view of an attester's state
172
+ */
173
+ export type AttesterView = {
174
+ status: AttesterStatus;
175
+ effectiveBalance: bigint;
176
+ exit: Exit;
177
+ config: AttesterConfig;
178
+ };
179
+
180
+ /**
181
+ * Return for a status call
182
+ */
183
+ export type RollupStatusResponse = {
184
+ provenCheckpointNumber: CheckpointNumber;
185
+ provenArchive: Fr;
186
+ pendingCheckpointNumber: CheckpointNumber;
187
+ pendingArchive: Fr;
188
+ archiveOfMyCheckpoint: Fr;
189
+ };
190
+
191
+ /** Arguments for the CheckpointProposed event. */
192
+ export type CheckpointProposedArgs = {
193
+ checkpointNumber: CheckpointNumber;
194
+ archive: Fr;
195
+ versionedBlobHashes: Buffer[];
196
+ /** Hash of attestations. Undefined for older events (backwards compatibility). */
197
+ attestationsHash?: Buffer32;
198
+ /** Digest of the payload. Undefined for older events (backwards compatibility). */
199
+ payloadDigest?: Buffer32;
200
+ };
201
+
202
+ /** Log type for CheckpointProposed events. */
203
+ export type CheckpointProposedLog = L1EventLog<CheckpointProposedArgs>;
204
+
92
205
  export class RollupContract {
93
206
  private readonly rollup: GetContractReturnType<typeof RollupAbi, ViemClient>;
94
207
 
95
208
  private static cachedStfStorageSlot: Hex | undefined;
209
+ private cachedEscapeHatch?: {
210
+ address: EthAddress;
211
+ contract: GetContractReturnType<typeof EscapeHatchAbi, ViemClient>;
212
+ };
96
213
 
97
214
  static get checkBlobStorageSlot(): bigint {
98
215
  const asString = RollupStorage.find(storage => storage.label === 'checkBlob')?.slot;
@@ -106,7 +223,7 @@ export class RollupContract {
106
223
  return (RollupContract.cachedStfStorageSlot ??= keccak256(Buffer.from('aztec.stf.storage', 'utf-8')));
107
224
  }
108
225
 
109
- static getFromL1ContractsValues(deployL1ContractsValues: DeployL1ContractsReturnType) {
226
+ static getFromL1ContractsValues(deployL1ContractsValues: DeployAztecL1ContractsReturnType) {
110
227
  const {
111
228
  l1Client,
112
229
  l1ContractAddresses: { rollupAddress },
@@ -130,8 +247,8 @@ export class RollupContract {
130
247
  this.rollup = getContract({ address, abi: RollupAbi, client });
131
248
  }
132
249
 
133
- getGSE() {
134
- return this.rollup.read.getGSE();
250
+ async getGSE(): Promise<EthAddress> {
251
+ return EthAddress.fromString(await this.rollup.read.getGSE());
135
252
  }
136
253
 
137
254
  public get address() {
@@ -173,23 +290,23 @@ export class RollupContract {
173
290
  }
174
291
 
175
292
  @memoize
176
- getL1StartBlock() {
293
+ getL1StartBlock(): Promise<bigint> {
177
294
  return this.rollup.read.L1_BLOCK_AT_GENESIS();
178
295
  }
179
296
 
180
297
  @memoize
181
- getL1GenesisTime() {
298
+ getL1GenesisTime(): Promise<bigint> {
182
299
  return this.rollup.read.getGenesisTime();
183
300
  }
184
301
 
185
302
  @memoize
186
- getProofSubmissionEpochs() {
187
- return this.rollup.read.getProofSubmissionEpochs();
303
+ async getProofSubmissionEpochs(): Promise<number> {
304
+ return Number(await this.rollup.read.getProofSubmissionEpochs());
188
305
  }
189
306
 
190
307
  @memoize
191
- getEpochDuration() {
192
- return this.rollup.read.getEpochDuration();
308
+ async getEpochDuration(): Promise<number> {
309
+ return Number(await this.rollup.read.getEpochDuration());
193
310
  }
194
311
 
195
312
  @memoize
@@ -198,68 +315,68 @@ export class RollupContract {
198
315
  }
199
316
 
200
317
  @memoize
201
- getTargetCommitteeSize() {
202
- return this.rollup.read.getTargetCommitteeSize();
318
+ async getTargetCommitteeSize(): Promise<number> {
319
+ return Number(await this.rollup.read.getTargetCommitteeSize());
203
320
  }
204
321
 
205
322
  @memoize
206
- getEjectionThreshold() {
323
+ getEjectionThreshold(): Promise<bigint> {
207
324
  return this.rollup.read.getEjectionThreshold();
208
325
  }
209
326
 
210
327
  @memoize
211
- getLocalEjectionThreshold() {
328
+ getLocalEjectionThreshold(): Promise<bigint> {
212
329
  return this.rollup.read.getLocalEjectionThreshold();
213
330
  }
214
331
 
215
332
  @memoize
216
- getLagInEpochsForValidatorSet() {
217
- return this.rollup.read.getLagInEpochsForValidatorSet();
333
+ async getLagInEpochsForValidatorSet(): Promise<number> {
334
+ return Number(await this.rollup.read.getLagInEpochsForValidatorSet());
218
335
  }
219
336
 
220
337
  @memoize
221
- getLagInEpochsForRandao() {
222
- return this.rollup.read.getLagInEpochsForRandao();
338
+ async getLagInEpochsForRandao(): Promise<number> {
339
+ return Number(await this.rollup.read.getLagInEpochsForRandao());
223
340
  }
224
341
 
225
342
  @memoize
226
- getActivationThreshold() {
343
+ getActivationThreshold(): Promise<bigint> {
227
344
  return this.rollup.read.getActivationThreshold();
228
345
  }
229
346
 
230
347
  @memoize
231
- getExitDelay() {
232
- return this.rollup.read.getExitDelay();
348
+ async getExitDelay(): Promise<number> {
349
+ return Number(await this.rollup.read.getExitDelay());
233
350
  }
234
351
 
235
352
  @memoize
236
- getManaTarget() {
353
+ getManaTarget(): Promise<bigint> {
237
354
  return this.rollup.read.getManaTarget();
238
355
  }
239
356
 
240
357
  @memoize
241
- getProvingCostPerMana() {
358
+ getProvingCostPerMana(): Promise<bigint> {
242
359
  return this.rollup.read.getProvingCostPerManaInEth();
243
360
  }
244
361
 
245
362
  @memoize
246
- getProvingCostPerManaInFeeAsset() {
363
+ getProvingCostPerManaInFeeAsset(): Promise<bigint> {
247
364
  return this.rollup.read.getProvingCostPerManaInFeeAsset();
248
365
  }
249
366
 
250
367
  @memoize
251
- getManaLimit() {
368
+ getManaLimit(): Promise<bigint> {
252
369
  return this.rollup.read.getManaLimit();
253
370
  }
254
371
 
255
372
  @memoize
256
- getVersion() {
373
+ getVersion(): Promise<bigint> {
257
374
  return this.rollup.read.getVersion();
258
375
  }
259
376
 
260
377
  @memoize
261
- async getGenesisArchiveTreeRoot(): Promise<`0x${string}`> {
262
- return await this.rollup.read.archiveAt([0n]);
378
+ async getGenesisArchiveTreeRoot(): Promise<Fr> {
379
+ return Fr.fromString(await this.rollup.read.archiveAt([0n]));
263
380
  }
264
381
 
265
382
  /**
@@ -291,27 +408,79 @@ export class RollupContract {
291
408
  };
292
409
  }
293
410
 
294
- getSlasherAddress() {
295
- return this.rollup.read.getSlasher();
411
+ async getSlasherAddress(): Promise<EthAddress> {
412
+ return EthAddress.fromString(await this.rollup.read.getSlasher());
413
+ }
414
+
415
+ /**
416
+ * Returns the configured escape hatch contract address, or zero if disabled.
417
+ */
418
+ async getEscapeHatchAddress(): Promise<EthAddress> {
419
+ return EthAddress.fromString(await this.rollup.read.getEscapeHatch());
420
+ }
421
+
422
+ private async getEscapeHatchContract(): Promise<
423
+ GetContractReturnType<typeof EscapeHatchAbi, ViemClient> | undefined
424
+ > {
425
+ const escapeHatchAddress = await this.getEscapeHatchAddress();
426
+ if (escapeHatchAddress.isZero()) {
427
+ return undefined;
428
+ }
429
+
430
+ // Cache the viem contract wrapper since it will be used frequently.
431
+ if (!this.cachedEscapeHatch || !this.cachedEscapeHatch.address.equals(escapeHatchAddress)) {
432
+ this.cachedEscapeHatch = {
433
+ address: escapeHatchAddress,
434
+ contract: getContract({
435
+ address: escapeHatchAddress.toString(),
436
+ abi: EscapeHatchAbi,
437
+ client: this.client,
438
+ }),
439
+ };
440
+ }
441
+
442
+ return this.cachedEscapeHatch.contract;
443
+ }
444
+
445
+ /**
446
+ * Returns whether the escape hatch is open for the given epoch.
447
+ * If escape hatch is not configured, returns false.
448
+ *
449
+ * This function is intentionally defensive: any failure to query the escape hatch
450
+ * (RPC issues, transient errors, etc.) is treated as "closed" to avoid callers
451
+ * needing to sprinkle try/catch everywhere.
452
+ */
453
+ async isEscapeHatchOpen(epoch: EpochNumber): Promise<boolean> {
454
+ try {
455
+ const escapeHatch = await this.getEscapeHatchContract();
456
+ if (!escapeHatch) {
457
+ return false;
458
+ }
459
+
460
+ const [isOpen] = await escapeHatch.read.isHatchOpen([BigInt(epoch)]);
461
+ return isOpen;
462
+ } catch {
463
+ return false;
464
+ }
296
465
  }
297
466
 
298
467
  /**
299
468
  * Returns a SlasherContract instance for interacting with the slasher contract.
300
469
  */
301
470
  async getSlasherContract(): Promise<SlasherContract | undefined> {
302
- const slasherAddress = EthAddress.fromString(await this.getSlasherAddress());
471
+ const slasherAddress = await this.getSlasherAddress();
303
472
  if (slasherAddress.isZero()) {
304
473
  return undefined;
305
474
  }
306
475
  return new SlasherContract(this.client, slasherAddress);
307
476
  }
308
477
 
309
- getOwner() {
310
- return this.rollup.read.owner();
478
+ async getOwner(): Promise<EthAddress> {
479
+ return EthAddress.fromString(await this.rollup.read.owner());
311
480
  }
312
481
 
313
- getActiveAttesterCount() {
314
- return this.rollup.read.getActiveAttesterCount();
482
+ async getActiveAttesterCount(): Promise<number> {
483
+ return Number(await this.rollup.read.getActiveAttesterCount());
315
484
  }
316
485
 
317
486
  public async getSlashingProposerAddress() {
@@ -322,31 +491,35 @@ export class RollupContract {
322
491
  return await slasher.getProposer();
323
492
  }
324
493
 
325
- getCheckpointReward() {
494
+ getCheckpointReward(): Promise<bigint> {
326
495
  return this.rollup.read.getCheckpointReward();
327
496
  }
328
497
 
329
- getCheckpointNumber() {
330
- return this.rollup.read.getPendingCheckpointNumber();
498
+ async getCheckpointNumber(): Promise<CheckpointNumber> {
499
+ return CheckpointNumber.fromBigInt(await this.rollup.read.getPendingCheckpointNumber());
331
500
  }
332
501
 
333
- getProvenCheckpointNumber() {
334
- return this.rollup.read.getProvenCheckpointNumber();
502
+ async getProvenCheckpointNumber(): Promise<CheckpointNumber> {
503
+ return CheckpointNumber.fromBigInt(await this.rollup.read.getProvenCheckpointNumber());
335
504
  }
336
505
 
337
506
  async getSlotNumber(): Promise<SlotNumber> {
338
507
  return SlotNumber.fromBigInt(await this.rollup.read.getCurrentSlot());
339
508
  }
340
509
 
341
- getL1FeesAt(timestamp: bigint) {
342
- return this.rollup.read.getL1FeesAt([timestamp]);
510
+ async getL1FeesAt(timestamp: bigint): Promise<L1FeeData> {
511
+ const result = await this.rollup.read.getL1FeesAt([timestamp]);
512
+ return {
513
+ baseFee: result.baseFee,
514
+ blobFee: result.blobFee,
515
+ };
343
516
  }
344
517
 
345
- getFeeAssetPerEth() {
346
- return this.rollup.read.getFeeAssetPerEth();
518
+ getEthPerFeeAsset(): Promise<bigint> {
519
+ return this.rollup.read.getEthPerFeeAsset();
347
520
  }
348
521
 
349
- async getCommitteeAt(timestamp: bigint): Promise<readonly `0x${string}`[] | undefined> {
522
+ async getCommitteeAt(timestamp: bigint): Promise<EthAddress[] | undefined> {
350
523
  const { result } = await this.client
351
524
  .simulateContract({
352
525
  address: this.address,
@@ -361,22 +534,22 @@ export class RollupContract {
361
534
  throw e;
362
535
  });
363
536
 
364
- return result;
537
+ return result ? result.map(addr => EthAddress.fromString(addr)) : undefined;
365
538
  }
366
539
 
367
- getSampleSeedAt(timestamp: bigint) {
368
- return this.rollup.read.getSampleSeedAt([timestamp]);
540
+ async getSampleSeedAt(timestamp: bigint): Promise<Buffer32> {
541
+ return Buffer32.fromBigInt(await this.rollup.read.getSampleSeedAt([timestamp]));
369
542
  }
370
543
 
371
- getCurrentSampleSeed() {
372
- return this.rollup.read.getCurrentSampleSeed();
544
+ async getCurrentSampleSeed(): Promise<Buffer32> {
545
+ return Buffer32.fromBigInt(await this.rollup.read.getCurrentSampleSeed());
373
546
  }
374
547
 
375
548
  async getCurrentEpoch(): Promise<EpochNumber> {
376
549
  return EpochNumber.fromBigInt(await this.rollup.read.getCurrentEpoch());
377
550
  }
378
551
 
379
- async getCurrentEpochCommittee(): Promise<readonly `0x${string}`[] | undefined> {
552
+ async getCurrentEpochCommittee(): Promise<EthAddress[] | undefined> {
380
553
  const { result } = await this.client
381
554
  .simulateContract({
382
555
  address: this.address,
@@ -391,10 +564,10 @@ export class RollupContract {
391
564
  throw e;
392
565
  });
393
566
 
394
- return result;
567
+ return result ? result.map(addr => EthAddress.fromString(addr)) : undefined;
395
568
  }
396
569
 
397
- async getCurrentProposer() {
570
+ async getCurrentProposer(): Promise<EthAddress> {
398
571
  const { result } = await this.client.simulateContract({
399
572
  address: this.address,
400
573
  abi: RollupAbi,
@@ -402,10 +575,10 @@ export class RollupContract {
402
575
  args: [],
403
576
  });
404
577
 
405
- return result;
578
+ return EthAddress.fromString(result);
406
579
  }
407
580
 
408
- async getProposerAt(timestamp: bigint) {
581
+ async getProposerAt(timestamp: bigint): Promise<EthAddress> {
409
582
  const { result } = await this.client.simulateContract({
410
583
  address: this.address,
411
584
  abi: RollupAbi,
@@ -413,27 +586,61 @@ export class RollupContract {
413
586
  args: [timestamp],
414
587
  });
415
588
 
416
- return result;
589
+ return EthAddress.fromString(result);
590
+ }
591
+
592
+ async getCheckpoint(checkpointNumber: CheckpointNumber): Promise<CheckpointLog> {
593
+ const result = await this.rollup.read.getCheckpoint([BigInt(checkpointNumber)]);
594
+ return {
595
+ archive: Fr.fromString(result.archive),
596
+ headerHash: Buffer32.fromString(result.headerHash),
597
+ blobCommitmentsHash: Buffer32.fromString(result.blobCommitmentsHash),
598
+ attestationsHash: Buffer32.fromString(result.attestationsHash),
599
+ payloadDigest: Buffer32.fromString(result.payloadDigest),
600
+ slotNumber: SlotNumber.fromBigInt(result.slotNumber),
601
+ feeHeader: {
602
+ excessMana: result.feeHeader.excessMana,
603
+ manaUsed: result.feeHeader.manaUsed,
604
+ ethPerFeeAsset: result.feeHeader.ethPerFeeAsset,
605
+ congestionCost: result.feeHeader.congestionCost,
606
+ proverCost: result.feeHeader.proverCost,
607
+ },
608
+ };
417
609
  }
418
610
 
419
- getCheckpoint(checkpointNumber: bigint | number) {
420
- return this.rollup.read.getCheckpoint([BigInt(checkpointNumber)]);
611
+ /** Returns the pending checkpoint from the rollup contract */
612
+ getPendingCheckpoint() {
613
+ // We retry because of race conditions during prunes: we may get a pending checkpoint number which is immediately
614
+ // reorged out due to a prune happening, causing the subsequent getCheckpoint call to fail. So we try again in that case.
615
+ return retry(
616
+ async () => {
617
+ const pendingCheckpointNumber = await this.getCheckpointNumber();
618
+ const pendingCheckpoint = await this.getCheckpoint(pendingCheckpointNumber);
619
+ return pendingCheckpoint;
620
+ },
621
+ 'getting pending checkpoint',
622
+ makeBackoff([0.5, 0.5, 0.5]),
623
+ );
421
624
  }
422
625
 
423
- getTips() {
424
- return this.rollup.read.getTips();
626
+ async getTips(): Promise<{ pending: CheckpointNumber; proven: CheckpointNumber }> {
627
+ const { pending, proven } = await this.rollup.read.getTips();
628
+ return {
629
+ pending: CheckpointNumber.fromBigInt(pending),
630
+ proven: CheckpointNumber.fromBigInt(proven),
631
+ };
425
632
  }
426
633
 
427
- getTimestampForSlot(slot: SlotNumber) {
634
+ getTimestampForSlot(slot: SlotNumber): Promise<bigint> {
428
635
  return this.rollup.read.getTimestampForSlot([BigInt(slot)]);
429
636
  }
430
637
 
431
- getEntryQueueLength() {
432
- return this.rollup.read.getEntryQueueLength();
638
+ async getEntryQueueLength(): Promise<number> {
639
+ return Number(await this.rollup.read.getEntryQueueLength());
433
640
  }
434
641
 
435
- getAvailableValidatorFlushes() {
436
- return this.rollup.read.getAvailableValidatorFlushes();
642
+ async getAvailableValidatorFlushes(): Promise<number> {
643
+ return Number(await this.rollup.read.getAvailableValidatorFlushes());
437
644
  }
438
645
 
439
646
  async getNextFlushableEpoch(): Promise<EpochNumber> {
@@ -444,7 +651,7 @@ export class RollupContract {
444
651
  return EpochNumber.fromBigInt(await this.rollup.read.getCurrentEpoch());
445
652
  }
446
653
 
447
- async getEpochNumberForCheckpoint(checkpointNumber: bigint): Promise<EpochNumber> {
654
+ async getEpochNumberForCheckpoint(checkpointNumber: CheckpointNumber): Promise<EpochNumber> {
448
655
  return EpochNumber.fromBigInt(await this.rollup.read.getEpochForCheckpoint([BigInt(checkpointNumber)]));
449
656
  }
450
657
 
@@ -489,10 +696,11 @@ export class RollupContract {
489
696
  return EpochNumber.fromBigInt(await this.rollup.read.getEpochAtSlot([BigInt(slotNumber)]));
490
697
  }
491
698
 
492
- getEpochProofPublicInputs(
699
+ async getEpochProofPublicInputs(
493
700
  args: readonly [bigint, bigint, EpochProofPublicInputArgs, readonly `0x${string}`[], `0x${string}`],
494
- ) {
495
- return this.rollup.read.getEpochProofPublicInputs(args);
701
+ ): Promise<Fr[]> {
702
+ const result = await this.rollup.read.getEpochProofPublicInputs(args);
703
+ return result.map(Fr.fromString);
496
704
  }
497
705
 
498
706
  public async validateHeader(
@@ -537,8 +745,8 @@ export class RollupContract {
537
745
  archive: Buffer,
538
746
  account: `0x${string}` | Account,
539
747
  slotDuration: number,
540
- opts: { forcePendingCheckpointNumber?: number } = {},
541
- ): Promise<{ slot: SlotNumber; checkpointNumber: bigint; timeOfNextL1Slot: bigint }> {
748
+ opts: { forcePendingCheckpointNumber?: CheckpointNumber } = {},
749
+ ): Promise<{ slot: SlotNumber; checkpointNumber: CheckpointNumber; timeOfNextL1Slot: bigint }> {
542
750
  const latestBlock = await this.client.getBlock();
543
751
  const timeOfNextL1Slot = latestBlock.timestamp + BigInt(slotDuration);
544
752
  const who = typeof account === 'string' ? account : account.address;
@@ -555,7 +763,11 @@ export class RollupContract {
555
763
  stateOverride: await this.makePendingCheckpointNumberOverride(opts.forcePendingCheckpointNumber),
556
764
  });
557
765
 
558
- return { slot: SlotNumber.fromBigInt(slot), checkpointNumber, timeOfNextL1Slot };
766
+ return {
767
+ slot: SlotNumber.fromBigInt(slot),
768
+ checkpointNumber: CheckpointNumber.fromBigInt(checkpointNumber),
769
+ timeOfNextL1Slot,
770
+ };
559
771
  } catch (err: unknown) {
560
772
  throw formatViemError(err);
561
773
  }
@@ -567,7 +779,7 @@ export class RollupContract {
567
779
  * stored in the same slot. If the argument is undefined, it returns an empty override.
568
780
  */
569
781
  public async makePendingCheckpointNumberOverride(
570
- forcePendingCheckpointNumber: number | undefined,
782
+ forcePendingCheckpointNumber: CheckpointNumber | undefined,
571
783
  ): Promise<StateOverride> {
572
784
  if (forcePendingCheckpointNumber === undefined) {
573
785
  return [];
@@ -586,7 +798,7 @@ export class RollupContract {
586
798
 
587
799
  /** Creates a request to Rollup#invalidateBadAttestation to be simulated or sent */
588
800
  public buildInvalidateBadAttestationRequest(
589
- checkpointNumber: number,
801
+ checkpointNumber: CheckpointNumber,
590
802
  attestationsAndSigners: ViemCommitteeAttestations,
591
803
  committee: EthAddress[],
592
804
  invalidIndex: number,
@@ -608,7 +820,7 @@ export class RollupContract {
608
820
 
609
821
  /** Creates a request to Rollup#invalidateInsufficientAttestations to be simulated or sent */
610
822
  public buildInvalidateInsufficientAttestationsRequest(
611
- checkpointNumber: number,
823
+ checkpointNumber: CheckpointNumber,
612
824
  attestationsAndSigners: ViemCommitteeAttestations,
613
825
  committee: EthAddress[],
614
826
  ): L1TxRequest {
@@ -630,85 +842,118 @@ export class RollupContract {
630
842
  return this.rollup.read.getHasSubmitted([BigInt(epochNumber), BigInt(numberOfCheckpointsInEpoch), prover]);
631
843
  }
632
844
 
633
- getManaBaseFeeAt(timestamp: bigint, inFeeAsset: boolean) {
634
- return this.rollup.read.getManaBaseFeeAt([timestamp, inFeeAsset]);
845
+ getManaMinFeeAt(timestamp: bigint, inFeeAsset: boolean): Promise<bigint> {
846
+ return this.rollup.read.getManaMinFeeAt([timestamp, inFeeAsset]);
635
847
  }
636
848
 
637
849
  async getSlotAt(timestamp: bigint): Promise<SlotNumber> {
638
850
  return SlotNumber.fromBigInt(await this.rollup.read.getSlotAt([timestamp]));
639
851
  }
640
852
 
641
- async status(checkpointNumber: bigint, options?: { blockNumber?: bigint }) {
853
+ async status(checkpointNumber: CheckpointNumber, options?: { blockNumber?: bigint }): Promise<RollupStatusResponse> {
642
854
  await checkBlockTag(options?.blockNumber, this.client);
643
- return this.rollup.read.status([checkpointNumber], options);
855
+ const result = await this.rollup.read.status([BigInt(checkpointNumber)], options);
856
+ return {
857
+ provenCheckpointNumber: CheckpointNumber.fromBigInt(result[0]),
858
+ provenArchive: Fr.fromString(result[1]),
859
+ pendingCheckpointNumber: CheckpointNumber.fromBigInt(result[2]),
860
+ pendingArchive: Fr.fromString(result[3]),
861
+ archiveOfMyCheckpoint: Fr.fromString(result[4]),
862
+ };
644
863
  }
645
864
 
646
- async canPruneAtTime(timestamp: bigint, options?: { blockNumber?: bigint }) {
865
+ async canPruneAtTime(timestamp: bigint, options?: { blockNumber?: bigint }): Promise<boolean> {
647
866
  await checkBlockTag(options?.blockNumber, this.client);
648
867
  return this.rollup.read.canPruneAtTime([timestamp], options);
649
868
  }
650
869
 
651
- archive() {
652
- return this.rollup.read.archive();
870
+ async archive(): Promise<Fr> {
871
+ return Fr.fromString(await this.rollup.read.archive());
653
872
  }
654
873
 
655
- archiveAt(checkpointNumber: bigint) {
656
- return this.rollup.read.archiveAt([checkpointNumber]);
874
+ async archiveAt(checkpointNumber: CheckpointNumber): Promise<Fr> {
875
+ return Fr.fromString(await this.rollup.read.archiveAt([BigInt(checkpointNumber)]));
657
876
  }
658
877
 
659
- getSequencerRewards(address: Hex | EthAddress) {
878
+ getSequencerRewards(address: Hex | EthAddress): Promise<bigint> {
660
879
  if (address instanceof EthAddress) {
661
880
  address = address.toString();
662
881
  }
663
882
  return this.rollup.read.getSequencerRewards([address]);
664
883
  }
665
884
 
666
- getSpecificProverRewardsForEpoch(epoch: bigint, prover: Hex | EthAddress) {
885
+ getSpecificProverRewardsForEpoch(epoch: bigint, prover: Hex | EthAddress): Promise<bigint> {
667
886
  if (prover instanceof EthAddress) {
668
887
  prover = prover.toString();
669
888
  }
670
889
  return this.rollup.read.getSpecificProverRewardsForEpoch([epoch, prover]);
671
890
  }
672
891
 
673
- async getAttesters() {
892
+ async getAttesters(): Promise<EthAddress[]> {
674
893
  const attesterSize = await this.getActiveAttesterCount();
675
894
  const gse = new GSEContract(this.client, await this.getGSE());
676
895
  const ts = (await this.client.getBlock()).timestamp;
677
896
 
678
- const indices = Array.from({ length: Number(attesterSize) }, (_, i) => BigInt(i));
897
+ const indices = Array.from({ length: attesterSize }, (_, i) => BigInt(i));
679
898
  const chunks = chunk(indices, 1000);
680
899
 
681
- return (await Promise.all(chunks.map(chunk => gse.getAttestersFromIndicesAtTime(this.address, ts, chunk)))).flat();
900
+ const results = await Promise.all(chunks.map(chunk => gse.getAttestersFromIndicesAtTime(this.address, ts, chunk)));
901
+ return results.flat().map(addr => EthAddress.fromString(addr));
682
902
  }
683
903
 
684
- getAttesterView(address: Hex | EthAddress) {
904
+ async getAttesterView(address: Hex | EthAddress): Promise<AttesterView> {
685
905
  if (address instanceof EthAddress) {
686
906
  address = address.toString();
687
907
  }
688
- return this.rollup.read.getAttesterView([address]);
908
+ const result = await this.rollup.read.getAttesterView([address]);
909
+ return {
910
+ status: result.status as AttesterStatus,
911
+ effectiveBalance: result.effectiveBalance,
912
+ exit: {
913
+ withdrawalId: result.exit.withdrawalId,
914
+ amount: result.exit.amount,
915
+ exitableAt: result.exit.exitableAt,
916
+ recipientOrWithdrawer: EthAddress.fromString(result.exit.recipientOrWithdrawer),
917
+ isRecipient: result.exit.isRecipient,
918
+ exists: result.exit.exists,
919
+ },
920
+ config: {
921
+ publicKey: {
922
+ x: result.config.publicKey.x,
923
+ y: result.config.publicKey.y,
924
+ },
925
+ withdrawer: EthAddress.fromString(result.config.withdrawer),
926
+ },
927
+ };
689
928
  }
690
929
 
691
- getStatus(address: Hex | EthAddress) {
930
+ async getStatus(address: Hex | EthAddress): Promise<AttesterStatus> {
692
931
  if (address instanceof EthAddress) {
693
932
  address = address.toString();
694
933
  }
695
- return this.rollup.read.getStatus([address]);
934
+ return (await this.rollup.read.getStatus([address])) as AttesterStatus;
696
935
  }
697
936
 
698
- getBlobCommitmentsHash(checkpointNumber: bigint) {
699
- return this.rollup.read.getBlobCommitmentsHash([checkpointNumber]);
937
+ async getBlobCommitmentsHash(checkpointNumber: CheckpointNumber): Promise<Buffer32> {
938
+ return Buffer32.fromString(await this.rollup.read.getBlobCommitmentsHash([BigInt(checkpointNumber)]));
700
939
  }
701
940
 
702
- getCurrentBlobCommitmentsHash() {
703
- return this.rollup.read.getCurrentBlobCommitmentsHash();
941
+ async getCurrentBlobCommitmentsHash(): Promise<Buffer32> {
942
+ return Buffer32.fromString(await this.rollup.read.getCurrentBlobCommitmentsHash());
704
943
  }
705
944
 
706
- getStakingAsset() {
707
- return this.rollup.read.getStakingAsset();
945
+ async getStakingAsset(): Promise<EthAddress> {
946
+ return EthAddress.fromString(await this.rollup.read.getStakingAsset());
708
947
  }
709
948
 
710
- getRewardConfig() {
711
- return this.rollup.read.getRewardConfig();
949
+ async getRewardConfig(): Promise<RewardConfig> {
950
+ const result = await this.rollup.read.getRewardConfig();
951
+ return {
952
+ rewardDistributor: EthAddress.fromString(result.rewardDistributor),
953
+ sequencerBps: BigInt(result.sequencerBps),
954
+ booster: EthAddress.fromString(result.booster),
955
+ checkpointReward: result.checkpointReward,
956
+ };
712
957
  }
713
958
 
714
959
  setupEpoch(l1TxUtils: L1TxUtils) {
@@ -752,7 +997,7 @@ export class RollupContract {
752
997
  }
753
998
 
754
999
  public listenToCheckpointInvalidated(
755
- callback: (args: { checkpointNumber: bigint }) => unknown,
1000
+ callback: (args: { checkpointNumber: CheckpointNumber }) => unknown,
756
1001
  ): WatchContractEventReturnType {
757
1002
  return this.rollup.watchEvent.CheckpointInvalidated(
758
1003
  {},
@@ -761,7 +1006,7 @@ export class RollupContract {
761
1006
  for (const log of logs) {
762
1007
  const args = log.args;
763
1008
  if (args.checkpointNumber !== undefined) {
764
- callback({ checkpointNumber: args.checkpointNumber });
1009
+ callback({ checkpointNumber: CheckpointNumber.fromBigInt(args.checkpointNumber) });
765
1010
  }
766
1011
  }
767
1012
  },
@@ -793,4 +1038,23 @@ export class RollupContract {
793
1038
  },
794
1039
  );
795
1040
  }
1041
+
1042
+ /** Fetches CheckpointProposed events within the given block range. */
1043
+ async getCheckpointProposedEvents(fromBlock: bigint, toBlock: bigint): Promise<CheckpointProposedLog[]> {
1044
+ const logs = await this.rollup.getEvents.CheckpointProposed({}, { fromBlock, toBlock });
1045
+ return logs
1046
+ .filter(log => log.blockNumber! >= fromBlock && log.blockNumber! <= toBlock)
1047
+ .map(log => ({
1048
+ l1BlockNumber: log.blockNumber!,
1049
+ l1BlockHash: Buffer32.fromString(log.blockHash!),
1050
+ l1TransactionHash: log.transactionHash!,
1051
+ args: {
1052
+ checkpointNumber: CheckpointNumber.fromBigInt(log.args.checkpointNumber!),
1053
+ archive: Fr.fromString(log.args.archive!),
1054
+ versionedBlobHashes: log.args.versionedBlobHashes!.map(h => Buffer.from(h.slice(2), 'hex')),
1055
+ attestationsHash: log.args.attestationsHash ? Buffer32.fromString(log.args.attestationsHash) : undefined,
1056
+ payloadDigest: log.args.payloadDigest ? Buffer32.fromString(log.args.payloadDigest) : undefined,
1057
+ },
1058
+ }));
1059
+ }
796
1060
  }