-
Notifications
You must be signed in to change notification settings - Fork 597
feat(aztec-nr): add Serialize/Deserialize for EphemeralArray #23417
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
Merged
nchamo
merged 3 commits into
merge-train/fairies
from
nchamo/ephemeral-arrays-serialization
May 21, 2026
Merged
Changes from 1 commit
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,32 +1,32 @@ | ||
| use crate::ephemeral::EphemeralArray; | ||
| use crate::messages::processing::{ | ||
| event_validation_request::EventValidationRequest, | ||
| log_retrieval_request::LogRetrievalRequest, log_retrieval_response::LogRetrievalResponse, MessageContext, | ||
| pending_tagged_log::PendingTaggedLog, | ||
| NoteValidationRequest, pending_tagged_log::PendingTaggedLog, | ||
| }; | ||
| use crate::protocol::address::AztecAddress; | ||
| use crate::protocol::blob_data::TxEffect; | ||
|
|
||
| /// Finds new private logs that may have been sent to all registered accounts in PXE in the current contract and | ||
| /// returns them in an ephemeral array with an oracle-allocated base slot. | ||
| pub(crate) unconstrained fn get_pending_tagged_logs(scope: AztecAddress) -> EphemeralArray<PendingTaggedLog> { | ||
| let result_slot = get_pending_tagged_logs_oracle(scope); | ||
| EphemeralArray::at(result_slot) | ||
| get_pending_tagged_logs_oracle(scope) | ||
|
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. lovely! |
||
| } | ||
|
|
||
| #[oracle(aztec_utl_getPendingTaggedLogs_v2)] | ||
| unconstrained fn get_pending_tagged_logs_oracle(scope: AztecAddress) -> Field {} | ||
| unconstrained fn get_pending_tagged_logs_oracle(scope: AztecAddress) -> EphemeralArray<PendingTaggedLog> {} | ||
|
|
||
| /// Validates note/event requests stored in ephemeral arrays. | ||
| pub(crate) unconstrained fn validate_and_store_enqueued_notes_and_events( | ||
| note_validation_requests_array_slot: Field, | ||
| event_validation_requests_array_slot: Field, | ||
| note_validation_requests: EphemeralArray<NoteValidationRequest>, | ||
| event_validation_requests: EphemeralArray<EventValidationRequest>, | ||
| max_note_packed_len: Field, | ||
| max_event_serialized_len: Field, | ||
| scope: AztecAddress, | ||
| ) { | ||
| validate_and_store_enqueued_notes_and_events_oracle( | ||
| note_validation_requests_array_slot, | ||
| event_validation_requests_array_slot, | ||
| note_validation_requests, | ||
| event_validation_requests, | ||
| max_note_packed_len, | ||
| max_event_serialized_len, | ||
| scope, | ||
|
|
@@ -35,8 +35,8 @@ pub(crate) unconstrained fn validate_and_store_enqueued_notes_and_events( | |
|
|
||
| #[oracle(aztec_utl_validateAndStoreEnqueuedNotesAndEvents_v2)] | ||
| unconstrained fn validate_and_store_enqueued_notes_and_events_oracle( | ||
| note_validation_requests_array_slot: Field, | ||
| event_validation_requests_array_slot: Field, | ||
| note_validation_requests: EphemeralArray<NoteValidationRequest>, | ||
| event_validation_requests: EphemeralArray<EventValidationRequest>, | ||
| max_note_packed_len: Field, | ||
| max_event_serialized_len: Field, | ||
| scope: AztecAddress, | ||
|
|
@@ -46,23 +46,25 @@ unconstrained fn validate_and_store_enqueued_notes_and_events_oracle( | |
| pub(crate) unconstrained fn get_logs_by_tag( | ||
| requests: EphemeralArray<LogRetrievalRequest>, | ||
| ) -> EphemeralArray<Option<LogRetrievalResponse>> { | ||
| let response_slot = get_logs_by_tag_v2_oracle(requests.slot); | ||
| EphemeralArray::at(response_slot) | ||
| get_logs_by_tag_v2_oracle(requests) | ||
| } | ||
|
|
||
| #[oracle(aztec_utl_getLogsByTag_v2)] | ||
| unconstrained fn get_logs_by_tag_v2_oracle(request_array_slot: Field) -> Field {} | ||
| unconstrained fn get_logs_by_tag_v2_oracle( | ||
| requests: EphemeralArray<LogRetrievalRequest>, | ||
| ) -> EphemeralArray<Option<LogRetrievalResponse>> {} | ||
|
|
||
| /// Resolves message contexts for tx hashes in an ephemeral request array and returns a response ephemeral array. | ||
| pub(crate) unconstrained fn get_message_contexts_by_tx_hash( | ||
| requests: EphemeralArray<Field>, | ||
| ) -> EphemeralArray<Option<MessageContext>> { | ||
| let response_slot = get_message_contexts_by_tx_hash_v2_oracle(requests.slot); | ||
| EphemeralArray::at(response_slot) | ||
| get_message_contexts_by_tx_hash_v2_oracle(requests) | ||
| } | ||
|
|
||
| #[oracle(aztec_utl_getMessageContextsByTxHash_v2)] | ||
| unconstrained fn get_message_contexts_by_tx_hash_v2_oracle(request_array_slot: Field) -> Field {} | ||
| unconstrained fn get_message_contexts_by_tx_hash_v2_oracle( | ||
| requests: EphemeralArray<Field>, | ||
| ) -> EphemeralArray<Option<MessageContext>> {} | ||
|
|
||
| /// Fetches all effects of a settled transaction by its hash. | ||
| pub unconstrained fn get_tx_effect(tx_hash: Field) -> Option<TxEffect> { | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This signature should be
[Field; N], correct?(or, if the N assignment in line 108 can be deleted, that would be equally good I guess)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Makes sense! Did it in 9968a92