refactor: enforce CLAIM note consumer via NetworkAccountTarget attachment, not NoteStorage#2480
Merged
refactor: enforce CLAIM note consumer via NetworkAccountTarget attachment, not NoteStorage#2480
CLAIM note consumer via NetworkAccountTarget attachment, not NoteStorage#2480Conversation
Comment on lines
389
to
394
| #! OUTPUT_NOTE_DATA_KEY => [ | ||
| #! output_p2id_serial_num[4], // P2ID note serial number (4 felts, Word) | ||
| #! agglayer_faucet_account_id[2], // Agglayer faucet account ID (2 felts, prefix and suffix) | ||
| #! output_note_tag[1], // P2ID output note tag | ||
| #! miden_claim_amount[1], // Miden claim amount (1 felt) | ||
| #! padding[2], // padding (2 felts) | ||
| #! ] |
Contributor
There was a problem hiding this comment.
Let's wait for this PR to land as it refactors OUTPUT_NOTE_DATA_KEY and removes output_p2id_serial_num
Or could you rebase off of #2484
Contributor
partylikeits1983
left a comment
There was a problem hiding this comment.
LGTM, but lets combine these two PRs since they overlap a lot.
e7ed7c1 to
86fcb9e
Compare
…ment Replace the storage-based assert_aggfaucet_is_consumer check with the standard network_account_target::active_account_matches_target_account attachment check, unifying how all agglayer note scripts enforce their target consumer. The CLAIM note already carries the target faucet ID in its NetworkAccountTarget attachment (set during note creation in Rust). This change makes the note script use that attachment for the consumer check instead of reading target_faucet_account_id from note storage. Closes #2468 Co-authored-by: marti <marti@hungrycats.studio>
Now that the consumer check uses the NetworkAccountTarget attachment, the target_faucet_account_id no longer needs to be serialized into NoteStorage. The field is kept in OutputNoteData (used to build the attachment in Rust) but excluded from to_elements(). The OutputNoteData memory layout changes from: [serial_num(4), faucet_id(2), tag(1), amount(1)] to: [serial_num(4), tag(1), amount(1), padding(2)] Updated MASM constants: - OUTPUT_NOTE_TAG_MEM_ADDR: 574 -> 572 - OUTPUT_NOTE_FAUCET_AMOUNT: 575 -> 573 Co-authored-by: marti <marti@hungrycats.studio>
…im_note param The target faucet account ID is only needed to build the NetworkAccountTarget attachment, not as part of the note storage data. Move it from OutputNoteData to a direct parameter of create_claim_note. Co-authored-by: marti <marti@hungrycats.studio>
d995f28 to
bde7af3
Compare
partylikeits1983
approved these changes
Feb 25, 2026
Comment on lines
+203
to
+204
| // Padding to keep 8 felts (2 words) for pipe_double_words_preimage_to_memory | ||
| elements.extend([Felt::ZERO; 2]); |
Contributor
There was a problem hiding this comment.
this actually doesn't have to be padded to 8 felts, (2 words) in NoteStorage for pipe_double_words_preimage_to_memory. But my follow up PR fixes this, so nothing to do here now.
|
|
||
| /// Output note data for CLAIM note creation. | ||
| /// Contains note-specific data and can use Miden types. | ||
| /// TODO: Remove all but target_faucet_account_id |
Contributor
There was a problem hiding this comment.
Nit: technically should not remove this TODO just yet.
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.
Replace the storage-based
assert_aggfaucet_is_consumercheck with the standardnetwork_account_target::active_account_matches_target_accountattachment check, unifying how all agglayer note scripts enforce their target consumer.The
CLAIMnote already carries the target faucet ID in its NetworkAccountTarget attachment (set during note creation in Rust).Closes #2468