Skip to content

feat(standards): add salted P2ID constructors - #3897

Open
partylikeits1983 wants to merge 8 commits into
nextfrom
ajl-p2id-salted-constructors
Open

partylikeits1983 wants to merge 8 commits into
nextfrom
ajl-p2id-salted-constructors

Conversation

@partylikeits1983

@partylikeits1983 partylikeits1983 commented Sep 17, 2026

Copy link
Copy Markdown
Contributor

MASM callers can now supply salt when creating P2ID notes through prepare_note_with_salt and create_output_note_with_salt. Existing constructors remain "zero salt" wrappers.

P2ID's consumption script lives in p2id/script.masm, with constructors and public exports in p2id/mod.masm. There is precedent for this directory structure in notes/mint/, which separates fungible and non-fungible implementations.

P2idNoteStorage now uses bon::Builder, replacing with_salt. Both Rust builders add generate_salt(&mut rng). Private notes continue to default to zero salt; the docs explain how to supply random, secret salt and the remaining note-tag privacy limitation.

Follow-up to #3887.

Comment thread CHANGELOG.md
Comment thread CHANGELOG.md Outdated
@partylikeits1983
partylikeits1983 marked this pull request as ready for review September 17, 2026 13:43
Comment thread crates/miden-standards/src/note/p2id.rs Outdated
Comment thread crates/miden-standards/src/note/p2id.rs Outdated
Comment thread crates/miden-standards/src/note/p2id.rs Outdated
Comment thread crates/miden-standards/src/note/p2id.rs Outdated
Comment thread crates/miden-standards/src/note/p2id.rs Outdated

@zeapoz zeapoz 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.

Looks good to me! But I think we can improve the repeated doc sections a bit, and consolidate the redefined storage pointer constants

Comment thread crates/miden-standards/asm/standards/notes/p2id/script.masm Outdated
Comment thread crates/miden-standards/src/note/p2id.rs
Share storage pointer constants between the P2ID script and constructors, and link salt setters to one privacy explanation. Move the follow-up changelog entries to Unreleased for the next release.

@zeapoz zeapoz 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.

LGTM!

@partylikeits1983 partylikeits1983 self-assigned this Sep 17, 2026
@partylikeits1983 partylikeits1983 added standards Related to standard note scripts or account components pr-from-maintainers PRs that come from internal contributors or integration partners. They should be given priority labels Sep 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pr-from-maintainers PRs that come from internal contributors or integration partners. They should be given priority standards Related to standard note scripts or account components

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants