#[repr(transparent)]pub struct PodG2(pub [u8; 128]);
Expand description
The BN254 (BN128) group element in G2 as a POD type.
Elements in G2 is represented by 2 field-extension elements (x, y)
. Each
field-extension element itself is a degree 1 polynomial x = x0 + x1*X
,
y = y0 + y1*X
. The EIP-197 standard encodes a G2 element as
[be(x1), be(x0), be(y1), be(y0)]
where be(..)
is the big-endian
encoding of the input field element. The ark-bn254
crate encodes a G2
element as [le(x0), le(x1), le(y0), le(y1)]
where le(..)
is the
little-endian encoding of the input field element. Notably, in addition to
the differences in the big-endian vs. little-endian encodings of field
elements, the order of the polynomial field coefficients x0
, x1
, y0
,
and y1
are different.
THe Solana syscalls still expect the inputs to be encoded as specified in
EIP-197. The type PodG2
is an intermediate type that facilitates the
translation between the `EIP-197 encoding and the encoding used in the
arkworks implementation.
Tuple Fields§
§0: [u8; 128]
Trait Implementations§
impl Copy for PodG2
impl Eq for PodG2
impl Pod for PodG2
impl StructuralPartialEq for PodG2
Auto Trait Implementations§
impl Freeze for PodG2
impl RefUnwindSafe for PodG2
impl Send for PodG2
impl Sync for PodG2
impl Unpin for PodG2
impl UnwindSafe for PodG2
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CheckedBitPattern for Twhere
T: AnyBitPattern,
impl<T> CheckedBitPattern for Twhere
T: AnyBitPattern,
Source§type Bits = T
type Bits = T
Self
must have the same layout as the specified Bits
except for
the possible invalid bit patterns being checked during
is_valid_bit_pattern
.Source§fn is_valid_bit_pattern(_bits: &T) -> bool
fn is_valid_bit_pattern(_bits: &T) -> bool
bits
as &Self
.Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more