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

Eval framework asserts #714

Merged
merged 1 commit into from
Jul 14, 2024
Merged

Eval framework asserts #714

merged 1 commit into from
Jul 14, 2024

Conversation

spapinistarkware
Copy link
Contributor

@spapinistarkware spapinistarkware commented Jul 9, 2024

This change is Reviewable

@codecov-commenter
Copy link

codecov-commenter commented Jul 9, 2024

Codecov Report

Attention: Patch coverage is 92.59259% with 4 lines in your changes missing coverage. Please review.

Project coverage is 90.43%. Comparing base (4839cd8) to head (ef45c3c).

Files Patch % Lines
crates/prover/src/constraint_framework/assert.rs 92.59% 3 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##              dev     #714      +/-   ##
==========================================
+ Coverage   90.42%   90.43%   +0.01%     
==========================================
  Files          79       80       +1     
  Lines       10274    10328      +54     
  Branches    10274    10328      +54     
==========================================
+ Hits         9290     9340      +50     
- Misses        901      904       +3     
- Partials       83       84       +1     

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

Copy link
Collaborator

@shaharsamocha7 shaharsamocha7 left a comment

Choose a reason for hiding this comment

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

Reviewed all commit messages.
Reviewable status: 0 of 3 files reviewed, 1 unresolved discussion (waiting on @spapinistarkware)


crates/prover/src/constraint_framework/mod.rs line 2 at r1 (raw file):

/// ! This module contains helpers to express and use constraints for components.
mod assert;

Is this uses only for tests?

Code quote:

mod assert;

Copy link
Collaborator

@shaharsamocha7 shaharsamocha7 left a comment

Choose a reason for hiding this comment

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

Reviewable status: 0 of 3 files reviewed, 3 unresolved discussions (waiting on @spapinistarkware)


crates/prover/src/constraint_framework/assert.rs line 38 at r1 (raw file):

        offsets.map(|off| {
            self.trace[interaction][col_index][(self.row as isize + off)
                .rem_euclid(self.trace[interaction][col_index].len() as isize)

Can you extract this to a variable col_length?
I think it will make it more clear

Maybe also add a comment that the mask overflows

Code quote:

self.trace[interaction][col_index].len() as isize

crates/prover/src/constraint_framework/assert.rs line 48 at r1 (raw file):

    {
        let res = SecureField::one() * constraint;
        assert_eq!(res, SecureField::zero(), "row: {}", self.row);

Add a comment that we expect this to be zero because we evaluate directly on the trace points.
Not sure if it belongs here or in the doc of AssertEvaluator

Code quote:

assert_eq!(res, SecureField::zero(), "row: {}", self.row);

Copy link
Contributor Author

@spapinistarkware spapinistarkware left a comment

Choose a reason for hiding this comment

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

Reviewable status: 0 of 3 files reviewed, 3 unresolved discussions (waiting on @shaharsamocha7)


crates/prover/src/constraint_framework/assert.rs line 38 at r1 (raw file):

Previously, shaharsamocha7 wrote…

Can you extract this to a variable col_length?
I think it will make it more clear

Maybe also add a comment that the mask overflows

Done.


crates/prover/src/constraint_framework/assert.rs line 48 at r1 (raw file):

Previously, shaharsamocha7 wrote…

Add a comment that we expect this to be zero because we evaluate directly on the trace points.
Not sure if it belongs here or in the doc of AssertEvaluator

Done.


crates/prover/src/constraint_framework/mod.rs line 2 at r1 (raw file):

Previously, shaharsamocha7 wrote…

Is this uses only for tests?

It won't be on production. But very useful for debugging, from experience.

Copy link
Collaborator

@shaharsamocha7 shaharsamocha7 left a comment

Choose a reason for hiding this comment

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

Reviewed 3 of 3 files at r2, all commit messages.
Reviewable status: all files reviewed, 2 unresolved discussions (waiting on @spapinistarkware)


crates/prover/src/constraint_framework/assert.rs line 50 at r2 (raw file):

        // Cast to SecureField.
        let res = SecureField::one() * constraint;
        // The constraint should be zero at the given row, since we are evaluating on the trace.

non-blocking

Suggestion:

since we are evaluating on the trace domain.

crates/prover/src/constraint_framework/mod.rs line 2 at r1 (raw file):

Previously, spapinistarkware (Shahar Papini) wrote…

It won't be on production. But very useful for debugging, from experience.

I suggested adding #[cfg(tests)]

Copy link
Contributor Author

@spapinistarkware spapinistarkware left a comment

Choose a reason for hiding this comment

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

Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @shaharsamocha7)


crates/prover/src/constraint_framework/mod.rs line 2 at r1 (raw file):

Previously, shaharsamocha7 wrote…

I suggested adding #[cfg(tests)]

It's useful as a library, so I don't think I want to gate this.

@spapinistarkware spapinistarkware force-pushed the eval_framework_asserts branch 2 times, most recently from d1f2d95 to d4bdc02 Compare July 14, 2024 08:48
Copy link
Collaborator

@shaharsamocha7 shaharsamocha7 left a comment

Choose a reason for hiding this comment

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

:lgtm:

Reviewed 1 of 1 files at r4.
Reviewable status: all files reviewed (commit messages unreviewed), all discussions resolved (waiting on @spapinistarkware)

Copy link
Collaborator

@shaharsamocha7 shaharsamocha7 left a comment

Choose a reason for hiding this comment

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

Reviewable status: all files reviewed (commit messages unreviewed), 1 unresolved discussion (waiting on @spapinistarkware)


crates/prover/src/constraint_framework/assert.rs line 55 at r4 (raw file):

    }

    fn combine_ef(values: [Self::F; 4]) -> Self::EF {

Fix

Suggestion:

    fn combine_ef(values: [Self::F; SECURE_EXTENSION_DEGREE]) -> Self::EF {

Copy link
Collaborator

@shaharsamocha7 shaharsamocha7 left a comment

Choose a reason for hiding this comment

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

Reviewed 1 of 1 files at r5, all commit messages.
Reviewable status: :shipit: complete! all files reviewed, all discussions resolved (waiting on @spapinistarkware)

@spapinistarkware spapinistarkware changed the base branch from eval_framework_point_domain to dev July 14, 2024 12:05
Copy link
Contributor Author

spapinistarkware commented Jul 14, 2024

Merge activity

  • Jul 14, 8:06 AM EDT: Graphite rebased this pull request after merging its parent, because this pull request is set to merge when ready.
  • Jul 14, 8:18 AM EDT: @spapinistarkware started a stack merge that includes this pull request via Graphite.
  • Jul 14, 8:18 AM EDT: @spapinistarkware merged this pull request with Graphite.

@spapinistarkware spapinistarkware merged commit a69e8ca into dev Jul 14, 2024
14 checks passed
@spapinistarkware spapinistarkware mentioned this pull request Aug 7, 2024
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.

3 participants