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.
Originally posted by @PhilippGackstatter in #2334 (comment)
I think we need ~3 helpers in
miden::standards::network_account_target, something like:const ATTACHMENT_SCHEME = NetworkAccountTarget::ATTACHMENT_SCHEMEget_id(NoteAttachment) -> AccountIdattachment_scheme == NetworkAccountTarget::ATTACHMENT_SCHEME.new(AccountID, NoteExecutionMode) -> NoteAttachmentThen you can just use
network_account_target::get_idhere. 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 whatget_idwould do). I think this will be needed in other places so there is a benefit of moving this tomiden::standards, and avoids low-level code here.Originally posted by @PhilippGackstatter in #2334 (comment)