@nori-zk/proof-conversion
Version:
Verifying zkVM proofs inside o1js circuits, to generate Mina compatible proof
25 lines • 1.13 kB
JavaScript
import { G1Affine } from '../ec/index.js';
import { make_w27 } from './helpers.js';
import { KZGPairing } from './mm_loop/multi_miller.js';
import { PlonkVerifierPIOP } from './piop/piop.js';
class Sp1PlonkVerifier {
constructor(VK, g2_lines, tau_lines) {
let w27 = make_w27();
this.piopV = new PlonkVerifierPIOP(VK);
this.kzgP = new KZGPairing(g2_lines, tau_lines, w27);
}
verify(proof, pi0, pi1, auxWitness) {
const [kzg_cm_x, kzg_cm_y, neg_fq_x, neg_fq_y] = this.piopV.piop(proof, pi0, pi1);
const A = new G1Affine({ x: kzg_cm_x, y: kzg_cm_y });
const negB = new G1Affine({ x: neg_fq_x, y: neg_fq_y });
this.kzgP.proveEqual(A, negB, auxWitness.shift_power, auxWitness.c);
}
computeMlo(proof, pi0, pi1) {
const [kzg_cm_x, kzg_cm_y, neg_fq_x, neg_fq_y] = this.piopV.piop(proof, pi0, pi1);
const A = new G1Affine({ x: kzg_cm_x, y: kzg_cm_y });
const negB = new G1Affine({ x: neg_fq_x, y: neg_fq_y });
return this.kzgP.multiMillerLoop(A, negB);
}
}
export { Sp1PlonkVerifier };
//# sourceMappingURL=verifier.js.map