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