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

Function test_point_double_eval

bitvm/src/chunk/taps_point_ops.rs:970–1020  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

968
969 #[test]
970 fn test_point_double_eval() {
971 let mut prng = ChaCha20Rng::seed_from_u64(0);
972 let t = ark_bn254::G2Affine::rand(&mut prng);
973 let p = ark_bn254::G1Affine::rand(&mut prng);
974
975 let ((r, le), scr, hints) = utils_point_double_eval(t, p);
976 // a, b, tx, ty, px, py
977
978 let script = script! {
979 for h in hints {
980 {h.push()}
981 }
982 {G2Affine::push(t)}
983 {G1Affine::push(p)}
984 // [hints, tx, ty, px, py]
985 {scr}
986 // t, R, dbl_le
987 {Fq2::push(le.1)}
988 {Fq2::equalverify()}
989 {Fq2::push(le.0)}
990 {Fq2::equalverify()}
991
992 {Fq2::push(r.y)}
993 {Fq2::equalverify()}
994 {Fq2::push(r.x)}
995 {Fq2::equalverify()}
996
997
998 {Fq2::push(t.y)}
999 {Fq2::equalverify()}
1000
1001
1002 {Fq2::push(t.x)}
1003 {Fq2::equalverify()}
1004
1005
1006 OP_TRUE
1007 };
1008 let res = execute_script(script);
1009 if res.final_stack.len() > 1 {
1010 for i in 0..res.final_stack.len() {
1011 println!("{i:} {:?}", res.final_stack.get(i));
1012 }
1013 }
1014 assert!(res.success);
1015 assert!(res.final_stack.len() == 1);
1016 println!(
1017 "utils_point_double_eval disprovable(false) max_stack {:?}",
1018 res.stats.max_nb_stack_items
1019 );
1020 }
1021
1022 #[test]
1023 fn test_point_add_eval() {

Callers

nothing calls this directly

Calls 3

utils_point_double_evalFunction · 0.85
execute_scriptFunction · 0.85
lenMethod · 0.80

Tested by

no test coverage detected