Skip to content

Conversation

@mmagician
Copy link
Collaborator

@mmagician mmagician commented Jan 23, 2026

As per the discussion here, the network target account ID is placed into NoteAttachment instead.

While at it, I created a helper function, similarly to the one we have for CLAIM notes: create_b2agg_note, and refactored the tests to use that utility.

TODO:

closes #2173
closes #2189

Comment on lines 50 to 59
# Ensure note attachment targets the consuming account.
exec.active_note::get_metadata
# => [NOTE_ATTACHMENT, METADATA_HEADER, pad(8)]

swapw dropw
# => [NOTE_ATTACHMENT, pad(12)]

# Reorder attachment word to [target_id_prefix, target_id_suffix, 0, 0].
movup.2 movup.3
# => [target_id_prefix, target_id_suffix, 0, 0, pad(12)]
Copy link
Contributor

@PhilippGackstatter PhilippGackstatter Jan 23, 2026

Choose a reason for hiding this comment

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

I think we need ~3 helpers in miden::standards::network_account_target, something like:

  • const ATTACHMENT_SCHEME = NetworkAccountTarget::ATTACHMENT_SCHEME
  • get_id(NoteAttachment) -> AccountId
    • This asserts attachment_scheme == NetworkAccountTarget::ATTACHMENT_SCHEME.
    • This assumes the attachment scheme was checked and simply returns the account ID. We may want to validate the account ID before returning?
    • A getter for note execution hint may not be necessary.
  • new(AccountID, NoteExecutionMode) -> NoteAttachment
    • Looks like that's not necessary for this PR, but you're creating network notes in the bridge_out.masm using the note tag, which should be replaced with a call to this function.

Then you can just use network_account_target::get_id here. The constant is useful to add in case some other code wants to inspect the attachment scheme and branch on it instead of panicking (which is what get_id would do). I think this will be needed in other places so there is a benefit of moving this to miden::standards, and avoids low-level code here.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Thanks, that's a good suggestion.

I created an issue to track this (PR already in draft), and for now added TODOs in the MASM code until that lands.

@mmagician mmagician force-pushed the mmagician-bagg-check branch from 69ed247 to bec68d1 Compare January 24, 2026 11:08
@mmagician mmagician marked this pull request as ready for review January 24, 2026 15:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants