-
Notifications
You must be signed in to change notification settings - Fork 115
Labels
good first issueGood for newcomersGood for newcomersstandardsRelated to standard note scripts or account componentsRelated to standard note scripts or account components
Milestone
Description
We should introduce note constructors for standard notes that make it easy to create them from MASM code.
The target use case here is when the note inputs are known. Meaning, that the way a SWAP note creates its payback note will not change through this, since it already only has the higher-level RECIPIENT.
As an example, for P2ID this could look like this in crates/miden-standards/asm/standards/notes/p2id.masm:
#! The existing main procedure, untouched.
pub proc main
# ...
end
#! Inputs: [target_id_prefix, target_id_suffix, tag, note_type, SERIAL_NUM]
#! Outputs: [note_idx]
pub proc new
# Write note inputs to memory in the expected layout (see `miden_standards::note::utils::build_p2id_recipient`)
# RECIPIENT = exec.miden::protocol::note::build_recipient(inputs, SERIAL_NUM, procref.main)
# note_idx = exec.miden::protocol::output_note::create(tag, note_type, RECIPIENT)
end
The benefit here is that:
- constructing the right note inputs layout would be handled by
new - obtaining the note script root is also handled by
new(viaprocref.main)
I think we should start by implementing this for the P2ID note, and then work on other standard notes, in case the approach changes.
Context: #2156 (comment)
Tasks:
- Implement the above.
- Test it.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
good first issueGood for newcomersGood for newcomersstandardsRelated to standard note scripts or account componentsRelated to standard note scripts or account components