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

Method read_from_stack

bitvm/src/bn254/g2.rs:117–131  ·  view source on GitHub ↗
(witness: Vec<Vec<u8>>)

Source from the content-addressed store, hash-verified

115 }
116
117 pub fn read_from_stack(witness: Vec<Vec<u8>>) -> ark_bn254::G2Affine {
118 assert_eq!(witness.len() as u32, Fq::N_LIMBS * 4);
119 let x = Fq2::read_from_stack(witness[0..2 * Fq::N_LIMBS as usize].to_vec());
120 let y = Fq2::read_from_stack(
121 witness[2 * Fq::N_LIMBS as usize..4 * Fq::N_LIMBS as usize].to_vec(),
122 );
123
124 let is_inf = x.is_zero() && y.is_zero();
125
126 ark_bn254::G2Affine {
127 x,
128 y,
129 infinity: is_inf,
130 }
131 }
132}
133
134// Stack: [q] q /in G2Affine

Callers

nothing calls this directly

Calls 1

is_zeroMethod · 0.45

Tested by

no test coverage detected