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

Function hinted_from_eval_point

bitvm/src/bn254/g1.rs:537–563  ·  view source on GitHub ↗

input of func (params): p.x, p.y Input Hints On Stack tmul hints, p.y_inverse output on stack: x' = -p.x / p.y y' = 1 / p.y

(p: ark_bn254::G1Affine)

Source from the content-addressed store, hash-verified

535/// x' = -p.x / p.y
536/// y' = 1 / p.y
537pub fn hinted_from_eval_point(p: ark_bn254::G1Affine) -> (Script, Vec<Hint>) {
538 let mut hints = Vec::new();
539
540 let py_inv = p.y().unwrap().inverse().unwrap();
541 let (hinted_script1, hint1) = Fq::hinted_mul(1, p.y, 0, py_inv);
542 let (hinted_script2, hint2) = Fq::hinted_mul(1, py_inv, 0, -p.x);
543 let script = script! {
544
545 // [hints, yinv, x, y]
546 {Fq::copy(2)}
547
548 {hinted_script1}
549 {Fq::push_one()}
550 {Fq::equalverify(1,0)}
551
552 // [hints, yinv, x]
553 {Fq::copy(1)}
554 {Fq::toaltstack()}
555 {Fq::neg(0)}
556 {hinted_script2}
557 {Fq::fromaltstack()}
558 };
559 hints.extend(hint1);
560 hints.extend(hint2);
561
562 (script, hints)
563}
564
565pub fn hinted_from_eval_points(p: ark_bn254::G1Affine) -> (Script, Vec<Hint>) {
566 let mut hints = Vec::new();

Calls

no outgoing calls