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

Function test_hinted_check_line_through_point

bitvm/src/bn254/g2.rs:1009–1038  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

1007
1008 #[test]
1009 fn test_hinted_check_line_through_point() {
1010 let mut prng = ChaCha20Rng::seed_from_u64(0);
1011 let t = ark_bn254::G2Affine::rand(&mut prng);
1012 let two_inv = ark_bn254::Fq::one().double().inverse().unwrap();
1013 let three_div_two = (ark_bn254::Fq::one().double() + ark_bn254::Fq::one()) * two_inv;
1014 let mut alpha = t.x.square();
1015 alpha /= t.y;
1016 alpha.mul_assign_by_fp(&three_div_two);
1017 // -bias
1018 let bias_minus = alpha * t.x - t.y;
1019
1020 let (scr, hints) = hinted_check_line_through_point(t.x, alpha, bias_minus);
1021 println!("hinted_check_line_through_point: {}", scr.len());
1022
1023 let script = script! {
1024 for hint in hints {
1025 { hint.push() }
1026 }
1027 { Fq2::push(alpha) }
1028 { Fq2::push(bias_minus) }
1029
1030 { Fq2::push(t.x) }
1031 { Fq2::push(t.y) }
1032 {scr}
1033 { Fq2::drop() }
1034 { Fq2::drop() }
1035 OP_TRUE
1036 };
1037 assert!(execute_script(script).success);
1038 }
1039
1040 #[test]
1041 fn test_hinted_affine_double_line() {

Callers

nothing calls this directly

Calls 2

doubleMethod · 0.45

Tested by

no test coverage detected