starknet_os: use expect! to assert the blake constants for easy fixing#14033
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 SummaryLow Risk Overview Updates unit tests in both Reviewed by Cursor Bugbot for commit 1286e2e. Bugbot is set up for automated code reviews on this repo. Configure here. |
| "from", | ||
| "into_iterator", | ||
| ] } | ||
| expect-test.workspace = true |
There was a problem hiding this comment.
Test-only crate promoted to production dependency
Medium Severity
The expect-test crate — a snapshot testing library — is moved from [dev-dependencies] to [dependencies], making it a production dependency. The Expect type and expect! macro embed source file paths, line numbers, and column numbers, and are designed exclusively for test assertions with UPDATE_EXPECT=1 auto-fixing. The _EXPECT constants are only consumed by LazyLock parsers and test assertions — they serve no production purpose. This also downgrades six compile-time const usize values to runtime-parsed LazyLock<usize> statics, introducing a panic path (.parse().expect(...)) that previously could not exist.
Additional Locations (1)
Reviewed by Cursor Bugbot for commit a3359be. Configure here.
a3359be to
c984a31
Compare
7d9a724 to
3f84cb4
Compare
c984a31 to
a8d3338
Compare
94c6189 to
af285f6
Compare
a8d3338 to
3afee9b
Compare
3afee9b to
1286e2e
Compare
af285f6 to
30206ec
Compare
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
There are 2 total unresolved issues (including 1 from previous review).
❌ 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 1286e2e. Configure here.
| pub const STEPS_PER_2_U32_REMINDER_EXPECT: Expect = expect!["3"]; | ||
| pub static STEPS_PER_2_U32_REMINDER: LazyLock<usize> = LazyLock::new(|| { | ||
| STEPS_PER_2_U32_REMINDER_EXPECT.data.parse().expect("Expected data is a usize") | ||
| }); |
There was a problem hiding this comment.
Compile-time constants replaced with runtime-parsed lazy statics
Medium Severity
Six constants that were previously const usize (e.g., const STEPS_EMPTY_INPUT: usize = 169) are now LazyLock<usize> statics that parse strings at runtime via .data.parse(). This converts compile-time-checked values into runtime-initialized values that can panic on first access, adds lock overhead on every dereference, and relies on #[doc(hidden)] internals of expect-test. The expect! pattern is intended for test assertions, not for defining production constants.
Reviewed by Cursor Bugbot for commit 1286e2e. Configure here.



No description provided.