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

Function test_utils_fq12_square_valid_data_zero

bitvm/src/chunk/taps_mul.rs:456–496  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

454
455 #[test]
456 fn test_utils_fq12_square_valid_data_zero() {
457 let f_n = ark_bn254::Fq12::new(ark_bn254::Fq6::ONE, ark_bn254::Fq6::ZERO);
458 let h = f_n * f_n;
459 let h_n = ark_bn254::Fq12::new(ark_bn254::Fq6::ONE, h.c1 / h.c0);
460
461 let (hint_out, is_valid_input, h_scr, mut mul_hints) = utils_fq12_square(f_n.c1);
462 assert!(is_valid_input);
463 let f_n_c1 = DataType::Fp6Data(f_n.c1);
464 let h_n_c1 = DataType::Fp6Data(h_n.c1);
465
466 let f6_hints = f_n_c1.to_witness(ElementType::Fp6);
467 let h6_hints = h_n_c1.to_witness(ElementType::Fp6);
468 mul_hints.extend_from_slice(&f6_hints);
469 mul_hints.extend_from_slice(&h6_hints);
470
471 let tap_len = h_scr.len();
472 let scr = script! {
473 for h in mul_hints {
474 {h.push()}
475 }
476 {h_scr}
477 OP_VERIFY
478 {Fq6::push(hint_out)}
479 {Fq6::equalverify()}
480 {Fq6::push(f_n.c1)}
481 {Fq6::equalverify()}
482 OP_TRUE
483 };
484 let res = execute_script(scr);
485 if res.final_stack.len() > 1 {
486 for i in 0..res.final_stack.len() {
487 println!("{i:} {:?}", res.final_stack.get(i));
488 }
489 }
490 assert!(res.success);
491 assert!(res.final_stack.len() == 1);
492 println!(
493 "utils_fq12_square disprovable(false) script {} stack {:?}",
494 tap_len, res.stats.max_nb_stack_items
495 );
496 }
497
498 #[test]
499 fn test_chunk_hinted_square() {

Callers

nothing calls this directly

Calls 4

utils_fq12_squareFunction · 0.85
execute_scriptFunction · 0.85
to_witnessMethod · 0.80
lenMethod · 0.80

Tested by

no test coverage detected