@aztec/prover-node 0.0.0-test.1 → 0.0.1-commit.21caa21
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 +13 -10
- package/dest/config.d.ts.map +1 -1
- package/dest/config.js +81 -14
- package/dest/factory.d.ts +13 -9
- package/dest/factory.d.ts.map +1 -1
- package/dest/factory.js +95 -31
- package/dest/index.d.ts +2 -2
- package/dest/index.d.ts.map +1 -1
- package/dest/index.js +1 -1
- package/dest/job/epoch-proving-job-data.d.ts +17 -0
- package/dest/job/epoch-proving-job-data.d.ts.map +1 -0
- package/dest/job/epoch-proving-job-data.js +53 -0
- package/dest/job/epoch-proving-job.d.ts +25 -17
- package/dest/job/epoch-proving-job.d.ts.map +1 -1
- package/dest/job/epoch-proving-job.js +155 -51
- package/dest/metrics.d.ts +29 -5
- package/dest/metrics.d.ts.map +1 -1
- package/dest/metrics.js +141 -35
- 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 +15 -2
- package/dest/monitors/index.d.ts +1 -1
- package/dest/prover-node-publisher.d.ts +10 -12
- package/dest/prover-node-publisher.d.ts.map +1 -1
- package/dest/prover-node-publisher.js +62 -62
- package/dest/prover-node.d.ts +48 -43
- package/dest/prover-node.d.ts.map +1 -1
- package/dest/prover-node.js +175 -105
- package/dest/prover-publisher-factory.d.ts +21 -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 +108 -24
- package/src/factory.ts +163 -43
- package/src/index.ts +1 -1
- package/src/job/epoch-proving-job-data.ts +77 -0
- package/src/job/epoch-proving-job.ts +222 -52
- package/src/metrics.ts +135 -37
- package/src/monitors/epoch-monitor.ts +18 -6
- package/src/prover-node-publisher.ts +96 -88
- package/src/prover-node.ts +213 -136
- package/src/prover-publisher-factory.ts +37 -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,5 +1,7 @@
|
|
|
1
|
+
import { EpochNumber } from '@aztec/foundation/branded-types';
|
|
1
2
|
import { createLogger } from '@aztec/foundation/log';
|
|
2
3
|
import { RunningPromise } from '@aztec/foundation/running-promise';
|
|
4
|
+
import { sleep } from '@aztec/foundation/sleep';
|
|
3
5
|
import type { L2BlockSource } from '@aztec/stdlib/block';
|
|
4
6
|
import { type L1RollupConstants, getEpochAtSlot } from '@aztec/stdlib/epoch-helpers';
|
|
5
7
|
import {
|
|
@@ -11,7 +13,7 @@ import {
|
|
|
11
13
|
} from '@aztec/telemetry-client';
|
|
12
14
|
|
|
13
15
|
export interface EpochMonitorHandler {
|
|
14
|
-
handleEpochReadyToProve(epochNumber:
|
|
16
|
+
handleEpochReadyToProve(epochNumber: EpochNumber): Promise<boolean>;
|
|
15
17
|
}
|
|
16
18
|
|
|
17
19
|
/**
|
|
@@ -31,21 +33,24 @@ export class EpochMonitor implements Traceable {
|
|
|
31
33
|
public readonly tracer: Tracer;
|
|
32
34
|
|
|
33
35
|
private handler: EpochMonitorHandler | undefined;
|
|
34
|
-
private latestEpochNumber:
|
|
36
|
+
private latestEpochNumber: EpochNumber | undefined;
|
|
35
37
|
|
|
36
38
|
constructor(
|
|
37
39
|
private readonly l2BlockSource: L2BlockSource,
|
|
38
40
|
private readonly l1Constants: Pick<L1RollupConstants, 'epochDuration'>,
|
|
39
|
-
private options: { pollingIntervalMs: number },
|
|
41
|
+
private options: { pollingIntervalMs: number; provingDelayMs?: number },
|
|
40
42
|
telemetry: TelemetryClient = getTelemetryClient(),
|
|
41
43
|
) {
|
|
42
44
|
this.tracer = telemetry.getTracer('EpochMonitor');
|
|
43
45
|
this.runningPromise = new RunningPromise(this.work.bind(this), this.log, this.options.pollingIntervalMs);
|
|
46
|
+
if (this.options.provingDelayMs) {
|
|
47
|
+
this.log.warn(`Prover node epoch monitor running with delay of ${this.options.provingDelayMs}ms`);
|
|
48
|
+
}
|
|
44
49
|
}
|
|
45
50
|
|
|
46
51
|
public static async create(
|
|
47
52
|
l2BlockSource: L2BlockSource,
|
|
48
|
-
options: { pollingIntervalMs: number },
|
|
53
|
+
options: { pollingIntervalMs: number; provingDelayMs?: number },
|
|
49
54
|
telemetry: TelemetryClient = getTelemetryClient(),
|
|
50
55
|
): Promise<EpochMonitor> {
|
|
51
56
|
const l1Constants = await l2BlockSource.getL1Constants();
|
|
@@ -71,6 +76,7 @@ export class EpochMonitor implements Traceable {
|
|
|
71
76
|
@trackSpan('EpochMonitor.work')
|
|
72
77
|
public async work() {
|
|
73
78
|
const { epochToProve, blockNumber, slotNumber } = await this.getEpochNumberToProve();
|
|
79
|
+
this.log.debug(`Epoch to prove: ${epochToProve}`, { blockNumber, slotNumber });
|
|
74
80
|
if (epochToProve === undefined) {
|
|
75
81
|
this.log.trace(`Next block to prove ${blockNumber} not yet mined`, { blockNumber });
|
|
76
82
|
return;
|
|
@@ -86,9 +92,15 @@ export class EpochMonitor implements Traceable {
|
|
|
86
92
|
return;
|
|
87
93
|
}
|
|
88
94
|
|
|
95
|
+
if (this.options.provingDelayMs) {
|
|
96
|
+
this.log.debug(`Waiting ${this.options.provingDelayMs}ms before proving epoch ${epochToProve}`);
|
|
97
|
+
await sleep(this.options.provingDelayMs);
|
|
98
|
+
}
|
|
99
|
+
|
|
89
100
|
this.log.debug(`Epoch ${epochToProve} is ready to be proven`);
|
|
90
|
-
await this.handler?.handleEpochReadyToProve(epochToProve)
|
|
91
|
-
|
|
101
|
+
if (await this.handler?.handleEpochReadyToProve(epochToProve)) {
|
|
102
|
+
this.latestEpochNumber = epochToProve;
|
|
103
|
+
}
|
|
92
104
|
}
|
|
93
105
|
|
|
94
106
|
private async getEpochNumberToProve() {
|
|
@@ -1,34 +1,32 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import
|
|
1
|
+
import { BatchedBlob, getEthBlobEvaluationInputs } from '@aztec/blob-lib';
|
|
2
|
+
import { AZTEC_MAX_EPOCH_DURATION } from '@aztec/constants';
|
|
3
|
+
import type { L1TxUtils, RollupContract, ViemCommitteeAttestation } from '@aztec/ethereum';
|
|
3
4
|
import { makeTuple } from '@aztec/foundation/array';
|
|
4
|
-
import {
|
|
5
|
+
import { EpochNumber } from '@aztec/foundation/branded-types';
|
|
6
|
+
import { areArraysEqual } from '@aztec/foundation/collection';
|
|
5
7
|
import { EthAddress } from '@aztec/foundation/eth-address';
|
|
6
8
|
import { Fr } from '@aztec/foundation/fields';
|
|
7
9
|
import { createLogger } from '@aztec/foundation/log';
|
|
8
|
-
import {
|
|
9
|
-
import { InterruptibleSleep } from '@aztec/foundation/sleep';
|
|
10
|
+
import type { Tuple } from '@aztec/foundation/serialize';
|
|
10
11
|
import { Timer } from '@aztec/foundation/timer';
|
|
11
12
|
import { RollupAbi } from '@aztec/l1-artifacts';
|
|
12
13
|
import type { PublisherConfig, TxSenderConfig } from '@aztec/sequencer-client';
|
|
14
|
+
import { CommitteeAttestation, CommitteeAttestationsAndSigners } from '@aztec/stdlib/block';
|
|
13
15
|
import type { Proof } from '@aztec/stdlib/proofs';
|
|
14
16
|
import type { FeeRecipient, RootRollupPublicInputs } from '@aztec/stdlib/rollup';
|
|
15
17
|
import type { L1PublishProofStats } from '@aztec/stdlib/stats';
|
|
16
18
|
import { type TelemetryClient, getTelemetryClient } from '@aztec/telemetry-client';
|
|
17
19
|
|
|
20
|
+
import { inspect } from 'util';
|
|
18
21
|
import { type Hex, type TransactionReceipt, encodeFunctionData } from 'viem';
|
|
19
22
|
|
|
20
|
-
import {
|
|
23
|
+
import { ProverNodePublisherMetrics } from './metrics.js';
|
|
21
24
|
|
|
22
|
-
/**
|
|
23
|
-
* Stats for a sent transaction.
|
|
24
|
-
*/
|
|
25
25
|
/** Arguments to the submitEpochProof method of the rollup contract */
|
|
26
26
|
export type L1SubmitEpochProofArgs = {
|
|
27
27
|
epochSize: number;
|
|
28
28
|
previousArchive: Fr;
|
|
29
29
|
endArchive: Fr;
|
|
30
|
-
previousBlockHash: Fr;
|
|
31
|
-
endBlockHash: Fr;
|
|
32
30
|
endTimestamp: Fr;
|
|
33
31
|
outHash: Fr;
|
|
34
32
|
proverId: Fr;
|
|
@@ -37,10 +35,8 @@ export type L1SubmitEpochProofArgs = {
|
|
|
37
35
|
};
|
|
38
36
|
|
|
39
37
|
export class ProverNodePublisher {
|
|
40
|
-
private interruptibleSleep = new InterruptibleSleep();
|
|
41
|
-
private sleepTimeMs: number;
|
|
42
38
|
private interrupted = false;
|
|
43
|
-
private metrics:
|
|
39
|
+
private metrics: ProverNodePublisherMetrics;
|
|
44
40
|
|
|
45
41
|
protected log = createLogger('prover-node:l1-tx-publisher');
|
|
46
42
|
|
|
@@ -56,16 +52,18 @@ export class ProverNodePublisher {
|
|
|
56
52
|
telemetry?: TelemetryClient;
|
|
57
53
|
},
|
|
58
54
|
) {
|
|
59
|
-
this.sleepTimeMs = config?.l1PublishRetryIntervalMS ?? 60_000;
|
|
60
|
-
|
|
61
55
|
const telemetry = deps.telemetry ?? getTelemetryClient();
|
|
62
56
|
|
|
63
|
-
this.metrics = new
|
|
57
|
+
this.metrics = new ProverNodePublisherMetrics(telemetry, 'ProverNode');
|
|
64
58
|
|
|
65
59
|
this.rollupContract = deps.rollupContract;
|
|
66
60
|
this.l1TxUtils = deps.l1TxUtils;
|
|
67
61
|
}
|
|
68
62
|
|
|
63
|
+
public getRollupContract() {
|
|
64
|
+
return this.rollupContract;
|
|
65
|
+
}
|
|
66
|
+
|
|
69
67
|
/**
|
|
70
68
|
* Calling `interrupt` will cause any in progress call to `publishRollup` to return `false` asap.
|
|
71
69
|
* Be warned, the call may return false even if the tx subsequently gets successfully mined.
|
|
@@ -74,30 +72,33 @@ export class ProverNodePublisher {
|
|
|
74
72
|
*/
|
|
75
73
|
public interrupt() {
|
|
76
74
|
this.interrupted = true;
|
|
77
|
-
this.
|
|
75
|
+
this.l1TxUtils.interrupt();
|
|
78
76
|
}
|
|
79
77
|
|
|
80
78
|
/** Restarts the publisher after calling `interrupt`. */
|
|
81
79
|
public restart() {
|
|
82
80
|
this.interrupted = false;
|
|
81
|
+
this.l1TxUtils.restart();
|
|
83
82
|
}
|
|
84
83
|
|
|
85
84
|
public getSenderAddress() {
|
|
86
|
-
return
|
|
85
|
+
return this.l1TxUtils.getSenderAddress();
|
|
87
86
|
}
|
|
88
87
|
|
|
89
88
|
public async submitEpochProof(args: {
|
|
90
|
-
epochNumber:
|
|
89
|
+
epochNumber: EpochNumber;
|
|
91
90
|
fromBlock: number;
|
|
92
91
|
toBlock: number;
|
|
93
92
|
publicInputs: RootRollupPublicInputs;
|
|
94
93
|
proof: Proof;
|
|
94
|
+
batchedBlobInputs: BatchedBlob;
|
|
95
|
+
attestations: ViemCommitteeAttestation[];
|
|
95
96
|
}): Promise<boolean> {
|
|
96
97
|
const { epochNumber, fromBlock, toBlock } = args;
|
|
97
98
|
const ctx = { epochNumber, fromBlock, toBlock };
|
|
99
|
+
|
|
98
100
|
if (!this.interrupted) {
|
|
99
101
|
const timer = new Timer();
|
|
100
|
-
|
|
101
102
|
// Validate epoch proof range and hashes are correct before submitting
|
|
102
103
|
await this.validateEpochProofSubmission(args);
|
|
103
104
|
|
|
@@ -107,13 +108,16 @@ export class ProverNodePublisher {
|
|
|
107
108
|
}
|
|
108
109
|
|
|
109
110
|
try {
|
|
110
|
-
this.metrics.recordSenderBalance(
|
|
111
|
+
this.metrics.recordSenderBalance(
|
|
112
|
+
await this.l1TxUtils.getSenderBalance(),
|
|
113
|
+
this.l1TxUtils.getSenderAddress().toString(),
|
|
114
|
+
);
|
|
111
115
|
} catch (err) {
|
|
112
116
|
this.log.warn(`Failed to record the ETH balance of the prover node: ${err}`);
|
|
113
117
|
}
|
|
114
118
|
|
|
115
119
|
// Tx was mined successfully
|
|
116
|
-
if (txReceipt.status) {
|
|
120
|
+
if (txReceipt.status === 'success') {
|
|
117
121
|
const tx = await this.l1TxUtils.getTransactionStats(txReceipt.transactionHash);
|
|
118
122
|
const stats: L1PublishProofStats = {
|
|
119
123
|
gasPrice: txReceipt.effectiveGasPrice,
|
|
@@ -132,11 +136,10 @@ export class ProverNodePublisher {
|
|
|
132
136
|
}
|
|
133
137
|
|
|
134
138
|
this.metrics.recordFailedTx();
|
|
135
|
-
this.log.error(`Rollup.submitEpochProof tx status failed
|
|
136
|
-
await this.sleepOrInterrupted();
|
|
139
|
+
this.log.error(`Rollup.submitEpochProof tx status failed ${txReceipt.transactionHash}`, undefined, ctx);
|
|
137
140
|
}
|
|
138
141
|
|
|
139
|
-
this.log.verbose('L2 block data syncing interrupted
|
|
142
|
+
this.log.verbose('L2 block data syncing interrupted', ctx);
|
|
140
143
|
return false;
|
|
141
144
|
}
|
|
142
145
|
|
|
@@ -145,49 +148,51 @@ export class ProverNodePublisher {
|
|
|
145
148
|
toBlock: number;
|
|
146
149
|
publicInputs: RootRollupPublicInputs;
|
|
147
150
|
proof: Proof;
|
|
151
|
+
batchedBlobInputs: BatchedBlob;
|
|
152
|
+
attestations: ViemCommitteeAttestation[];
|
|
148
153
|
}) {
|
|
149
|
-
const { fromBlock, toBlock, publicInputs,
|
|
154
|
+
const { fromBlock, toBlock, publicInputs, batchedBlobInputs } = args;
|
|
150
155
|
|
|
151
156
|
// Check that the block numbers match the expected epoch to be proven
|
|
152
|
-
const {
|
|
153
|
-
if
|
|
157
|
+
const { pending, proven } = await this.rollupContract.getTips();
|
|
158
|
+
// Don't publish if proven is beyond our toBlock, pointless to do so
|
|
159
|
+
if (proven > BigInt(toBlock)) {
|
|
154
160
|
throw new Error(`Cannot submit epoch proof for ${fromBlock}-${toBlock} as proven block is ${proven}`);
|
|
155
161
|
}
|
|
162
|
+
// toBlock can't be greater than pending
|
|
156
163
|
if (toBlock > pending) {
|
|
157
164
|
throw new Error(`Cannot submit epoch proof for ${fromBlock}-${toBlock} as pending block is ${pending}`);
|
|
158
165
|
}
|
|
159
166
|
|
|
160
|
-
// Check the
|
|
161
|
-
const blockLog = await this.rollupContract.
|
|
162
|
-
if (publicInputs.
|
|
167
|
+
// Check the archive for the immediate block before the epoch
|
|
168
|
+
const blockLog = await this.rollupContract.getCheckpoint(BigInt(fromBlock - 1));
|
|
169
|
+
if (publicInputs.previousArchiveRoot.toString() !== blockLog.archive) {
|
|
163
170
|
throw new Error(
|
|
164
|
-
`Previous archive root mismatch: ${publicInputs.
|
|
171
|
+
`Previous archive root mismatch: ${publicInputs.previousArchiveRoot.toString()} !== ${blockLog.archive}`,
|
|
165
172
|
);
|
|
166
173
|
}
|
|
167
|
-
|
|
168
|
-
|
|
174
|
+
|
|
175
|
+
// Check the archive for the last block in the epoch
|
|
176
|
+
const endBlockLog = await this.rollupContract.getCheckpoint(BigInt(toBlock));
|
|
177
|
+
if (publicInputs.endArchiveRoot.toString() !== endBlockLog.archive) {
|
|
169
178
|
throw new Error(
|
|
170
|
-
`
|
|
179
|
+
`End archive root mismatch: ${publicInputs.endArchiveRoot.toString()} !== ${endBlockLog.archive}`,
|
|
171
180
|
);
|
|
172
181
|
}
|
|
173
182
|
|
|
174
|
-
// Check the
|
|
175
|
-
const
|
|
176
|
-
if (publicInputs.
|
|
183
|
+
// Check the batched blob inputs from the root rollup against the batched blob computed in ts
|
|
184
|
+
const finalBlobAccumulator = batchedBlobInputs.toFinalBlobAccumulator();
|
|
185
|
+
if (!publicInputs.blobPublicInputs.equals(finalBlobAccumulator)) {
|
|
177
186
|
throw new Error(
|
|
178
|
-
`
|
|
187
|
+
`Batched blob mismatch: ${inspect(publicInputs.blobPublicInputs)} !== ${inspect(finalBlobAccumulator)}`,
|
|
179
188
|
);
|
|
180
189
|
}
|
|
181
|
-
if (publicInputs.endBlockHash.toString() !== endBlockLog.blockHash) {
|
|
182
|
-
throw new Error(`End block hash mismatch: ${publicInputs.endBlockHash.toString()} !== ${endBlockLog.blockHash}`);
|
|
183
|
-
}
|
|
184
190
|
|
|
185
191
|
// 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];
|
|
192
|
+
const rollupPublicInputs = await this.rollupContract.getEpochProofPublicInputs(
|
|
193
|
+
this.getEpochProofPublicInputsArgs(args),
|
|
194
|
+
);
|
|
195
|
+
const argsPublicInputs = [...publicInputs.toFields()];
|
|
191
196
|
|
|
192
197
|
if (!areArraysEqual(rollupPublicInputs.map(Fr.fromHexString), argsPublicInputs, (a, b) => a.equals(b))) {
|
|
193
198
|
const fmt = (inputs: Fr[] | readonly string[]) => inputs.map(x => x.toString()).join(', ');
|
|
@@ -202,34 +207,23 @@ export class ProverNodePublisher {
|
|
|
202
207
|
toBlock: number;
|
|
203
208
|
publicInputs: RootRollupPublicInputs;
|
|
204
209
|
proof: Proof;
|
|
210
|
+
batchedBlobInputs: BatchedBlob;
|
|
211
|
+
attestations: ViemCommitteeAttestation[];
|
|
205
212
|
}): 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;
|
|
213
|
+
const txArgs = [this.getSubmitEpochProofArgs(args)] as const;
|
|
220
214
|
|
|
221
|
-
this.log.info(`
|
|
215
|
+
this.log.info(`Submitting epoch proof to L1 rollup contract`, {
|
|
216
|
+
proofSize: args.proof.withoutPublicInputs().length,
|
|
217
|
+
fromBlock: args.fromBlock,
|
|
218
|
+
toBlock: args.toBlock,
|
|
219
|
+
});
|
|
222
220
|
const data = encodeFunctionData({
|
|
223
221
|
abi: RollupAbi,
|
|
224
222
|
functionName: 'submitEpochRootProof',
|
|
225
223
|
args: txArgs,
|
|
226
224
|
});
|
|
227
225
|
try {
|
|
228
|
-
const { receipt } = await this.l1TxUtils.sendAndMonitorTransaction({
|
|
229
|
-
to: this.rollupContract.address,
|
|
230
|
-
data,
|
|
231
|
-
});
|
|
232
|
-
|
|
226
|
+
const { receipt } = await this.l1TxUtils.sendAndMonitorTransaction({ to: this.rollupContract.address, data });
|
|
233
227
|
return receipt;
|
|
234
228
|
} catch (err) {
|
|
235
229
|
this.log.error(`Rollup submit epoch proof failed`, err);
|
|
@@ -249,38 +243,52 @@ export class ProverNodePublisher {
|
|
|
249
243
|
}
|
|
250
244
|
}
|
|
251
245
|
|
|
252
|
-
private
|
|
246
|
+
private getEpochProofPublicInputsArgs(args: {
|
|
253
247
|
fromBlock: number;
|
|
254
248
|
toBlock: number;
|
|
255
249
|
publicInputs: RootRollupPublicInputs;
|
|
256
|
-
|
|
250
|
+
batchedBlobInputs: BatchedBlob;
|
|
251
|
+
attestations: ViemCommitteeAttestation[];
|
|
257
252
|
}) {
|
|
253
|
+
// Returns arguments for EpochProofLib.sol -> getEpochProofPublicInputs()
|
|
258
254
|
return [
|
|
259
|
-
BigInt(args.fromBlock)
|
|
260
|
-
BigInt(args.toBlock)
|
|
255
|
+
BigInt(args.fromBlock) /*_start*/,
|
|
256
|
+
BigInt(args.toBlock) /*_end*/,
|
|
261
257
|
{
|
|
262
|
-
previousArchive: args.publicInputs.
|
|
263
|
-
endArchive: args.publicInputs.
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
endTimestamp: args.publicInputs.endTimestamp.toBigInt(),
|
|
267
|
-
outHash: args.publicInputs.outHash.toString(),
|
|
268
|
-
proverId: EthAddress.fromField(args.publicInputs.proverId).toString(),
|
|
269
|
-
},
|
|
258
|
+
previousArchive: args.publicInputs.previousArchiveRoot.toString(),
|
|
259
|
+
endArchive: args.publicInputs.endArchiveRoot.toString(),
|
|
260
|
+
proverId: EthAddress.fromField(args.publicInputs.constants.proverId).toString(),
|
|
261
|
+
} /*_args*/,
|
|
270
262
|
makeTuple(AZTEC_MAX_EPOCH_DURATION * 2, i =>
|
|
271
263
|
i % 2 === 0
|
|
272
264
|
? args.publicInputs.fees[i / 2].recipient.toField().toString()
|
|
273
265
|
: 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')}`,
|
|
266
|
+
) /*_fees*/,
|
|
267
|
+
getEthBlobEvaluationInputs(args.batchedBlobInputs) /*_blobPublicInputs*/,
|
|
280
268
|
] as const;
|
|
281
269
|
}
|
|
282
270
|
|
|
283
|
-
|
|
284
|
-
|
|
271
|
+
private getSubmitEpochProofArgs(args: {
|
|
272
|
+
fromBlock: number;
|
|
273
|
+
toBlock: number;
|
|
274
|
+
publicInputs: RootRollupPublicInputs;
|
|
275
|
+
proof: Proof;
|
|
276
|
+
batchedBlobInputs: BatchedBlob;
|
|
277
|
+
attestations: ViemCommitteeAttestation[];
|
|
278
|
+
}) {
|
|
279
|
+
// Returns arguments for EpochProofLib.sol -> submitEpochRootProof()
|
|
280
|
+
const proofHex: Hex = `0x${args.proof.withoutPublicInputs().toString('hex')}`;
|
|
281
|
+
const argsArray = this.getEpochProofPublicInputsArgs(args);
|
|
282
|
+
return {
|
|
283
|
+
start: argsArray[0],
|
|
284
|
+
end: argsArray[1],
|
|
285
|
+
args: argsArray[2],
|
|
286
|
+
fees: argsArray[3],
|
|
287
|
+
attestations: new CommitteeAttestationsAndSigners(
|
|
288
|
+
args.attestations.map(a => CommitteeAttestation.fromViem(a)),
|
|
289
|
+
).getPackedAttestations(),
|
|
290
|
+
blobInputs: argsArray[4],
|
|
291
|
+
proof: proofHex,
|
|
292
|
+
};
|
|
285
293
|
}
|
|
286
294
|
}
|