feat!: automatic NoteInterface and NoteGetterOptions auto select#4508
Merged
Conversation
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Partially addresses: #4519 (moved autogeneration to the macro, even if not incremental)
Closes: #3011
Added the
#[aztec(note)]attribute, which automatically implements most of theNoteInterfacetrait in a struct marked as such, plus several utilities. Even if this adds a fair share of "magic" to the note implementation logic, it is structured in a way that it's hopefully easy to follow, including meaningful errors attached to the correct span during the process.Hey you! Implement the trait!
But only the meat and potatoes though.
As long as the user doesn't want to do any custom stuff,
get_header,set_header,compute_note_content_hash,get_note_type_id,serialize_contentanddeserialize_contentget automatically implemented. Any combination of them can be overridden by the developer though.A metadata struct is also added, which takes the following form:
This is used to implement a
properties()function, which in turn can be used in conjunction with theNoteGetterOptions.selectand.sort