Skip to content

Commit 9d756c7

Browse files
committed
refactor(prover-node): use each entity's own id as the failure-upload jobId
uploadEpochProofFailure already prefixes the upload path with the epoch number, so the epoch in the jobId was redundant — and the epoch-only string dropped the per-upload uniqueness the original session.getId() UUID gave. Use each entity's own id instead: the session's id for a session (epoch) failure, and the prover's content-addressed id for a checkpoint failure. Drop the now-unused epoch param from tryUploadEpochFailure.
1 parent 6619403 commit 9d756c7

2 files changed

Lines changed: 9 additions & 7 deletions

File tree

yarn-project/end-to-end/src/single-node/proving/upload_failed_proof.test.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ describe('single-node/proving/upload_failed_proof', () => {
6363

6464
// Makes the prover's top-tree prove always throw. Because every checkpoint prover still succeeds, the
6565
// session fails on its own account (state 'failed'), which the session manager treats as a genuine,
66-
// race-free failure and uploads a post-mortem eagerly via tryUploadEpochFailure(epoch, checkpoints).
66+
// race-free failure and uploads a post-mortem eagerly via tryUploadEpochFailure(sessionId, checkpoints).
6767
// Intercepts that to capture the upload URL, then tears down the live context, downloads the proving
6868
// job data, and re-runs it via rerunEpochProvingJob with fake proofs on a fresh config.
6969
it('uploads failed proving job state and re-runs it on a fresh instance', async () => {
@@ -81,8 +81,8 @@ describe('single-node/proving/upload_failed_proof', () => {
8181
// healthy provers (a top-tree failure here).
8282
const { promise: epochUploaded, resolve: onEpochUploaded } = promiseWithResolvers<string>();
8383
const origTryUploadEpochFailure = proverNode.tryUploadEpochFailure.bind(proverNode);
84-
proverNode.tryUploadEpochFailure = async (epoch: any, checkpoints: any) => {
85-
const url = await origTryUploadEpochFailure(epoch, checkpoints);
84+
proverNode.tryUploadEpochFailure = async (id: any, checkpoints: any) => {
85+
const url = await origTryUploadEpochFailure(id, checkpoints);
8686
if (url !== undefined) {
8787
onEpochUploaded(url);
8888
}

yarn-project/prover-node/src/prover-node.ts

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -582,7 +582,7 @@ export class ProverNode implements L2BlockStreamEventHandler, ProverNodeApi, Tra
582582
finalizationDelayMs: this.config.proverNodeEpochProvingDelayMs,
583583
},
584584
onSessionFailed: async session => {
585-
await this.tryUploadEpochFailure(session.getEpochNumber(), session.getCheckpoints());
585+
await this.tryUploadEpochFailure(session.getId(), session.getCheckpoints());
586586
},
587587
bindings: this.log.getBindings(),
588588
});
@@ -615,7 +615,7 @@ export class ProverNode implements L2BlockStreamEventHandler, ProverNodeApi, Tra
615615
* store is configured or the checkpoint set is empty.
616616
*/
617617
public async tryUploadEpochFailure(
618-
epoch: EpochNumber,
618+
id: string,
619619
checkpoints: readonly CheckpointProver[],
620620
): Promise<string | undefined> {
621621
if (!this.config.proverNodeFailedEpochStore || checkpoints.length === 0) {
@@ -624,7 +624,8 @@ export class ProverNode implements L2BlockStreamEventHandler, ProverNodeApi, Tra
624624
const data = SessionManager.buildProvingData(checkpoints);
625625
return await uploadEpochProofFailure(
626626
this.config.proverNodeFailedEpochStore,
627-
`failed-epoch-${epoch}`,
627+
// The session's own id; `uploadEpochProofFailure` already prefixes the path with the epoch number.
628+
id,
628629
data,
629630
this.l2BlockSource as Archiver,
630631
this.worldState,
@@ -647,7 +648,8 @@ export class ProverNode implements L2BlockStreamEventHandler, ProverNodeApi, Tra
647648
const data = SessionManager.buildProvingData([prover]);
648649
return await uploadEpochProofFailure(
649650
this.config.proverNodeFailedEpochStore,
650-
`failed-checkpoint-${prover.epochNumber}-${prover.checkpoint.number}`,
651+
// The prover's content-addressed id; the epoch number is already in the upload path.
652+
prover.id,
651653
data,
652654
this.l2BlockSource as Archiver,
653655
this.worldState,

0 commit comments

Comments
 (0)