-
Notifications
You must be signed in to change notification settings - Fork 607
feat: upstream oxide aztec-nr changes #22979
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
c2b2565
93cf68b
f1f57e3
a28ab4b
20b63f0
1c3c4d2
c46bfdd
70cbd8f
a044cfd
e655627
d48e5d1
86743ad
f7b650a
a2abef5
dbe82c3
09ce2f7
8b34b37
8671dc0
fe10569
a7e77c5
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -19,10 +19,12 @@ pub(crate) global PRIVATE_NOTE_MSG_PLAINTEXT_RANDOMNESS_INDEX: u32 = 2; | |
| /// encryption overhead and extra fields in the message (e.g. message type id, storage slot, randomness, etc.). | ||
| pub global MAX_NOTE_PACKED_LEN: u32 = MAX_MESSAGE_CONTENT_LEN - PRIVATE_NOTE_MSG_PLAINTEXT_RESERVED_FIELDS_LEN; | ||
|
|
||
| /// Creates the plaintext for a private note message (i.e. one of type [`PRIVATE_NOTE_MSG_TYPE_ID`]). | ||
| /// Creates the plaintext for a private note message with the given `msg_type_id`. | ||
| /// | ||
| /// This plaintext is meant to be decoded via [`decode_private_note_message`]. | ||
| pub fn encode_private_note_message<Note>( | ||
| /// Shared encoder used by [`encode_private_note_message`] and by custom message handlers that use the same format as | ||
| /// standard private note message but perform additional validation logic. | ||
| pub fn encode_private_note_message_with_msg_type_id<Note>( | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is admittedly a bit messy and I am not sure it will survive long-term but I exposed this because in oxide there we have a custom message handler that triggers the standard note message processing pipeline while performing additional logic. This means that there we have a message encoded exactly the same way as PRIVATE_NOTE_MSG_TYPE_ID message but it travels here via the custom message handler. Maybe with time we will want to create some standard for a custom message handler that triggers default aztec-nr message handlers but it's too soon for that so think this "messyness" is justified for now.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This makes sense 👍. The only thing that I find a bit strange now is that this source file lives under I don't see the connection with logs, this all seems to be purely about putting notes inside messages
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This being under logs is a pure tech debt from times where the separation between log and messages didn't really exist. I remember Nico was doing some restructurings like a year ago. @nventuro was this just forgotten? |
||
| msg_type_id: u64, | ||
| note: Note, | ||
| owner: AztecAddress, | ||
| storage_slot: Field, | ||
|
|
@@ -49,7 +51,28 @@ where | |
| } | ||
|
|
||
| // Notes use the note type id for metadata | ||
| encode_message(PRIVATE_NOTE_MSG_TYPE_ID, Note::get_id() as u64, msg_content) | ||
| encode_message(msg_type_id, Note::get_id() as u64, msg_content) | ||
| } | ||
|
|
||
| /// Creates the plaintext for a private note message (i.e. one of type [`PRIVATE_NOTE_MSG_TYPE_ID`]). | ||
| /// | ||
| /// This plaintext is meant to be decoded via [`decode_private_note_message`]. | ||
| pub fn encode_private_note_message<Note>( | ||
| note: Note, | ||
| owner: AztecAddress, | ||
| storage_slot: Field, | ||
| randomness: Field, | ||
| ) -> [Field; PRIVATE_NOTE_MSG_PLAINTEXT_RESERVED_FIELDS_LEN + <Note as Packable>::N + MESSAGE_EXPANDED_METADATA_LEN] | ||
| where | ||
| Note: NoteType + Packable, | ||
| { | ||
| encode_private_note_message_with_msg_type_id( | ||
| PRIVATE_NOTE_MSG_TYPE_ID, | ||
| note, | ||
| owner, | ||
| storage_slot, | ||
| randomness, | ||
| ) | ||
| } | ||
|
|
||
| /// Decodes the plaintext from a private note message (i.e. one of type [`PRIVATE_NOTE_MSG_TYPE_ID`]). | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.