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

Function test_hinted_from_eval_point

bitvm/src/bn254/g1.rs:940–962  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

938
939 #[test]
940 fn test_hinted_from_eval_point() {
941 let mut prng = ChaCha20Rng::seed_from_u64(1);
942 let p = ark_bn254::G1Affine::rand(&mut prng);
943 let (eval_scr, hints) = hinted_from_eval_point(p);
944 let pyinv = p.y.inverse().unwrap();
945
946 let script = script! {
947 for tmp in hints {
948 { tmp.push() }
949 }
950 { Fq::push_u32_le(&BigUint::from(pyinv).to_u32_digits()) } // aux hint
951
952 { Fq::push_u32_le(&BigUint::from(p.x).to_u32_digits()) } // input
953 { Fq::push_u32_le(&BigUint::from(p.y).to_u32_digits()) }
954 { eval_scr }
955 { Fq::push_u32_le(&BigUint::from(-p.x / p.y).to_u32_digits()) } // expected output
956 { Fq::push_u32_le(&BigUint::from(pyinv).to_u32_digits()) }
957 { Fq2::equalverify() }
958 OP_TRUE
959 };
960 let exec_result = execute_script(script);
961 assert!(exec_result.success);
962 }
963}

Callers

nothing calls this directly

Calls 2

hinted_from_eval_pointFunction · 0.85
execute_scriptFunction · 0.85

Tested by

no test coverage detected