feat: Enable CodeBuilder to add advice map entries to compiled scripts#2275
Merged
feat: Enable CodeBuilder to add advice map entries to compiled scripts#2275
Conversation
Contributor
|
Looks great, thanks! Can you address the TODO in Also, afaict this does not make it possible to add advice map entries for |
huitseeker
added a commit
that referenced
this pull request
Jan 16, 2026
…otes_script This addresses reviewer feedback on PR #2275: 1. build_send_notes_script now automatically adds NoteAttachmentContent::Array entries to the transaction script's advice map, eliminating the need for callers to manually add attachment data via extend_advice_map. 2. AccountComponentCode now has a with_advice_map method for feature parity with TransactionScript and NoteScript. 3. CodeBuilder's compile_component_code now applies the advice map to the compiled library, consistent with compile_tx_script and compile_note_script. 4. Added tests for the new functionality.
6e5a34f to
988ce7b
Compare
huitseeker
added a commit
that referenced
this pull request
Jan 17, 2026
…otes_script This addresses reviewer feedback on PR #2275: 1. build_send_notes_script now automatically adds NoteAttachmentContent::Array entries to the transaction script's advice map, eliminating the need for callers to manually add attachment data via extend_advice_map. 2. AccountComponentCode now has a with_advice_map method for feature parity with TransactionScript and NoteScript. 3. CodeBuilder's compile_component_code now applies the advice map to the compiled library, consistent with compile_tx_script and compile_note_script. 4. Added tests for the new functionality.
988ce7b to
fc8a1a8
Compare
bobbinth
reviewed
Jan 20, 2026
PhilippGackstatter
approved these changes
Jan 20, 2026
Contributor
PhilippGackstatter
left a comment
There was a problem hiding this comment.
Looks great, thank you!
Enable CodeBuilder to add advice map entries to compiled scripts. This addresses issue #2267 by allowing advice entries to be included in transaction scripts and note scripts via the MastForest. Added methods: - add_advice_map_entry: adds a single entry - with_advice_map_entry: builder pattern for single entry - extend_advice_map: adds multiple entries - with_extended_advice_map: builder pattern for multiple entries The advice map entries are incorporated into the Program via Program::with_advice_map() before wrapping in TransactionScript or NoteScript.
Extract duplicate advice map application logic into a private helper method apply_advice_map(). This reduces code duplication between compile_tx_script and compile_note_script. Also simplify test assertions by using expect() instead of is_some() + unwrap() pattern, which is more idiomatic for tests.
Add `with_advice_map` method to both `TransactionScript` and `NoteScript`, allowing advice map entries to be added after script compilation. This complements the CodeBuilder API by enabling post-compilation advice map modifications directly on script types.
…ports Simplify test structure by merging separate empty and non-empty advice map test cases into single comprehensive tests. Add AdviceMap to import list in script.rs for consistency.
huitseeker
added a commit
that referenced
this pull request
Jan 20, 2026
…otes_script This addresses reviewer feedback on PR #2275: 1. build_send_notes_script now automatically adds NoteAttachmentContent::Array entries to the transaction script's advice map, eliminating the need for callers to manually add attachment data via extend_advice_map. 2. AccountComponentCode now has a with_advice_map method for feature parity with TransactionScript and NoteScript. 3. CodeBuilder's compile_component_code now applies the advice map to the compiled library, consistent with compile_tx_script and compile_note_script. 4. Added tests for the new functionality.
6615a39 to
2935eb5
Compare
…otes_script This addresses reviewer feedback on PR #2275: 1. build_send_notes_script now automatically adds NoteAttachmentContent::Array entries to the transaction script's advice map, eliminating the need for callers to manually add attachment data via extend_advice_map. 2. AccountComponentCode now has a with_advice_map method for feature parity with TransactionScript and NoteScript. 3. CodeBuilder's compile_component_code now applies the advice map to the compiled library, consistent with compile_tx_script and compile_note_script. 4. Added tests for the new functionality.
2935eb5 to
a9751db
Compare
bobbinth
approved these changes
Jan 21, 2026
Contributor
bobbinth
left a comment
There was a problem hiding this comment.
All looks good! Thank you!
partylikeits1983
pushed a commit
that referenced
this pull request
Feb 12, 2026
afa7789
pushed a commit
to afa7789/miden-base
that referenced
this pull request
Mar 9, 2026
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.
Fixes #2267.