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

verify and ret #166

Merged
merged 1 commit into from
Nov 14, 2024
Merged

verify and ret #166

merged 1 commit into from
Nov 14, 2024

Conversation

ohad-starkware
Copy link
Contributor

@ohad-starkware ohad-starkware commented Nov 13, 2024

This change is Reviewable

This was referenced Nov 13, 2024
Copy link
Contributor Author

ohad-starkware commented Nov 13, 2024

This stack of pull requests is managed by Graphite. Learn more about stacking.

Join @ohad-starkware and the rest of your teammates on Graphite Graphite

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


stwo_cairo_prover/crates/prover/src/components/ret_opcode/prover.rs line 39 at r1 (raw file):

        let cpu_inputs = cpu_inputs
            .into_iter()
            .map(|VmState { pc, ap, fp }| CasmState {

This should be rename to VmState

Code quote:

CasmState

stwo_cairo_prover/crates/prover/src/components/ret_opcode/prover.rs line 278 at r1 (raw file):

                M31_0,
                M31_0,
                M31_0,

I thought we got rid of those

Code quote:

                M31_0,
                M31_0,
                M31_0,
                M31_0,
                M31_0,
                M31_0,
                M31_0,
                M31_0,
                M31_0,
                M31_0,
                M31_0,
                M31_0,
                M31_0,
                M31_0,
                M31_0,
                M31_0,
                M31_0,
                M31_0,
                M31_0,
                M31_0,
                M31_0,
                M31_0,
                M31_0,
                M31_0,
                M31_0,

stwo_cairo_prover/crates/prover/src/cairo_air/mod.rs line 346 at r1 (raw file):

        memory_id_to_value_trace_generator
            .write_trace(&mut tree_builder, &mut range_check_9_9_trace_generator);
    let (vi_claim, verify_instruction_interaction_generator) = verify_instruction_trace_generator

maybe we want to shorten all the names, but let's be consistent for now and rethink in the future.

Suggestion:

verify_instruction_claim

stwo_cairo_prover/crates/prover/src/components/mod.rs line 11 at r1 (raw file):

pub mod verifyinstruction;

pub fn pack_values<T: Pack>(values: &[T]) -> Vec<T::SimdType> {

Is this Pack trait new?
Are we going to implement it for every type?
I wonder if this function should be near the trait declaration itself

Code quote:

pub fn pack_values<T: Pack>(values: &[T]) -> Vec<T::SimdType> {

stwo_cairo_prover/crates/prover/src/components/ret_opcode/component.rs line 75 at r1 (raw file):

impl InteractionClaim {
    pub fn mix_into(&self, channel: &mut impl Channel) {
        // TODO(Ohad): mix claimed_sum.

Can't you implement this TODO now?

Code quote:

// TODO(Ohad): mix claimed_sum.

stwo_cairo_prover/crates/prover/src/components/opcodes/mod.rs line 3 at r1 (raw file):

use stwo_prover::constraint_framework::logup::LookupElements;

pub type RelationElements = LookupElements<3>;

Add a comment that this refers to the VmState?
Actually, why the VmState isn't defined here?

Suggestion:

pub type VmRelationElements = LookupElements<3>;

Copy link
Contributor Author

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


stwo_cairo_prover/crates/prover/src/cairo_air/mod.rs line 346 at r1 (raw file):

Previously, shaharsamocha7 wrote…

maybe we want to shorten all the names, but let's be consistent for now and rethink in the future.

Done.


stwo_cairo_prover/crates/prover/src/components/mod.rs line 11 at r1 (raw file):

Previously, shaharsamocha7 wrote…

Is this Pack trait new?
Are we going to implement it for every type?
I wonder if this function should be near the trait declaration itself

it's a trait in stwo, already implemented recursively for every type that is M31- based (arrays, tupples, array of tupples etc.).
do you think the function also belongs in two? I'm not sure, using this as a utility here.


stwo_cairo_prover/crates/prover/src/components/opcodes/mod.rs line 3 at r1 (raw file):

Previously, shaharsamocha7 wrote…

Add a comment that this refers to the VmState?
Actually, why the VmState isn't defined here?

CasmState - defined by the air team as a prover type,
we should kill papini's vmstate and rename CasmState to VmState, but that would take coordinating with the air team


stwo_cairo_prover/crates/prover/src/components/ret_opcode/component.rs line 75 at r1 (raw file):

Previously, shaharsamocha7 wrote…

Can't you implement this TODO now?

done


stwo_cairo_prover/crates/prover/src/components/ret_opcode/prover.rs line 39 at r1 (raw file):

Previously, shaharsamocha7 wrote…

This should be rename to VmState

same answer as above


stwo_cairo_prover/crates/prover/src/components/ret_opcode/prover.rs line 278 at r1 (raw file):

Previously, shaharsamocha7 wrote…

I thought we got rid of those

in constraints yes
trace_gen is a bit more tricky, because I'm generating the struct appropriately, and it would mean inlining the arrays in lookup_data
here there's only one call to verify so should be okay, changed manually.

Copy link
Contributor Author

@ohad-starkware ohad-starkware 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: 7 of 13 files reviewed, 6 unresolved discussions (waiting on @shaharsamocha7)


stwo_cairo_prover/crates/prover/src/components/ret_opcode/prover.rs line 278 at r1 (raw file):

Previously, ohad-starkware (Ohad) wrote…

in constraints yes
trace_gen is a bit more tricky, because I'm generating the struct appropriately, and it would mean inlining the arrays in lookup_data
here there's only one call to verify so should be okay, changed manually.

onecall to memory**

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


stwo_cairo_prover/crates/prover/src/components/mod.rs line 11 at r1 (raw file):

Previously, ohad-starkware (Ohad) wrote…

it's a trait in stwo, already implemented recursively for every type that is M31- based (arrays, tupples, array of tupples etc.).
do you think the function also belongs in two? I'm not sure, using this as a utility here.

I think this function should be near the trait.
Not sure any of those belong to Stwo TBH


stwo_cairo_prover/crates/prover/src/components/opcodes/mod.rs line 3 at r1 (raw file):

Previously, ohad-starkware (Ohad) wrote…

CasmState - defined by the air team as a prover type,
we should kill papini's vmstate and rename CasmState to VmState, but that would take coordinating with the air team

ok, let's send them a message about that


stwo_cairo_prover/crates/prover/src/components/verifyinstruction/component.rs line 93 at r2 (raw file):

pub struct InteractionClaim {
    pub total_sum: SecureField,
    pub claimed_sum: Option<ClaimedPrefixSum>,

AlonT pr has new type names LogupSums
pub type LogupSums = (SecureField, Option<ClaimedPrefixSum>);

We should consider to integrate with that, not for this pr

Code quote:

    pub total_sum: SecureField,
    pub claimed_sum: Option<ClaimedPrefixSum>,

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.

Reviewable status: all files reviewed, 4 unresolved discussions (waiting on @ohad-starkware)


stwo_cairo_prover/crates/prover/src/components/verifyinstruction/prover.rs line 310 at r1 (raw file):

                M31_0,
                M31_0,
                M31_0,

I don't think we want to do this manual changes.
We will probably generate those files again, so we want to track the changes

Code quote:

                    + ((input_col18) * (M31_256))),
                M31_0,
                M31_0,
                M31_0,
                M31_0,
                M31_0,
                M31_0,
                M31_0,
                M31_0,
                M31_0,
                M31_0,
                M31_0,
                M31_0,
                M31_0,
                M31_0,
                M31_0,
                M31_0,
                M31_0,
                M31_0,
                M31_0,
                M31_0,
                M31_0,

@ohad-starkware ohad-starkware changed the base branch from ohad/memory_small_table to graphite-base/166 November 14, 2024 11:35
@ohad-starkware ohad-starkware changed the base branch from graphite-base/166 to main November 14, 2024 12:17
Copy link
Contributor Author

@ohad-starkware ohad-starkware 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: 12 of 13 files reviewed, 4 unresolved discussions (waiting on @shaharsamocha7)


stwo_cairo_prover/crates/prover/src/components/mod.rs line 11 at r1 (raw file):

Previously, shaharsamocha7 wrote…

I think this function should be near the trait.
Not sure any of those belong to Stwo TBH

they both belong in "stwo_air_utils", but it doesn't exist


stwo_cairo_prover/crates/prover/src/components/opcodes/mod.rs line 3 at r1 (raw file):

Previously, shaharsamocha7 wrote…

ok, let's send them a message about that

sent


stwo_cairo_prover/crates/prover/src/components/verifyinstruction/component.rs line 93 at r2 (raw file):

Previously, shaharsamocha7 wrote…

AlonT pr has new type names LogupSums
pub type LogupSums = (SecureField, Option<ClaimedPrefixSum>);

We should consider to integrate with that, not for this pr

will consider


stwo_cairo_prover/crates/prover/src/components/verifyinstruction/prover.rs line 310 at r1 (raw file):

Previously, shaharsamocha7 wrote…

I don't think we want to do this manual changes.
We will probably generate those files again, so we want to track the changes

reverted

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.

:lgtm:

Reviewed 1 of 1 files at r3, all commit messages.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @ohad-starkware)


stwo_cairo_prover/crates/prover/src/components/mod.rs line 11 at r1 (raw file):

Previously, ohad-starkware (Ohad) wrote…

they both belong in "stwo_air_utils", but it doesn't exist

so, TODO?

Copy link
Contributor Author

ohad-starkware commented Nov 14, 2024

Merge activity

  • Nov 14, 8:43 AM EST: A user started a stack merge that includes this pull request via Graphite.
  • Nov 14, 8:43 AM EST: A user merged this pull request with Graphite.

@ohad-starkware ohad-starkware merged commit 9189828 into main Nov 14, 2024
4 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.

2 participants