starknet_os: proper base measurement in OS resources test#14294
Conversation
|
Artifacts upload workflows: |
PR SummaryLow Risk Overview The test now tracks how many linear elements are baked into the first paired measurement (e.g. deploy calldata length) and subtracts Versioned constants for 0.14.4 are refreshed to match the corrected measurements: lower Reviewed by Cursor Bugbot for commit c8fdcf3. Bugbot is set up for automated code reviews on this repo. Configure here. |
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 c8fdcf3. Configure here.
| /// it does have a measurable linear factor stored under [Selector::KeccakRound]. | ||
| const SYSCALLS_WITH_LINEAR_FACTOR: LazyLock<HashMap<Selector, usize>> = LazyLock::new(|| { | ||
| HashMap::from([(Selector::Deploy, 1), (Selector::Keccak, 0), (Selector::MetaTxV0, 1)]) | ||
| }); |
There was a problem hiding this comment.
const with LazyLock defeats lazy caching purpose
Low Severity
SYSCALLS_WITH_LINEAR_FACTOR is declared as const but wraps a LazyLock<HashMap<...>>. In Rust, const items are inlined at each use site, so every reference to this identifier creates a brand-new LazyLock and re-allocates the HashMap — completely defeating the lazy-initialization caching that LazyLock provides. Since it's referenced inside a while loop (at line 436), a fresh HashMap is built on every iteration. Every other LazyLock in this crate correctly uses static. This is the well-known declare_interior_mutable_const anti-pattern; changing const to static fixes it.
Reviewed by Cursor Bugbot for commit c8fdcf3. Configure here.



No description provided.