pub struct PublicParameters { /* private fields */ }Expand description
The Public Parameters can also be referred to as the Structured Reference String (SRS). It is available to both the prover and verifier and allows the verifier to efficiently verify and make claims about polynomials up to and including a configured degree.
Implementations§
Source§impl PublicParameters
impl PublicParameters
Sourcepub fn commit_key(&self) -> &CommitKey
pub fn commit_key(&self) -> &CommitKey
Returns an untrimmed CommitKey reference contained in the
PublicParameters instance.
Sourcepub fn opening_key(&self) -> &OpeningKey
pub fn opening_key(&self) -> &OpeningKey
Returns an OpeningKey reference contained in the
PublicParameters instance.
Sourcepub fn setup(
max_degree: usize,
rng: impl RngCore,
) -> Result<PublicParameters, Error>
pub fn setup( max_degree: usize, rng: impl RngCore, ) -> Result<PublicParameters, Error>
Setup generates the public parameters using a random number generator.
This method will in most cases be used for testing and exploration.
In reality, a Trusted party or a Multiparty Computation will be used
to generate the SRS. Returns an error if the configured degree is less
than one.
Sourcepub fn to_raw_var_bytes(&self) -> Vec<u8> ⓘ
pub fn to_raw_var_bytes(&self) -> Vec<u8> ⓘ
Serialize the PublicParameters into bytes.
This operation is designed to store the raw representation of the
contents of the PublicParameters. Therefore, the size of the bytes
outputed by this function is expected to be the double than the one
that PublicParameters::to_var_bytes.
§Note
This function should be used when we want to serialize the
PublicParameters allowing a really fast deserialization later.
This functions output should not be used by the regular
PublicParameters::from_slice fn.
Sourcepub unsafe fn from_slice_unchecked(bytes: &[u8]) -> Self
pub unsafe fn from_slice_unchecked(bytes: &[u8]) -> Self
Deserialize PublicParameters from a set of bytes created by
PublicParameters::to_raw_var_bytes.
The bytes source is expected to be trusted and no checks will be performed reggarding the content of the points that the bytes contain serialized.
§Safety
This function will not produce any memory errors but can deal to the generation of invalid or unsafe points/keys. To make sure this does not happen, the inputed bytes must match the ones that were generated by the encoding functions of this lib.
Sourcepub fn to_var_bytes(&self) -> Vec<u8> ⓘ
pub fn to_var_bytes(&self) -> Vec<u8> ⓘ
Serialises a PublicParameters struct into a slice of bytes.
Sourcepub fn from_slice(bytes: &[u8]) -> Result<PublicParameters, Error>
pub fn from_slice(bytes: &[u8]) -> Result<PublicParameters, Error>
Deserialise a slice of bytes into a Public Parameter struct performing security and consistency checks for each point that the bytes contain.
§Note
This function can be really slow if the PublicParameters have a
certain degree. If the bytes come from a trusted source such as a
local file, we recommend to use
PublicParameters::from_slice_unchecked and
PublicParameters::to_raw_var_bytes.
Sourcepub fn trim(
&self,
truncated_degree: usize,
) -> Result<(CommitKey, OpeningKey), Error>
pub fn trim( &self, truncated_degree: usize, ) -> Result<(CommitKey, OpeningKey), Error>
Trim truncates the PublicParameters to allow the prover to commit to
polynomials up to the and including the truncated degree.
Returns the CommitKey and OpeningKey used to generate and verify
proofs.
Returns an error if the truncated degree is larger than the public parameters configured degree.
Sourcepub fn max_degree(&self) -> usize
pub fn max_degree(&self) -> usize
Max degree specifies the largest Polynomial that this prover key can commit to.
Trait Implementations§
Source§impl Clone for PublicParameters
impl Clone for PublicParameters
Source§fn clone(&self) -> PublicParameters
fn clone(&self) -> PublicParameters
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for PublicParameters
impl Debug for PublicParameters
Source§impl Decode for PublicParameters
impl Decode for PublicParameters
Source§impl<'de> Deserialize<'de> for PublicParameters
impl<'de> Deserialize<'de> for PublicParameters
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl Encode for PublicParameters
impl Encode for PublicParameters
Source§fn encode_to<__CodecOutputEdqy: Output + ?Sized>(
&self,
__codec_dest_edqy: &mut __CodecOutputEdqy,
)
fn encode_to<__CodecOutputEdqy: Output + ?Sized>( &self, __codec_dest_edqy: &mut __CodecOutputEdqy, )
Source§fn size_hint(&self) -> usize
fn size_hint(&self) -> usize
Source§fn using_encoded<R, F>(&self, f: F) -> R
fn using_encoded<R, F>(&self, f: F) -> R
Source§fn encoded_size(&self) -> usize
fn encoded_size(&self) -> usize
Source§impl PartialEq for PublicParameters
impl PartialEq for PublicParameters
Source§impl Serialize for PublicParameters
impl Serialize for PublicParameters
impl EncodeLike for PublicParameters
impl StructuralPartialEq for PublicParameters
Auto Trait Implementations§
impl Freeze for PublicParameters
impl RefUnwindSafe for PublicParameters
impl Send for PublicParameters
impl Sync for PublicParameters
impl Unpin for PublicParameters
impl UnwindSafe for PublicParameters
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> DecodeLimit for Twhere
T: Decode,
impl<T> DecodeLimit for Twhere
T: Decode,
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