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

Fix process block bug #851

Merged
merged 1 commit into from
Oct 15, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/starknet.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1750,7 +1750,8 @@ pub(crate) mod handler {
state: *mut [u32; 8],
block: &[u32; 16],
) {
let result = ptr.sha256_process_block(unsafe { &mut *state }, block, gas);
let state_ref = unsafe { state.as_mut().unwrap() };
let result = ptr.sha256_process_block(state_ref, block, gas);
Comment on lines 1750 to +1754
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the following would be better:

// ...
            state: &mut [u32; 8],
            block: &[u32; 16],
        ) {
            let result = ptr.sha256_process_block(state, block, gas);
// ...


*result_ptr = match result {
Ok(x) => SyscallResultAbi {
Expand Down
Loading