-
Notifications
You must be signed in to change notification settings - Fork 599
refactor: streamlined log processing #13107
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
Merged
Changes from all commits
Commits
Show all changes
28 commits
Select commit
Hold shift + click to select a range
0ad539e
refactor: streamlined log processing
benesjan a671142
WIP
benesjan d2160e5
serialization test
benesjan a834bb7
cleanup
benesjan 899798c
spinach
benesjan 2a08077
updated comment
benesjan 9f4960d
WIP
benesjan f33e099
test fix
benesjan 82ac16c
disabled test to get full CI feedback
benesjan cb1ca2b
fixes after rebase
benesjan 15f802f
fixes after rebase 2
benesjan 52a0881
fix after rebase
benesjan 183140e
WIP
benesjan b4dc4b1
fix1
benesjan 6230b5c
diff cleanup
benesjan cb05afe
reverting accidental change
benesjan e97f128
passing LOG_CAPSULE_ARRAY_BASE_SLOT from Aztec.nr
benesjan e77fcaf
linking issue
benesjan a26b6b3
final cleanup
benesjan 993ea01
Apply suggestions from code review
benesjan 5651f6b
Apply suggestions from code review
benesjan dea43e6
stale comment fix
benesjan 1654d93
comp fix
benesjan 51cede1
removing in 1 loop
benesjan e009c31
stale comment fix
benesjan d489eaa
renamings
benesjan a73fc86
fix
benesjan d016b48
ordering fix
benesjan 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
142 changes: 142 additions & 0 deletions
142
noir-projects/aztec-nr/aztec/src/discovery/pending_tagged_log.nr
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 |
|---|---|---|
| @@ -0,0 +1,142 @@ | ||
| use protocol_types::{ | ||
| address::AztecAddress, | ||
| constants::{MAX_NOTE_HASHES_PER_TX, PRIVATE_LOG_SIZE_IN_FIELDS}, | ||
| hash::sha256_to_field, | ||
| traits::{Deserialize, Serialize}, | ||
| }; | ||
|
|
||
| // Base slot for the pending tagged log array to which the syncNotes oracle inserts found private logs. | ||
| pub(crate) global PENDING_TAGGED_LOG_ARRAY_BASE_SLOT: Field = sha256_to_field( | ||
| "AZTEC_NR::PENDING_TAGGED_PENDING_TAGGED_LOG_ARRAY_BASE_SLOT".as_bytes(), | ||
| ); | ||
|
|
||
| /// Represents a log as it is stored in the pending tagged log array to which the syncNotes oracle inserts found private log. | ||
| #[derive(Deserialize, Serialize)] | ||
| pub(crate) struct PendingTaggedLog { | ||
| pub log: BoundedVec<Field, PRIVATE_LOG_SIZE_IN_FIELDS>, | ||
| pub tx_hash: Field, | ||
| pub unique_note_hashes_in_tx: BoundedVec<Field, MAX_NOTE_HASHES_PER_TX>, | ||
| pub first_nullifier_in_tx: Field, | ||
| pub recipient: AztecAddress, | ||
| pub log_index_in_tx: Field, | ||
| } | ||
|
|
||
| mod test { | ||
| use crate::discovery::pending_tagged_log::PendingTaggedLog; | ||
| use protocol_types::{address::AztecAddress, traits::{FromField, Serialize}}; | ||
|
|
||
| #[test] | ||
| unconstrained fn pending_tagged_log_serialization_matches_typescript() { | ||
| let log = BoundedVec::from_array([1, 2, 3]); | ||
| let tx_hash = 123; | ||
| let unique_note_hashes = BoundedVec::from_array([4, 5]); | ||
| let first_nullifier = 6; | ||
| let recipient = AztecAddress::from_field(789); | ||
| let log_index_in_tx = 10; | ||
| let pending_log = PendingTaggedLog { | ||
| log, | ||
| tx_hash, | ||
| unique_note_hashes_in_tx: unique_note_hashes, | ||
| first_nullifier_in_tx: first_nullifier, | ||
| recipient, | ||
| log_index_in_tx, | ||
| }; | ||
|
|
||
| let serialized = pending_log.serialize(); | ||
|
|
||
| // The following value was generated by `pending_tagged_log.test.ts` | ||
| // --> Run the test with AZTEC_GENERATE_TEST_DATA=1 flag to update test data. | ||
| let serialized_pending_tagged_log_from_typescript = [ | ||
| 0x0000000000000000000000000000000000000000000000000000000000000001, | ||
| 0x0000000000000000000000000000000000000000000000000000000000000002, | ||
| 0x0000000000000000000000000000000000000000000000000000000000000003, | ||
| 0x0000000000000000000000000000000000000000000000000000000000000000, | ||
| 0x0000000000000000000000000000000000000000000000000000000000000000, | ||
| 0x0000000000000000000000000000000000000000000000000000000000000000, | ||
| 0x0000000000000000000000000000000000000000000000000000000000000000, | ||
| 0x0000000000000000000000000000000000000000000000000000000000000000, | ||
| 0x0000000000000000000000000000000000000000000000000000000000000000, | ||
| 0x0000000000000000000000000000000000000000000000000000000000000000, | ||
| 0x0000000000000000000000000000000000000000000000000000000000000000, | ||
| 0x0000000000000000000000000000000000000000000000000000000000000000, | ||
| 0x0000000000000000000000000000000000000000000000000000000000000000, | ||
| 0x0000000000000000000000000000000000000000000000000000000000000000, | ||
| 0x0000000000000000000000000000000000000000000000000000000000000000, | ||
| 0x0000000000000000000000000000000000000000000000000000000000000000, | ||
| 0x0000000000000000000000000000000000000000000000000000000000000000, | ||
| 0x0000000000000000000000000000000000000000000000000000000000000000, | ||
| 0x0000000000000000000000000000000000000000000000000000000000000003, | ||
| 0x000000000000000000000000000000000000000000000000000000000000007b, | ||
| 0x0000000000000000000000000000000000000000000000000000000000000004, | ||
| 0x0000000000000000000000000000000000000000000000000000000000000005, | ||
| 0x0000000000000000000000000000000000000000000000000000000000000000, | ||
| 0x0000000000000000000000000000000000000000000000000000000000000000, | ||
| 0x0000000000000000000000000000000000000000000000000000000000000000, | ||
| 0x0000000000000000000000000000000000000000000000000000000000000000, | ||
| 0x0000000000000000000000000000000000000000000000000000000000000000, | ||
| 0x0000000000000000000000000000000000000000000000000000000000000000, | ||
| 0x0000000000000000000000000000000000000000000000000000000000000000, | ||
| 0x0000000000000000000000000000000000000000000000000000000000000000, | ||
| 0x0000000000000000000000000000000000000000000000000000000000000000, | ||
| 0x0000000000000000000000000000000000000000000000000000000000000000, | ||
| 0x0000000000000000000000000000000000000000000000000000000000000000, | ||
| 0x0000000000000000000000000000000000000000000000000000000000000000, | ||
| 0x0000000000000000000000000000000000000000000000000000000000000000, | ||
| 0x0000000000000000000000000000000000000000000000000000000000000000, | ||
| 0x0000000000000000000000000000000000000000000000000000000000000000, | ||
| 0x0000000000000000000000000000000000000000000000000000000000000000, | ||
| 0x0000000000000000000000000000000000000000000000000000000000000000, | ||
| 0x0000000000000000000000000000000000000000000000000000000000000000, | ||
| 0x0000000000000000000000000000000000000000000000000000000000000000, | ||
| 0x0000000000000000000000000000000000000000000000000000000000000000, | ||
| 0x0000000000000000000000000000000000000000000000000000000000000000, | ||
| 0x0000000000000000000000000000000000000000000000000000000000000000, | ||
| 0x0000000000000000000000000000000000000000000000000000000000000000, | ||
| 0x0000000000000000000000000000000000000000000000000000000000000000, | ||
| 0x0000000000000000000000000000000000000000000000000000000000000000, | ||
| 0x0000000000000000000000000000000000000000000000000000000000000000, | ||
| 0x0000000000000000000000000000000000000000000000000000000000000000, | ||
| 0x0000000000000000000000000000000000000000000000000000000000000000, | ||
| 0x0000000000000000000000000000000000000000000000000000000000000000, | ||
| 0x0000000000000000000000000000000000000000000000000000000000000000, | ||
| 0x0000000000000000000000000000000000000000000000000000000000000000, | ||
| 0x0000000000000000000000000000000000000000000000000000000000000000, | ||
| 0x0000000000000000000000000000000000000000000000000000000000000000, | ||
| 0x0000000000000000000000000000000000000000000000000000000000000000, | ||
| 0x0000000000000000000000000000000000000000000000000000000000000000, | ||
| 0x0000000000000000000000000000000000000000000000000000000000000000, | ||
| 0x0000000000000000000000000000000000000000000000000000000000000000, | ||
| 0x0000000000000000000000000000000000000000000000000000000000000000, | ||
| 0x0000000000000000000000000000000000000000000000000000000000000000, | ||
| 0x0000000000000000000000000000000000000000000000000000000000000000, | ||
| 0x0000000000000000000000000000000000000000000000000000000000000000, | ||
| 0x0000000000000000000000000000000000000000000000000000000000000000, | ||
| 0x0000000000000000000000000000000000000000000000000000000000000000, | ||
| 0x0000000000000000000000000000000000000000000000000000000000000000, | ||
| 0x0000000000000000000000000000000000000000000000000000000000000000, | ||
| 0x0000000000000000000000000000000000000000000000000000000000000000, | ||
| 0x0000000000000000000000000000000000000000000000000000000000000000, | ||
| 0x0000000000000000000000000000000000000000000000000000000000000000, | ||
| 0x0000000000000000000000000000000000000000000000000000000000000000, | ||
| 0x0000000000000000000000000000000000000000000000000000000000000000, | ||
| 0x0000000000000000000000000000000000000000000000000000000000000000, | ||
| 0x0000000000000000000000000000000000000000000000000000000000000000, | ||
| 0x0000000000000000000000000000000000000000000000000000000000000000, | ||
| 0x0000000000000000000000000000000000000000000000000000000000000000, | ||
| 0x0000000000000000000000000000000000000000000000000000000000000000, | ||
| 0x0000000000000000000000000000000000000000000000000000000000000000, | ||
| 0x0000000000000000000000000000000000000000000000000000000000000000, | ||
| 0x0000000000000000000000000000000000000000000000000000000000000000, | ||
| 0x0000000000000000000000000000000000000000000000000000000000000000, | ||
| 0x0000000000000000000000000000000000000000000000000000000000000000, | ||
| 0x0000000000000000000000000000000000000000000000000000000000000000, | ||
| 0x0000000000000000000000000000000000000000000000000000000000000000, | ||
| 0x0000000000000000000000000000000000000000000000000000000000000002, | ||
| 0x0000000000000000000000000000000000000000000000000000000000000006, | ||
| 0x0000000000000000000000000000000000000000000000000000000000000315, | ||
| 0x000000000000000000000000000000000000000000000000000000000000000a, | ||
| ]; | ||
|
|
||
| assert_eq(serialized, serialized_pending_tagged_log_from_typescript); | ||
| } | ||
| } |
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
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.
Uh oh!
There was an error while loading. Please reload this page.