starknet_os: define sha256 batch resources constants#14140
Conversation
PR SummaryLow Risk Overview A new integration test runs the OS program entrypoint Reviewed by Cursor Bugbot for commit 4d46e0c. Bugbot is set up for automated code reviews on this repo. Configure here. |
aa0b28b to
e94b0c7
Compare
228195b to
d6c4ad3
Compare
062b998 to
09cbdec
Compare
4417771 to
f287752
Compare
09cbdec to
c5b45e5
Compare
yoavGrs
left a comment
There was a problem hiding this comment.
@yoavGrs reviewed 2 files and all commit messages, and made 4 comments.
Reviewable status: all files reviewed, 4 unresolved discussions (waiting on dorimedini-starkware and Yoni-Starkware).
crates/starknet_os/src/resource_utils_test.rs line 44 at r1 (raw file):
let len = input.len(); let message: &[u32; 16] = input[len - 24..len - 8].try_into().unwrap(); let state: &[u32; 8] = input[len - 8..].try_into().unwrap();
Try to avoid the indexing
Suggestion:
let message: [u32; 16] = rng.gen();
let state: [u32; 8] = rng.gen();
input.extend_from_slice(&message.into());
input.extend_from_slice(&state.into());crates/starknet_os/src/resource_utils_test.rs line 100 at r1 (raw file):
#[test] fn test_finalize_sha256() { // Sha256 batching resources has a linear factor and a constant factor. Sample the execution at
Suggestion:
has a linear factor by the number of rounds crates/starknet_os/src/resource_utils_test.rs line 102 at r1 (raw file):
// Sha256 batching resources has a linear factor and a constant factor. Sample the execution at // two points to compute both factors. let block_to_round = 7_usize;
From where this number come from?
Suggestion:
let blocks_in_round = 7_usize;crates/starknet_os/src/test_utils.rs line 22 at r1 (raw file):
// Resources consumed by the SHA-256 batch phase, separated into linear and constant factors. pub static SHA256_BATCH_RESOURCES_LINEAR: LazyLock<ExecutionResources> =
Why don't we need it in the VC?
c5b45e5 to
a1487a4
Compare
yoavGrs
left a comment
There was a problem hiding this comment.
@yoavGrs made 1 comment.
Reviewable status: all files reviewed, 4 unresolved discussions (waiting on dorimedini-starkware and Yoni-Starkware).
crates/starknet_os/src/test_utils.rs line 22 at r1 (raw file):
Previously, yoavGrs wrote…
Why don't we need it in the VC?
OK, these are the resources of a round.
Reflect it in the constant name / the comment.
a1487a4 to
db6000c
Compare
dorimedini-starkware
left a comment
There was a problem hiding this comment.
@dorimedini-starkware made 4 comments.
Reviewable status: 1 of 2 files reviewed, 4 unresolved discussions (waiting on yoavGrs and Yoni-Starkware).
crates/starknet_os/src/resource_utils_test.rs line 44 at r1 (raw file):
Previously, yoavGrs wrote…
Try to avoid the indexing
Done.
crates/starknet_os/src/resource_utils_test.rs line 102 at r1 (raw file):
Previously, yoavGrs wrote…
From where this number come from?
this is called BATCH_SIZE in the cairo common library implementing SHA
crates/starknet_os/src/test_utils.rs line 22 at r1 (raw file):
Previously, yoavGrs wrote…
OK, these are the resources of a round.
Reflect it in the constant name / the comment.
the resources of a batch, I think, is the terminology; hence BATCH_RESOURCES
crates/starknet_os/src/resource_utils_test.rs line 100 at r1 (raw file):
#[test] fn test_finalize_sha256() { // Sha256 batching resources has a linear factor and a constant factor. Sample the execution at
Done.
yoavGrs
left a comment
There was a problem hiding this comment.
@yoavGrs reviewed 1 file and all commit messages, and resolved 4 discussions.
Reviewable status:complete! all files reviewed, all discussions resolved (waiting on Yoni-Starkware).
5352b8c to
8b873b5
Compare
db6000c to
2a07010
Compare
8b873b5 to
636be17
Compare
2a07010 to
335dd5f
Compare
636be17 to
8ba4b2d
Compare
335dd5f to
b1625f5
Compare
|
Artifacts upload workflows: |
b1625f5 to
4d46e0c
Compare

No description provided.