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

test(cairo_native): add native to transactions test #3041

Open
wants to merge 2 commits into
base: main-v0.13.4
Choose a base branch
from

Conversation

meship-starkware
Copy link
Contributor

No description provided.

@reviewable-StarkWare
Copy link

This change is Reviewable

@meship-starkware meship-starkware force-pushed the meship/add_native_to_recursion_depth_test branch from 9e0a752 to 52015d2 Compare December 31, 2024 16:02
@meship-starkware meship-starkware changed the base branch from main-v0.13.4 to meship/fix_bugs_in_native_syscall_handler December 31, 2024 16:03
Copy link
Collaborator

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


crates/blockifier/src/test_utils.rs line 9 at r2 (raw file):

pub mod struct_impls;
pub mod syscall;
#[cfg(test)]

Not needed as the file is already under this feature flag. See here.

Code quote:

#[cfg(test)]

crates/blockifier/src/test_utils/test_templates.rs line 6 at r2 (raw file):

#[template]
#[rstest]
fn cairo_version_no_native(

I think that you can all both functions cairo_version and then you can apply in one line (and use one import).

Suggestion:

fn cairo_version(

crates/blockifier/src/test_utils/test_templates.rs line 32 at r2 (raw file):

    cairo_version: CairoVersion,
) {
}

Remove?

Code quote:

#[cfg(not(feature = "cairo_native"))]
#[template]
#[rstest]
fn cairo_version_no_native(
    #[values(CairoVersion::Cairo0, CairoVersion::Cairo1(RunnableCairo1::Casm))]
    cairo_version: CairoVersion,
) {
}

crates/blockifier/src/transaction/transactions_test.rs line 485 at r2 (raw file):

        validate_gas_consumed: 4740, // The gas consumption results from parsing the input
            // arguments.
        execute_gas_consumed: 112080,

Why do we have additional vm resources in case of the casm?

Code quote:

        resources: ExecutionResources::default(),
        validate_gas_consumed: 4740, // The gas consumption results from parsing the input
            // arguments.
        execute_gas_consumed: 112080,

crates/blockifier/src/transaction/transactions_test.rs line 734 at r2 (raw file):

    feature = "cairo_native",
    case::with_cairo1_native_account(CairoVersion::Cairo1(RunnableCairo1::Native))
)]

Why not use the apply here?

Code quote:

#[case::with_cairo0_account(CairoVersion::Cairo0)]
#[case::with_cairo1_account(CairoVersion::Cairo1(RunnableCairo1::Casm))]
#[cfg_attr(
    feature = "cairo_native",
    case::with_cairo1_native_account(CairoVersion::Cairo1(RunnableCairo1::Native))
)]

crates/blockifier/src/transaction/transactions_test.rs line 909 at r2 (raw file):

    cairo_version: CairoVersion,
) {
    let account_cairo_version = cairo_version;

Why is this needed? Does the input must be called cairo_version?

Code quote:

    let account_cairo_version = cairo_version;

Copy link
Contributor Author

@meship-starkware meship-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 @avivg-starkware and @noaov1)


crates/blockifier/src/test_utils/test_templates.rs line 6 at r2 (raw file):

Previously, noaov1 (Noa Oved) wrote…

I think that you can all both functions cairo_version and then you can apply in one line (and use one import).

That is a very good idea


crates/blockifier/src/transaction/transactions_test.rs line 734 at r2 (raw file):

Previously, noaov1 (Noa Oved) wrote…

Why not use the apply here?

I think it more elegant to do cases when it is only three cases, but I can add the template instead


crates/blockifier/src/transaction/transactions_test.rs line 909 at r2 (raw file):

Previously, noaov1 (Noa Oved) wrote…

Why is this needed? Does the input must be called cairo_version?

Yes, we might be able to resolve it with a macro but I think that is good for now

Base automatically changed from meship/fix_bugs_in_native_syscall_handler to main-v0.13.4 January 1, 2025 18:52
@meship-starkware meship-starkware force-pushed the meship/add_native_to_recursion_depth_test branch from 52015d2 to c7a6cfe Compare January 2, 2025 11:54
@meship-starkware meship-starkware changed the base branch from main-v0.13.4 to meship/add_cairo_native_template_for_testing January 2, 2025 11:55
@meship-starkware meship-starkware force-pushed the meship/add_native_to_recursion_depth_test branch from c7a6cfe to 436df65 Compare January 2, 2025 11:56
Copy link
Contributor Author

@meship-starkware meship-starkware 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 7 files at r3.
Reviewable status: 2 of 8 files reviewed, 6 unresolved discussions (waiting on @avivg-starkware and @noaov1)

@meship-starkware meship-starkware force-pushed the meship/add_native_to_recursion_depth_test branch from 436df65 to b835be9 Compare January 2, 2025 12:18
@meship-starkware meship-starkware force-pushed the meship/add_cairo_native_template_for_testing branch 2 times, most recently from ec3c06a to 16068a9 Compare January 2, 2025 12:34
@meship-starkware meship-starkware force-pushed the meship/add_native_to_recursion_depth_test branch from b835be9 to afb7053 Compare January 2, 2025 12:34
Copy link
Contributor Author

@meship-starkware meship-starkware 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 7 files at r3, 1 of 2 files at r4.
Reviewable status: 4 of 9 files reviewed, 6 unresolved discussions (waiting on @avivg-starkware and @noaov1)

@meship-starkware meship-starkware force-pushed the meship/add_native_to_recursion_depth_test branch from afb7053 to 948ca79 Compare January 2, 2025 12:44
@meship-starkware meship-starkware force-pushed the meship/add_cairo_native_template_for_testing branch from 16068a9 to ac7407d Compare January 2, 2025 13:09
@meship-starkware meship-starkware force-pushed the meship/add_native_to_recursion_depth_test branch from 948ca79 to c3e48ef Compare January 2, 2025 13:09
Copy link
Contributor Author

@meship-starkware meship-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: 3 of 9 files reviewed, 6 unresolved discussions (waiting on @avivg-starkware and @noaov1)


crates/blockifier/src/test_utils/test_templates.rs line 32 at r2 (raw file):

Previously, noaov1 (Noa Oved) wrote…

Remove?

Done.

@meship-starkware meship-starkware force-pushed the meship/add_cairo_native_template_for_testing branch from ac7407d to 7a44005 Compare January 2, 2025 13:30
@meship-starkware meship-starkware force-pushed the meship/add_native_to_recursion_depth_test branch from c3e48ef to 2a8a873 Compare January 2, 2025 13:32
Copy link
Contributor Author

@meship-starkware meship-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: 3 of 9 files reviewed, 6 unresolved discussions (waiting on @avivg-starkware and @noaov1)


crates/blockifier/src/test_utils.rs line 9 at r2 (raw file):

Previously, noaov1 (Noa Oved) wrote…

Not needed as the file is already under this feature flag. See here.

Done.

@meship-starkware meship-starkware force-pushed the meship/add_cairo_native_template_for_testing branch from 7a44005 to 21e3422 Compare January 2, 2025 13:57
@meship-starkware meship-starkware force-pushed the meship/add_native_to_recursion_depth_test branch 2 times, most recently from 3adccaa to 4e66ac7 Compare January 2, 2025 14:06
@meship-starkware meship-starkware force-pushed the meship/add_cairo_native_template_for_testing branch from 21e3422 to 7612687 Compare January 2, 2025 14:09
@meship-starkware meship-starkware force-pushed the meship/add_native_to_recursion_depth_test branch from 4e66ac7 to 9a0c70f Compare January 2, 2025 14:09
@meship-starkware meship-starkware force-pushed the meship/add_cairo_native_template_for_testing branch from 7612687 to 3806aa2 Compare January 2, 2025 14:12
@meship-starkware meship-starkware force-pushed the meship/add_native_to_recursion_depth_test branch 2 times, most recently from 4e23b6d to a8b9ee1 Compare January 3, 2025 12:27
@meship-starkware meship-starkware force-pushed the meship/add_cairo_native_template_for_testing branch from 3806aa2 to a340146 Compare January 6, 2025 10:00
@meship-starkware meship-starkware force-pushed the meship/add_native_to_recursion_depth_test branch from a8b9ee1 to 094a794 Compare January 6, 2025 10:01
Base automatically changed from meship/add_cairo_native_template_for_testing to main-v0.13.4 January 6, 2025 11:00
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