UNPKG

@nori-zk/proof-conversion

Version:

Verifying zkVM proofs inside o1js circuits, to generate Mina compatible proof

43 lines 1.71 kB
/* Accumulate lines to utilize sparse multiplications: - It checks if lines are correct (if point is not fixed) and evaluates them with sparse mul */ import { AffineCache } from '../../lines/precompute.js'; import { ATE_LOOP_COUNT } from '../../towers/consts.js'; class KZGLineAccumulator { static accumulate(g2_lines, tau_lines, A, negB) { const g = []; const a_cache = new AffineCache(A); const negB_cache = new AffineCache(negB); let idx = 0; let line_cnt = 0; for (let i = 1; i < ATE_LOOP_COUNT.length; i++) { idx = i - 1; let g2_line = g2_lines[line_cnt]; let tau_line = tau_lines[line_cnt]; line_cnt += 1; g.push(g2_line.psi(a_cache)); g[idx] = g[idx].sparse_mul(tau_line.psi(negB_cache)); if (ATE_LOOP_COUNT[i] == 1 || ATE_LOOP_COUNT[i] == -1) { let g2_line = g2_lines[line_cnt]; let tau_line = tau_lines[line_cnt]; line_cnt += 1; g[idx] = g[idx].sparse_mul(g2_line.psi(a_cache)); g[idx] = g[idx].sparse_mul(tau_line.psi(negB_cache)); } } let g2_line = g2_lines[line_cnt]; let tau_line = tau_lines[line_cnt]; line_cnt += 1; idx += 1; g.push(g2_line.psi(a_cache)); g[idx] = g[idx].sparse_mul(tau_line.psi(negB_cache)); g2_line = g2_lines[line_cnt]; tau_line = tau_lines[line_cnt]; g[idx] = g[idx].sparse_mul(g2_line.psi(a_cache)); g[idx] = g[idx].sparse_mul(tau_line.psi(negB_cache)); return g; } } export { KZGLineAccumulator }; //# sourceMappingURL=accumulate_lines.js.map