Struct SRS

Source
pub struct SRS {
    pub g1: Vec<G1Affine>,
    pub order: u32,
}
Expand description

Represents the Structured Reference String (SRS) used in KZG commitments.

Fields§

§g1: Vec<G1Affine>§order: u32

The order of the SRS.

Implementations§

Source§

impl SRS

Source

pub fn new( path_to_g1_points: &str, order: u32, points_to_load: u32, ) -> Result<Self, KzgError>

Initializes the SRS by loading G1 points from a file.

§Arguments
  • path_to_g1_points - The file path to load G1 points from.
  • order - The total order of the SRS.
  • points_to_load - The number of SRS points to load.
§Returns
  • Result<SRS, KzgError> - The initialized SRS or an error.
Source

pub fn process_chunks<T>( receiver: Receiver<(Vec<u8>, usize, bool)>, ) -> Vec<(T, usize)>

Source

pub fn parallel_read_g1_points_native( file_path: String, points_to_load: u32, is_native: bool, ) -> Result<Vec<G1Affine>, KzgError>

read G1 points in parallel, by creating one reader thread, which reads bytes from the file, and fans them out to worker threads (one per cpu) which parse the bytes into G1Affine points. The worker threads then fan in the parsed points to the main thread, which sorts them by their original position in the file to maintain order. Not used anywhere but kept as a reference.

§Arguments
  • file_path - The path to the file containing the G1 points
  • points_to_load - The number of points to load from the file
  • is_native - Whether the points are in native arkworks format or not
§Returns
  • Ok(Vec<G1Affine>) - The G1 points read from the file
  • Err(KzgError) - An error occurred while reading the file

Trait Implementations§

Source§

impl Clone for SRS

Source§

fn clone(&self) -> SRS

Returns a copy of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for SRS

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl PartialEq for SRS

Source§

fn eq(&self, other: &SRS) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl StructuralPartialEq for SRS

Auto Trait Implementations§

§

impl Freeze for SRS

§

impl RefUnwindSafe for SRS

§

impl Send for SRS

§

impl Sync for SRS

§

impl Unpin for SRS

§

impl UnwindSafe for SRS

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dst: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V