use crate::setup::{ProverSetup, VerifierSetup};
use std::ops::{Deref, DerefMut};
use super::BN254;
#[derive(Clone, Debug)]
pub struct ArkworksProverSetup(pub ProverSetup<BN254>);
#[derive(Clone, Debug)]
pub struct ArkworksVerifierSetup(pub VerifierSetup<BN254>);
impl ArkworksProverSetup {
pub fn new(max_log_n: usize) -> Self {
Self(ProverSetup::new(max_log_n))
}
#[cfg(all(feature = "disk-persistence", not(target_arch = "wasm32")))]
pub fn new_from_urs(max_log_n: usize) -> Self {
let (prover_setup, _) = crate::setup::<BN254>(max_log_n);
Self(prover_setup)
}
pub fn to_verifier_setup(&self) -> ArkworksVerifierSetup {
ArkworksVerifierSetup(self.0.to_verifier_setup())
}
pub fn into_inner(self) -> ProverSetup<BN254> {
self.0
}
}
impl ArkworksVerifierSetup {
pub fn into_inner(self) -> VerifierSetup<BN254> {
self.0
}
}
impl From<ProverSetup<BN254>> for ArkworksProverSetup {
fn from(setup: ProverSetup<BN254>) -> Self {
Self(setup)
}
}
impl From<ArkworksProverSetup> for ProverSetup<BN254> {
fn from(setup: ArkworksProverSetup) -> Self {
setup.0
}
}
impl From<VerifierSetup<BN254>> for ArkworksVerifierSetup {
fn from(setup: VerifierSetup<BN254>) -> Self {
Self(setup)
}
}
impl From<ArkworksVerifierSetup> for VerifierSetup<BN254> {
fn from(setup: ArkworksVerifierSetup) -> Self {
setup.0
}
}
impl Deref for ArkworksProverSetup {
type Target = ProverSetup<BN254>;
fn deref(&self) -> &Self::Target {
&self.0
}
}
impl DerefMut for ArkworksProverSetup {
fn deref_mut(&mut self) -> &mut Self::Target {
&mut self.0
}
}
impl Deref for ArkworksVerifierSetup {
type Target = VerifierSetup<BN254>;
fn deref(&self) -> &Self::Target {
&self.0
}
}
impl DerefMut for ArkworksVerifierSetup {
fn deref_mut(&mut self) -> &mut Self::Target {
&mut self.0
}
}