starknet_os: recompute and assert the blake constants#14032
Conversation
|
Warning This pull request is not mergeable via GitHub because a downstack PR is open. Once all requirements are satisfied, merge this PR as a stack on Graphite.
This stack of pull requests is managed by Graphite. Learn more about stacking. |
PR SummaryMedium Risk Overview Introduces a small helper ( Reviewed by Cursor Bugbot for commit 139758c. Bugbot is set up for automated code reviews on this repo. Configure here. |
dorimedini-starkware
left a comment
There was a problem hiding this comment.
@dorimedini-starkware made 1 comment.
Reviewable status: 0 of 2 files reviewed, 1 unresolved discussion (waiting on AvivYossef-starkware and Yoni-Starkware).
crates/blockifier/src/execution/casm_hash_estimation.rs line 266 at r1 (raw file):
pub const BASE_STEPS_PARTIAL_MSG: usize = 195; // Extra VM steps added per 2-u32 remainder in partial Blake messages. pub const STEPS_PER_2_U32_REMINDER: usize = 3;
all 6 constants are tested, 3 needed a one-step adjustment
Code quote:
// Base number of VM steps applied when the input to Blake hashing is empty.
// Determined empirically by running `encode_felt252_data_and_calc_blake_hash` on empty input.
pub const STEPS_EMPTY_INPUT: usize = 170;
// The constants used are empirical, based on running `encode_felt252_data_and_calc_blake_hash`
// on combinations of large and small felts.
// VM steps per large felt.
pub const STEPS_PER_LARGE_FELT: usize = 45;
// VM steps per small felt.
pub const STEPS_PER_SMALL_FELT: usize = 15;
// Base overhead when input exactly fills a 16-u32 Blake message.
pub const BASE_STEPS_FULL_MSG: usize = 217;
// Base overhead when the input leaves a remainder (< 16 u32s) for a Blake message.
pub const BASE_STEPS_PARTIAL_MSG: usize = 195;
// Extra VM steps added per 2-u32 remainder in partial Blake messages.
pub const STEPS_PER_2_U32_REMINDER: usize = 3;There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 7d9a724. Configure here.
3f84cb4 to
94c6189
Compare
94c6189 to
af285f6
Compare
3ccab0e to
ba51f08
Compare
af285f6 to
30206ec
Compare
30206ec to
139758c
Compare


No description provided.