return correct proof

This commit is contained in:
Dmitriy Ryajov 2024-02-12 13:19:10 -06:00 committed by Eric
parent 62008eec1e
commit e21da286d9
No known key found for this signature in database
1 changed files with 20 additions and 9 deletions

View File

@ -587,17 +587,28 @@ proc onProve(
error "Unable to fetch manifest for cid", err = err.msg
return failure(err)
without proof =? await prover.prove(slotIdx, manifest, challenge), err:
error "Unable to generate proof", err = err.msg
return failure(err)
when defined(verify_circuit):
without (inputs, proof) =? await prover.prove(slotIdx, manifest, challenge), err:
error "Unable to generate proof", err = err.msg
return failure(err)
# Todo: send proofInput to circuit. Get proof. (Profit, repeat.)
without checked =? await prover.verify(proof, inputs), err:
error "Unable to verify proof", err = err.msg
return failure(err)
# For now: dummy proof that is not all zero's, so that it is accepted by the
# dummy verifier:
var proof = Groth16Proof.default
proof.a.x = 42.u256
success(proof)
if not checked:
error "Proof verification failed"
return failure("Proof verification failed")
else:
without (_, proof) =? await prover.prove(slotIdx, manifest, challenge), err:
error "Unable to generate proof", err = err.msg
return failure(err)
success proof.toGroth16Proof()
else:
warn "Prover not enabled"
failure "Prover not enabled"
proc onExpiryUpdate(
self: CodexNodeRef,