Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Stark: Prover and Verifier over field extensions #716

Merged
merged 8 commits into from
Dec 18, 2023

Conversation

schouhy
Copy link
Contributor

@schouhy schouhy commented Dec 11, 2023

Prover and Verifier over field extensions

Description

This PR is the first step to support field extensions in the stark prover and verifier.

In summary, this PR

  • Adds associated type FieldExtension to both IsStarkProver and IsStarkVerifier.
  • The prover casts the trace to the field extension at the very beginning of the prove method and continues as before.
  • Implements polynomial operations between polynomials with coefficients in a field and a subfield. This will be needed in a subsequent PR.

There is a followup PR that improves the way the prover handles the trace and avoids casting it to the field extension. This is so dividided in two PRs to make reviewing easier.

Type of change

  • New feature

@codecov-commenter
Copy link

Codecov Report

Attention: 27 lines in your changes are missing coverage. Please review.

Comparison is base (75dd92f) 96.10% compared to head (69aa426) 96.09%.

Files Patch % Lines
math/src/polynomial.rs 73.26% 27 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #716      +/-   ##
==========================================
- Coverage   96.10%   96.09%   -0.02%     
==========================================
  Files         133      133              
  Lines       30052    30166     +114     
==========================================
+ Hits        28882    28987     +105     
- Misses       1170     1179       +9     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@schouhy schouhy marked this pull request as ready for review December 13, 2023 11:15
@schouhy schouhy requested review from ajgara and a team as code owners December 13, 2023 11:15
) -> FieldElement<F>
where
FieldElement<F>: Serializable,
{
loop {
let value: FieldElement<F> = self.sample_field_element();
if !lde_roots_of_unity_coset.iter().any(|x| x == &value)
&& !trace_roots_of_unity.iter().any(|x| x == &value)
if !lde_roots_of_unity_coset
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Given that roots of unity are real for the cases we have, it would suffice to check if the imaginary part is non-zero to know it is an ood point, avoiding the cloning and extension

Copy link
Contributor Author

@schouhy schouhy Dec 13, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

True! But that would work for quadratic extensions only (and would be a sufficient but not necessary condition to be out of the LDE). For the case of Stone the field extension is the prime field itself.
A way to avoid cloning and extending would be to add an eq method to the trait IsSubFieldOf and force subfields to implement efficient comparison with elements of the extension.

math/src/polynomial.rs Outdated Show resolved Hide resolved
Co-authored-by: Mario Rugiero <mrugiero@gmail.com>
@@ -46,7 +51,7 @@ pub fn validate_trace<F: IsFFTField, A: AIR<Field = F>>(
let boundary_value = constraint.value.clone();
let trace_value = trace.get(step, col);

if &boundary_value != trace_value {
if &boundary_value.clone().to_extension() != trace_value {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this clone needed ?

@diegokingston diegokingston added this pull request to the merge queue Dec 18, 2023
Merged via the queue into main with commit 703db8a Dec 18, 2023
7 checks passed
@diegokingston diegokingston deleted the stark-prover-over-field-extensions branch December 18, 2023 14:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants