Trait snarkvm_algorithms::traits::snark::SNARK
source · pub trait SNARK {
type ScalarField: Clone + PrimeField;
type BaseField: Clone + PrimeField;
type Certificate: CanonicalSerialize + CanonicalDeserialize + Clone + Debug + ToBytes + FromBytes + PartialEq + Eq + Send + Sync;
type Proof: Clone + Debug + ToBytes + FromBytes + PartialEq + Eq + Send + Sync;
type ProvingKey: Clone + ToBytes + FromBytes + Send + Sync + Ord;
type UniversalSRS: Clone;
type UniversalProver;
type UniversalVerifier;
type VerifierInput: ?Sized;
type VerifyingKey: Clone + Send + Sync + ToBytes + FromBytes + Ord;
type FiatShamirRng: AlgebraicSponge<Self::BaseField, 2, Parameters = Self::FSParameters>;
type FSParameters;
// Required methods
fn universal_setup(config: usize) -> Result<Self::UniversalSRS>;
fn circuit_setup<C: ConstraintSynthesizer<Self::ScalarField>>(
srs: &Self::UniversalSRS,
circuit: &C
) -> Result<(Self::ProvingKey, Self::VerifyingKey)>;
fn prove_vk(
universal_prover: &Self::UniversalProver,
fs_parameters: &Self::FSParameters,
verifying_key: &Self::VerifyingKey,
proving_key: &Self::ProvingKey
) -> Result<Self::Certificate>;
fn prove_batch<C: ConstraintSynthesizer<Self::ScalarField>, R: Rng + CryptoRng>(
universal_prover: &Self::UniversalProver,
fs_parameters: &Self::FSParameters,
keys_to_constraints: &BTreeMap<&Self::ProvingKey, &[C]>,
rng: &mut R
) -> Result<Self::Proof>;
fn verify_vk<C: ConstraintSynthesizer<Self::ScalarField>>(
universal_verifier: &Self::UniversalVerifier,
fs_parameters: &Self::FSParameters,
circuit: &C,
verifying_key: &Self::VerifyingKey,
certificate: &Self::Certificate
) -> Result<bool>;
fn verify_batch<B: Borrow<Self::VerifierInput>>(
universal_verifier: &Self::UniversalVerifier,
fs_parameters: &Self::FSParameters,
keys_to_inputs: &BTreeMap<&Self::VerifyingKey, &[B]>,
proof: &Self::Proof
) -> Result<bool>;
// Provided methods
fn prove<C: ConstraintSynthesizer<Self::ScalarField>, R: Rng + CryptoRng>(
universal_prover: &Self::UniversalProver,
fs_parameters: &Self::FSParameters,
proving_key: &Self::ProvingKey,
constraints: &C,
rng: &mut R
) -> Result<Self::Proof> { ... }
fn verify<B: Borrow<Self::VerifierInput>>(
universal_verifier: &Self::UniversalVerifier,
fs_parameters: &Self::FSParameters,
verifying_key: &Self::VerifyingKey,
input: B,
proof: &Self::Proof
) -> Result<bool> { ... }
}
Required Associated Types§
type ScalarField: Clone + PrimeField
type BaseField: Clone + PrimeField
sourcetype Certificate: CanonicalSerialize + CanonicalDeserialize + Clone + Debug + ToBytes + FromBytes + PartialEq + Eq + Send + Sync
type Certificate: CanonicalSerialize + CanonicalDeserialize + Clone + Debug + ToBytes + FromBytes + PartialEq + Eq + Send + Sync
A certificate that the indexing was performed correctly.
type Proof: Clone + Debug + ToBytes + FromBytes + PartialEq + Eq + Send + Sync
type ProvingKey: Clone + ToBytes + FromBytes + Send + Sync + Ord
type UniversalSRS: Clone
type UniversalProver
type UniversalVerifier
type VerifierInput: ?Sized
type VerifyingKey: Clone + Send + Sync + ToBytes + FromBytes + Ord
type FiatShamirRng: AlgebraicSponge<Self::BaseField, 2, Parameters = Self::FSParameters>
type FSParameters
Required Methods§
fn universal_setup(config: usize) -> Result<Self::UniversalSRS>
fn circuit_setup<C: ConstraintSynthesizer<Self::ScalarField>>( srs: &Self::UniversalSRS, circuit: &C ) -> Result<(Self::ProvingKey, Self::VerifyingKey)>
fn prove_vk( universal_prover: &Self::UniversalProver, fs_parameters: &Self::FSParameters, verifying_key: &Self::VerifyingKey, proving_key: &Self::ProvingKey ) -> Result<Self::Certificate>
fn prove_batch<C: ConstraintSynthesizer<Self::ScalarField>, R: Rng + CryptoRng>( universal_prover: &Self::UniversalProver, fs_parameters: &Self::FSParameters, keys_to_constraints: &BTreeMap<&Self::ProvingKey, &[C]>, rng: &mut R ) -> Result<Self::Proof>
fn verify_vk<C: ConstraintSynthesizer<Self::ScalarField>>( universal_verifier: &Self::UniversalVerifier, fs_parameters: &Self::FSParameters, circuit: &C, verifying_key: &Self::VerifyingKey, certificate: &Self::Certificate ) -> Result<bool>
fn verify_batch<B: Borrow<Self::VerifierInput>>( universal_verifier: &Self::UniversalVerifier, fs_parameters: &Self::FSParameters, keys_to_inputs: &BTreeMap<&Self::VerifyingKey, &[B]>, proof: &Self::Proof ) -> Result<bool>
Provided Methods§
fn prove<C: ConstraintSynthesizer<Self::ScalarField>, R: Rng + CryptoRng>( universal_prover: &Self::UniversalProver, fs_parameters: &Self::FSParameters, proving_key: &Self::ProvingKey, constraints: &C, rng: &mut R ) -> Result<Self::Proof>
fn verify<B: Borrow<Self::VerifierInput>>( universal_verifier: &Self::UniversalVerifier, fs_parameters: &Self::FSParameters, verifying_key: &Self::VerifyingKey, input: B, proof: &Self::Proof ) -> Result<bool>
Object Safety§
This trait is not object safe.