Skip to content

Commit 796c121

Browse files
committed
fix: proof submitter must match claimer (burner key)
submit_proof requires claimer == submitter. Since the burner placed the bid, the burner is the claimer. Added sendL1WithBurner helper and updated stepProve to sign with burner keypair on L1.
1 parent 1499196 commit 796c121

1 file changed

Lines changed: 29 additions & 6 deletions

File tree

client/src/App.tsx

Lines changed: 29 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -485,23 +485,46 @@ function App() {
485485
}
486486
}
487487

488+
// Send L1 tx signed by the burner keypair (for steps where burner is the authorized signer)
489+
async function sendL1WithBurner(tx: Transaction): Promise<string> {
490+
tx.feePayer = erBurner.publicKey
491+
tx.recentBlockhash = (await connection.getLatestBlockhash('confirmed')).blockhash
492+
tx.sign(erBurner)
493+
const raw = tx.serialize()
494+
const sig = await connection.sendRawTransaction(raw, { skipPreflight: true })
495+
const timeout = new Promise<never>((_, reject) =>
496+
setTimeout(() => reject(new Error('Confirmation timeout (30s)')), 30000)
497+
)
498+
await Promise.race([connection.confirmTransaction(sig, 'confirmed'), timeout])
499+
return sig
500+
}
501+
488502
async function stepProve(): Promise<boolean> {
489-
if (!program || !publicKey || !jobPDA) return false
503+
if (!program || !jobPDA) return false
490504
setActiveStep('proving')
491-
addEvent('Submitting proof on L1...', 'l1')
505+
addEvent('Submitting proof on L1 (burner = claimer)...', 'l1')
492506
const start = Date.now()
493507
try {
494-
const tx = await program.methods
508+
// Build program with burner as provider for the tx
509+
const burnerWallet = {
510+
publicKey: erBurner.publicKey,
511+
signTransaction: async (tx: Transaction) => { tx.partialSign(erBurner); return tx },
512+
signAllTransactions: async (txs: Transaction[]) => { txs.forEach(t => t.partialSign(erBurner)); return txs },
513+
}
514+
const burnerProvider = new anchor.AnchorProvider(connection, burnerWallet as any, { commitment: 'confirmed' })
515+
const burnerProgram = new Program(idl as any, burnerProvider)
516+
517+
const tx = await burnerProgram.methods
495518
.submitProof(randomHash())
496-
.accounts({ job: jobPDA, submitter: publicKey })
519+
.accounts({ job: jobPDA, submitter: erBurner.publicKey })
497520
.transaction()
498521

499-
const sig = await sendTx(connection, tx)
522+
const sig = await sendL1WithBurner(tx)
500523
addEvent(`Proof submitted`, 'success', { txHash: sig, ms: Date.now() - start })
501524
setCompletedSteps(prev => new Set([...prev, 'proving']))
502525
return true
503526
} catch (e) {
504-
addEvent(`Proof failed: ${(e as Error).message.slice(0, 80)}`, 'error')
527+
addEvent(`Proof failed: ${(e as Error).message.slice(0, 200)}`, 'error')
505528
return false
506529
}
507530
}

0 commit comments

Comments
 (0)