@aztec/prover-node 0.0.0-test.0 → 0.0.1-commit.0208eb9

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 (82) hide show
  1. package/dest/actions/download-epoch-proving-job.d.ts +18 -0
  2. package/dest/actions/download-epoch-proving-job.d.ts.map +1 -0
  3. package/dest/actions/download-epoch-proving-job.js +37 -0
  4. package/dest/actions/index.d.ts +3 -0
  5. package/dest/actions/index.d.ts.map +1 -0
  6. package/dest/actions/index.js +2 -0
  7. package/dest/actions/rerun-epoch-proving-job.d.ts +12 -0
  8. package/dest/actions/rerun-epoch-proving-job.d.ts.map +1 -0
  9. package/dest/actions/rerun-epoch-proving-job.js +42 -0
  10. package/dest/actions/upload-epoch-proof-failure.d.ts +15 -0
  11. package/dest/actions/upload-epoch-proof-failure.d.ts.map +1 -0
  12. package/dest/actions/upload-epoch-proof-failure.js +78 -0
  13. package/dest/bin/run-failed-epoch.d.ts +2 -0
  14. package/dest/bin/run-failed-epoch.d.ts.map +1 -0
  15. package/dest/bin/run-failed-epoch.js +67 -0
  16. package/dest/config.d.ts +15 -11
  17. package/dest/config.d.ts.map +1 -1
  18. package/dest/config.js +83 -15
  19. package/dest/factory.d.ts +14 -12
  20. package/dest/factory.d.ts.map +1 -1
  21. package/dest/factory.js +106 -37
  22. package/dest/index.d.ts +3 -2
  23. package/dest/index.d.ts.map +1 -1
  24. package/dest/index.js +2 -1
  25. package/dest/job/epoch-proving-job-data.d.ts +18 -0
  26. package/dest/job/epoch-proving-job-data.d.ts.map +1 -0
  27. package/dest/job/epoch-proving-job-data.js +59 -0
  28. package/dest/job/epoch-proving-job.d.ts +27 -18
  29. package/dest/job/epoch-proving-job.d.ts.map +1 -1
  30. package/dest/job/epoch-proving-job.js +583 -97
  31. package/dest/metrics.d.ts +30 -5
  32. package/dest/metrics.d.ts.map +1 -1
  33. package/dest/metrics.js +111 -73
  34. package/dest/monitors/epoch-monitor.d.ts +5 -2
  35. package/dest/monitors/epoch-monitor.d.ts.map +1 -1
  36. package/dest/monitors/epoch-monitor.js +18 -13
  37. package/dest/monitors/index.d.ts +1 -1
  38. package/dest/prover-node-publisher.d.ts +17 -17
  39. package/dest/prover-node-publisher.d.ts.map +1 -1
  40. package/dest/prover-node-publisher.js +89 -83
  41. package/dest/prover-node.d.ts +49 -44
  42. package/dest/prover-node.d.ts.map +1 -1
  43. package/dest/prover-node.js +582 -130
  44. package/dest/prover-publisher-factory.d.ts +25 -0
  45. package/dest/prover-publisher-factory.d.ts.map +1 -0
  46. package/dest/prover-publisher-factory.js +28 -0
  47. package/dest/test/index.d.ts +5 -3
  48. package/dest/test/index.d.ts.map +1 -1
  49. package/dest/test/index.js +1 -3
  50. package/package.json +39 -33
  51. package/src/actions/download-epoch-proving-job.ts +44 -0
  52. package/src/actions/index.ts +2 -0
  53. package/src/actions/rerun-epoch-proving-job.ts +63 -0
  54. package/src/actions/upload-epoch-proof-failure.ts +88 -0
  55. package/src/bin/run-failed-epoch.ts +77 -0
  56. package/src/config.ts +111 -25
  57. package/src/factory.ts +177 -46
  58. package/src/index.ts +2 -1
  59. package/src/job/epoch-proving-job-data.ts +82 -0
  60. package/src/job/epoch-proving-job.ts +264 -84
  61. package/src/metrics.ts +119 -72
  62. package/src/monitors/epoch-monitor.ts +20 -15
  63. package/src/prover-node-publisher.ts +137 -117
  64. package/src/prover-node.ts +225 -142
  65. package/src/prover-publisher-factory.ts +45 -0
  66. package/src/test/index.ts +7 -4
  67. package/dest/http.d.ts +0 -8
  68. package/dest/http.d.ts.map +0 -1
  69. package/dest/http.js +0 -9
  70. package/dest/prover-coordination/config.d.ts +0 -7
  71. package/dest/prover-coordination/config.d.ts.map +0 -1
  72. package/dest/prover-coordination/config.js +0 -11
  73. package/dest/prover-coordination/factory.d.ts +0 -22
  74. package/dest/prover-coordination/factory.d.ts.map +0 -1
  75. package/dest/prover-coordination/factory.js +0 -42
  76. package/dest/prover-coordination/index.d.ts +0 -3
  77. package/dest/prover-coordination/index.d.ts.map +0 -1
  78. package/dest/prover-coordination/index.js +0 -2
  79. package/src/http.ts +0 -13
  80. package/src/prover-coordination/config.ts +0 -17
  81. package/src/prover-coordination/factory.ts +0 -72
  82. package/src/prover-coordination/index.ts +0 -2
@@ -1,34 +1,33 @@
1
- import { AGGREGATION_OBJECT_LENGTH, AZTEC_MAX_EPOCH_DURATION } from '@aztec/constants';
2
- import type { L1TxUtils, RollupContract } from '@aztec/ethereum';
1
+ import { BatchedBlob, getEthBlobEvaluationInputs } from '@aztec/blob-lib';
2
+ import { AZTEC_MAX_EPOCH_DURATION } from '@aztec/constants';
3
+ import type { RollupContract, ViemCommitteeAttestation } from '@aztec/ethereum/contracts';
4
+ import type { L1TxUtils } from '@aztec/ethereum/l1-tx-utils';
3
5
  import { makeTuple } from '@aztec/foundation/array';
4
- import { areArraysEqual, times } from '@aztec/foundation/collection';
6
+ import { CheckpointNumber, EpochNumber } from '@aztec/foundation/branded-types';
7
+ import { areArraysEqual } from '@aztec/foundation/collection';
8
+ import { Fr } from '@aztec/foundation/curves/bn254';
5
9
  import { EthAddress } from '@aztec/foundation/eth-address';
6
- import { Fr } from '@aztec/foundation/fields';
7
- import { createLogger } from '@aztec/foundation/log';
8
- import { type Tuple, serializeToBuffer } from '@aztec/foundation/serialize';
9
- import { InterruptibleSleep } from '@aztec/foundation/sleep';
10
+ import { type Logger, type LoggerBindings, createLogger } from '@aztec/foundation/log';
11
+ import type { Tuple } from '@aztec/foundation/serialize';
10
12
  import { Timer } from '@aztec/foundation/timer';
11
13
  import { RollupAbi } from '@aztec/l1-artifacts';
12
14
  import type { PublisherConfig, TxSenderConfig } from '@aztec/sequencer-client';
15
+ import { CommitteeAttestation, CommitteeAttestationsAndSigners } from '@aztec/stdlib/block';
13
16
  import type { Proof } from '@aztec/stdlib/proofs';
14
17
  import type { FeeRecipient, RootRollupPublicInputs } from '@aztec/stdlib/rollup';
15
18
  import type { L1PublishProofStats } from '@aztec/stdlib/stats';
16
19
  import { type TelemetryClient, getTelemetryClient } from '@aztec/telemetry-client';
17
20
 
21
+ import { inspect } from 'util';
18
22
  import { type Hex, type TransactionReceipt, encodeFunctionData } from 'viem';
19
23
 
20
- import { ProverNodeMetrics } from './metrics.js';
24
+ import { ProverNodePublisherMetrics } from './metrics.js';
21
25
 
22
- /**
23
- * Stats for a sent transaction.
24
- */
25
26
  /** Arguments to the submitEpochProof method of the rollup contract */
26
27
  export type L1SubmitEpochProofArgs = {
27
28
  epochSize: number;
28
29
  previousArchive: Fr;
29
30
  endArchive: Fr;
30
- previousBlockHash: Fr;
31
- endBlockHash: Fr;
32
31
  endTimestamp: Fr;
33
32
  outHash: Fr;
34
33
  proverId: Fr;
@@ -37,12 +36,10 @@ export type L1SubmitEpochProofArgs = {
37
36
  };
38
37
 
39
38
  export class ProverNodePublisher {
40
- private interruptibleSleep = new InterruptibleSleep();
41
- private sleepTimeMs: number;
42
39
  private interrupted = false;
43
- private metrics: ProverNodeMetrics;
40
+ private metrics: ProverNodePublisherMetrics;
44
41
 
45
- protected log = createLogger('prover-node:l1-tx-publisher');
42
+ protected log: Logger;
46
43
 
47
44
  protected rollupContract: RollupContract;
48
45
 
@@ -55,17 +52,21 @@ export class ProverNodePublisher {
55
52
  l1TxUtils: L1TxUtils;
56
53
  telemetry?: TelemetryClient;
57
54
  },
55
+ bindings?: LoggerBindings,
58
56
  ) {
59
- this.sleepTimeMs = config?.l1PublishRetryIntervalMS ?? 60_000;
60
-
61
57
  const telemetry = deps.telemetry ?? getTelemetryClient();
62
58
 
63
- this.metrics = new ProverNodeMetrics(telemetry, 'ProverNode');
59
+ this.metrics = new ProverNodePublisherMetrics(telemetry, 'ProverNode');
60
+ this.log = createLogger('prover-node:l1-tx-publisher', bindings);
64
61
 
65
62
  this.rollupContract = deps.rollupContract;
66
63
  this.l1TxUtils = deps.l1TxUtils;
67
64
  }
68
65
 
66
+ public getRollupContract() {
67
+ return this.rollupContract;
68
+ }
69
+
69
70
  /**
70
71
  * Calling `interrupt` will cause any in progress call to `publishRollup` to return `false` asap.
71
72
  * Be warned, the call may return false even if the tx subsequently gets successfully mined.
@@ -74,46 +75,53 @@ export class ProverNodePublisher {
74
75
  */
75
76
  public interrupt() {
76
77
  this.interrupted = true;
77
- this.interruptibleSleep.interrupt();
78
+ this.l1TxUtils.interrupt();
78
79
  }
79
80
 
80
81
  /** Restarts the publisher after calling `interrupt`. */
81
82
  public restart() {
82
83
  this.interrupted = false;
84
+ this.l1TxUtils.restart();
83
85
  }
84
86
 
85
87
  public getSenderAddress() {
86
- return EthAddress.fromString(this.l1TxUtils.getSenderAddress());
88
+ return this.l1TxUtils.getSenderAddress();
87
89
  }
88
90
 
89
91
  public async submitEpochProof(args: {
90
- epochNumber: number;
91
- fromBlock: number;
92
- toBlock: number;
92
+ epochNumber: EpochNumber;
93
+ fromCheckpoint: CheckpointNumber;
94
+ toCheckpoint: CheckpointNumber;
93
95
  publicInputs: RootRollupPublicInputs;
94
96
  proof: Proof;
97
+ batchedBlobInputs: BatchedBlob;
98
+ attestations: ViemCommitteeAttestation[];
95
99
  }): Promise<boolean> {
96
- const { epochNumber, fromBlock, toBlock } = args;
97
- const ctx = { epochNumber, fromBlock, toBlock };
100
+ const { epochNumber, fromCheckpoint, toCheckpoint } = args;
101
+ const ctx = { epochNumber, fromCheckpoint, toCheckpoint };
102
+
98
103
  if (!this.interrupted) {
99
104
  const timer = new Timer();
100
-
101
105
  // Validate epoch proof range and hashes are correct before submitting
102
106
  await this.validateEpochProofSubmission(args);
103
107
 
104
108
  const txReceipt = await this.sendSubmitEpochProofTx(args);
105
109
  if (!txReceipt) {
110
+ this.log.error(`Failed to mine submitEpochProof tx`, undefined, ctx);
106
111
  return false;
107
112
  }
108
113
 
109
114
  try {
110
- this.metrics.recordSenderBalance(await this.l1TxUtils.getSenderBalance(), this.l1TxUtils.getSenderAddress());
115
+ this.metrics.recordSenderBalance(
116
+ await this.l1TxUtils.getSenderBalance(),
117
+ this.l1TxUtils.getSenderAddress().toString(),
118
+ );
111
119
  } catch (err) {
112
120
  this.log.warn(`Failed to record the ETH balance of the prover node: ${err}`);
113
121
  }
114
122
 
115
123
  // Tx was mined successfully
116
- if (txReceipt.status) {
124
+ if (txReceipt.status === 'success') {
117
125
  const tx = await this.l1TxUtils.getTransactionStats(txReceipt.transactionHash);
118
126
  const stats: L1PublishProofStats = {
119
127
  gasPrice: txReceipt.effectiveGasPrice,
@@ -132,64 +140,69 @@ export class ProverNodePublisher {
132
140
  }
133
141
 
134
142
  this.metrics.recordFailedTx();
135
- this.log.error(`Rollup.submitEpochProof tx status failed: ${txReceipt.transactionHash}`, ctx);
136
- await this.sleepOrInterrupted();
143
+ this.log.error(`Rollup submitEpochProof tx reverted ${txReceipt.transactionHash}`, undefined, ctx);
137
144
  }
138
145
 
139
- this.log.verbose('L2 block data syncing interrupted while processing blocks.', ctx);
146
+ this.log.verbose('Checkpoint data syncing interrupted', ctx);
140
147
  return false;
141
148
  }
142
149
 
143
150
  private async validateEpochProofSubmission(args: {
144
- fromBlock: number;
145
- toBlock: number;
151
+ fromCheckpoint: CheckpointNumber;
152
+ toCheckpoint: CheckpointNumber;
146
153
  publicInputs: RootRollupPublicInputs;
147
154
  proof: Proof;
155
+ batchedBlobInputs: BatchedBlob;
156
+ attestations: ViemCommitteeAttestation[];
148
157
  }) {
149
- const { fromBlock, toBlock, publicInputs, proof } = args;
158
+ const { fromCheckpoint, toCheckpoint, publicInputs, batchedBlobInputs } = args;
150
159
 
151
- // Check that the block numbers match the expected epoch to be proven
152
- const { pendingBlockNumber: pending, provenBlockNumber: proven } = await this.rollupContract.getTips();
153
- if (proven !== BigInt(fromBlock) - 1n) {
154
- throw new Error(`Cannot submit epoch proof for ${fromBlock}-${toBlock} as proven block is ${proven}`);
160
+ // Check that the checkpoint numbers match the expected epoch to be proven
161
+ const { pending, proven } = await this.rollupContract.getTips();
162
+ // Don't publish if proven is beyond our toCheckpoint, pointless to do so
163
+ if (proven > toCheckpoint) {
164
+ throw new Error(
165
+ `Cannot submit epoch proof for ${fromCheckpoint}-${toCheckpoint} as proven checkpoint is ${proven}`,
166
+ );
155
167
  }
156
- if (toBlock > pending) {
157
- throw new Error(`Cannot submit epoch proof for ${fromBlock}-${toBlock} as pending block is ${pending}`);
168
+ // toCheckpoint can't be greater than pending
169
+ if (toCheckpoint > pending) {
170
+ throw new Error(
171
+ `Cannot submit epoch proof for ${fromCheckpoint}-${toCheckpoint} as pending checkpoint is ${pending}`,
172
+ );
158
173
  }
159
174
 
160
- // Check the block hash and archive for the immediate block before the epoch
161
- const blockLog = await this.rollupContract.getBlock(proven);
162
- if (publicInputs.previousArchive.root.toString() !== blockLog.archive) {
175
+ // Check the archive for the immediate checkpoint before the epoch
176
+ const checkpointLog = await this.rollupContract.getCheckpoint(CheckpointNumber(fromCheckpoint - 1));
177
+ if (!publicInputs.previousArchiveRoot.equals(checkpointLog.archive)) {
163
178
  throw new Error(
164
- `Previous archive root mismatch: ${publicInputs.previousArchive.root.toString()} !== ${blockLog.archive}`,
179
+ `Previous archive root mismatch: ${publicInputs.previousArchiveRoot.toString()} !== ${checkpointLog.archive.toString()}`,
165
180
  );
166
181
  }
167
- // TODO: Remove zero check once we inject the proper zero blockhash
168
- if (blockLog.blockHash !== Fr.ZERO.toString() && publicInputs.previousBlockHash.toString() !== blockLog.blockHash) {
182
+
183
+ // Check the archive for the last checkpoint in the epoch
184
+ const endCheckpointLog = await this.rollupContract.getCheckpoint(toCheckpoint);
185
+ if (!publicInputs.endArchiveRoot.equals(endCheckpointLog.archive)) {
169
186
  throw new Error(
170
- `Previous block hash mismatch: ${publicInputs.previousBlockHash.toString()} !== ${blockLog.blockHash}`,
187
+ `End archive root mismatch: ${publicInputs.endArchiveRoot.toString()} !== ${endCheckpointLog.archive.toString()}`,
171
188
  );
172
189
  }
173
190
 
174
- // Check the block hash and archive for the last block in the epoch
175
- const endBlockLog = await this.rollupContract.getBlock(BigInt(toBlock));
176
- if (publicInputs.endArchive.root.toString() !== endBlockLog.archive) {
191
+ // Check the batched blob inputs from the root rollup against the batched blob computed in ts
192
+ const finalBlobAccumulator = batchedBlobInputs.toFinalBlobAccumulator();
193
+ if (!publicInputs.blobPublicInputs.equals(finalBlobAccumulator)) {
177
194
  throw new Error(
178
- `End archive root mismatch: ${publicInputs.endArchive.root.toString()} !== ${endBlockLog.archive}`,
195
+ `Batched blob mismatch: ${inspect(publicInputs.blobPublicInputs)} !== ${inspect(finalBlobAccumulator)}`,
179
196
  );
180
197
  }
181
- if (publicInputs.endBlockHash.toString() !== endBlockLog.blockHash) {
182
- throw new Error(`End block hash mismatch: ${publicInputs.endBlockHash.toString()} !== ${endBlockLog.blockHash}`);
183
- }
184
198
 
185
199
  // Compare the public inputs computed by the contract with the ones injected
186
- const rollupPublicInputs = await this.rollupContract.getEpochProofPublicInputs(this.getSubmitEpochProofArgs(args));
187
- const aggregationObject = proof.isEmpty()
188
- ? times(AGGREGATION_OBJECT_LENGTH, Fr.zero)
189
- : proof.extractAggregationObject();
190
- const argsPublicInputs = [...publicInputs.toFields(), ...aggregationObject];
200
+ const rollupPublicInputs = await this.rollupContract.getEpochProofPublicInputs(
201
+ this.getEpochProofPublicInputsArgs(args),
202
+ );
203
+ const argsPublicInputs = [...publicInputs.toFields()];
191
204
 
192
- if (!areArraysEqual(rollupPublicInputs.map(Fr.fromHexString), argsPublicInputs, (a, b) => a.equals(b))) {
205
+ if (!areArraysEqual(rollupPublicInputs, argsPublicInputs, (a, b) => a.equals(b))) {
193
206
  const fmt = (inputs: Fr[] | readonly string[]) => inputs.map(x => x.toString()).join(', ');
194
207
  throw new Error(
195
208
  `Root rollup public inputs mismatch:\nRollup: ${fmt(rollupPublicInputs)}\nComputed:${fmt(argsPublicInputs)}`,
@@ -198,89 +211,96 @@ export class ProverNodePublisher {
198
211
  }
199
212
 
200
213
  private async sendSubmitEpochProofTx(args: {
201
- fromBlock: number;
202
- toBlock: number;
214
+ fromCheckpoint: CheckpointNumber;
215
+ toCheckpoint: CheckpointNumber;
203
216
  publicInputs: RootRollupPublicInputs;
204
217
  proof: Proof;
218
+ batchedBlobInputs: BatchedBlob;
219
+ attestations: ViemCommitteeAttestation[];
205
220
  }): Promise<TransactionReceipt | undefined> {
206
- const proofHex: Hex = `0x${args.proof.withoutPublicInputs().toString('hex')}`;
207
- const argsArray = this.getSubmitEpochProofArgs(args);
208
-
209
- const txArgs = [
210
- {
211
- start: argsArray[0],
212
- end: argsArray[1],
213
- args: argsArray[2],
214
- fees: argsArray[3],
215
- blobPublicInputs: argsArray[4],
216
- aggregationObject: argsArray[5],
217
- proof: proofHex,
218
- },
219
- ] as const;
221
+ const txArgs = [this.getSubmitEpochProofArgs(args)] as const;
220
222
 
221
- this.log.info(`SubmitEpochProof proofSize=${args.proof.withoutPublicInputs().length} bytes`);
223
+ this.log.info(`Submitting epoch proof to L1 rollup contract`, {
224
+ proofSize: args.proof.withoutPublicInputs().length,
225
+ fromCheckpoint: args.fromCheckpoint,
226
+ toCheckpoint: args.toCheckpoint,
227
+ });
222
228
  const data = encodeFunctionData({
223
229
  abi: RollupAbi,
224
230
  functionName: 'submitEpochRootProof',
225
231
  args: txArgs,
226
232
  });
227
233
  try {
228
- const { receipt } = await this.l1TxUtils.sendAndMonitorTransaction({
229
- to: this.rollupContract.address,
230
- data,
231
- });
232
-
234
+ const { receipt } = await this.l1TxUtils.sendAndMonitorTransaction({ to: this.rollupContract.address, data });
235
+ if (receipt.status !== 'success') {
236
+ const errorMsg = await this.l1TxUtils.tryGetErrorFromRevertedTx(
237
+ data,
238
+ {
239
+ args: [...txArgs],
240
+ functionName: 'submitEpochRootProof',
241
+ abi: RollupAbi,
242
+ address: this.rollupContract.address,
243
+ },
244
+ /*blobInputs*/ undefined,
245
+ /*stateOverride*/ [],
246
+ );
247
+ this.log.error(`Rollup submit epoch proof tx reverted with ${errorMsg ?? 'unknown error'}`);
248
+ return undefined;
249
+ }
233
250
  return receipt;
234
251
  } catch (err) {
235
252
  this.log.error(`Rollup submit epoch proof failed`, err);
236
- const errorMsg = await this.l1TxUtils.tryGetErrorFromRevertedTx(
237
- data,
238
- {
239
- args: [...txArgs],
240
- functionName: 'submitEpochRootProof',
241
- abi: RollupAbi,
242
- address: this.rollupContract.address,
243
- },
244
- /*blobInputs*/ undefined,
245
- /*stateOverride*/ [],
246
- );
247
- this.log.error(`Rollup submit epoch proof tx reverted. ${errorMsg}`);
248
253
  return undefined;
249
254
  }
250
255
  }
251
256
 
252
- private getSubmitEpochProofArgs(args: {
253
- fromBlock: number;
254
- toBlock: number;
257
+ private getEpochProofPublicInputsArgs(args: {
258
+ fromCheckpoint: CheckpointNumber;
259
+ toCheckpoint: CheckpointNumber;
255
260
  publicInputs: RootRollupPublicInputs;
256
- proof: Proof;
261
+ batchedBlobInputs: BatchedBlob;
262
+ attestations: ViemCommitteeAttestation[];
257
263
  }) {
264
+ // Returns arguments for EpochProofLib.sol -> getEpochProofPublicInputs()
258
265
  return [
259
- BigInt(args.fromBlock),
260
- BigInt(args.toBlock),
266
+ BigInt(args.fromCheckpoint) /*_start*/,
267
+ BigInt(args.toCheckpoint) /*_end*/,
261
268
  {
262
- previousArchive: args.publicInputs.previousArchive.root.toString(),
263
- endArchive: args.publicInputs.endArchive.root.toString(),
264
- previousBlockHash: args.publicInputs.previousBlockHash.toString(),
265
- endBlockHash: args.publicInputs.endBlockHash.toString(),
266
- endTimestamp: args.publicInputs.endTimestamp.toBigInt(),
269
+ previousArchive: args.publicInputs.previousArchiveRoot.toString(),
270
+ endArchive: args.publicInputs.endArchiveRoot.toString(),
267
271
  outHash: args.publicInputs.outHash.toString(),
268
- proverId: EthAddress.fromField(args.publicInputs.proverId).toString(),
269
- },
272
+ proverId: EthAddress.fromField(args.publicInputs.constants.proverId).toString(),
273
+ } /*_args*/,
270
274
  makeTuple(AZTEC_MAX_EPOCH_DURATION * 2, i =>
271
275
  i % 2 === 0
272
276
  ? args.publicInputs.fees[i / 2].recipient.toField().toString()
273
277
  : args.publicInputs.fees[(i - 1) / 2].value.toString(),
274
- ),
275
- `0x${args.publicInputs.blobPublicInputs
276
- .filter((_, i) => i < args.toBlock - args.fromBlock + 1)
277
- .map(b => b.toString())
278
- .join(``)}`,
279
- `0x${serializeToBuffer(args.proof.extractAggregationObject()).toString('hex')}`,
278
+ ) /*_fees*/,
279
+ getEthBlobEvaluationInputs(args.batchedBlobInputs) /*_blobPublicInputs*/,
280
280
  ] as const;
281
281
  }
282
282
 
283
- protected async sleepOrInterrupted() {
284
- await this.interruptibleSleep.sleep(this.sleepTimeMs);
283
+ private getSubmitEpochProofArgs(args: {
284
+ fromCheckpoint: CheckpointNumber;
285
+ toCheckpoint: CheckpointNumber;
286
+ publicInputs: RootRollupPublicInputs;
287
+ proof: Proof;
288
+ batchedBlobInputs: BatchedBlob;
289
+ attestations: ViemCommitteeAttestation[];
290
+ }) {
291
+ // Returns arguments for EpochProofLib.sol -> submitEpochRootProof()
292
+ const proofHex: Hex = `0x${args.proof.withoutPublicInputs().toString('hex')}`;
293
+ const argsArray = this.getEpochProofPublicInputsArgs(args);
294
+ return {
295
+ start: argsArray[0],
296
+ end: argsArray[1],
297
+ args: argsArray[2],
298
+ fees: argsArray[3],
299
+ attestations: new CommitteeAttestationsAndSigners(
300
+ args.attestations.map(a => CommitteeAttestation.fromViem(a)),
301
+ ).getPackedAttestations(),
302
+ blobInputs: argsArray[4],
303
+ proof: proofHex,
304
+ };
285
305
  }
286
306
  }