use std::{error::Error, fmt::Debug};
use ark_ff::{PrimeField, Zero};
use rand::RngCore;
pub mod kzg_amortized;
pub trait VCUniversalParams {
fn max_size(&self) -> usize;
}
pub trait VCPreparedData {
type Item: Clone + Zero;
type Error: Debug;
fn from_vec(data: Vec<Self::Item>) -> Self;
fn set_evaluation(&mut self, index: usize, value: Self::Item) -> Result<(), Self::Error>;
fn get(&self, index: usize) -> Option<&Self::Item>;
fn get_all(&self) -> Vec<(usize, Self::Item)>;
fn max_size(&self) -> usize;
}
pub trait VectorCommitment {
type UniversalParams: VCUniversalParams;
type PreparedData: VCPreparedData;
type Commitment: PartialEq + Clone;
type Proof;
type BatchProof;
type Error: Error + Debug;
fn setup<R: RngCore>(
max_items: usize,
rng: &mut R,
) -> Result<Self::UniversalParams, Self::Error>;
fn commit(
key: &Self::UniversalParams,
data: &Self::PreparedData,
) -> Result<Self::Commitment, Self::Error>;
fn prove(
key: &Self::UniversalParams,
commitment: &Self::Commitment,
index: usize,
data: &Self::PreparedData,
) -> Result<Self::Proof, Self::Error>;
fn prove_all(
key: &Self::UniversalParams,
commitment: &Self::Commitment,
data: &Self::PreparedData,
) -> Result<Self::BatchProof, Self::Error>;
fn verify(
key: &Self::UniversalParams,
commitment: &Self::Commitment,
proof: &Self::Proof,
) -> Result<bool, Self::Error>;
fn verify_batch(
key: &Self::UniversalParams,
commitment: &Self::Commitment,
proof: &Self::BatchProof,
) -> Result<bool, Self::Error>;
fn convert_commitment_to_data(
commit: &Self::Commitment,
) -> <Self::PreparedData as VCPreparedData>::Item;
}