-
Notifications
You must be signed in to change notification settings - Fork 32
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Feature: Add support for SHA256_PROCESS_BLOCK syscall (#348)
* feat: add Sha256ProcessBlock syscall * fmt + clippy * Write response to out_state properly * implement exit_sha256_process_block_syscall * hint_1: use cairo-vm implementation * update cairo-vm commit * address review comments. add integration test for failing block --------- Co-authored-by: Stephen Shelton <[email protected]> Co-authored-by: ftheirs <[email protected]>
- Loading branch information
1 parent
7cde766
commit dd0af9e
Showing
12 changed files
with
147 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,4 @@ | ||
use indoc::indoc; | ||
|
||
#[allow(unused)] | ||
pub const HINT_1: &str = indoc! {r#"# Add dummy pairs of input and output. | ||
from starkware.cairo.common.cairo_sha256.sha256_utils import ( | ||
IV, | ||
compute_message_schedule, | ||
sha2_compress_function, | ||
) | ||
number_of_missing_blocks = (-ids.n) % ids.BATCH_SIZE | ||
assert 0 <= number_of_missing_blocks < 20 | ||
_sha256_input_chunk_size_felts = ids.SHA256_INPUT_CHUNK_SIZE_FELTS | ||
assert 0 <= _sha256_input_chunk_size_felts < 100 | ||
message = [0] * _sha256_input_chunk_size_felts | ||
w = compute_message_schedule(message) | ||
output = sha2_compress_function(IV, w) | ||
padding = (message + IV + output) * number_of_missing_blocks | ||
segments.write_arg(ids.sha256_ptr_end, padding)"#}; | ||
|
||
#[allow(unused)] | ||
pub const HINT_4: &str = indoc! {r#"exit_syscall(selector=ids.SHA256_PROCESS_BLOCK_SELECTOR)"#}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters