Skip to content

Commit

Permalink
decrease visibility of some internal structs and methods
Browse files Browse the repository at this point in the history
  • Loading branch information
jan-ferdinand committed Oct 3, 2023
1 parent 2f3867d commit f25ed35
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 22 deletions.
37 changes: 17 additions & 20 deletions triton-vm/src/table/extension_table.rs
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ pub trait Evaluable<FF: FiniteField> {
}
}

pub trait Quotientable: Evaluable<BFieldElement> {
pub(crate) trait Quotientable: Evaluable<BFieldElement> {
/// Compute the degrees of the quotients from all AIR constraints that apply to the table.
fn all_degrees_with_origin(
table_name: &str,
Expand All @@ -75,12 +75,12 @@ pub trait Quotientable: Evaluable<BFieldElement> {
let initial_degrees_with_origin = Self::initial_quotient_degree_bounds(interpolant_degree)
.into_iter()
.enumerate()
.map(|(i, d)| DegreeWithOrigin {
degree: d,
.map(|(origin_index, degree)| DegreeWithOrigin {
degree,
interpolant_degree,
zerofier_degree: 1,
origin_table_name: table_name.to_owned(),
origin_index: i,
origin_index,
origin_table_height: padded_height,
origin_constraint_type: ConstraintType::Initial,
})
Expand All @@ -90,12 +90,12 @@ pub trait Quotientable: Evaluable<BFieldElement> {
Self::consistency_quotient_degree_bounds(interpolant_degree, padded_height)
.into_iter()
.enumerate()
.map(|(i, d)| DegreeWithOrigin {
degree: d,
.map(|(origin_index, degree)| DegreeWithOrigin {
degree,
interpolant_degree,
zerofier_degree: padded_height as Degree,
origin_table_name: table_name.to_owned(),
origin_index: i,
origin_index,
origin_table_height: padded_height,
origin_constraint_type: ConstraintType::Consistency,
})
Expand All @@ -105,12 +105,12 @@ pub trait Quotientable: Evaluable<BFieldElement> {
Self::transition_quotient_degree_bounds(interpolant_degree, padded_height)
.into_iter()
.enumerate()
.map(|(i, d)| DegreeWithOrigin {
degree: d,
.map(|(origin_index, degree)| DegreeWithOrigin {
degree,
interpolant_degree,
zerofier_degree: padded_height as Degree - 1,
origin_table_name: table_name.to_owned(),
origin_index: i,
origin_index,
origin_table_height: padded_height,
origin_constraint_type: ConstraintType::Transition,
})
Expand All @@ -120,12 +120,12 @@ pub trait Quotientable: Evaluable<BFieldElement> {
Self::terminal_quotient_degree_bounds(interpolant_degree)
.into_iter()
.enumerate()
.map(|(i, d)| DegreeWithOrigin {
degree: d,
.map(|(origin_index, degree)| DegreeWithOrigin {
degree,
interpolant_degree,
zerofier_degree: 1,
origin_table_name: table_name.to_owned(),
origin_index: i,
origin_index,
origin_table_height: padded_height,
origin_constraint_type: ConstraintType::Terminal,
})
Expand Down Expand Up @@ -302,7 +302,7 @@ pub trait Quotientable: Evaluable<BFieldElement> {
/// polynomials. Concretely, the degree of the zerofier polynomials differs between the
/// constraint types.
#[derive(Clone, PartialEq, Eq, PartialOrd, Ord, Debug)]
pub enum ConstraintType {
pub(crate) enum ConstraintType {
Initial,
Consistency,
Transition,
Expand All @@ -323,7 +323,7 @@ impl Display for ConstraintType {
/// Helps debugging and benchmarking. The maximal degree achieved in any table dictates the length
/// of the FRI domain, which in turn is responsible for the main performance bottleneck.
#[derive(Clone, PartialEq, Eq, PartialOrd, Ord, Debug)]
pub struct DegreeWithOrigin {
pub(crate) struct DegreeWithOrigin {
pub degree: Degree,
pub interpolant_degree: Degree,
pub zerofier_degree: Degree,
Expand All @@ -335,12 +335,9 @@ pub struct DegreeWithOrigin {

impl Display for DegreeWithOrigin {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
assert!(self.degree > 0);
let zerofier_corrected_degree = self.degree + self.zerofier_degree;
let degree = if self.interpolant_degree != 0 {
zerofier_corrected_degree / self.interpolant_degree
} else {
zerofier_corrected_degree
};
let degree = zerofier_corrected_degree / self.interpolant_degree;
write!(
f,
"Degree of poly for table {} (index {:02}) of type “{}” is {}.",
Expand Down
4 changes: 2 additions & 2 deletions triton-vm/src/table/master_table.rs
Original file line number Diff line number Diff line change
Expand Up @@ -951,14 +951,14 @@ impl MasterExtTable {
}
}

pub fn all_degrees_with_origin(
pub(crate) fn all_degrees_with_origin(
interpolant_degree: Degree,
padded_height: usize,
) -> Vec<DegreeWithOrigin> {
MasterExtTable::all_degrees_with_origin("master table", interpolant_degree, padded_height)
}

pub fn max_degree_with_origin(
pub(crate) fn max_degree_with_origin(
interpolant_degree: Degree,
padded_height: usize,
) -> DegreeWithOrigin {
Expand Down

0 comments on commit f25ed35

Please sign in to comment.