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

Add constraint for Logup claimed cumsum #830

Merged
merged 1 commit into from
Sep 25, 2024

Conversation

shaharsamocha7
Copy link
Collaborator

@shaharsamocha7 shaharsamocha7 commented Sep 10, 2024

Add optional constraint for logup claimed sum
The constraint applies only in case that the claimed_sum is not the total sum
Uses for padding components with default rows


This change is Reviewable

@codecov-commenter
Copy link

codecov-commenter commented Sep 10, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 92.21%. Comparing base (69bcf5e) to head (8ba2299).
Report is 3 commits behind head on dev.

Additional details and impacted files
@@            Coverage Diff             @@
##              dev     #830      +/-   ##
==========================================
+ Coverage   92.15%   92.21%   +0.06%     
==========================================
  Files          90       90              
  Lines       12306    12322      +16     
  Branches    12306    12322      +16     
==========================================
+ Hits        11340    11363      +23     
+ Misses        860      853       -7     
  Partials      106      106              
Flag Coverage Δ
92.21% <100.00%> (+0.06%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

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

@shaharsamocha7 shaharsamocha7 force-pushed the 09-09-Logup_generator_returns_multiple_prefix_sums branch from b3f754b to 4c3990c Compare September 17, 2024 11:01
@shaharsamocha7 shaharsamocha7 force-pushed the 09-10-Add_constraint_for_Logup_claimed_cumsum branch from 62fbf19 to 536f8f9 Compare September 17, 2024 11:01
@shaharsamocha7 shaharsamocha7 force-pushed the 09-09-Logup_generator_returns_multiple_prefix_sums branch from 4c3990c to 45206e8 Compare September 17, 2024 14:43
@shaharsamocha7 shaharsamocha7 force-pushed the 09-10-Add_constraint_for_Logup_claimed_cumsum branch from 536f8f9 to da54d68 Compare September 17, 2024 15:10
@shaharsamocha7 shaharsamocha7 marked this pull request as ready for review September 17, 2024 15:25
Copy link
Contributor

@andrewmilson andrewmilson 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 6 files reviewed, 1 unresolved discussion (waiting on @Alon-Ti and @shaharsamocha7)


crates/prover/src/constraint_framework/logup.rs line 84 at r2 (raw file):

            Some((claimed_sum, claimed_row_index)) => {
                let [cur_cumsum, prev_row_cumsum, claimed_cumsum] = eval
                    .next_extension_interaction_mask(self.interaction, [0, -1, claimed_row_index]);

It's more efficient using is_first column and doing the constraint with cur_cumsum and a row selector

Copy link
Contributor

@Alon-Ti Alon-Ti 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 6 files at r1, 3 of 3 files at r2, all commit messages.
Reviewable status: all files reviewed, 2 unresolved discussions (waiting on @shaharsamocha7)


crates/prover/src/constraint_framework/logup.rs line 104 at r2 (raw file):

        // Constrain that the claimed_sum in case that it is not equal to the total_sum.
        if let Some((claimed_cumsum, claimed_sum)) = claimed_cumsum {

Move this to the match above.

@shaharsamocha7 shaharsamocha7 force-pushed the 09-09-Logup_generator_returns_multiple_prefix_sums branch from 45206e8 to 4a63b70 Compare September 22, 2024 10:14
@shaharsamocha7 shaharsamocha7 force-pushed the 09-10-Add_constraint_for_Logup_claimed_cumsum branch 2 times, most recently from cef3cc6 to f6fc394 Compare September 22, 2024 10:23
Copy link
Collaborator Author

@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: 5 of 6 files reviewed, 2 unresolved discussions (waiting on @Alon-Ti and @andrewmilson)


crates/prover/src/constraint_framework/logup.rs line 84 at r2 (raw file):

Previously, andrewmilson (Andrew Milson) wrote…

It's more efficient using is_first column and doing the constraint with cur_cumsum and a row selector

Added a TODO.


crates/prover/src/constraint_framework/logup.rs line 104 at r2 (raw file):

Previously, Alon-Ti wrote…

Move this to the match above.

Done.

Copy link
Contributor

@andrewmilson andrewmilson 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: 5 of 6 files reviewed, 3 unresolved discussions (waiting on @Alon-Ti and @shaharsamocha7)


crates/prover/src/constraint_framework/logup.rs line 26 at r3 (raw file):

/// Represents the value of the prefix sum column at some index.
/// Should be used to eliminate padded rows for the logup sum.
pub type ClaimedPrefixSum = (SecureField, isize);

Would there ever be a negative index?

Suggestion:

usize

Copy link
Collaborator Author

@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: 5 of 6 files reviewed, 3 unresolved discussions (waiting on @Alon-Ti and @andrewmilson)


crates/prover/src/constraint_framework/logup.rs line 26 at r3 (raw file):

Previously, andrewmilson (Andrew Milson) wrote…

Would there ever be a negative index?

You can also feed negative numbers if you want (as the domain is cyclic)
I can change it to usize, but there would be a cast afterwords because next_extension_interaction_mask gets a list of isize.
Should I make the change?

Copy link
Contributor

@andrewmilson andrewmilson 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: 5 of 6 files reviewed, 2 unresolved discussions (waiting on @Alon-Ti and @shaharsamocha7)


crates/prover/src/constraint_framework/logup.rs line 26 at r3 (raw file):

Previously, shaharsamocha7 wrote…

You can also feed negative numbers if you want (as the domain is cyclic)
I can change it to usize, but there would be a cast afterwords because next_extension_interaction_mask gets a list of isize.
Should I make the change?

Given it's an index I think it should be usize. Offsets make sense as isize so I think it's better to be usize here and to cast to isize when it's needed as an offset

@shaharsamocha7 shaharsamocha7 force-pushed the 09-09-Logup_generator_returns_multiple_prefix_sums branch from 4a63b70 to 93e7e51 Compare September 24, 2024 07:34
@shaharsamocha7 shaharsamocha7 force-pushed the 09-10-Add_constraint_for_Logup_claimed_cumsum branch from f6fc394 to 81e8174 Compare September 24, 2024 07:34
Copy link
Contributor

@Alon-Ti Alon-Ti 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 3 of 3 files at r4, all commit messages.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @shaharsamocha7)

@shaharsamocha7 shaharsamocha7 force-pushed the 09-10-Add_constraint_for_Logup_claimed_cumsum branch from 81e8174 to cbe1dd7 Compare September 24, 2024 10:55
Copy link
Collaborator Author

@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: 4 of 6 files reviewed, 1 unresolved discussion (waiting on @Alon-Ti and @andrewmilson)


crates/prover/src/constraint_framework/logup.rs line 26 at r3 (raw file):

Previously, andrewmilson (Andrew Milson) wrote…

Given it's an index I think it should be usize. Offsets make sense as isize so I think it's better to be usize here and to cast to isize when it's needed as an offset

Done.

@shaharsamocha7 shaharsamocha7 force-pushed the 09-09-Logup_generator_returns_multiple_prefix_sums branch from 93e7e51 to c011bab Compare September 24, 2024 11:21
@shaharsamocha7 shaharsamocha7 force-pushed the 09-10-Add_constraint_for_Logup_claimed_cumsum branch from cbe1dd7 to 257a05a Compare September 24, 2024 11:21
@shaharsamocha7 shaharsamocha7 force-pushed the 09-09-Logup_generator_returns_multiple_prefix_sums branch 2 times, most recently from 51bde84 to ee7ec83 Compare September 24, 2024 11:32
@shaharsamocha7 shaharsamocha7 force-pushed the 09-10-Add_constraint_for_Logup_claimed_cumsum branch from 257a05a to aa70c61 Compare September 24, 2024 11:32
@shaharsamocha7 shaharsamocha7 changed the base branch from 09-09-Logup_generator_returns_multiple_prefix_sums to graphite-base/830 September 24, 2024 12:49
@shaharsamocha7 shaharsamocha7 force-pushed the 09-10-Add_constraint_for_Logup_claimed_cumsum branch from aa70c61 to 97d0f88 Compare September 24, 2024 12:49
@shaharsamocha7 shaharsamocha7 changed the base branch from graphite-base/830 to dev September 24, 2024 12:50
@shaharsamocha7 shaharsamocha7 force-pushed the 09-10-Add_constraint_for_Logup_claimed_cumsum branch from 97d0f88 to 92540c0 Compare September 24, 2024 12:50
@shaharsamocha7 shaharsamocha7 force-pushed the 09-10-Add_constraint_for_Logup_claimed_cumsum branch from 92540c0 to 8ba2299 Compare September 24, 2024 13:41
Copy link
Contributor

@andrewmilson andrewmilson left a comment

Choose a reason for hiding this comment

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

:lgtm:

Reviewable status: 3 of 6 files reviewed, 1 unresolved discussion (waiting on @Alon-Ti)

@shaharsamocha7 shaharsamocha7 merged commit f1f1d18 into dev Sep 25, 2024
15 of 16 checks passed
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.

4 participants