-
Notifications
You must be signed in to change notification settings - Fork 21
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 support for sha256_process_block syscall #1545
base: rdr/add-syscall-counting
Are you sure you want to change the base?
Conversation
Artifacts upload triggered. View details here |
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## rdr/add-syscall-counting #1545 +/- ##
=========================================================
Coverage 68.48% 68.48%
=========================================================
Files 102 102
Lines 13662 13662
Branches 13662 13662
=========================================================
Hits 9357 9357
Misses 3904 3904
Partials 401 401 ☔ View full report in Codecov by Sentry. |
c728762
to
4cf52c8
Compare
a8a4e1b
to
05ccd53
Compare
Artifacts upload triggered. View details here |
Artifacts upload triggered. View details here |
Artifacts upload triggered. View details here |
147c1d3
to
ded98cf
Compare
05ccd53
to
3cf4a05
Compare
Artifacts upload triggered. View details here |
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 1 files at r5.
Reviewable status: 1 of 5 files reviewed, 2 unresolved discussions (waiting on @noaov1 and @varex83)
crates/blockifier/src/execution/native/entry_point_execution.rs
line 74 at r5 (raw file):
let versioned_constants = syscall_handler.context.versioned_constants(); *syscall_handler.resources += &versioned_constants.get_additional_os_syscall_resources(&syscall_handler.syscall_counter);
It seems like these lines are duplicated.
Suggestion:
// todo(rodrigo): execution resources for native execution are still wip until future
// development on both Cairo lang and the Native compiler
let versioned_constants = syscall_handler.context.versioned_constants();
*syscall_handler.resources +=
&versioned_constants.get_additional_os_syscall_resources(&syscall_handler.syscall_counter);
crates/blockifier/src/test_utils/cairo_compile.rs
line 198 at r5 (raw file):
sierra_output.stdout }
I don't think this should be part of this PR. Is it here because this PR is based on add_syscall_counting and not add_native_suppourt_in_testing_suite?
Code quote:
pub fn sierra_compile(
path: String,
git_tag_override: Option<String>,
cargo_nightly_arg: Option<String>,
) -> Vec<u8> {
prepare_cairo1_compiler_deps(git_tag_override);
let cairo1_compiler_path = local_cairo1_compiler_repo_path();
// Command args common to both compilation phases.
let mut base_compile_args = vec![
"run".into(),
format!("--manifest-path={}/Cargo.toml", cairo1_compiler_path.to_string_lossy()),
"--bin".into(),
];
// Add additional cargo arg if provided. Should be first arg (base command is `cargo`).
if let Some(nightly_version) = cargo_nightly_arg {
base_compile_args.insert(0, format!("+nightly-{nightly_version}"));
}
// Cairo -> Sierra.
let mut starknet_compile_commmand = Command::new("cargo");
starknet_compile_commmand.args(base_compile_args.clone());
starknet_compile_commmand.args(["starknet-compile", "--", "--single-file", &path]);
let sierra_output = run_and_verify_output(&mut starknet_compile_commmand);
sierra_output.stdout
}
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 r1, 1 of 1 files at r2, 1 of 1 files at r3, 1 of 2 files at r4, all commit messages.
Reviewable status: all files reviewed, 2 unresolved discussions (waiting on @noaov1 and @varex83)
6e88aa9
to
55834b2
Compare
429e95a
to
baab125
Compare
Artifacts upload triggered. View details here |
baab125
to
506c511
Compare
Artifacts upload triggered. View details here |
55834b2
to
60e2392
Compare
506c511
to
deb6167
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 5 files reviewed, 2 unresolved discussions (waiting on @meship-starkware and @noaov1)
crates/blockifier/src/execution/native/entry_point_execution.rs
line 74 at r5 (raw file):
Previously, meship-starkware (Meshi Peled) wrote…
It seems like these lines are duplicated.
Fixed.
crates/blockifier/src/test_utils/cairo_compile.rs
line 198 at r5 (raw file):
Previously, meship-starkware (Meshi Peled) wrote…
I don't think this should be part of this PR. Is it here because this PR is based on add_syscall_counting and not add_native_suppourt_in_testing_suite?
I think this was because rdr/add-syscall-counting
had been updated and this branch was still based on an old version. I rebased onto the latest rdr/add-syscall-counting
and it's no longer incorrectly showing this as part of the PR.
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 3 of 4 files at r6, all commit messages.
Reviewable status: 4 of 5 files reviewed, all discussions resolved (waiting on @noaov1)
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 @noaov1 and @varex83)
crates/blockifier/src/execution/native/syscall_handler.rs
line 319 at r6 (raw file):
current_block: &[u32; 16], remaining_gas: &mut u128, ) -> SyscallResult<()> {
Why is it ok to return None here while the function in the VM returns Sha256ProcessBlockResponse?
Code quote:
SyscallResult<()> {
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 @meship-starkware and @noaov1)
crates/blockifier/src/execution/native/syscall_handler.rs
line 319 at r6 (raw file):
Previously, meship-starkware (Meshi Peled) wrote…
Why is it ok to return None here while the function in the VM returns Sha256ProcessBlockResponse?
It's more of a question to the cairo native team before it returns a new state, but now we pass a mutable reference of prev_state
and update it accordingly. Why this design choice is made I can't say
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 r5, 4 of 4 files at r6, all commit messages.
Reviewable status: all files reviewed, 2 unresolved discussions (waiting on @meship-starkware and @varex83)
crates/blockifier/src/execution/native/syscall_handler.rs
line 326 at r6 (raw file):
)?; let data_as_bytes = sha2::digest::generic_array::GenericArray::from_exact_iter(
Suggestion:
let current_block_as_bytes = sha2::digest::generic_array::GenericArray:
60e2392
to
538df34
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 r5, 1 of 4 files at r6, all commit messages.
Reviewable status: all files reviewed, 2 unresolved discussions (waiting on @meship-starkware and @varex83)
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 4 files at r6.
Reviewable status: all files reviewed, 2 unresolved discussions (waiting on @varex83)
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 @meship-starkware and @noaov1)
crates/blockifier/src/execution/native/syscall_handler.rs
line 326 at r6 (raw file):
)?; let data_as_bytes = sha2::digest::generic_array::GenericArray::from_exact_iter(
Named like that just to be consistent with the current VM implementation:
let data_as_bytes = |
deb6167
to
1cd6470
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: all files reviewed, 1 unresolved discussion (waiting on @noaov1)
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)
538df34
to
861b3c2
Compare
1cd6470
to
bd4f9d6
Compare
Artifacts upload triggered. View details here |
This PR adds support for the sha256_process_block syscall for cairo native's syscall handler.