Skip to content
Snippets Groups Projects
Verified Commit c7f6af78 authored by STEVAN Antoine's avatar STEVAN Antoine :crab:
Browse files

add example

parent 9a8acbf7
No related branches found
No related tags found
No related merge requests found
......@@ -55,3 +55,7 @@ required-features = ["kzg"]
[[example]]
name = "aplonk"
required-features = ["aplonk"]
[[example]]
name = "fri"
required-features = ["fri"]
use ark_bls12_381::Fr;
use ark_ff::PrimeField;
use ark_poly::univariate::DensePolynomial;
use ark_poly::DenseUVPolynomial;
use ark_std::ops::Div;
use rs_merkle::Hasher;
use fri::algorithms::Blake3;
use komodo::error::KomodoError;
fn run<F: PrimeField, H: Hasher, P>() -> Result<(), KomodoError>
where
P: DenseUVPolynomial<F>,
for<'a, 'b> &'a P: Div<&'b P, Output = P>,
<H as rs_merkle::Hasher>::Hash: AsRef<[u8]>,
{
// the code parameters and the data to manipulate
let (k, n) = (4, 16);
let bytes = include_bytes!("../assets/dragoon_133x133.png").to_vec();
eprintln!("loaded {} bytes of data", bytes.len());
let shards = komodo::fri::encode::<F>(&bytes, k, n);
let blocks = komodo::fri::prove::<2, F, H, P>(shards, 1, 1, 50).unwrap();
komodo::fri::verify::<2, F, H, P>(blocks[0].clone(), n, 50).unwrap();
Ok(())
}
fn main() {
run::<Fr, Blake3, DensePolynomial<Fr>>().unwrap();
}
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment