feat: NetworkAccountTarget helpers in miden::standards#2338
Conversation
a429f13 to
39c3b41
Compare
bobbinth
left a comment
There was a problem hiding this comment.
Looks good! Thank you! I reviewed only the non-test code and left a couple of small comments inline.
crates/miden-standards/asm/standards/attachments/network_account_target.masm
Outdated
Show resolved
Hide resolved
crates/miden-standards/asm/standards/attachment/network_account_target.masm
Outdated
Show resolved
Hide resolved
PhilippGackstatter
left a comment
There was a problem hiding this comment.
Looks good!
I left a few suggestions.
crates/miden-standards/asm/standards/attachment/network_account_target.masm
Outdated
Show resolved
Hide resolved
crates/miden-standards/asm/standards/attachment/network_account_target.masm
Outdated
Show resolved
Hide resolved
crates/miden-standards/asm/standards/attachment/network_account_target.masm
Outdated
Show resolved
Hide resolved
crates/miden-standards/asm/standards/attachment/network_account_target.masm
Outdated
Show resolved
Hide resolved
crates/miden-standards/asm/standards/attachments/network_account_target.masm
Show resolved
Hide resolved
crates/miden-standards/asm/standards/attachment/network_account_target.masm
Outdated
Show resolved
Hide resolved
crates/miden-standards/asm/standards/attachment/network_account_target.masm
Outdated
Show resolved
Hide resolved
bobbinth
left a comment
There was a problem hiding this comment.
Looks good! Thank you! I left a couple of comments inline.
Not for this PR, but we should also create documentation for the standards - similar to how we have docs for the protocol functionality. Let's create an issue for this.
|
|
||
| # 0.13.3 (TBD) | ||
|
|
||
| - Added standards for working with `NetworkAccountTarget` attachments ([#2338](https://github.com/0xMiden/miden-base/pull/2338)). |
There was a problem hiding this comment.
If we want this to go into the v0.13.x release, we should change the PR target to main. Otherwise, we should move the changelog entry into the v0.14.0 section.
There was a problem hiding this comment.
changed to main and rebased 👍🏼
PhilippGackstatter
left a comment
There was a problem hiding this comment.
Looks good to me!
Left two comments regarding validation and moving MASM tests to miden-testing.
| u32split | ||
| # => [attachment_kind, attachment_scheme] |
There was a problem hiding this comment.
We should probably validate attachment_kind as well here, i.e.:
And looking at the neighboring extract_sender_from_metadata, it doesn't validate the account ID which it probably should also do. Would you mind adding a account_id::validate line there and add a Panics if section? If not, lmk and I'll open an issue or address it.
In general, I think the procedures we provide should provide as much safety as they can and if users want to work with potentially invalid metadata, they likely know what they're doing and can write their own procedures. But for 95% of users, validation should be the safer option.
Co-authored-by: Philipp Gackstatter <PhilippGackstatter@users.noreply.github.com>
instead of the whole METADATA word, pass only scheme and kind
move under miden-testing/src/standards
59052a4 to
d01e1cf
Compare
PhilippGackstatter
left a comment
There was a problem hiding this comment.
Looks great, thank you for moving the tests to miden-testing🙏
Create two MASM helper procedures under a new
miden::standards::attachment::network_account_target:new_attachment(account_id_prefix, account_id_suffix, exec_hint) -> NOTE_ATTACHMENTget_id(NOTE_ATTACHMENT, NOTE_METADATA_HEADER) -> account_id_prefix, account_id_suffixcloses #2337