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

Method read_from_stack

bitvm/src/bn254/g1.rs:156–170  ·  view source on GitHub ↗
(witness: Vec<Vec<u8>>)

Source from the content-addressed store, hash-verified

154 }
155
156 pub fn read_from_stack(witness: Vec<Vec<u8>>) -> ark_bn254::G1Affine {
157 assert_eq!(witness.len() as u32, Fq::N_LIMBS * 2);
158 let x: ark_bn254::Fq =
159 BigUint::from_slice(&Fq::read_u32_le(witness[0..Fq::N_LIMBS as usize].to_vec())).into();
160 let y: ark_bn254::Fq = BigUint::from_slice(&Fq::read_u32_le(
161 witness[Fq::N_LIMBS as usize..2 * Fq::N_LIMBS as usize].to_vec(),
162 ))
163 .into();
164 let is_inf = x.is_zero() && y.is_zero();
165 ark_bn254::G1Affine {
166 x,
167 y,
168 infinity: is_inf,
169 }
170 }
171
172 pub fn hinted_check_add_prevent_degenerate(
173 t: ark_bn254::G1Affine,

Callers

nothing calls this directly

Calls 2

intoMethod · 0.45
is_zeroMethod · 0.45

Tested by

no test coverage detected