pub comptime fn custom_note(s: TypeDefinition) -> Quoted
Generates code for a custom note implementation that requires specialized note hash or nullifier computation.
The note struct must:
Packable
MAX_NOTE_PACKED_LEN
Unlike the #[note] macro, there is no requirement for an owner field.
#[note]
owner
Registers the note in the global NOTES BoundedVec to enable note processing functionality.
NOTES
Use this macro when implementing a note that needs custom:
The macro omits generating default NoteHash trait implementation, allowing you to provide your own.
#[custom_note] struct CustomNote { value: Field, metadata: Field } impl NoteHash for CustomNote { // Custom note hash computation... fn compute_note_hash(...) -> Field { ... } // Custom nullifier computation... fn compute_nullifier(...) -> Field { ... } fn compute_nullifier_unconstrained(...) -> Field { ... } }
Generates code for a custom note implementation that requires specialized note hash or nullifier computation.
Generated Code
Requirements
The note struct must:
PackabletraitMAX_NOTE_PACKED_LENwhen packedUnlike the
#[note]macro, there is no requirement for anownerfield.Registration
Registers the note in the global
NOTESBoundedVec to enable note processing functionality.Use Cases
Use this macro when implementing a note that needs custom:
The macro omits generating default NoteHash trait implementation, allowing you to provide your own.
Example