(p: ark_bn254::G1Affine)
| 563 | } |
| 564 | |
| 565 | pub 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)] |
| 604 | mod test { |
no test coverage detected