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

Function test_hash_witness

bitvm/src/chunk/elements.rs:398–416  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

396
397 #[test]
398 fn test_hash_witness() {
399 let mut prng = ChaCha20Rng::seed_from_u64(117);
400 let fld = ark_bn254::Fq6::rand(&mut prng);
401 let elem = super::DataType::Fp6Data(fld);
402
403 let check_output_bit = 1;
404 let preim = elem.to_witness(ElementType::Fp6);
405 let scr = script! {
406 for p in preim {
407 {p.push()}
408 }
409 {check_output_bit}
410 {elem.to_hash().as_hint_type().push()}
411 {Fq::toaltstack()}
412 {hash_messages(vec![ElementType::Fp6])}
413 };
414 let res = execute_script(scr);
415 assert!(!res.success && res.final_stack.len() == 1);
416 }
417}

Callers

nothing calls this directly

Calls 2

execute_scriptFunction · 0.85
to_witnessMethod · 0.80

Tested by

no test coverage detected