-
Notifications
You must be signed in to change notification settings - Fork 28
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): inner revert in cairo 1 contract #2889
Conversation
This stack of pull requests is managed by Graphite. Learn more about stacking. |
989a841
to
f90806a
Compare
f90806a
to
65648a1
Compare
6bdbf6b
to
2aa93aa
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It won't pass the CI until #2895 will merge
Reviewable status: 0 of 5 files reviewed, all discussions resolved (waiting on @dorimedini-starkware and @ilyalesokhin-starkware)
There was a problem hiding this 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 r1, 4 of 4 files at r2, all commit messages.
Reviewable status: all files reviewed, 3 unresolved discussions (waiting on @AvivYossef-starkware and @ilyalesokhin-starkware)
crates/blockifier/feature_contracts/cairo1/test_contract.cairo
line 669 at r2 (raw file):
else { assert(inner_error == 'execute_and_revert', 'Wrong_error'); }
consider adding this for clarity. non-blocking
Suggestion:
else {
assert(entry_point_selector == selector!("middle_revert_contract"));
assert(inner_error == 'execute_and_revert', 'Wrong_error');
}
crates/blockifier/src/execution/syscalls/syscall_tests/call_contract.rs
line 87 at r2 (raw file):
/// 2. Contract B error as expected. /// 3. Tracked resources are correctly identified as SierraGas in all calls. #[rstest]
if you use rstest
you should probably use the case
attributes
Suggestion:
#[rstest]
#[cfg_attr(feature = "cairo_native", case::native(RunnableCairo1::Native))]
#[case::vm(RunnableCairo1::Casm)]
/// This test verifies the behavior of a contract call sequence with nested calls and state
/// assertions.
///
/// - Contract A calls Contract B and asserts that the state remains unchanged.
/// - Contract B calls Contract C and panics.
/// - Contract C modifies the state but does not panic.
///
/// The test ensures that:
/// 1. Contract A's state remains unaffected despite the modifications in Contract C.
/// 2. Contract B error as expected.
/// 3. Tracked resources are correctly identified as SierraGas in all calls.
crates/blockifier/src/execution/syscalls/syscall_tests/call_contract.rs
line 88 at r2 (raw file):
/// 3. Tracked resources are correctly identified as SierraGas in all calls. #[rstest] fn test_call_contract_and_than_revert(runnable_version: RunnableCairo1) {
if you use rstest
you should probably use the case
attributes
Suggestion:
#[rstest]
#[cfg_attr(feature = "cairo_native", case::native(RunnableCairo1::Native))]
#[case::vm(RunnableCairo1::Casm)]
/// This test verifies the behavior of a contract call sequence with nested calls and state
/// assertions.
///
/// - Contract A calls Contract B and asserts that the state remains unchanged.
/// - Contract B calls Contract C and panics.
/// - Contract C modifies the state but does not panic.
///
/// The test ensures that:
/// 1. Contract A's state remains unaffected despite the modifications in Contract C.
/// 2. Contract B error as expected.
/// 3. Tracked resources are correctly identified as SierraGas in all calls.
fn test_call_contract_and_than_revert(#[case] runnable_version: RunnableCairo1) {
crates/blockifier/src/execution/syscalls/syscall_tests/call_contract.rs
line 144 at r2 (raw file):
assert_eq!(call.tracked_resource, TrackedResource::SierraGas); } }
how about testing also that state changes in A
are not reverted?
maybe add some dummy storage-write in A
's context, and assert it's still included in the diff?
There was a problem hiding this 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 @AvivYossef-starkware and @ilyalesokhin-starkware)
crates/blockifier/src/execution/syscalls/syscall_tests/call_contract.rs
line 134 at r2 (raw file):
assert!(inner_call.execution.failed); assert!(inner_call.execution.events.is_empty()); assert!(inner_call.execution.l2_to_l1_messages.is_empty());
Check C as well - it should not have events or messages on it, even though it didn't fail
Code quote:
assert!(inner_call.execution.events.is_empty());
assert!(inner_call.execution.l2_to_l1_messages.is_empty());
2aa93aa
to
41f7ae1
Compare
41f7ae1
to
5a95f02
Compare
There was a problem hiding this 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 5 files reviewed, 4 unresolved discussions (waiting on @dorimedini-starkware, @ilyalesokhin-starkware, and @Yoni-Starkware)
crates/blockifier/src/execution/syscalls/syscall_tests/call_contract.rs
line 87 at r2 (raw file):
Previously, dorimedini-starkware wrote…
if you use
rstest
you should probably use thecase
attributes
Done.
crates/blockifier/src/execution/syscalls/syscall_tests/call_contract.rs
line 88 at r2 (raw file):
Previously, dorimedini-starkware wrote…
if you use
rstest
you should probably use thecase
attributes
Done.
crates/blockifier/src/execution/syscalls/syscall_tests/call_contract.rs
line 134 at r2 (raw file):
Previously, Yoni-Starkware (Yoni) wrote…
Check C as well - it should not have events or messages on it, even though it didn't fail
Done.
crates/blockifier/src/execution/syscalls/syscall_tests/call_contract.rs
line 144 at r2 (raw file):
Previously, dorimedini-starkware wrote…
how about testing also that state changes in
A
are not reverted?
maybe add some dummy storage-write inA
's context, and assert it's still included in the diff?
Sounds good, I opened separate PR for it
be4a681
to
29e52d0
Compare
5a95f02
to
a33c06c
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewed 5 of 5 files at r3, all commit messages.
Reviewable status: all files reviewed, 2 unresolved discussions (waiting on @AvivYossef-starkware, @ilyalesokhin-starkware, and @Yoni-Starkware)
crates/blockifier/src/execution/syscalls/syscall_tests/call_contract.rs
line 145 at r3 (raw file):
}; assert!(!inner_inner_call_c.execution.failed);
non-blocking but you seem to have extra whitespace here - please check your local formatter (if you merge this, this will appear as a diff in someone else's PR later)
There was a problem hiding this 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 r3, all commit messages.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @AvivYossef-starkware and @ilyalesokhin-starkware)
29e52d0
to
4c44815
Compare
a33c06c
to
722577e
Compare
There was a problem hiding this 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 5 files reviewed, 1 unresolved discussion (waiting on @dorimedini-starkware and @ilyalesokhin-starkware)
crates/blockifier/src/execution/syscalls/syscall_tests/call_contract.rs
line 145 at r3 (raw file):
Previously, dorimedini-starkware wrote…
non-blocking but you seem to have extra whitespace here - please check your local formatter (if you merge this, this will appear as a diff in someone else's PR later)
Is it ok now?
The CI failed on the previous
4c44815
to
3a6c12f
Compare
722577e
to
4dd8747
Compare
3a6c12f
to
7237414
Compare
4dd8747
to
1658f7a
Compare
There was a problem hiding this 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 r4, all commit messages.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @AvivYossef-starkware and @ilyalesokhin-starkware)
a discussion (no related file):
blocking until bottom PR is merged, so I'm sure it's over main-v0.13.4
1658f7a
to
7cf7409
Compare
There was a problem hiding this 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 (commit messages unreviewed), 1 unresolved discussion (waiting on @dorimedini-starkware and @ilyalesokhin-starkware)
a discussion (no related file):
Previously, dorimedini-starkware wrote…
blocking until bottom PR is merged, so I'm sure it's over main-v0.13.4
Done.
a7a49cd
to
082a8b1
Compare
7cf7409
to
aa6067b
Compare
aa6067b
to
52633ad
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewed all commit messages.
Reviewable status: complete! all files reviewed, all discussions resolved (waiting on @ilyalesokhin-starkware)
Merge activity
|
No description provided.