Skip to content

Replace as-cast with u32::try_from in SRS creation#3483

Open
dannywillems wants to merge 2 commits intomasterfrom
dw/explicit-u32-cast
Open

Replace as-cast with u32::try_from in SRS creation#3483
dannywillems wants to merge 2 commits intomasterfrom
dw/explicit-u32-cast

Conversation

@dannywillems
Copy link
Member

Summary

  • Replace #[allow(clippy::cast_possible_truncation)] + i as u32 with u32::try_from(i).unwrap() in both create_parallel and create SRS methods
  • Makes the depth bound check explicit at runtime rather than silently truncating

Addresses Richard's review feedback on #3480.

Test plan

  • cargo clippy --all-targets --all-features passes clean
  • Existing serialization regression tests pass (ser_regression_canonical_*)
  • CI passes

@dannywillems dannywillems self-assigned this Feb 7, 2026
@dannywillems dannywillems moved this to In Review in Rust node Feb 7, 2026
Base automatically changed from dw/mina-hasher-hardening to master February 7, 2026 13:58
Replace `#[allow(clippy::cast_possible_truncation)]` with
`u32::try_from(i).unwrap()` in SRS creation, making the depth bound
check explicit at runtime rather than silently truncating.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: In Review

Development

Successfully merging this pull request may close these issues.

1 participant