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(blockifier): test contract for validate and execute merging #2456

Merged
merged 1 commit into from
Dec 8, 2024

Conversation

yoavGrs
Copy link
Contributor

@yoavGrs yoavGrs commented Dec 4, 2024

No description provided.

@reviewable-StarkWare
Copy link

This change is Reviewable

@yoavGrs yoavGrs marked this pull request as ready for review December 4, 2024 14:01
Copy link
Contributor Author

@yoavGrs yoavGrs 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 4 files reviewed, 1 unresolved discussion (waiting on @dorimedini-starkware)


a discussion (no related file):
There are too many tests for the same function. I suggest deleting test_state_cache_merge and test_allocated_keys_two_transactions. WDYT?

Copy link

codecov bot commented Dec 4, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 71.99%. Comparing base (e3165c4) to head (96db9a1).
Report is 743 commits behind head on main.

Additional details and impacted files
@@             Coverage Diff             @@
##             main    #2456       +/-   ##
===========================================
+ Coverage   40.10%   71.99%   +31.88%     
===========================================
  Files          26      101       +75     
  Lines        1895    13518    +11623     
  Branches     1895    13518    +11623     
===========================================
+ Hits          760     9732     +8972     
- Misses       1100     3371     +2271     
- Partials       35      415      +380     

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

Copy link
Collaborator

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


a discussion (no related file):

Previously, yoavGrs wrote…

There are too many tests for the same function. I suggest deleting test_state_cache_merge and test_allocated_keys_two_transactions. WDYT?

as long as the union of scenarios and union of assertions exist - sgtm


crates/blockifier/src/state/cached_state_test.rs line 490 at r1 (raw file):

#[case(true, felt!("0x7"), felt!("0x7"), true)]
#[case(false, felt!("0x0"), felt!("0x8"), false)]
#[case(true, felt!("0x7"), felt!("0x0"), false)]

give names to cases like this

Suggestion:

#[case::real_diff_nonzero_base(false, felt!("0x7"), felt!("0x8"), false)]
#[case::execute_allocation(true, felt!("0x0"), felt!("0x8"), true)]
#[case::validate_allocation(true, felt!("0x7"), felt!("0x7"), true)]
#[case::nonzero_to_zero_to_nonzero(false, felt!("0x0"), felt!("0x8"), false)]
#[case::zero_to_nonzero_to_zero(true, felt!("0x7"), felt!("0x0"), false)]

crates/blockifier/src/state/cached_state_test.rs line 516 at r1 (raw file):

    });
    let tx_execution_info =
        invoke_tx.execute(&mut transactional_state, &block_context, false, true).unwrap();

you shouldn't need to create a transactional state

Suggestion:

    let signature =
        TransactionSignature(vec![Felt::from(STORAGE_WRITE), validate_value, execute_value]);
    let invoke_tx = account_invoke_tx(invoke_tx_args! {
        signature,
        sender_address: contract_address,
        calldata: create_calldata(contract_address, "foo", &[]),
    });
    let tx_execution_info =
        invoke_tx.execute(&mut state, &block_context, false, true).unwrap();

crates/blockifier/src/state/cached_state_test.rs line 516 at r1 (raw file):

    });
    let tx_execution_info =
        invoke_tx.execute(&mut transactional_state, &block_context, false, true).unwrap();

why did you set charge_fee to false here?

Code quote:

false

crates/blockifier/feature_contracts/cairo1/account_faulty.cairo line 0 at r1 (raw file):
can you add the same functionality to the cairo0 contract?
that way we will be able to parametrize the test to both cairo versions

@yoavGrs yoavGrs force-pushed the yoav/compression/merge_state_diff branch from 9a66da9 to bd621f5 Compare December 4, 2024 14:21
@yoavGrs yoavGrs force-pushed the yoav/compression/test_contract branch from 3ef88f8 to 4bec2fe Compare December 4, 2024 14:21
Copy link
Collaborator

@dorimedini-starkware dorimedini-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 1 files at r2, all commit messages.
Reviewable status: all files reviewed, 5 unresolved discussions (waiting on @yoavGrs)

@yoavGrs yoavGrs force-pushed the yoav/compression/test_contract branch from 4bec2fe to 42b1ca0 Compare December 4, 2024 16:10
Copy link
Contributor Author

@yoavGrs yoavGrs 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 8 files reviewed, 5 unresolved discussions (waiting on @dorimedini-starkware)


a discussion (no related file):

Previously, dorimedini-starkware wrote…

as long as the union of scenarios and union of assertions exist - sgtm

So I'll delete only the second.


crates/blockifier/feature_contracts/cairo1/account_faulty.cairo line at r1 (raw file):

Previously, dorimedini-starkware wrote…

can you add the same functionality to the cairo0 contract?
that way we will be able to parametrize the test to both cairo versions

Done.


crates/blockifier/src/state/cached_state_test.rs line 490 at r1 (raw file):

Previously, dorimedini-starkware wrote…

give names to cases like this

Done.


crates/blockifier/src/state/cached_state_test.rs line 516 at r1 (raw file):

Previously, dorimedini-starkware wrote…

why did you set charge_fee to false here?

Changed.


crates/blockifier/src/state/cached_state_test.rs line 516 at r1 (raw file):

Previously, dorimedini-starkware wrote…

you shouldn't need to create a transactional state

Done.

@yoavGrs yoavGrs force-pushed the yoav/compression/test_contract branch from 42b1ca0 to ce766a8 Compare December 4, 2024 16:20
Copy link
Collaborator

@dorimedini-starkware dorimedini-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 6 of 7 files at r3, 1 of 1 files at r4, all commit messages.
Reviewable status: :shipit: complete! all files reviewed, all discussions resolved (waiting on @yoavGrs)

@yoavGrs yoavGrs force-pushed the yoav/compression/merge_state_diff branch 2 times, most recently from 923bc81 to c9454fc Compare December 4, 2024 16:44
@yoavGrs yoavGrs force-pushed the yoav/compression/test_contract branch from ce766a8 to 24761cc Compare December 4, 2024 16:44
@yoavGrs yoavGrs force-pushed the yoav/compression/merge_state_diff branch 2 times, most recently from 3a7681a to fb29524 Compare December 5, 2024 09:13
@yoavGrs yoavGrs force-pushed the yoav/compression/test_contract branch from 24761cc to 27c808f Compare December 5, 2024 09:13
@yoavGrs yoavGrs force-pushed the yoav/compression/merge_state_diff branch from fb29524 to dc573fe Compare December 5, 2024 10:00
@yoavGrs yoavGrs force-pushed the yoav/compression/test_contract branch from 27c808f to fb3d179 Compare December 5, 2024 10:01
Copy link
Collaborator

@dorimedini-starkware dorimedini-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 1159 of 1159 files at r5, all commit messages.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @yoavGrs)


a discussion (no related file):
remove the target_vscode from this PR...
where did it come from? did you set up your vscode in some non-standard way? or should this dir be added to everyone's gitignore?

@yoavGrs yoavGrs force-pushed the yoav/compression/merge_state_diff branch from dc573fe to 5861d2a Compare December 5, 2024 10:53
@yoavGrs yoavGrs force-pushed the yoav/compression/test_contract branch from fb3d179 to 7c7f02d Compare December 5, 2024 10:57
@yoavGrs yoavGrs changed the base branch from yoav/compression/merge_state_diff to graphite-base/2456 December 5, 2024 12:08
@yoavGrs yoavGrs force-pushed the graphite-base/2456 branch from 5861d2a to 61340f7 Compare December 5, 2024 12:26
@yoavGrs yoavGrs force-pushed the yoav/compression/test_contract branch from 7c7f02d to 4fb6d8f Compare December 5, 2024 12:26
@yoavGrs yoavGrs changed the base branch from graphite-base/2456 to main December 5, 2024 12:26
@yoavGrs yoavGrs force-pushed the yoav/compression/test_contract branch from 4fb6d8f to 4312ac1 Compare December 5, 2024 12:30
Copy link
Collaborator

@dorimedini-starkware dorimedini-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 1 files at r6, all commit messages.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @yoavGrs)

Copy link
Contributor Author

@yoavGrs yoavGrs 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, 1 unresolved discussion (waiting on @dorimedini-starkware)


a discussion (no related file):

Previously, dorimedini-starkware wrote…

remove the target_vscode from this PR...
where did it come from? did you set up your vscode in some non-standard way? or should this dir be added to everyone's gitignore?

Done.
Maybe it should be added to '.gitignore'. Let's talk offline.

Copy link
Collaborator

@dorimedini-starkware dorimedini-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, 1 unresolved discussion (waiting on @yoavGrs)


a discussion (no related file):

Previously, yoavGrs wrote…

Done.
Maybe it should be added to '.gitignore'. Let's talk offline.

I still see the files in this PR..

@yoavGrs yoavGrs force-pushed the yoav/compression/test_contract branch from 4312ac1 to 96db9a1 Compare December 5, 2024 15:40
Copy link
Collaborator

@dorimedini-starkware dorimedini-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 1158 of 1158 files at r7, all commit messages.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @yoavGrs)

Copy link
Collaborator

@dorimedini-starkware dorimedini-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: :shipit: complete! all files reviewed, all discussions resolved (waiting on @yoavGrs)

@yoavGrs yoavGrs merged commit c97fe52 into main Dec 8, 2024
14 checks passed
@github-actions github-actions bot locked and limited conversation to collaborators Dec 10, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants