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

Function test_read_from_stack

bitvm/src/bn254/fq.rs:823–838  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

821
822 #[test]
823 fn test_read_from_stack() {
824 let _m = BigUint::from_str_radix(Fq::MODULUS, 16).unwrap();
825 let mut prng = ChaCha20Rng::seed_from_u64(0);
826 let a: BigUint = prng.sample(RandomBits::new(254));
827
828 let script = script! {
829 { Fq::push_u32_le(&a.to_u32_digits()) }
830 };
831
832 let res = execute_script(script);
833 let witness = extract_witness_from_stack(res);
834
835 let u32s = Fq::read_u32_le(witness);
836 let read_a = BigUint::from_slice(&u32s);
837 assert_eq!(read_a, a);
838 }
839
840 #[test]
841 fn test_add() {

Callers

nothing calls this directly

Calls 2

execute_scriptFunction · 0.85

Tested by

no test coverage detected