Skip to content

feat: move standard note scripts into standard library#2255

Merged
mmagician merged 5 commits into0xMiden:nextfrom
Farukest:feat/move-note-scripts-to-stdlib-v2
Jan 12, 2026
Merged

feat: move standard note scripts into standard library#2255
mmagician merged 5 commits into0xMiden:nextfrom
Farukest:feat/move-note-scripts-to-stdlib-v2

Conversation

@Farukest
Copy link
Contributor

Summary

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.

For context see #2156 and #2188.

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

Benefits

  • Script roots accessible via procref.p2id::main (no more hardcoded constants)
  • Note script files reduced from ~100+ lines to 5 lines each
  • Opens possibility for future note constructors (separate PR)

Test plan

  • cargo build -p miden-standards passes
  • cargo test -p miden-standards passes (52 tests)
  • Note script integration tests pass (27 tests: p2id, p2ide, swap, mint, burn)

Closes #2243

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
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

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 main procedure
  • 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.

@Farukest Farukest force-pushed the feat/move-note-scripts-to-stdlib-v2 branch from 18e6d9b to 34837b7 Compare January 12, 2026 16:17
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

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.

@mmagician
Copy link
Collaborator

@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
Copy link
Collaborator

@mmagician mmagician left a comment

Choose a reason for hiding this comment

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

LGTM thanks

@mmagician mmagician merged commit e4116a0 into 0xMiden:next Jan 12, 2026
17 checks passed
CreeptoGengar pushed a commit to CreeptoGengar/miden-base that referenced this pull request Jan 15, 2026
* 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>
afa7789 pushed a commit to afa7789/miden-base that referenced this pull request Jan 15, 2026
* 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>
afa7789 pushed a commit to afa7789/miden-base that referenced this pull request Jan 15, 2026
* 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>
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.

Move standard note scripts into standard library

3 participants