8000 fix is_small_add by Stavbe · Pull Request #989 · starkware-libs/stwo-cairo · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

fix is_small_add #989

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

Merged
merged 1 commit into from
Jun 15, 2025
Merged

fix is_small_add #989

merged 1 commit into from
Jun 15, 2025

Conversation

Stavbe
Copy link
Contributor
@Stavbe Stavbe commented Jun 10, 2025

This change is Reviewable

@Stavbe Stavbe marked this pull request as ready for review June 10, 2025 15:48
Copy link
Contributor Author
Stavbe commented Jun 10, 2025

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

@Stavbe Stavbe self-assigned this Jun 10, 2025
@Stavbe Stavbe force-pushed the stav/fix_is_small_add branch from 59cbc54 to 592a940 Compare June 10, 2025 15:51
Copy link
Collaborator
@ohad-agadi ohad-agadi 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 2 files at r1, all commit messages.
Reviewable status: 1 of 2 files reviewed, 5 unresolved discussions (waiting on @DavidLevitGurevich)


stwo_cairo_prover/crates/adapter/src/opcodes.rs line 17 at r2 (raw file):

// Small add operands are 27 bits.
const SMALL_ADD_MAX_VALUE: u128 = 2_u128.pow(27) - 1;

u128 probably shouldnt appear anywhere in this context
the bounds should either be defined by [u32;8], or be projected to a range (טווח) that makes sense - in the small add case that is i32


stwo_cairo_prover/crates/adapter/src/opcodes.rs line 700 at r2 (raw file):

fn is_small_add(dst: MemoryValue, op0: MemoryValue, op_1: MemoryValue) -> bool {
    [dst, op0, op_1].iter().all(|val| {
        match val {

I think you should delegate this to a function and test it specifically


stwo_cairo_prover/crates/adapter/src/opcodes.rs line 707 at r2 (raw file):

                let val = limbs_to_u128(felt252[0..4].try_into().unwrap());
                val <= SMALL_ADD_MAX_VALUE
            }

I think you can delete, the 3rd case should cover every possible value


stwo_cairo_prover/crates/adapter/src/opcodes.rs line 712 at r2 (raw file):

                let val_be = val.iter().rev();
                let p_min_1_be = P_MIN_1.iter().rev();
                let p_min_2_to_27_be = P_MIN_2_TO_27.iter().rev();

iterate in reverse?

Code quote:

                let val_be = val.iter().rev();
                let p_min_1_be = P_MIN_1.iter().rev();
                let p_min_2_to_27_be = P_MIN_2_TO_27.iter().rev();

stwo_cairo_prover/crates/adapter/src/opcodes.rs line 718 at r2 (raw file):

                    val_be.clone().cmp(p_min_2_to_27_be),
                    Ordering::Greater | Ordering::Equal
                ) && matches!(val_be.cmp(p_min_1_be), Ordering::Less | Ordering::Equal)

name the two variables

Code quote:

                // For small negative we check that operands are in the range [P-2^27, P-1].
                matches!(
                    val_be.clone().cmp(p_min_2_to_27_be),
                    Ordering::Greater | Ordering::Equal
                ) && matches!(val_be.cmp(p_min_1_be), Ordering::Less | Ordering::Equal)

stwo_cairo_prover/crates/adapter/src/opcodes.rs line 1072 at r2 (raw file):

        let casm_states_by_opcode =
            CasmStatesByOpcode::from_iter([trace_entry].into_iter(), &memory_builder);
        assert_eq!(casm_states_by_opcode.add_opcode_small.len(), 1);

Suggestion:

        memory_builder.set(fp, MemoryValue::F252(P_MIN_1));
        memory_builder.set(fp + 2, MemoryValue::F252(P_MIN_2));
        let trace_entry = relocated_trace_entry!(ap as usize, fp as usize, pc as usize);
        
        let casm_states_by_opcode =
            CasmStatesByOpcode::from_iter([trace_entry].into_iter(), &memory_builder);
            
        assert_eq!(casm_states_by_opcode.add_opcode_small.len(), 1);

@ohad-agadi
Copy link
Collaborator

stwo_cairo_prover/crates/adapter/src/opcodes.rs line 712 at r2 (raw file):

Previously, ohad-agadi (Ohad) wrote…

iterate in reverse?

I take that back

@Stavbe Stavbe force-pushed the stav/fix_is_small_add branch from 592a940 to ab90194 Compare June 11, 2025 08:56
Copy link
Contributor Author
@Stavbe Stavbe 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: 1 of 4 files reviewed, 4 unresolved discussions (waiting on @DavidLevitGurevich and @ohad-agadi)


stwo_cairo_prover/crates/adapter/src/opcodes.rs line 17 at r2 (raw file):

Previously, ohad-agadi (Ohad) wrote…

u128 probably shouldnt appear anywhere in this context
the bounds should either be defined by [u32;8], or be projected to a range (טווח) that makes sense - in the small add case that is i32

But small values are defined as u128, I want to put a bound that speaks the same language. Why to have an extra casting?


stwo_cairo_prover/crates/adapter/src/opcodes.rs line 700 at r2 (raw file):

Previously, ohad-agadi (Ohad) wrote…

I think you should delegate this to a function and test it specifically

what do you mean? It is already a separate function. added tests


stwo_cairo_prover/crates/adapter/src/opcodes.rs line 707 at r2 (raw file):

Previously, ohad-agadi (Ohad) wrote…

I think you can delete, the 3rd case should cover every possible value

If small values can be stored in F252 (as you said can happen), it won't catch it (for example, zero).
If you promise that small values are in MemoryValue::Small, it can be deleted.


stwo_cairo_prover/crates/adapter/src/opcodes.rs line 718 at r2 (raw file):

Previously, ohad-agadi (Ohad) wrote…

name the two variables

which ? val_be.clone().cmp(p_min_2_to_27_be) ? this ? How?

@Stavbe Stavbe requested a review from anatgstarkware June 11, 2025 08:57
Copy link
Collaborator
@ohad-agadi ohad-agadi 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: 1 of 4 files reviewed, 4 unresolved discussions (waiting on @anatgstarkware, @DavidLevitGurevich, and @Stavbe)


stwo_cairo_prover/crates/adapter/src/opcodes.rs line 17 at r2 (raw file):

Previously, Stavbe wrote…

But small values are defined as u128, I want to put a bound that speaks the same language. Why to have an extra casting?

because the u128 is implementation and not API


stwo_cairo_prover/crates/adapter/src/opcodes.rs line 700 at r2 (raw file):

Previously, Stavbe wrote…

what do you mean? It is already a separate function. added tests

you're testing the sorting, I want to specifically check values


stwo_cairo_prover/crates/adapter/src/opcodes.rs line 707 at r2 (raw file):

Previously, Stavbe wrote…

If small values can be stored in F252 (as you said can happen), it won't catch it (for example, zero).
If you promise that small values are in MemoryValue::Small, it can be deleted.

can you give an example?


stwo_cairo_prover/crates/adapter/src/opcodes.rs line 718 at r2 (raw file):

Previously, Stavbe wrote…

which ? val_be.clone().cmp(p_min_2_to_27_be) ? this ? How?

yes

Copy link
Contributor Author
@Stavbe Stavbe 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: 1 of 4 files reviewed, 4 unresolved discussions (waiting on @anatgstarkware, @DavidLevitGurevich, and @ohad-agadi)


stwo_cairo_prover/crates/adapter/src/opcodes.rs line 17 at r2 (raw file):

Previously, ohad-agadi (Ohad) wrote…

because the u128 is implementation and not API

This const is also an implementation and not an API. It will add to the code about 20 "as u128".


stwo_cairo_prover/crates/adapter/src/opcodes.rs line 700 at r2 (raw file):

Previously, ohad-agadi (Ohad) wrote…

you're testing the sorting, I want to specifically check values

I added test, please take a look


stwo_cairo_prover/crates/adapter/src/opcodes.rs line 707 at r2 (raw file):

Previously, ohad-agadi (Ohad) wrote…

can you give an example?

for example, zero.


stwo_cairo_prover/crates/adapter/src/opcodes.rs line 718 at r2 (raw file):

Previously, ohad-agadi (Ohad) wrote…

yes

I don't have a good idea how to call it, so please suggest

Copy link
Collaborator
@ohad-agadi ohad-agadi 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: 1 of 4 files reviewed, 2 unresolved discussions (waiting on @anatgstarkware, @DavidLevitGurevich, and @Stavbe)


stwo_cairo_prover/crates/adapter/src/opcodes.rs line 17 at r2 (raw file):

Previously, Stavbe wrote…

This const is also an implementation and not an API. It will add to the code about 20 "as u128".

can you define it above the is_small_add function?


stwo_cairo_prover/crates/adapter/src/opcodes.rs line 707 at r2 (raw file):

Previously, Stavbe wrote…

for example, zero.

your test pass on zero


stwo_cairo_prover/crates/adapter/src/opcodes.rs line 718 at r2 (raw file):

Previously, Stavbe wrote…

I don't have a good idea how to call it, so please suggest

ok

@Stavbe Stavbe force-pushed the stav/fix_is_small_add branch from ab90194 to 5a13821 Compare June 11, 2025 10:50
Copy link
Contributor Author
@Stavbe Stavbe 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: 1 of 4 files reviewed, 2 unresolved discussions (waiting on @anatgstarkware, @DavidLevitGurevich, and @ohad-agadi)


stwo_cairo_prover/crates/adapter/src/opcodes.rs line 17 at r2 (raw file):

Previously, ohad-agadi (Ohad) wrote…

can you define it above the is_small_add function?

Done.


stwo_cairo_prover/crates/adapter/src/opcodes.rs line 707 at r2 (raw file):

Previously, ohad-agadi (Ohad) wrote…

your test pass on zero

Done.

@Stavbe Stavbe force-pushed the stav/fix_is_small_add branch from 5a13821 to 2d64b05 Compare June 11, 2025 10:57
@Stavbe Stavbe requested a review from az-starkware June 11, 2025 12:00
Copy link
Collaborator
@ohad-agadi ohad-agadi 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: 1 of 4 files reviewed, 1 unresolved discussion (waiting on @anatgstarkware, @az-starkware, and @DavidLevitGurevich)


stwo_cairo_prover/crates/adapter/src/opcodes.rs line 703 at r4 (raw file):

        match felt252[4..8] {
            // If the value is small, it can only fit in the positive range.
            [0, 0, 0, 0] => limbs_to_u128(felt252[0..4].try_into().unwrap()) <= SMALL_ADD_MAX_VALUE,

im not sure this is correct
what happens when there are 5 limbs?

@Stavbe Stavbe force-pushed the stav/fix_is_small_add branch 2 times, most recently from ebf0af6 to b24bcc0 Compare June 11, 2025 14:31
Copy link
Contributor Author
@Stavbe Stavbe 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: 1 of 6 files reviewed, 1 unresolved discussion (waiting on @anatgstarkware, @az-starkware, @DavidLevitGurevich, and @ohad-agadi)


stwo_cairo_prover/crates/adapter/src/opcodes.rs line 703 at r4 (raw file):

Previously, ohad-agadi (Ohad) wrote…

im not sure this is correct
what happens when there are 5 limbs?

If it's positive, it is for sure not less than 2**27-1
If it's negative, go to the other match

Anyway, changed for more clear implementation

Copy link
Collaborator
@ohad-agadi ohad-agadi 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: 1 of 6 files reviewed, 3 unresolved discussions (waiting on @anatgstarkware, @az-starkware, and @DavidLevitGurevich)


stwo_cairo_prover/crates/adapter/src/opcodes.rs line 703 at r4 (raw file):

Previously, Stavbe wrote…

If it's positive, it is for sure not less than 2**27-1
If it's negative, go to the other match

Anyway, changed for more clear implementation

alright


stwo_cairo_prover/crates/adapter/src/opcodes.rs line 699 at r6 (raw file):

            .flat_map(|&x| x.to_le_bytes())
            .collect::<Vec<_>>(),
    )

that's a malloc for every value , n_add_steps * 3 :(
try using bytemuck::cast if the unsafe scares u

Suggestion:

    U256::from_little_endian(
        unsafe{transmute(arr.map(u32::to_le_bytes))}
    )

stwo_cairo_prover/crates/adapter/src/opcodes.rs line 707 at r6 (raw file):

        let value = u256_from_le_array(val.as_u256());
        let postive_upper_bound = U256::from(2_u128.pow(27) - 1);
        let negative_upper_bound = u256_from_le_array(P_MIN_1);

can these be consts? sorry not checking myself bad reception in train


stwo_cairo_prover/crates/adapter/src/opcodes.rs line 772 at r6 (raw file):

    #[test]
    fn test_is_small_add() {
        let postive_upper_bound = 2_u128.pow(27) - 1;

can you add tests for values in [0, positive_upper_bound) that are F252
I know it's trivial it works because you call to_u256 but implementation might change

Copy link
Collaborator
@ohad-agadi ohad-agadi 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: 1 of 6 files reviewed, 3 unresolved discussions (waiting on @anatgstarkware, @az-starkware, @DavidLevitGurevich, and @Stavbe)


stwo_cairo_prover/crates/adapter/src/opcodes.rs line 699 at r6 (raw file):

Previously, ohad-agadi (Ohad) wrote…

that's a malloc for every value , n_add_steps * 3 :(
try using bytemuck::cast if the unsafe scares u

but it really is safe so consider using that favorably

@Stavbe Stavbe force-pushed the stav/fix_is_small_add branch 2 times, most recently from 4caecbe to 79f781c Compare June 11, 2025 19:19
Copy link
Contributor Author
@Stavbe Stavbe 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: 1 of 6 files reviewed, 3 unresolved discussions (waiting on @anatgstarkware, @az-starkware, @DavidLevitGurevich, and @ohad-agadi)


stwo_cairo_prover/crates/adapter/src/opcodes.rs line 699 at r6 (raw file):

Previously, ohad-agadi (Ohad) wrote…

but it really is safe so consider using that favorably

no malloc + safe


stwo_cairo_prover/crates/adapter/src/opcodes.rs line 707 at r6 (raw file):

Previously, ohad-agadi (Ohad) wrote…

can these be consts? sorry not checking myself bad reception in train

Done.


stwo_cairo_prover/crates/adapter/src/opcodes.rs line 772 at r6 (raw file):

Previously, ohad-agadi (Ohad) wrote…

can you add tests for values in [0, positive_upper_bound) that are F252
I know it's trivial it works because you call to_u256 but implementation might change

Done.

@ohad-agadi
Copy link
Collaborator

stwo_cairo_prover/crates/adapter/src/opcodes.rs line 707 at r6 (raw file):

Previously, Stavbe wrote…

Done.

I meant the U256

Copy link
Contributor
@anatgstarkware anatgstarkware left a comment

Choose a reason for hiding this comment

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

Maybe we shouldn't introduce primitive_types::U256, starknet-ff uses crypto_bigint::U256.
We can do this without going to u256 at all, work only with the reduced form (like we do in the air).
If you want starknet-ff functionality, please see impl From<Felt252> for FieldElement in cpu.rs and the comment above it.
Please consult @dancarmoz

Reviewable status: 1 of 6 files reviewed, 2 unresolved discussions (waiting on @az-starkware, @DavidLevitGurevich, and @ohad-agadi)

@Stavbe Stavbe force-pushed the stav/fix_is_small_add branch from 79f781c to 5852b3b Compare June 12, 2025 09:04
@Stavbe Stavbe force-pushed the stav/fix_is_small_add branch from c58d1eb to f7ff8d5 Compare June 15, 2025 08:01
Copy link
Collaborator
@ohad-agadi ohad-agadi left a comment

Choose a reason for hiding this comment

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

Reviewed 2 of 3 files at r8, all commit messages.
Reviewable status: 5 of 7 files reviewed, 1 unresolved discussion (waiting on @az-starkware and @DavidLevitGurevich)


stwo_cairo_verifier/asdf-vm line 1 at r10 (raw file):

Subproject commit d536803b6f20b8d031e5e9173f6fdc82380ba5c1

?

@Stavbe Stavbe force-pushed the stav/fix_is_small_add branch from f7ff8d5 to 36e1f67 Compare June 15, 2025 08:21
Copy link
Contributor Author
@Stavbe Stavbe 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 7 files reviewed, 1 unresolved discussion (waiting on @az-starkware, @DavidLevitGurevich, and @ohad-agadi)


stwo_cairo_verifier/asdf-vm line 1 at r10 (raw file):

Previously, ohad-agadi (Ohad) wrote…

?

Done.

@anatgstarkware
Copy link
Contributor

stwo_cairo_prover/crates/adapter/src/opcodes.rs line 725 at r11 (raw file):

        value <= SMALL_ADD_POSITIVE_UPPER_BOUND
            || value >= SMALL_ADD_NEGATIVE_LOWER_BOUND && value <= SMALL_ADD_NEGATIVE_UPPER_BOUND

Don't we need parentheses?

Suggestion:

(value >= SMALL_ADD_NEGATIVE_LOWER_BOUND && value <= SMALL_ADD_NEGATIVE_UPPER_BOUND)

Copy link
Collaborator
@ohad-agadi ohad-agadi 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 7 files reviewed, 1 unresolved discussion (waiting on @anatgstarkware, @az-starkware, and @DavidLevitGurevich)


stwo_cairo_prover/crates/adapter/src/opcodes.rs line 725 at r11 (raw file):

Previously, anatgstarkware (anatg) wrote…

Don't we need parentheses?

I believe anat is correct, can we have a test for this (not the entire is_small_add_function)?
and test a value in every range and also the boundaries

@Stavbe Stavbe force-pushed the stav/fix_is_small_add branch from 36e1f67 to 96346d5 Compare June 15, 2025 09:33
Copy link
Contributor Author
@Stavbe Stavbe 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 7 files reviewed, 1 unresolved discussion (waiting on @anatgstarkware, @az-starkware, @DavidLevitGurevich, and @ohad-agadi)


stwo_cairo_prover/crates/adapter/src/opcodes.rs line 725 at r11 (raw file):

Previously, ohad-agadi (Ohad) wrote…

I believe anat is correct, can we have a test for this (not the entire is_small_add_function)?
and test a value in every range and also the boundaries

No need, but added for clarity.
There are already tests for all the cases.

Actually, the checking: value <= SMALL_ADD_NEGATIVE_UPPER_BOUND, checks that we are in the reduced form, but the AIR allows values that are not reduced. So maybe I need to relax it and change upper bound = P + 2**27 -1, WDYT?

Copy link
Collaborator
@ohad-agadi ohad-agadi 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 7 files reviewed, 1 unresolved discussion (waiting on @anatgstarkware, @az-starkware, @DavidLevitGurevich, and @Stavbe)


stwo_cairo_prover/crates/adapter/src/opcodes.rs line 725 at r11 (raw file):

Previously, Stavbe wrote…

No need, but added for clarity.
There are already tests for all the cases.

Actually, the checking: value <= SMALL_ADD_NEGATIVE_UPPER_BOUND, checks that we are in the reduced form, but the AIR allows values that are not reduced. So maybe I need to relax it and change upper bound = P + 2**27 -1, WDYT?

so you need to add something like:
|| (value >= SMALL_ADD_NEGATIVE_LOWER_BOUND + P && value <= SMALL_ADD_NEGATIVE_UPPER_BOUND + P)?

Copy link
Contributor Author
@Stavbe Stavbe 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 7 files reviewed, 1 unresolved discussion (waiting on @anatgstarkware, @az-starkware, @DavidLevitGurevich, and @ohad-agadi)


stwo_cairo_prover/crates/adapter/src/opcodes.rs line 725 at r11 (raw file):

Previously, ohad-agadi (Ohad) wrote…

so you need to add something like:
|| (value >= SMALL_ADD_NEGATIVE_LOWER_BOUND + P && value <= SMALL_ADD_NEGATIVE_UPPER_BOUND + P)?

No. It's not linear. The lower bound is the same. The upper bound will be changed from P-1 to P + 2**27 + 1, but I am not sure it is needed since the honest prover assumed to fill the trace with the reduced form.

Copy link
Collaborator
@ohad-agadi ohad-agadi 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 7 files reviewed, 1 unresolved discussion (waiting on @az-starkware and @DavidLevitGurevich)


stwo_cairo_prover/crates/adapter/src/opcodes.rs line 725 at r11 (raw file):

Previously, Stavbe wrote…

No. It's not linear. The lower bound is the same. The upper bound will be changed from P-1 to P + 2**27 + 1, but I am not sure it is needed since the honest prover assumed to fill the trace with the reduced form.

@DavidLevitGurevich

@anatgstarkware
Copy link
Contributor

stwo_cairo_prover/crates/adapter/src/opcodes.rs line 725 at r11 (raw file):

Previously, ohad-agadi (Ohad) wrote…

@DavidLevitGurevich

This is a completeness issue. It is fine to increase the upper bound as Stav suggested

Copy link
Contributor
@anatgstarkware anatgstarkware 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 7 files reviewed, 3 unresolved discussions (waiting on @az-starkware and @DavidLevitGurevich)


stwo_cairo_prover/crates/adapter/src/memory.rs line 11 at r12 (raw file):

/// P-2**27 in F252 format.
pub const P_MIN_2_TO_27: [u32; 8] = [

Can we move to the tests?

Code quote:

P_MIN_2_TO_27

stwo_cairo_prover/crates/adapter/src/opcodes.rs line 702 at r12 (raw file):

}

// 2^27

Suggestion:

// 2^27 - 1

@anatgstarkware
Copy link
Contributor

stwo_cairo_prover/crates/adapter/src/opcodes.rs line 785 at r12 (raw file):

    #[test]
    fn test_is_small_add() {

Please separate this test into the three ranges

Copy link
Collaborator
@ohad-agadi ohad-agadi 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: 5 of 7 files reviewed, 3 unresolved discussions (waiting on @az-starkware, @DavidLevitGurevich, and @Stavbe)

@Stavbe Stavbe force-pushed the stav/fix_is_small_add branch 2 times, most recently from 2663321 to 9d243ed Compare June 15, 2025 12:39
Copy link
Contributor Author
@Stavbe Stavbe 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 7 files reviewed, 1 unresolved discussion (waiting on @anatgstarkware, @az-starkware, @DavidLevitGurevich, and @ohad-agadi)


stwo_cairo_prover/crates/adapter/src/opcodes.rs line 785 at r12 (raw file):

Previously, anatgstarkware (anatg) wrote…

Please separate this test into the three ranges

Done.

Copy link
Contributor
@anatgstarkware anatgstarkware 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 7 files reviewed, 1 unresolved discussion (waiting on @az-starkware, @DavidLevitGurevich, and @ohad-agadi)


stwo_cairo_prover/crates/adapter/src/memory.rs line 10 at r13 (raw file):

use tracing::{span, Level};

/// Prime 2^251 + 17 * 2^192 + 1 in little endian.

Why was that deleted?

Copy link
Collaborator
@az-starkware az-starkware 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 2 of 3 files at r3, 2 of 3 files at r8, 1 of 1 files at r11, 2 of 2 files at r13, all commit messages.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @DavidLevitGurevich and @Stavbe)

@Stavbe Stavbe force-pushed the stav/fix_is_small_add branch from 9d243ed to cf2120d Compare June 15, 2025 13:45
Copy link
Contributor
@anatgstarkware anatgstarkware 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: 6 of 7 files reviewed, 1 unresolved discussion (waiting on @az-starkware and @DavidLevitGurevich)


stwo_cairo_prover/crates/adapter/src/memory.rs line 10 at r14 (raw file):

use tracing::{span, Level};

/// Prime 2^251 + 17 * 2^192 in little endian.

Suggestion:

Prime minus one 2^251 + 17 * 2^192 in little endian

@anatgstarkware
Copy link
Contributor

stwo_cairo_prover/crates/adapter/src/memory.rs line 10 at r14 (raw file):

use tracing::{span, Level};

/// Prime 2^251 + 17 * 2^192 in little endian.

same below
or separate the comment from the number, just as a reminder of what prime is

/// Prime is ...
/// All constants below are in little endian

@anatgstarkware
Copy link
Contributor

stwo_cairo_prover/crates/adapter/src/memory.rs line 10 at r14 (raw file):

Previously, anatgstarkware (anatg) wrote…

same below
or separate the comment from the number, just as a reminder of what prime is

/// Prime is ...
/// All constants below are in little endian

Please keep the line between constants

@Stavbe Stavbe force-pushed the stav/fix_is_small_add branch from cf2120d to 83e5720 Compare June 15, 2025 13:53
Copy link
Contributor Author
@Stavbe Stavbe 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: 6 of 7 files reviewed, all discussions resolved (waiting on @az-starkware and @DavidLevitGurevich)


stwo_cairo_prover/crates/adapter/src/memory.rs line 10 at r13 (raw file):

Previously, anatgstarkware (anatg) wrote…

Why was that deleted?

because it was not true. Fixed.

Copy link
Contributor
@anatgstarkware anatgstarkware 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: 6 of 7 files reviewed, all discussions resolved (waiting on @az-starkware and @DavidLevitGurevich)

Copy link
Contributor
@anatgstarkware anatgstarkware 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 r15, all commit messages.
Reviewable status: :shipit: complete! all files reviewed, all discussions resolved (waiting on @DavidLevitGurevich)

@Stavbe Stavbe merged commit 1befb54 into main Jun 15, 2025
8 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
0