Skip to main content

slop_primitives/
lib.rs

1use core::marker::PhantomData;
2
3#[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Hash)]
4pub struct FriConfig<F> {
5    pub log_blowup: usize,
6    pub num_queries: usize,
7    pub proof_of_work_bits: usize,
8    _marker: PhantomData<F>,
9}
10
11impl<F> Copy for FriConfig<F> {}
12
13impl<F> Clone for FriConfig<F> {
14    fn clone(&self) -> Self {
15        *self
16    }
17}
18
19impl<F> FriConfig<F> {
20    #[inline]
21    pub const fn new(log_blowup: usize, num_queries: usize, proof_of_work_bits: usize) -> Self {
22        Self { log_blowup, num_queries, proof_of_work_bits, _marker: PhantomData }
23    }
24
25    /// This FRI config relies on a conjecture for achieving 100 bits of security. Given Gruen and
26    /// Diamond's recent result, we have increased the number of queries to 94 to be on the safe
27    /// side. (With the original conjecture, we would achieve 100 bits of security with 84
28    /// queries and 16 bits of grinding.)
29    pub fn default_fri_config() -> Self {
30        Self::new(1, 94, 16)
31    }
32
33    #[inline]
34    pub const fn log_blowup(&self) -> usize {
35        self.log_blowup
36    }
37
38    #[inline]
39    pub const fn num_queries(&self) -> usize {
40        self.num_queries
41    }
42
43    #[inline]
44    pub const fn proof_of_work_bits(&self) -> usize {
45        self.proof_of_work_bits
46    }
47}