-
Notifications
You must be signed in to change notification settings - Fork 22
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
feat(blockifier): add call_contract cairo native syscall #1548
Conversation
Artifacts upload triggered. View details here |
Artifacts upload triggered. View details here |
ceff54f
to
f9d4b21
Compare
69984e0
to
8e422b7
Compare
Artifacts upload triggered. View details here |
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: 0 of 2 files reviewed, 1 unresolved discussion
a discussion (no related file):
In test_track_resources
, the logic for what we expect has changed. Now, I'm not sure if the result is expected or not and I need clarification.
Previously, both the outer call and the inner call had to be (Cairo1 | Native) for the inner tracked_resource to be SierraGas.
Now, long as the inner is (Cairo1 | Native) I think SierraGas should be used.
Currently, one case fails: when outer is Cairo0 and inner is Cairo1, SierraGas is expected, but CairoSteps is used.
I've added a complete table of the results here in csv format:
Code snippet:
outer , inner , expected_outer , expected_inner , actual_outer , actual_expected , pass/fail
Cairo0 , Cairo0 , CairoSteps , CairoSteps , CairoSteps , CairoSteps , pass
Cairo0 , Cairo1 , CairoSteps , SierraGas , CairoSteps , CairoSteps , failed <--- Should this fail? Or is it expected?
Cairo1 , Cairo0 , SierraGas , CairoSteps , SierraGas , CairoSteps , pass
Cairo1 , Cairo1 , SierraGas , SierraGas , SierraGas , SierraGas , pass
Cairo0 , Native , CairoSteps , SierraGas , CairoSteps , SierraGas , pass
Native , Cairo1 , SierraGas , SierraGas , SierraGas , SierraGas , pass
Native , Cairo0 , SierraGas , CairoSteps , SierraGas , CairoSteps , pass
Cairo1 , Native , SierraGas , SierraGas , SierraGas , SierraGas , pass
Native , Native , SierraGas , SierraGas , SierraGas , SierraGas , pass
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: 0 of 2 files reviewed, 2 unresolved discussions (waiting on @PearsonWhite)
crates/blockifier/src/execution/native/syscall_handler.rs
line 203 at r1 (raw file):
let contract_address = ContractAddress::try_from(address) .expect("Failed to convert address argument to a ContractAddress");
Don't use expect, return runtime error instead
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: 0 of 2 files reviewed, 3 unresolved discussions (waiting on @PearsonWhite)
crates/blockifier/src/execution/native/syscall_handler.rs
line 225 at r1 (raw file):
caller_address: self.contract_address, call_type: CallType::Call, initial_gas: u64::try_from(*remaining_gas).unwrap(),
Use expect
instead of unwrap
here
8e422b7
to
13b068e
Compare
Artifacts upload triggered. View details here |
f9d4b21
to
9ab9eee
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: 0 of 2 files reviewed, 3 unresolved discussions (waiting on @varex83)
crates/blockifier/src/execution/native/syscall_handler.rs
line 203 at r1 (raw file):
Previously, varex83 (Bohdan Ohorodnii) wrote…
Don't use expect, return runtime error instead
Done.
crates/blockifier/src/execution/native/syscall_handler.rs
line 225 at r1 (raw file):
Previously, varex83 (Bohdan Ohorodnii) wrote…
Use
expect
instead ofunwrap
here
Done.
a00063b
to
8ad184c
Compare
13b068e
to
2bac70d
Compare
Artifacts upload triggered. View details here |
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #1548 +/- ##
===========================================
+ Coverage 40.10% 69.28% +29.17%
===========================================
Files 26 105 +79
Lines 1895 13771 +11876
Branches 1895 13771 +11876
===========================================
+ Hits 760 9541 +8781
- Misses 1100 3827 +2727
- Partials 35 403 +368 ☔ View full report in Codecov by Sentry. |
Artifacts upload triggered. View details here |
faa013c
to
f4a0399
Compare
Artifacts upload triggered. View details here |
8ad184c
to
93ac2d0
Compare
f4a0399
to
14d9cb4
Compare
Artifacts upload triggered. View details here |
20227be
to
9327187
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, 1 unresolved discussion (waiting on @meship-starkware, @noaov1, and @Yoni-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.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @noaov1 and @Yoni-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.
Reviewable status: complete! all files reviewed, all discussions resolved (waiting on @noaov1 and @Yoni-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.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @noaov1, @PearsonWhite, and @Yoni-Starkware)
a discussion (no related file):
Please rebase to resolve conflicts.
39f53e8
to
14014a2
Compare
Artifacts upload triggered. View details here |
14014a2
to
4aab01a
Compare
Artifacts upload triggered. View details here |
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 2 files reviewed, all discussions resolved (waiting on @meship-starkware, @noaov1, and @Yoni-Starkware)
a discussion (no related file):
Previously, meship-starkware (Meshi Peled) wrote…
Please rebase to resolve conflicts.
done
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 r9, all commit messages.
Reviewable status: complete! all files reviewed, all discussions resolved (waiting on @noaov1 and @Yoni-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 1 files at r9, all commit messages.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @noaov1 and @PearsonWhite)
crates/blockifier/src/execution/syscalls/syscall_tests/call_contract.rs
line 205 at r9 (raw file):
) { let cairo_steps_contract = cairo_steps_contract_version.get_test_contract(); let sierra_gas_contract = FeatureContract::TestContract(CairoVersion::Cairo1);
Please fixturize this (add a case for native class)
Code quote:
sierra_gas_contract
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, 2 unresolved discussions (waiting on @noaov1 and @PearsonWhite)
crates/blockifier/src/execution/syscalls/syscall_tests/call_contract.rs
line 32 at r9 (raw file):
#[test] fn test_call_contract_that_panics() {
Please add a TODO to support this test once we support reverts
97abe4b
to
90a251e
Compare
Artifacts upload triggered. View details here |
90a251e
to
461aebf
Compare
Artifacts upload triggered. View details here |
461aebf
to
cdcb110
Compare
Artifacts upload triggered. View details here |
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 2 files at r11, 3 of 3 files at r12, all commit messages.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @noaov1 and @PearsonWhite)
crates/blockifier/src/execution/syscalls/syscall_tests/call_contract.rs
line 202 at r12 (raw file):
#[cfg_attr( feature = "cairo_native", test_case(CompilerBasedVersion::OldCairo1, CompilerBasedVersion::CairoVersion(CairoVersion::Native); "Cairo1_and_Native")
Thanks! non-blocking
Suggestion:
"OldCairo1_and_Native
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, 1 unresolved discussion (waiting on @noaov1)
crates/blockifier/src/execution/syscalls/syscall_tests/call_contract.rs
line 32 at r9 (raw file):
Previously, Yoni-Starkware (Yoni) wrote…
Please add a TODO to support this test once we support reverts
Added TODO
crates/blockifier/src/execution/syscalls/syscall_tests/call_contract.rs
line 205 at r9 (raw file):
Previously, Yoni-Starkware (Yoni) wrote…
Please fixturize this (add a case for native class)
done
cdcb110
to
86e7eec
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: 3 of 4 files reviewed, all discussions resolved (waiting on @noaov1 and @Yoni-Starkware)
crates/blockifier/src/execution/syscalls/syscall_tests/call_contract.rs
line 202 at r12 (raw file):
Previously, Yoni-Starkware (Yoni) wrote…
Thanks! non-blocking
done
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 r13, all commit messages.
Reviewable status: complete! all files reviewed, all discussions resolved (waiting on @noaov1)
Artifacts upload triggered. View details here |
Implements
call_contract
inNativeSyscallHandler
.