pub const LOOKUP_LABEL: &str = "lookup-challenge";
pub const COMPOSITION_LABEL: &str = "constraint-composition";
pub const OUT_OF_DOMAIN_LABEL: &str = "out-of-domain";
pub const DEEP_COMPOSITION_LABEL: &str = "deep-composition";
pub const FOLDING_LABEL: &str = "fri-folding";
pub const QUERY_LABEL: &str = "fri-query";
pub const COLLISION_LABEL: &str = "commitment-collision";
pub const NUM_TERMS: usize = 7;
#[derive(Copy, Clone, Debug, PartialEq, Eq)]
pub struct SecurityTerm {
pub label: &'static str,
pub bits: u64,
}
impl SecurityTerm {
pub const fn new(label: &'static str, bits: u64) -> Self {
Self { label, bits }
}
}
#[derive(Copy, Clone, Debug, PartialEq, Eq)]
pub struct SecurityReport {
terms: [SecurityTerm; NUM_TERMS],
}
impl SecurityReport {
pub const fn new(terms: [SecurityTerm; NUM_TERMS]) -> Self {
Self { terms }
}
pub const fn terms(&self) -> &[SecurityTerm; NUM_TERMS] {
&self.terms
}
pub const fn binding_term(&self) -> SecurityTerm {
let mut binding = self.terms[0];
let mut index = 1;
while index < NUM_TERMS {
if self.terms[index].bits < binding.bits {
binding = self.terms[index];
}
index += 1;
}
binding
}
pub const fn attained(&self) -> u64 {
self.binding_term().bits
}
pub const fn security_level(&self) -> u32 {
crate::fixed::to_bits(self.attained())
}
}