From 3b79a7362fe2f6d79adb65716654cca3d2a0f8ca Mon Sep 17 00:00:00 2001 From: Jan Ferdinand Sauer Date: Tue, 15 Nov 2022 01:56:43 +0100 Subject: [PATCH] use `fri_domain_generator` instead of `omega` --- triton-vm/src/domain.rs | 8 ++++---- triton-vm/src/fri.rs | 12 ++++++------ triton-vm/src/stark.rs | 4 ++-- 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/triton-vm/src/domain.rs b/triton-vm/src/domain.rs index b9c064c1b..9ea2d1c75 100644 --- a/triton-vm/src/domain.rs +++ b/triton-vm/src/domain.rs @@ -77,13 +77,13 @@ mod domain_tests { let poly = Polynomial::::new(x_squared_coefficients.clone()); for order in [4, 8, 32] { - let omega = BFieldElement::primitive_root_of_unity(order).unwrap(); + let generator = BFieldElement::primitive_root_of_unity(order).unwrap(); let offset = BFieldElement::generator(); - let b_domain = Domain::::new(offset, omega, order as usize); - let x_domain = Domain::::new(offset, omega, order as usize); + let b_domain = Domain::::new(offset, generator, order as usize); + let x_domain = Domain::::new(offset, generator, order as usize); let expected_b_values: Vec = - (0..order).map(|i| offset * omega.mod_pow(i)).collect(); + (0..order).map(|i| offset * generator.mod_pow(i)).collect(); let actual_b_values_1 = b_domain.domain_values(); let actual_b_values_2 = (0..order as u32) .map(|i| b_domain.domain_value(i)) diff --git a/triton-vm/src/fri.rs b/triton-vm/src/fri.rs index 514b9b1c7..5236c8680 100644 --- a/triton-vm/src/fri.rs +++ b/triton-vm/src/fri.rs @@ -57,12 +57,12 @@ pub struct Fri { impl Fri { pub fn new( offset: BFieldElement, - omega: BFieldElement, + fri_domain_generator: BFieldElement, domain_length: usize, expansion_factor: usize, colinearity_checks_count: usize, ) -> Self { - let domain = Domain::new(offset, omega, domain_length); + let domain = Domain::new(offset, fri_domain_generator, domain_length); let _hasher = PhantomData; Self { domain, @@ -346,11 +346,11 @@ impl Fri { let log_2_of_n = log_2_floor(last_codeword.len() as u128) as u32; let mut last_polynomial = last_codeword.clone(); - let last_omega = self + let last_fri_domain_generator = self .domain .generator .mod_pow_u32(2u32.pow(num_rounds as u32)); - intt::(&mut last_polynomial, last_omega, log_2_of_n); + intt::(&mut last_polynomial, last_fri_domain_generator, log_2_of_n); let last_poly_degree: isize = (Polynomial:: { coefficients: last_polynomial, @@ -666,7 +666,7 @@ mod triton_xfri_tests { expansion_factor: usize, colinearity_checks: usize, ) -> Fri { - let omega = BFieldElement::primitive_root_of_unity(subgroup_order).unwrap(); + let fri_domain_generator = BFieldElement::primitive_root_of_unity(subgroup_order).unwrap(); // The following offset was picked arbitrarily by copying the one found in // `get_b_field_fri_test_object`. It does not generate the full Z_p\{0}, but @@ -675,7 +675,7 @@ mod triton_xfri_tests { let fri: Fri = Fri::new( offset, - omega, + fri_domain_generator, subgroup_order as usize, expansion_factor, colinearity_checks, diff --git a/triton-vm/src/stark.rs b/triton-vm/src/stark.rs index e8f734d26..14fedecb8 100644 --- a/triton-vm/src/stark.rs +++ b/triton-vm/src/stark.rs @@ -120,12 +120,12 @@ impl Stark { empty_table_collection.max_degree_with_origin(parameters.num_trace_randomizers); let max_degree = (other::roundup_npo2(max_degree_with_origin.degree as u64) - 1) as i64; let fri_domain_length = parameters.fri_expansion_factor * (max_degree as usize + 1); - let omega = + let fri_domain_generator = BFieldElement::primitive_root_of_unity(fri_domain_length.try_into().unwrap()).unwrap(); let coset_offset = BFieldElement::generator(); let fri = Fri::new( coset_offset, - omega, + fri_domain_generator, fri_domain_length, parameters.fri_expansion_factor, parameters.num_colinearity_checks,