From 7aca99fac5dbeb64b41ea6671a4733234f10150f Mon Sep 17 00:00:00 2001 From: "a.stevan" <antoine.stevan@isae-supaero.fr> Date: Tue, 10 Sep 2024 16:04:23 +0200 Subject: [PATCH] WIP: make it compile --- src/fri.rs | 38 +++++++++++++++++++------------------- 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/src/fri.rs b/src/fri.rs index 4ddcb3ce..a98c5fad 100644 --- a/src/fri.rs +++ b/src/fri.rs @@ -1,15 +1,12 @@ use ark_ff::PrimeField; use ark_poly::DenseUVPolynomial; -use ark_std::{ - ops::Div, - rand::{thread_rng, Rng}, -}; +use ark_std::ops::Div; use rs_merkle::Hasher; use tracing::{debug, info}; use crate::{algebra, error::KomodoError, fec}; use fri::{ - frida::{FridaBuilder, FridaCommitment}, + frida::{nth_evaluations, FridaBuilder, FridaCommitment}, rng::FriChallenger, utils::{to_evaluations, HasherExt, MerkleProof}, }; @@ -67,17 +64,22 @@ where Ok(shards .iter() - .map(|s| Block { - shard: s.clone(), - proof: builder.prove_shards(&[s + .map(|s| { + // TODO: compute true position + let position = 0; + let _pos = s .linear_combination .iter() .filter(|x| !x.is_zero()) + .cloned() .collect::<Vec<F>>() .first() - .unwrap() - .into()]), - commit: commit.clone(), + .unwrap(); + Block { + shard: s.clone(), + proof: builder.prove_shards(&[position]), + commit: commit.clone(), + } }) .collect()) } @@ -86,8 +88,6 @@ pub fn verify<const N: usize, F: PrimeField, H: Hasher, P>( block: Block<F, H>, k: usize, domain_size: usize, - blowup_factor: usize, - remainder_plus_one: usize, nb_queries: usize, ) -> Result<(), KomodoError> where @@ -97,14 +97,14 @@ where { block .commit - .verify::<N, _>( - FriChallenger::<H>::default(), - nb_queries, - nb_coeffs, - domain_size, - ) + .verify::<N, _>(FriChallenger::<H>::default(), nb_queries, k, domain_size) .unwrap(); + // TODO: compute true position + let position = 0; + // TODO: compute true evaluations + let evaluations: Vec<Vec<F>> = vec![]; + assert!(block.proof.verify( block.commit.tree_root(), &[position], -- GitLab