pub trait SNARK {
type AllocatedCircuit;
type Circuit;
type PreparedVerifyingKey: Clone + From<Self::ProvingKey> + From<Self::VerifyingKey>;
type Proof: Clone + Debug + ToBytes + FromBytes;
type ProvingKey: Clone + ToBytes + FromBytes;
type VerifierInput: ?Sized;
type VerifyingKey: Clone + ToBytes + FromBytes + From<Self::PreparedVerifyingKey> + From<Self::ProvingKey>;
fn setup<R: Rng>(
circuit: &Self::Circuit,
rng: &mut R
) -> Result<(Self::ProvingKey, Self::PreparedVerifyingKey), SNARKError>;
fn prove_with_terminator<R: Rng>(
proving_key: &Self::ProvingKey,
input_and_witness: &Self::AllocatedCircuit,
terminator: &AtomicBool,
rng: &mut R
) -> Result<Self::Proof, SNARKError>;
fn verify(
verifying_key: &Self::PreparedVerifyingKey,
input: &Self::VerifierInput,
proof: &Self::Proof
) -> Result<bool, SNARKError>;
fn prove<R: Rng>(
proving_key: &Self::ProvingKey,
input_and_witness: &Self::AllocatedCircuit,
rng: &mut R
) -> Result<Self::Proof, SNARKError> { ... }
}