feat: move standard note scripts into standard library#2255
feat: move standard note scripts into standard library#2255mmagician merged 5 commits into0xMiden:nextfrom
Conversation
Move note script logic from standalone files in `note_scripts/` directory to `miden::standards::notes` namespace modules. This enables dynamic access to script roots via `procref` instead of hardcoding values. Changes: - Add new modules under `standards/notes/`: p2id, p2ide, swap, burn, mint - Each module contains a `pub proc main` with the script logic - Original note script files now serve as minimal wrappers calling `exec.<note>::main` Closes 0xMiden#2243
There was a problem hiding this comment.
Pull request overview
This PR refactors note script logic by moving implementation from standalone files in note_scripts/ to modules under miden::standards::notes namespace. This enables dynamic access to script roots via procref and reduces code duplication by converting the original note scripts to minimal wrappers.
Changes:
- Created new modules under
standards/notes/(p2id, p2ide, swap, burn, mint) containing the script implementation - Refactored original note script files into 5-line wrappers that execute the corresponding module's
mainprocedure - Added CHANGELOG entry documenting the refactoring
Reviewed changes
Copilot reviewed 11 out of 11 changed files in this pull request and generated 7 comments.
Show a summary per file
| File | Description |
|---|---|
| crates/miden-standards/asm/standards/notes/swap.masm | New module containing SWAP note script implementation with pub proc main |
| crates/miden-standards/asm/standards/notes/p2ide.masm | New module containing P2IDE note script implementation with pub proc main |
| crates/miden-standards/asm/standards/notes/p2id.masm | New module containing P2ID note script implementation with pub proc main |
| crates/miden-standards/asm/standards/notes/mint.masm | New module containing MINT note script implementation with pub proc main |
| crates/miden-standards/asm/standards/notes/burn.masm | New module containing BURN note script implementation with pub proc main |
| crates/miden-standards/asm/note_scripts/SWAP.masm | Refactored to minimal wrapper calling exec.swap::main |
| crates/miden-standards/asm/note_scripts/P2IDE.masm | Refactored to minimal wrapper calling exec.p2ide::main |
| crates/miden-standards/asm/note_scripts/P2ID.masm | Refactored to minimal wrapper calling exec.p2id::main |
| crates/miden-standards/asm/note_scripts/MINT.masm | Refactored to minimal wrapper calling exec.mint::main |
| crates/miden-standards/asm/note_scripts/BURN.masm | Refactored to minimal wrapper calling exec.burn::main |
| CHANGELOG.md | Added entry documenting the refactoring to miden::standards::notes namespace |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
18e6d9b to
34837b7
Compare
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 11 out of 11 changed files in this pull request and generated no new comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
@Farukest there were a few locations in the code that still needed to be updated, see my PR against your branch: Farukest#1 |
chore: update docs contracts->standards
* feat: move standard note scripts into standard library Move note script logic from standalone files in `note_scripts/` directory to `miden::standards::notes` namespace modules. This enables dynamic access to script roots via `procref` instead of hardcoding values. Changes: - Add new modules under `standards/notes/`: p2id, p2ide, swap, burn, mint - Each module contains a `pub proc main` with the script logic - Original note script files now serve as minimal wrappers calling `exec.<note>::main` Closes 0xMiden#2243 * chore: add changelog entry for note scripts refactoring * docs: fix namespace references in note script documentation * chore: update docs contracts->standards --------- Co-authored-by: Marti <marti@miden.team>
* feat: move standard note scripts into standard library Move note script logic from standalone files in `note_scripts/` directory to `miden::standards::notes` namespace modules. This enables dynamic access to script roots via `procref` instead of hardcoding values. Changes: - Add new modules under `standards/notes/`: p2id, p2ide, swap, burn, mint - Each module contains a `pub proc main` with the script logic - Original note script files now serve as minimal wrappers calling `exec.<note>::main` Closes 0xMiden#2243 * chore: add changelog entry for note scripts refactoring * docs: fix namespace references in note script documentation * chore: update docs contracts->standards --------- Co-authored-by: Marti <marti@miden.team>
* feat: move standard note scripts into standard library Move note script logic from standalone files in `note_scripts/` directory to `miden::standards::notes` namespace modules. This enables dynamic access to script roots via `procref` instead of hardcoding values. Changes: - Add new modules under `standards/notes/`: p2id, p2ide, swap, burn, mint - Each module contains a `pub proc main` with the script logic - Original note script files now serve as minimal wrappers calling `exec.<note>::main` Closes 0xMiden#2243 * chore: add changelog entry for note scripts refactoring * docs: fix namespace references in note script documentation * chore: update docs contracts->standards --------- Co-authored-by: Marti <marti@miden.team>
Summary
Move note script logic from standalone files in
note_scripts/directory tomiden::standards::notesnamespace modules. This enables dynamic access to script roots viaprocrefinstead of hardcoding values.For context see #2156 and #2188.
Changes:
standards/notes/: p2id, p2ide, swap, burn, mintpub proc mainwith the script logicexec.<note>::mainBenefits
procref.p2id::main(no more hardcoded constants)Test plan
cargo build -p miden-standardspassescargo test -p miden-standardspasses (52 tests)Closes #2243