refactor(protocol): share MAX_ASSETS_PER_NOTE through protocol_utils - #3821
Open
mmagician wants to merge 5 commits into
Open
refactor(protocol): share MAX_ASSETS_PER_NOTE through protocol_utils#3821mmagician wants to merge 5 commits into
MAX_ASSETS_PER_NOTE through protocol_utils#3821mmagician wants to merge 5 commits into
Conversation
The constant lived in the transaction kernel, which is statically linked and so unreachable from `miden-standards`. A standard script that needs to bound itself by the note asset limit therefore had to re-derive the value, leaving two independent literals with nothing tying them together. Moves it next to `WORD_NUM_ELEMENTS` in `protocol_utils` and re-exports it from both the kernel and `miden::protocol::constants`, so the kernel's use sites are unchanged and standard scripts can import it. Also drops the last local `WORD_NUM_ELEMENTS` copy in `send_notes::common`, whose comment was waiting on a VM version the workspace has long since passed. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01FpaHTkPD94eEhrv7JTDoej
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01FpaHTkPD94eEhrv7JTDoej
Also says the kernel still re-exports the constant, so the entry does not read as a removal from that namespace. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01FpaHTkPD94eEhrv7JTDoej
mmagician
commented
Sep 7, 2026
MAX_ASSETS_PER_NOTE through protocol_utils
mmagician
marked this pull request as ready for review
September 7, 2026 10:45
mmagician
pushed a commit
that referenced
this pull request
Sep 7, 2026
Drops both asserts from the sweep component. `assert_vault_unchanged` is replaced by the account-commitment check in the auth component (#3733), and the initial-balance assert belongs there too - the procedure should be agnostic to what the vault holds. That leaves the component with the one action it is for, and keeps the stack's diff to what survives once all three PRs merge. Bounds the payload by importing `MAX_ASSETS_PER_NOTE` (#3821) rather than re-deriving it from the locals frame, which also removes the local `WORD_NUM_ELEMENTS` copy and its stale VM-issue comment. Validates the account interface in `new` the way `SendNotesTransactionScript` does: an account missing `sweep_asset_to_note`, `create_note` or `receive_asset` is now rejected at construction rather than deep inside execution. Also applies the review's wording throughout: assets are listed by the payload, not named by it. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01FpaHTkPD94eEhrv7JTDoej
zeapoz
approved these changes
Sep 7, 2026
`send_notes::common` is private to `send_notes`, and no consumer imports `WORD_NUM_ELEMENTS` from it - the three script modules name the constants they need explicitly. The `pub` was carried over from the `pub const` this import replaced. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01FpaHTkPD94eEhrv7JTDoej
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Makes #3713 easier, see the review comment.