Skip to content

fix(standards): bound the PSWAP lineage depth to u32 - #3777

Merged
mmagician merged 9 commits into
nextfrom
fix-bound-pswap-depth
Sep 3, 2026
Merged

fix(standards): bound the PSWAP lineage depth to u32#3777
mmagician merged 9 commits into
nextfrom
fix-bound-pswap-depth

Conversation

@onurinanc

Copy link
Copy Markdown
Collaborator

Summary

  • Bound the depth increment in get_current_depth to a u32, aborting with ERR_PSWAP_PARENT_DEPTH_NOT_U32 or ERR_PSWAP_DEPTH_OVERFLOW instead of wrapping the field.
  • Validate the PswapAttachment word through a new TryFrom<&NoteAttachment> for PswapNoteAttachment whenever a PswapNote is built or decoded.

Closes #3682.

@mmagician mmagician left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

MASM change is ok, but I'd reword some of the comments to be more human-readable

Comment thread crates/miden-standards/src/note/pswap.rs Outdated
Comment thread crates/miden-standards/src/note/pswap.rs Outdated

@partylikeits1983 partylikeits1983 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me! Agree with Marti on the two comments above, some doc comments can be simplified.

@mmagician
mmagician added this pull request to the merge queue Sep 3, 2026
Merged via the queue into next with commit fcbb257 Sep 3, 2026
19 checks passed
@mmagician
mmagician deleted the fix-bound-pswap-depth branch September 3, 2026 08:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Smart Contract Diff Audit L-21: PSWAP Lineage Depth Tracking Diverges Between The On-Chain Script And The Rust Helpers

3 participants