@aztec/prover-node 0.0.0-test.0 → 0.0.1-commit.001888fc
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.
- package/dest/actions/download-epoch-proving-job.d.ts +18 -0
- package/dest/actions/download-epoch-proving-job.d.ts.map +1 -0
- package/dest/actions/download-epoch-proving-job.js +37 -0
- package/dest/actions/index.d.ts +3 -0
- package/dest/actions/index.d.ts.map +1 -0
- package/dest/actions/index.js +2 -0
- package/dest/actions/rerun-epoch-proving-job.d.ts +12 -0
- package/dest/actions/rerun-epoch-proving-job.d.ts.map +1 -0
- package/dest/actions/rerun-epoch-proving-job.js +40 -0
- package/dest/actions/upload-epoch-proof-failure.d.ts +15 -0
- package/dest/actions/upload-epoch-proof-failure.d.ts.map +1 -0
- package/dest/actions/upload-epoch-proof-failure.js +78 -0
- package/dest/bin/run-failed-epoch.d.ts +2 -0
- package/dest/bin/run-failed-epoch.d.ts.map +1 -0
- package/dest/bin/run-failed-epoch.js +70 -0
- package/dest/config.d.ts +17 -16
- package/dest/config.d.ts.map +1 -1
- package/dest/config.js +93 -28
- package/dest/factory.d.ts +26 -18
- package/dest/factory.d.ts.map +1 -1
- package/dest/factory.js +72 -42
- package/dest/index.d.ts +3 -2
- package/dest/index.d.ts.map +1 -1
- package/dest/index.js +2 -1
- package/dest/job/epoch-proving-job-data.d.ts +18 -0
- package/dest/job/epoch-proving-job-data.d.ts.map +1 -0
- package/dest/job/epoch-proving-job-data.js +59 -0
- package/dest/job/epoch-proving-job.d.ts +27 -18
- package/dest/job/epoch-proving-job.d.ts.map +1 -1
- package/dest/job/epoch-proving-job.js +604 -97
- package/dest/metrics.d.ts +40 -5
- package/dest/metrics.d.ts.map +1 -1
- package/dest/metrics.js +136 -73
- package/dest/monitors/epoch-monitor.d.ts +5 -2
- package/dest/monitors/epoch-monitor.d.ts.map +1 -1
- package/dest/monitors/epoch-monitor.js +18 -15
- package/dest/monitors/index.d.ts +1 -1
- package/dest/prover-node-publisher.d.ts +19 -19
- package/dest/prover-node-publisher.d.ts.map +1 -1
- package/dest/prover-node-publisher.js +90 -84
- package/dest/prover-node.d.ts +61 -46
- package/dest/prover-node.d.ts.map +1 -1
- package/dest/prover-node.js +592 -135
- package/dest/prover-publisher-factory.d.ts +25 -0
- package/dest/prover-publisher-factory.d.ts.map +1 -0
- package/dest/prover-publisher-factory.js +28 -0
- package/dest/test/index.d.ts +5 -3
- package/dest/test/index.d.ts.map +1 -1
- package/dest/test/index.js +1 -3
- package/package.json +40 -33
- package/src/actions/download-epoch-proving-job.ts +44 -0
- package/src/actions/index.ts +2 -0
- package/src/actions/rerun-epoch-proving-job.ts +63 -0
- package/src/actions/upload-epoch-proof-failure.ts +88 -0
- package/src/bin/run-failed-epoch.ts +80 -0
- package/src/config.ts +123 -45
- package/src/factory.ts +146 -66
- package/src/index.ts +2 -1
- package/src/job/epoch-proving-job-data.ts +82 -0
- package/src/job/epoch-proving-job.ts +295 -85
- package/src/metrics.ts +153 -72
- package/src/monitors/epoch-monitor.ts +21 -17
- package/src/prover-node-publisher.ts +139 -119
- package/src/prover-node.ts +238 -149
- package/src/prover-publisher-factory.ts +45 -0
- package/src/test/index.ts +7 -4
- package/dest/http.d.ts +0 -8
- package/dest/http.d.ts.map +0 -1
- package/dest/http.js +0 -9
- package/dest/prover-coordination/config.d.ts +0 -7
- package/dest/prover-coordination/config.d.ts.map +0 -1
- package/dest/prover-coordination/config.js +0 -11
- package/dest/prover-coordination/factory.d.ts +0 -22
- package/dest/prover-coordination/factory.d.ts.map +0 -1
- package/dest/prover-coordination/factory.js +0 -42
- package/dest/prover-coordination/index.d.ts +0 -3
- package/dest/prover-coordination/index.d.ts.map +0 -1
- package/dest/prover-coordination/index.js +0 -2
- package/src/http.ts +0 -13
- package/src/prover-coordination/config.ts +0 -17
- package/src/prover-coordination/factory.ts +0 -72
- package/src/prover-coordination/index.ts +0 -2
|
@@ -1,48 +1,45 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import
|
|
1
|
+
import { BatchedBlob, getEthBlobEvaluationInputs } from '@aztec/blob-lib';
|
|
2
|
+
import { MAX_CHECKPOINTS_PER_EPOCH } 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 {
|
|
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 {
|
|
7
|
-
import {
|
|
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 {
|
|
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;
|
|
35
|
-
fees: Tuple<FeeRecipient, typeof
|
|
34
|
+
fees: Tuple<FeeRecipient, typeof MAX_CHECKPOINTS_PER_EPOCH>;
|
|
36
35
|
proof: Proof;
|
|
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:
|
|
40
|
+
private metrics: ProverNodePublisherMetrics;
|
|
44
41
|
|
|
45
|
-
protected log
|
|
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
|
|
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.
|
|
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
|
|
88
|
+
return this.l1TxUtils.getSenderAddress();
|
|
87
89
|
}
|
|
88
90
|
|
|
89
91
|
public async submitEpochProof(args: {
|
|
90
|
-
epochNumber:
|
|
91
|
-
|
|
92
|
-
|
|
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,
|
|
97
|
-
const ctx = { epochNumber,
|
|
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(
|
|
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
|
|
136
|
-
await this.sleepOrInterrupted();
|
|
143
|
+
this.log.error(`Rollup submitEpochProof tx reverted ${txReceipt.transactionHash}`, undefined, ctx);
|
|
137
144
|
}
|
|
138
145
|
|
|
139
|
-
this.log.verbose('
|
|
146
|
+
this.log.verbose('Checkpoint data syncing interrupted', ctx);
|
|
140
147
|
return false;
|
|
141
148
|
}
|
|
142
149
|
|
|
143
150
|
private async validateEpochProofSubmission(args: {
|
|
144
|
-
|
|
145
|
-
|
|
151
|
+
fromCheckpoint: CheckpointNumber;
|
|
152
|
+
toCheckpoint: CheckpointNumber;
|
|
146
153
|
publicInputs: RootRollupPublicInputs;
|
|
147
154
|
proof: Proof;
|
|
155
|
+
batchedBlobInputs: BatchedBlob;
|
|
156
|
+
attestations: ViemCommitteeAttestation[];
|
|
148
157
|
}) {
|
|
149
|
-
const {
|
|
158
|
+
const { fromCheckpoint, toCheckpoint, publicInputs, batchedBlobInputs } = args;
|
|
150
159
|
|
|
151
|
-
// Check that the
|
|
152
|
-
const {
|
|
153
|
-
if
|
|
154
|
-
|
|
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
|
-
|
|
157
|
-
|
|
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
|
|
161
|
-
const
|
|
162
|
-
if (publicInputs.
|
|
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.
|
|
179
|
+
`Previous archive root mismatch: ${publicInputs.previousArchiveRoot.toString()} !== ${checkpointLog.archive.toString()}`,
|
|
165
180
|
);
|
|
166
181
|
}
|
|
167
|
-
|
|
168
|
-
|
|
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
|
-
`
|
|
187
|
+
`End archive root mismatch: ${publicInputs.endArchiveRoot.toString()} !== ${endCheckpointLog.archive.toString()}`,
|
|
171
188
|
);
|
|
172
189
|
}
|
|
173
190
|
|
|
174
|
-
// Check the
|
|
175
|
-
const
|
|
176
|
-
if (publicInputs.
|
|
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
|
-
`
|
|
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(
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
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
|
|
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
|
-
|
|
202
|
-
|
|
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
|
|
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(`
|
|
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
|
-
|
|
230
|
-
|
|
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
|
|
253
|
-
|
|
254
|
-
|
|
257
|
+
private getEpochProofPublicInputsArgs(args: {
|
|
258
|
+
fromCheckpoint: CheckpointNumber;
|
|
259
|
+
toCheckpoint: CheckpointNumber;
|
|
255
260
|
publicInputs: RootRollupPublicInputs;
|
|
256
|
-
|
|
261
|
+
batchedBlobInputs: BatchedBlob;
|
|
262
|
+
attestations: ViemCommitteeAttestation[];
|
|
257
263
|
}) {
|
|
264
|
+
// Returns arguments for EpochProofLib.sol -> getEpochProofPublicInputs()
|
|
258
265
|
return [
|
|
259
|
-
BigInt(args.
|
|
260
|
-
BigInt(args.
|
|
266
|
+
BigInt(args.fromCheckpoint) /*_start*/,
|
|
267
|
+
BigInt(args.toCheckpoint) /*_end*/,
|
|
261
268
|
{
|
|
262
|
-
previousArchive: args.publicInputs.
|
|
263
|
-
endArchive: args.publicInputs.
|
|
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
|
-
}
|
|
270
|
-
makeTuple(
|
|
272
|
+
proverId: EthAddress.fromField(args.publicInputs.constants.proverId).toString(),
|
|
273
|
+
} /*_args*/,
|
|
274
|
+
makeTuple(MAX_CHECKPOINTS_PER_EPOCH * 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
|
-
|
|
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
|
-
|
|
284
|
-
|
|
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
|
}
|