@aztec/prover-node 0.0.1-commit.fffb133c → 0.0.1-dev
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/rerun-epoch-proving-job.d.ts +1 -1
- package/dest/actions/rerun-epoch-proving-job.d.ts.map +1 -1
- package/dest/actions/rerun-epoch-proving-job.js +3 -5
- package/dest/bin/run-failed-epoch.js +5 -2
- package/dest/config.d.ts +4 -7
- package/dest/config.d.ts.map +1 -1
- package/dest/config.js +15 -18
- package/dest/factory.d.ts +19 -13
- package/dest/factory.d.ts.map +1 -1
- package/dest/factory.js +20 -59
- package/dest/job/epoch-proving-job.d.ts +3 -2
- package/dest/job/epoch-proving-job.d.ts.map +1 -1
- package/dest/job/epoch-proving-job.js +38 -14
- package/dest/metrics.d.ts +11 -1
- package/dest/metrics.d.ts.map +1 -1
- package/dest/metrics.js +36 -3
- package/dest/monitors/epoch-monitor.d.ts +1 -1
- package/dest/monitors/epoch-monitor.d.ts.map +1 -1
- package/dest/monitors/epoch-monitor.js +5 -7
- package/dest/prover-node-publisher.d.ts +10 -5
- package/dest/prover-node-publisher.d.ts.map +1 -1
- package/dest/prover-node-publisher.js +47 -4
- package/dest/prover-node.d.ts +18 -8
- package/dest/prover-node.d.ts.map +1 -1
- package/dest/prover-node.js +16 -11
- package/dest/prover-publisher-factory.d.ts +6 -4
- package/dest/prover-publisher-factory.d.ts.map +1 -1
- package/dest/prover-publisher-factory.js +4 -2
- package/package.json +23 -22
- package/src/actions/rerun-epoch-proving-job.ts +3 -2
- package/src/bin/run-failed-epoch.ts +4 -1
- package/src/config.ts +22 -30
- package/src/factory.ts +51 -102
- package/src/job/epoch-proving-job.ts +55 -20
- package/src/metrics.ts +40 -2
- package/src/monitors/epoch-monitor.ts +3 -4
- package/src/prover-node-publisher.ts +61 -5
- package/src/prover-node.ts +18 -10
- package/src/prover-publisher-factory.ts +13 -7
package/src/metrics.ts
CHANGED
|
@@ -13,6 +13,7 @@ import {
|
|
|
13
13
|
type TelemetryClient,
|
|
14
14
|
type Tracer,
|
|
15
15
|
type UpDownCounter,
|
|
16
|
+
createUpDownCounterWithDefault,
|
|
16
17
|
} from '@aztec/telemetry-client';
|
|
17
18
|
|
|
18
19
|
import { formatEther, formatUnits } from 'viem';
|
|
@@ -24,6 +25,12 @@ export class ProverNodeJobMetrics {
|
|
|
24
25
|
provingJobBlocks: Gauge;
|
|
25
26
|
provingJobTransactions: Gauge;
|
|
26
27
|
|
|
28
|
+
private blobProcessingDuration: Gauge;
|
|
29
|
+
private chonkVerifierDuration: Gauge;
|
|
30
|
+
private blockProcessingDuration: Histogram;
|
|
31
|
+
private checkpointProcessingDuration: Histogram;
|
|
32
|
+
private allCheckpointsProcessingDuration: Gauge;
|
|
33
|
+
|
|
27
34
|
constructor(
|
|
28
35
|
private meter: Meter,
|
|
29
36
|
public readonly tracer: Tracer,
|
|
@@ -34,6 +41,14 @@ export class ProverNodeJobMetrics {
|
|
|
34
41
|
this.provingJobCheckpoints = this.meter.createGauge(Metrics.PROVER_NODE_JOB_CHECKPOINTS);
|
|
35
42
|
this.provingJobBlocks = this.meter.createGauge(Metrics.PROVER_NODE_JOB_BLOCKS);
|
|
36
43
|
this.provingJobTransactions = this.meter.createGauge(Metrics.PROVER_NODE_JOB_TRANSACTIONS);
|
|
44
|
+
|
|
45
|
+
this.blobProcessingDuration = this.meter.createGauge(Metrics.PROVER_NODE_BLOB_PROCESSING_LAST_DURATION);
|
|
46
|
+
this.chonkVerifierDuration = this.meter.createGauge(Metrics.PROVER_NODE_CHONK_VERIFIER_LAST_DURATION);
|
|
47
|
+
this.blockProcessingDuration = this.meter.createHistogram(Metrics.PROVER_NODE_BLOCK_PROCESSING_DURATION);
|
|
48
|
+
this.checkpointProcessingDuration = this.meter.createHistogram(Metrics.PROVER_NODE_CHECKPOINT_PROCESSING_DURATION);
|
|
49
|
+
this.allCheckpointsProcessingDuration = this.meter.createGauge(
|
|
50
|
+
Metrics.PROVER_NODE_ALL_CHECKPOINTS_PROCESSING_LAST_DURATION,
|
|
51
|
+
);
|
|
37
52
|
}
|
|
38
53
|
|
|
39
54
|
public recordProvingJob(
|
|
@@ -49,6 +64,26 @@ export class ProverNodeJobMetrics {
|
|
|
49
64
|
this.provingJobBlocks.record(Math.floor(numBlocks));
|
|
50
65
|
this.provingJobTransactions.record(Math.floor(numTxs));
|
|
51
66
|
}
|
|
67
|
+
|
|
68
|
+
public recordBlobProcessing(durationMs: number) {
|
|
69
|
+
this.blobProcessingDuration.record(Math.ceil(durationMs));
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
public recordChonkVerifier(durationMs: number) {
|
|
73
|
+
this.chonkVerifierDuration.record(Math.ceil(durationMs));
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
public recordBlockProcessing(durationMs: number) {
|
|
77
|
+
this.blockProcessingDuration.record(Math.ceil(durationMs));
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
public recordCheckpointProcessing(durationMs: number) {
|
|
81
|
+
this.checkpointProcessingDuration.record(Math.ceil(durationMs));
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
public recordAllCheckpointsProcessing(durationMs: number) {
|
|
85
|
+
this.allCheckpointsProcessingDuration.record(Math.ceil(durationMs));
|
|
86
|
+
}
|
|
52
87
|
}
|
|
53
88
|
|
|
54
89
|
export class ProverNodeRewardsMetrics {
|
|
@@ -65,7 +100,7 @@ export class ProverNodeRewardsMetrics {
|
|
|
65
100
|
) {
|
|
66
101
|
this.rewards = this.meter.createObservableGauge(Metrics.PROVER_NODE_REWARDS_PER_EPOCH);
|
|
67
102
|
|
|
68
|
-
this.accumulatedRewards = this.meter
|
|
103
|
+
this.accumulatedRewards = createUpDownCounterWithDefault(this.meter, Metrics.PROVER_NODE_REWARDS_TOTAL);
|
|
69
104
|
}
|
|
70
105
|
|
|
71
106
|
public async start() {
|
|
@@ -128,7 +163,10 @@ export class ProverNodePublisherMetrics {
|
|
|
128
163
|
|
|
129
164
|
this.gasPrice = this.meter.createHistogram(Metrics.L1_PUBLISHER_GAS_PRICE);
|
|
130
165
|
|
|
131
|
-
this.txCount = this.meter
|
|
166
|
+
this.txCount = createUpDownCounterWithDefault(this.meter, Metrics.L1_PUBLISHER_TX_COUNT, {
|
|
167
|
+
[Attributes.L1_TX_TYPE]: ['submitProof'],
|
|
168
|
+
[Attributes.OK]: [true, false],
|
|
169
|
+
});
|
|
132
170
|
|
|
133
171
|
this.txDuration = this.meter.createHistogram(Metrics.L1_PUBLISHER_TX_DURATION);
|
|
134
172
|
|
|
@@ -69,9 +69,8 @@ export class EpochMonitor implements Traceable {
|
|
|
69
69
|
|
|
70
70
|
public async work() {
|
|
71
71
|
const { epochToProve, blockNumber, slotNumber } = await this.getEpochNumberToProve();
|
|
72
|
-
this.log.debug(`Epoch to prove: ${epochToProve}`, { blockNumber, slotNumber });
|
|
73
72
|
if (epochToProve === undefined) {
|
|
74
|
-
this.log.trace(`Next block to prove ${blockNumber} not yet mined`, { blockNumber });
|
|
73
|
+
this.log.trace(`Next block to prove ${blockNumber} not yet mined`, { epochToProve, blockNumber, slotNumber });
|
|
75
74
|
return;
|
|
76
75
|
}
|
|
77
76
|
if (this.latestEpochNumber !== undefined && epochToProve <= this.latestEpochNumber) {
|
|
@@ -86,11 +85,11 @@ export class EpochMonitor implements Traceable {
|
|
|
86
85
|
}
|
|
87
86
|
|
|
88
87
|
if (this.options.provingDelayMs) {
|
|
89
|
-
this.log.
|
|
88
|
+
this.log.warn(`Waiting ${this.options.provingDelayMs}ms before proving epoch ${epochToProve}`);
|
|
90
89
|
await sleep(this.options.provingDelayMs);
|
|
91
90
|
}
|
|
92
91
|
|
|
93
|
-
this.log.
|
|
92
|
+
this.log.verbose(`Epoch ${epochToProve} is ready to be proven`);
|
|
94
93
|
if (await this.handler?.handleEpochReadyToProve(epochToProve)) {
|
|
95
94
|
this.latestEpochNumber = epochToProve;
|
|
96
95
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { BatchedBlob, getEthBlobEvaluationInputs } from '@aztec/blob-lib';
|
|
2
|
-
import {
|
|
2
|
+
import { MAX_CHECKPOINTS_PER_EPOCH } from '@aztec/constants';
|
|
3
3
|
import type { RollupContract, ViemCommitteeAttestation } from '@aztec/ethereum/contracts';
|
|
4
4
|
import type { L1TxUtils } from '@aztec/ethereum/l1-tx-utils';
|
|
5
5
|
import { makeTuple } from '@aztec/foundation/array';
|
|
@@ -7,12 +7,14 @@ import { CheckpointNumber, EpochNumber } from '@aztec/foundation/branded-types';
|
|
|
7
7
|
import { areArraysEqual } from '@aztec/foundation/collection';
|
|
8
8
|
import { Fr } from '@aztec/foundation/curves/bn254';
|
|
9
9
|
import { EthAddress } from '@aztec/foundation/eth-address';
|
|
10
|
-
import { createLogger } from '@aztec/foundation/log';
|
|
10
|
+
import { type Logger, type LoggerBindings, createLogger } from '@aztec/foundation/log';
|
|
11
|
+
import { retryUntil } from '@aztec/foundation/retry';
|
|
11
12
|
import type { Tuple } from '@aztec/foundation/serialize';
|
|
12
13
|
import { Timer } from '@aztec/foundation/timer';
|
|
13
14
|
import { RollupAbi } from '@aztec/l1-artifacts';
|
|
14
15
|
import type { PublisherConfig, TxSenderConfig } from '@aztec/sequencer-client';
|
|
15
16
|
import { CommitteeAttestation, CommitteeAttestationsAndSigners } from '@aztec/stdlib/block';
|
|
17
|
+
import { getProofSubmissionDeadlineTimestamp } from '@aztec/stdlib/epoch-helpers';
|
|
16
18
|
import type { Proof } from '@aztec/stdlib/proofs';
|
|
17
19
|
import type { FeeRecipient, RootRollupPublicInputs } from '@aztec/stdlib/rollup';
|
|
18
20
|
import type { L1PublishProofStats } from '@aztec/stdlib/stats';
|
|
@@ -31,7 +33,7 @@ export type L1SubmitEpochProofArgs = {
|
|
|
31
33
|
endTimestamp: Fr;
|
|
32
34
|
outHash: Fr;
|
|
33
35
|
proverId: Fr;
|
|
34
|
-
fees: Tuple<FeeRecipient, typeof
|
|
36
|
+
fees: Tuple<FeeRecipient, typeof MAX_CHECKPOINTS_PER_EPOCH>;
|
|
35
37
|
proof: Proof;
|
|
36
38
|
};
|
|
37
39
|
|
|
@@ -39,7 +41,7 @@ export class ProverNodePublisher {
|
|
|
39
41
|
private interrupted = false;
|
|
40
42
|
private metrics: ProverNodePublisherMetrics;
|
|
41
43
|
|
|
42
|
-
protected log
|
|
44
|
+
protected log: Logger;
|
|
43
45
|
|
|
44
46
|
protected rollupContract: RollupContract;
|
|
45
47
|
|
|
@@ -52,10 +54,12 @@ export class ProverNodePublisher {
|
|
|
52
54
|
l1TxUtils: L1TxUtils;
|
|
53
55
|
telemetry?: TelemetryClient;
|
|
54
56
|
},
|
|
57
|
+
bindings?: LoggerBindings,
|
|
55
58
|
) {
|
|
56
59
|
const telemetry = deps.telemetry ?? getTelemetryClient();
|
|
57
60
|
|
|
58
61
|
this.metrics = new ProverNodePublisherMetrics(telemetry, 'ProverNode');
|
|
62
|
+
this.log = createLogger('prover-node:l1-tx-publisher', bindings);
|
|
59
63
|
|
|
60
64
|
this.rollupContract = deps.rollupContract;
|
|
61
65
|
this.l1TxUtils = deps.l1TxUtils;
|
|
@@ -99,6 +103,11 @@ export class ProverNodePublisher {
|
|
|
99
103
|
const ctx = { epochNumber, fromCheckpoint, toCheckpoint };
|
|
100
104
|
|
|
101
105
|
if (!this.interrupted) {
|
|
106
|
+
if (!(await this.waitUntilStartBuildsOnProven(args))) {
|
|
107
|
+
this.log.verbose('Checkpoint data syncing interrupted', ctx);
|
|
108
|
+
return false;
|
|
109
|
+
}
|
|
110
|
+
|
|
102
111
|
const timer = new Timer();
|
|
103
112
|
// Validate epoch proof range and hashes are correct before submitting
|
|
104
113
|
await this.validateEpochProofSubmission(args);
|
|
@@ -145,6 +154,53 @@ export class ProverNodePublisher {
|
|
|
145
154
|
return false;
|
|
146
155
|
}
|
|
147
156
|
|
|
157
|
+
private async waitUntilStartBuildsOnProven(args: { epochNumber: EpochNumber; fromCheckpoint: CheckpointNumber }) {
|
|
158
|
+
const { epochNumber, fromCheckpoint } = args;
|
|
159
|
+
const provenCheckpoint = await this.getProvenCheckpoint();
|
|
160
|
+
if (this.isStartBuildingOnProven(fromCheckpoint, provenCheckpoint)) {
|
|
161
|
+
return true;
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
const timeout = await this.getSecondsUntilProofSubmissionWindowEnd(epochNumber);
|
|
165
|
+
this.log.info(`Waiting for proven checkpoint to reach proof start`, {
|
|
166
|
+
epochNumber,
|
|
167
|
+
fromCheckpoint,
|
|
168
|
+
provenCheckpoint,
|
|
169
|
+
timeout,
|
|
170
|
+
});
|
|
171
|
+
|
|
172
|
+
await retryUntil(
|
|
173
|
+
async () => {
|
|
174
|
+
if (this.interrupted) {
|
|
175
|
+
return true;
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
const proven = await this.getProvenCheckpoint();
|
|
179
|
+
this.log.verbose(`Proven checkpoint is at ${proven} (waiting for ${fromCheckpoint - 1})`, { epochNumber });
|
|
180
|
+
return this.isStartBuildingOnProven(fromCheckpoint, proven) ? true : undefined;
|
|
181
|
+
},
|
|
182
|
+
`proven checkpoint to reach ${fromCheckpoint - 1}`,
|
|
183
|
+
timeout,
|
|
184
|
+
4,
|
|
185
|
+
);
|
|
186
|
+
|
|
187
|
+
return !this.interrupted;
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
private async getProvenCheckpoint() {
|
|
191
|
+
return (await this.rollupContract.getTips()).proven;
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
private isStartBuildingOnProven(fromCheckpoint: CheckpointNumber, provenCheckpoint: CheckpointNumber) {
|
|
195
|
+
return fromCheckpoint - 1 <= provenCheckpoint;
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
private async getSecondsUntilProofSubmissionWindowEnd(epochNumber: EpochNumber) {
|
|
199
|
+
const deadline = getProofSubmissionDeadlineTimestamp(epochNumber, await this.rollupContract.getRollupConstants());
|
|
200
|
+
const now = BigInt(Math.floor(Date.now() / 1000));
|
|
201
|
+
return Math.max(Number(deadline - now), 0.001);
|
|
202
|
+
}
|
|
203
|
+
|
|
148
204
|
private async validateEpochProofSubmission(args: {
|
|
149
205
|
fromCheckpoint: CheckpointNumber;
|
|
150
206
|
toCheckpoint: CheckpointNumber;
|
|
@@ -269,7 +325,7 @@ export class ProverNodePublisher {
|
|
|
269
325
|
outHash: args.publicInputs.outHash.toString(),
|
|
270
326
|
proverId: EthAddress.fromField(args.publicInputs.constants.proverId).toString(),
|
|
271
327
|
} /*_args*/,
|
|
272
|
-
makeTuple(
|
|
328
|
+
makeTuple(MAX_CHECKPOINTS_PER_EPOCH * 2, i =>
|
|
273
329
|
i % 2 === 0
|
|
274
330
|
? args.publicInputs.fees[i / 2].recipient.toField().toString()
|
|
275
331
|
: args.publicInputs.fees[(i - 1) / 2].value.toString(),
|
package/src/prover-node.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { Archiver } from '@aztec/archiver';
|
|
2
2
|
import type { RollupContract } from '@aztec/ethereum/contracts';
|
|
3
|
+
import type { Delayer } from '@aztec/ethereum/l1-tx-utils';
|
|
3
4
|
import { BlockNumber, CheckpointNumber, EpochNumber } from '@aztec/foundation/branded-types';
|
|
4
5
|
import { assertRequired, compact, pick, sum } from '@aztec/foundation/collection';
|
|
5
6
|
import type { Fr } from '@aztec/foundation/curves/bn254';
|
|
@@ -7,7 +8,6 @@ import { memoize } from '@aztec/foundation/decorators';
|
|
|
7
8
|
import { createLogger } from '@aztec/foundation/log';
|
|
8
9
|
import { DateProvider } from '@aztec/foundation/timer';
|
|
9
10
|
import type { DataStoreConfig } from '@aztec/kv-store/config';
|
|
10
|
-
import type { P2PClient } from '@aztec/p2p';
|
|
11
11
|
import { PublicProcessorFactory } from '@aztec/simulator/server';
|
|
12
12
|
import type { L2BlockSource } from '@aztec/stdlib/block';
|
|
13
13
|
import type { Checkpoint } from '@aztec/stdlib/checkpoint';
|
|
@@ -17,6 +17,7 @@ import { getProofSubmissionDeadlineTimestamp } from '@aztec/stdlib/epoch-helpers
|
|
|
17
17
|
import {
|
|
18
18
|
type EpochProverManager,
|
|
19
19
|
EpochProvingJobTerminalState,
|
|
20
|
+
type ITxProvider,
|
|
20
21
|
type ProverNodeApi,
|
|
21
22
|
type Service,
|
|
22
23
|
type WorldStateSyncStatus,
|
|
@@ -24,7 +25,6 @@ import {
|
|
|
24
25
|
tryStop,
|
|
25
26
|
} from '@aztec/stdlib/interfaces/server';
|
|
26
27
|
import type { L1ToL2MessageSource } from '@aztec/stdlib/messaging';
|
|
27
|
-
import type { P2PClientType } from '@aztec/stdlib/p2p';
|
|
28
28
|
import type { Tx } from '@aztec/stdlib/tx';
|
|
29
29
|
import {
|
|
30
30
|
Attributes,
|
|
@@ -55,7 +55,6 @@ type DataStoreOptions = Pick<DataStoreConfig, 'dataDirectory'> & Pick<ChainConfi
|
|
|
55
55
|
*/
|
|
56
56
|
export class ProverNode implements EpochMonitorHandler, ProverNodeApi, Traceable {
|
|
57
57
|
private log = createLogger('prover-node');
|
|
58
|
-
private dateProvider = new DateProvider();
|
|
59
58
|
|
|
60
59
|
private jobs: Map<string, EpochProvingJob> = new Map();
|
|
61
60
|
private config: ProverNodeOptions;
|
|
@@ -73,17 +72,19 @@ export class ProverNode implements EpochMonitorHandler, ProverNodeApi, Traceable
|
|
|
73
72
|
protected readonly l1ToL2MessageSource: L1ToL2MessageSource,
|
|
74
73
|
protected readonly contractDataSource: ContractDataSource,
|
|
75
74
|
protected readonly worldState: WorldStateSynchronizer,
|
|
76
|
-
protected readonly p2pClient:
|
|
75
|
+
protected readonly p2pClient: { getTxProvider(): ITxProvider } & Partial<Service>,
|
|
77
76
|
protected readonly epochsMonitor: EpochMonitor,
|
|
78
77
|
protected readonly rollupContract: RollupContract,
|
|
79
78
|
protected readonly l1Metrics: L1Metrics,
|
|
80
79
|
config: Partial<ProverNodeOptions> = {},
|
|
81
80
|
protected readonly telemetryClient: TelemetryClient = getTelemetryClient(),
|
|
81
|
+
private delayer?: Delayer,
|
|
82
|
+
private readonly dateProvider: DateProvider = new DateProvider(),
|
|
82
83
|
) {
|
|
83
84
|
this.config = {
|
|
84
85
|
proverNodePollingIntervalMs: 1_000,
|
|
85
86
|
proverNodeMaxPendingJobs: 100,
|
|
86
|
-
proverNodeMaxParallelBlocksPerEpoch:
|
|
87
|
+
proverNodeMaxParallelBlocksPerEpoch: 0,
|
|
87
88
|
txGatheringIntervalMs: 1_000,
|
|
88
89
|
txGatheringBatchSize: 10,
|
|
89
90
|
txGatheringMaxParallelRequestsPerNode: 100,
|
|
@@ -111,6 +112,11 @@ export class ProverNode implements EpochMonitorHandler, ProverNodeApi, Traceable
|
|
|
111
112
|
return this.p2pClient;
|
|
112
113
|
}
|
|
113
114
|
|
|
115
|
+
/** Returns the shared tx delayer for prover L1 txs, if enabled. Test-only. */
|
|
116
|
+
public getDelayer(): Delayer | undefined {
|
|
117
|
+
return this.delayer;
|
|
118
|
+
}
|
|
119
|
+
|
|
114
120
|
/**
|
|
115
121
|
* Handles an epoch being completed by starting a proof for it if there are no active jobs for it.
|
|
116
122
|
* @param epochNumber - The epoch number that was just completed.
|
|
@@ -155,17 +161,15 @@ export class ProverNode implements EpochMonitorHandler, ProverNodeApi, Traceable
|
|
|
155
161
|
|
|
156
162
|
/**
|
|
157
163
|
* Stops the prover node and all its dependencies.
|
|
164
|
+
* Resources not owned by this node (shared with the parent aztec-node) are skipped.
|
|
158
165
|
*/
|
|
159
166
|
async stop() {
|
|
160
167
|
this.log.info('Stopping ProverNode');
|
|
161
168
|
await this.epochsMonitor.stop();
|
|
162
169
|
await this.prover.stop();
|
|
163
|
-
await tryStop(this.p2pClient);
|
|
164
|
-
await tryStop(this.l2BlockSource);
|
|
165
170
|
await tryStop(this.publisherFactory);
|
|
166
171
|
this.publisher?.interrupt();
|
|
167
172
|
await Promise.all(Array.from(this.jobs.values()).map(job => job.stop()));
|
|
168
|
-
await this.worldState.stop();
|
|
169
173
|
this.rewardsMetrics.stop();
|
|
170
174
|
this.l1Metrics.stop();
|
|
171
175
|
await this.telemetryClient.stop();
|
|
@@ -275,19 +279,22 @@ export class ProverNode implements EpochMonitorHandler, ProverNodeApi, Traceable
|
|
|
275
279
|
const fromCheckpoint = epochData.checkpoints[0].number;
|
|
276
280
|
const toCheckpoint = epochData.checkpoints.at(-1)!.number;
|
|
277
281
|
const fromBlock = epochData.checkpoints[0].blocks[0].number;
|
|
278
|
-
const
|
|
282
|
+
const lastBlock = epochData.checkpoints.at(-1)!.blocks.at(-1)!;
|
|
283
|
+
const toBlock = lastBlock.number;
|
|
279
284
|
this.log.verbose(
|
|
280
285
|
`Creating proving job for epoch ${epochNumber} for checkpoint range ${fromCheckpoint} to ${toCheckpoint} and block range ${fromBlock} to ${toBlock}`,
|
|
281
286
|
);
|
|
282
287
|
|
|
283
288
|
// Fast forward world state to right before the target block and get a fork
|
|
284
|
-
await
|
|
289
|
+
const lastBlockHash = await lastBlock.header.hash();
|
|
290
|
+
await this.worldState.syncImmediate(toBlock, lastBlockHash);
|
|
285
291
|
|
|
286
292
|
// Create a processor factory
|
|
287
293
|
const publicProcessorFactory = new PublicProcessorFactory(
|
|
288
294
|
this.contractDataSource,
|
|
289
295
|
this.dateProvider,
|
|
290
296
|
this.telemetryClient,
|
|
297
|
+
this.log.getBindings(),
|
|
291
298
|
);
|
|
292
299
|
|
|
293
300
|
// Set deadline for this job to run. It will abort if it takes too long.
|
|
@@ -384,6 +391,7 @@ export class ProverNode implements EpochMonitorHandler, ProverNodeApi, Traceable
|
|
|
384
391
|
this.jobMetrics,
|
|
385
392
|
deadline,
|
|
386
393
|
{ parallelBlockLimit, skipSubmitProof: proverNodeDisableProofPublish, ...opts },
|
|
394
|
+
this.log.getBindings(),
|
|
387
395
|
);
|
|
388
396
|
}
|
|
389
397
|
|
|
@@ -1,19 +1,21 @@
|
|
|
1
1
|
import type { RollupContract } from '@aztec/ethereum/contracts';
|
|
2
2
|
import type { L1TxUtils } from '@aztec/ethereum/l1-tx-utils';
|
|
3
3
|
import type { PublisherManager } from '@aztec/ethereum/publisher-manager';
|
|
4
|
-
import type {
|
|
4
|
+
import type { LoggerBindings } from '@aztec/foundation/log';
|
|
5
|
+
import type { ProverPublisherConfig, ProverTxSenderConfig } from '@aztec/sequencer-client';
|
|
5
6
|
import type { TelemetryClient } from '@aztec/telemetry-client';
|
|
6
7
|
|
|
7
8
|
import { ProverNodePublisher } from './prover-node-publisher.js';
|
|
8
9
|
|
|
9
10
|
export class ProverPublisherFactory {
|
|
10
11
|
constructor(
|
|
11
|
-
private config:
|
|
12
|
+
private config: ProverTxSenderConfig & ProverPublisherConfig,
|
|
12
13
|
private deps: {
|
|
13
14
|
rollupContract: RollupContract;
|
|
14
15
|
publisherManager: PublisherManager<L1TxUtils>;
|
|
15
16
|
telemetry?: TelemetryClient;
|
|
16
17
|
},
|
|
18
|
+
private bindings?: LoggerBindings,
|
|
17
19
|
) {}
|
|
18
20
|
|
|
19
21
|
public async start() {
|
|
@@ -30,10 +32,14 @@ export class ProverPublisherFactory {
|
|
|
30
32
|
*/
|
|
31
33
|
public async create(): Promise<ProverNodePublisher> {
|
|
32
34
|
const l1Publisher = await this.deps.publisherManager.getAvailablePublisher();
|
|
33
|
-
return new ProverNodePublisher(
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
35
|
+
return new ProverNodePublisher(
|
|
36
|
+
this.config,
|
|
37
|
+
{
|
|
38
|
+
rollupContract: this.deps.rollupContract,
|
|
39
|
+
l1TxUtils: l1Publisher,
|
|
40
|
+
telemetry: this.deps.telemetry,
|
|
41
|
+
},
|
|
42
|
+
this.bindings,
|
|
43
|
+
);
|
|
38
44
|
}
|
|
39
45
|
}
|