Skip to content

Use enum for note_type field in protobuf representation of NoteMetadata #624

@polydez

Description

@polydez

Currently we encode note_type field in protobuf representation of NoteMetadata as uint32 with additional description of encoding:

https://github.com/0xPolygonMiden/miden-node/blob/3612ef622e3affef87d05bc638b00a7b3de01ab9/proto/note.proto#L14-L15

We could use enum support in Protocol Buffers in order to make our code/encoding clearer:

enum NoteType {
    NOTE_TYPE_UNSPECIFIED = 0;
    NOTE_TYPE_PUBLIC = 1;
    NOTE_TYPE_PRIVATE = 2;
    NOTE_TYPE_ENCRYPTED = 3;
}


// Represents a note's metadata.
message NoteMetadata {
    // ...

    // The type of the note (0b01 = public, 0b10 = private, 0b11 = encrypted).
    NoteType note_type = 2;

    // ....
}

Metadata

Metadata

Labels

No labels
No labels

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions