pub struct R1CSProof { /* private fields */ }
Expand description

A proof of some statement specified by a ConstraintSystem.

Statements are specified by writing gadget functions which add constraints to a ConstraintSystem implementation. To construct an R1CSProof, a prover constructs a ProverCS, then passes it to gadget functions to build the constraint system, then consumes the constraint system using ProverCS::prove to produce an R1CSProof. To verify an R1CSProof, a verifier constructs a VerifierCS, then passes it to the same gadget functions to (re)build the constraint system, then consumes the constraint system using VerifierCS::verify to verify the proof.

Implementations§

source§

impl R1CSProof

source

pub fn to_bytes(&self) -> Vec<u8>

Serializes the proof into a byte array of 1 version byte + \((13 or 16) + 2k\) 32-byte elements, where \(k=\lceil \log_2(n) \rceil\) and \(n\) is the number of multiplication gates.

Layout

The layout of the r1cs proof encoding is:

  • 1 version byte indicating whether the proof contains second-phase commitments or not,
  • 8 or 11 compressed Ristretto points \(A_{I1},A_{O1},S_1,(A_{I2},A_{O2},S_2),T_1,…,T_6\) (\(A_{I2},A_{O2},S_2\) are skipped if there were no multipliers added in the randomized phase),
  • three scalars \(t_x, \tilde{t}_x, \tilde{e}\),
  • \(k\) pairs of compressed Ristretto points \(L_0,R_0\dots,L_{k-1},R_{k-1}\),
  • two scalars \(a, b\).
source

pub fn serialized_size(&self) -> usize

Returns the size in bytes required to serialize the R1CSProof.

source

pub fn from_bytes(slice: &[u8]) -> Result<R1CSProof, R1CSError>

Deserializes the proof from a byte slice.

Returns an error if the byte slice cannot be parsed into a R1CSProof.

Trait Implementations§

source§

impl Clone for R1CSProof

source§

fn clone(&self) -> R1CSProof

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 R1CSProof

source§

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

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

impl<'de> Deserialize<'de> for R1CSProof

source§

fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>where D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
source§

impl Serialize for R1CSProof

source§

fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>where S: Serializer,

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations§

Blanket Implementations§

source§

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

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

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

const: unstable · source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

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

const: unstable · source§

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

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

const: unstable · source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

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

const: unstable · 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> Same<T> for T

§

type Output = T

Should always be Self
source§

impl<T> ToOwned for Twhere T: Clone,

§

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 Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
const: unstable · source§

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

Performs the conversion.
source§

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

§

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

The type returned in the event of a conversion error.
const: unstable · source§

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

Performs the conversion.
§

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

§

fn vzip(self) -> V

source§

impl<T> DeserializeOwned for Twhere T: for<'de> Deserialize<'de>,