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

Implement ComponentProver for RangeCheckUnitComponent. #13

Merged

Conversation

alonh5
Copy link
Contributor

@alonh5 alonh5 commented Jul 9, 2024

This change is Reviewable

@alonh5 alonh5 requested a review from shaharsamocha7 July 9, 2024 14:45
Copy link
Contributor

@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 4 of 6 files at r1, all commit messages.
Reviewable status: 4 of 6 files reviewed, 6 unresolved discussions (waiting on @alonh5)


stwo_cairo_prover/rustfmt.toml line 1 at r1 (raw file):

# See: https://rust-lang.github.io/rustfmt

Can you merge it in a separate pr?


stwo_cairo_prover/src/components/mod.rs line 1 at r1 (raw file):

pub mod range_check;

Why?
Do you think we'll put here the other range checks?

Code quote:

pub mod range_check;

stwo_cairo_prover/src/components/range_check/component_prover.rs line 24 at r1 (raw file):

        accum: &mut ColumnAccumulator<'_, CpuBackend>,
        interaction_elements: &InteractionElements,
        _lookup_values: &LookupValues,

Remove

Code quote:

        _lookup_values: &LookupValues,

stwo_cairo_prover/src/components/range_check/mod.rs line 29 at r1 (raw file):

    pub fn register_test_rc() -> ComponentGenerationRegistry {
        let mut registry = ComponentGenerationRegistry::default();

Consider to get a mut registry as input and register to it.

Code quote:

let mut registry = ComponentGenerationRegistry::default();

stwo_cairo_prover/src/components/range_check/mod.rs line 139 at r1 (raw file):

        // let verifier_channel =
        //     &mut Blake2sChannel::new(Blake2sHasher::hash(BaseField::into_slice(&[])));
        // verify(proof, &air.to_air_prover(), verifier_channel).unwrap();

Verify doesn't work?

Code quote:

        // verify(proof, &air.to_air_prover(), verifier_channel).unwrap();

stwo_cairo_prover/src/components/range_check/component.rs line 77 at r1 (raw file):

    ) -> TreeVec<ColumnVec<Vec<CirclePoint<SecureField>>>> {
        TreeVec::new(vec![
            fixed_mask_points(&vec![vec![0_usize]; 2], point),

Was it a bug? the 2 change

Code quote:

fixed_mask_points(&vec![vec![0_usize]; 2], point),

Copy link
Contributor Author

@alonh5 alonh5 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, 6 unresolved discussions (waiting on @shaharsamocha7)


stwo_cairo_prover/rustfmt.toml line 1 at r1 (raw file):

Previously, shaharsamocha7 wrote…

Can you merge it in a separate pr?

Done.


stwo_cairo_prover/src/components/mod.rs line 1 at r1 (raw file):

Previously, shaharsamocha7 wrote…

Why?
Do you think we'll put here the other range checks?

This is where we'll declare each component model. I'm not sure if that answers the question.


stwo_cairo_prover/src/components/range_check/component_prover.rs line 24 at r1 (raw file):

Previously, shaharsamocha7 wrote…

Remove

Done.


stwo_cairo_prover/src/components/range_check/mod.rs line 29 at r1 (raw file):

Previously, shaharsamocha7 wrote…

Consider to get a mut registry as input and register to it.

Done.


stwo_cairo_prover/src/components/range_check/mod.rs line 139 at r1 (raw file):

Previously, shaharsamocha7 wrote…

Verify doesn't work?

It does, forgot to uncomment.


stwo_cairo_prover/src/components/range_check/component.rs line 77 at r1 (raw file):

Previously, shaharsamocha7 wrote…

Was it a bug? the 2 change

Yes there are 2 columns and not 1.

@alonh5 alonh5 force-pushed the 07-07-implement_component_for_rangecheckunitcomponent branch from 5fe74b3 to 7a7ccc6 Compare July 10, 2024 10:46
@alonh5 alonh5 force-pushed the 07-09-implement_componentprover_for_rangecheckunitcomponent branch from 2a5c91e to 86e955f Compare July 10, 2024 10:46
@alonh5 alonh5 force-pushed the 07-07-implement_component_for_rangecheckunitcomponent branch from 7a7ccc6 to 5a3f6c8 Compare July 10, 2024 10:58
@alonh5 alonh5 force-pushed the 07-09-implement_componentprover_for_rangecheckunitcomponent branch from 86e955f to e7109d3 Compare July 10, 2024 10:58
@alonh5 alonh5 mentioned this pull request Jul 10, 2024
@alonh5 alonh5 force-pushed the 07-07-implement_component_for_rangecheckunitcomponent branch from 5a3f6c8 to e0f48d2 Compare July 10, 2024 11:04
@alonh5 alonh5 force-pushed the 07-09-implement_componentprover_for_rangecheckunitcomponent branch from e7109d3 to dbcd5a7 Compare July 10, 2024 11:04
Copy link
Contributor

@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 5 files at r2, all commit messages.
Reviewable status: 2 of 6 files reviewed, all discussions resolved

@alonh5 alonh5 force-pushed the 07-07-implement_component_for_rangecheckunitcomponent branch from e0f48d2 to 9e6c006 Compare July 11, 2024 07:24
Copy link
Contributor

@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.

Reviewed 1 of 6 files at r1, 5 of 5 files at r2, all commit messages.
Reviewable status: all files reviewed, 2 unresolved discussions (waiting on @alonh5)


stwo_cairo_prover/src/components/range_check_unit/component_prover.rs line 16 at r2 (raw file):

use super::component::{RangeCheckUnitComponent, RC_Z};

impl RangeCheckUnitComponent {

Let's try to put impls on structs only near the struct definition. Here, you can make this a function instead of a method (i.e., not inside an impl).


stwo_cairo_prover/src/components/range_check_unit/component_prover.rs line 17 at r2 (raw file):

impl RangeCheckUnitComponent {
    fn evaluate_lookup_boundary_constraints(

Bring this function down, after its use. This is not the first thing the reader should see in this file.

@alonh5 alonh5 force-pushed the 07-09-implement_componentprover_for_rangecheckunitcomponent branch from dbcd5a7 to e03e436 Compare July 11, 2024 11:57
@alonh5 alonh5 changed the base branch from 07-07-implement_component_for_rangecheckunitcomponent to main July 11, 2024 11:57
This was referenced Jul 11, 2024
Copy link
Contributor Author

@alonh5 alonh5 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, 2 unresolved discussions (waiting on @spapinistarkware)


stwo_cairo_prover/src/components/range_check_unit/component_prover.rs line 16 at r2 (raw file):

Previously, spapinistarkware (Shahar Papini) wrote…

Let's try to put impls on structs only near the struct definition. Here, you can make this a function instead of a method (i.e., not inside an impl).

I removed this impl in a later PR (18).


stwo_cairo_prover/src/components/range_check_unit/component_prover.rs line 17 at r2 (raw file):

Previously, spapinistarkware (Shahar Papini) wrote…

Bring this function down, after its use. This is not the first thing the reader should see in this file.

I removed this function altogether in said PR (18).

Copy link
Contributor

@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, 2 unresolved discussions (waiting on @alonh5)


stwo_cairo_prover/src/components/range_check_unit/component_prover.rs line 16 at r2 (raw file):

Previously, alonh5 (Alon Haramati) wrote…

I removed this impl in a later PR (18).

But right now it's not near the component, and I will surely forget to check it by then.
Can you juse make it a function here instead? Shouldn't eb a lot of work

Copy link
Contributor

@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, 2 unresolved discussions (waiting on @alonh5)


stwo_cairo_prover/src/components/range_check_unit/component_prover.rs line 17 at r2 (raw file):

Previously, alonh5 (Alon Haramati) wrote…

I removed this function altogether in said PR (18).

Can you do it now?

@alonh5 alonh5 force-pushed the 07-09-implement_componentprover_for_rangecheckunitcomponent branch from e03e436 to 7af1f0d Compare July 14, 2024 10:32
Copy link
Contributor Author

@alonh5 alonh5 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, 2 unresolved discussions (waiting on @spapinistarkware)


stwo_cairo_prover/src/components/range_check_unit/component_prover.rs line 16 at r2 (raw file):

Previously, spapinistarkware (Shahar Papini) wrote…

But right now it's not near the component, and I will surely forget to check it by then.
Can you juse make it a function here instead? Shouldn't eb a lot of work

Done.


stwo_cairo_prover/src/components/range_check_unit/component_prover.rs line 17 at r2 (raw file):

Previously, spapinistarkware (Shahar Papini) wrote…

Can you do it now?

Done.

Copy link
Contributor

@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.

:lgtm:

Reviewed 5 of 5 files at r3, all commit messages.
Reviewable status: :shipit: complete! all files reviewed, all discussions resolved (waiting on @alonh5)

@alonh5 alonh5 merged commit 01abfb0 into main Jul 14, 2024
4 checks passed
@alonh5 alonh5 deleted the 07-09-implement_componentprover_for_rangecheckunitcomponent branch July 14, 2024 12:02
@alonh5 alonh5 restored the 07-09-implement_componentprover_for_rangecheckunitcomponent branch July 14, 2024 12:03
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