Skip to content

Add method for determining if Note is a network note #2362

@partylikeits1983

Description

@partylikeits1983

Feature description

In release 0.10.0, we had a convenient Note::is_network_note() method. Since the introduction of NoteAttachments, it’s now more confusing to determine whether a Note is a network note.

Current Behavior

Right now, the simplest approach is:

NetworkAccountTarget::try_from(note.metadata().attachment())

This works, but it’s indirect and not very discoverable.

Proposal

Introduce a NetworkNote newtype wrapper in miden-standards.

This would allow a cleaner API such as:

NetworkNote::try_from(note)

Benefits

  • Makes “is this a network note?” a straightforward, first-class operation.

  • Centralizes the parsing/validation logic instead of spreading it across call sites.

  • Enables extracting additional network-note-specific properties, e.g.:

    • target account ID

Acceptance Criteria

  • NetworkNote::try_from(Note) (or &Note) returns:

    • Ok(NetworkNote) if the note is a network note
    • an error otherwise (ideally informative enough to debug misuse)
  • NetworkNote exposes helper accessors for common fields (at minimum: target account ID)

Why is this feature needed?

DevEx

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions