MCPcopy Create free account
hub / github.com/BitVM/BitVM / hinted_from_eval_points

Function hinted_from_eval_points

bitvm/src/bn254/g1.rs:565–601  ·  view source on GitHub ↗
(p: ark_bn254::G1Affine)

Source from the content-addressed store, hash-verified

563}
564
565pub fn hinted_from_eval_points(p: ark_bn254::G1Affine) -> (Script, Vec<Hint>) {
566 let mut hints = Vec::new();
567
568 let py_inv = p.y().unwrap().inverse().unwrap();
569
570 let (hinted_script1, hint1) = Fq::hinted_mul(1, p.y, 0, py_inv);
571 let (hinted_script2, hint2) = Fq::hinted_mul(1, py_inv, 0, -p.x);
572
573 let script = script! {
574 // [yinv, hints,.., x, y]
575 {Fq2::toaltstack()}
576 for _ in 0..Fq::N_LIMBS {
577 OP_DEPTH OP_1SUB OP_ROLL
578 }
579 { Fq::check_validity_and_keep_element() }
580 {Fq2::fromaltstack()}
581 // [hints, yinv, x, y]
582 {Fq::copy(2)}
583
584 {hinted_script1}
585 {Fq::push_one()}
586 {Fq::equalverify(1,0)}
587
588 // [hints, yinv, x]
589 {Fq::copy(1)}
590 {Fq::toaltstack()}
591 {Fq::neg(0)}
592 {hinted_script2}
593 {Fq::fromaltstack()}
594 };
595
596 hints.push(Hint::Fq(py_inv));
597 hints.extend(hint1);
598 hints.extend(hint2);
599
600 (script, hints)
601}
602
603#[cfg(test)]
604mod test {

Callers 2

chunk_precompute_pFunction · 0.85

Calls 2

FqClass · 0.85
pushMethod · 0.45

Tested by

no test coverage detected