-
Notifications
You must be signed in to change notification settings - Fork 306
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
feat: delivering partial fields via unencrypted logs #8725
Merged
benesjan
merged 24 commits into
master
from
09-24-feat_delivering_partial_fields_via_unencrypted_logs
Oct 4, 2024
Merged
Changes from all commits
Commits
Show all changes
24 commits
Select commit
Hold shift + click to select a range
80c40d9
feat: delivering partial fields via unencrypted logs
benesjan cff3a7d
WIP
benesjan c52d749
fix
benesjan 3572b2e
WIP
benesjan 1a20478
cleanup
benesjan a15120f
TXE fix
benesjan f15972c
clarifications
benesjan 066f43e
linking TXE issue
benesjan 50fd2b3
clarified comment
benesjan 767b6f9
comment
benesjan 29c8a19
fixes after rebase
benesjan 8ea43be
fix after rebase
benesjan dc33344
WIP
benesjan 5a4272c
WIP
benesjan eb168c1
WIP
benesjan 4cad61d
separating logic
benesjan b5c4944
reverting note change
benesjan c3fede9
WIP
benesjan a6237b2
cleanup
benesjan 8c5b283
WIP
benesjan 01962d1
separated findNoteIndexAndNullifier
benesjan 40b45c0
WIP on note daos refactor
benesjan a23d987
more code re-use
benesjan 581e7b8
WIP
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 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 |
---|---|---|
|
@@ -156,8 +156,11 @@ pub(crate) comptime fn generate_note_export( | |
fields: [(Quoted, u32, bool)] | ||
) -> Quoted { | ||
let name = s.name(); | ||
let global_export_name = f"{name}_EXPORTS".quoted_contents(); | ||
let note_fields_name = f"{name}Fields".quoted_contents(); | ||
let mut hasher = Poseidon2Hasher::default(); | ||
s.as_type().hash(&mut hasher); | ||
let hash = hasher.finish() as u32; | ||
let global_export_name = f"{name}_{hash}_EXPORTS".quoted_contents(); | ||
let note_fields_name = f"{name}Fields_{hash}".quoted_contents(); | ||
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. With my work on having the note fields and indices in the ABI there is now NoteFields exported and I got collision here as well so I had to do the same change as what Grego advised me to do for the exports. |
||
let note_name_as_str = name.as_str_quote(); | ||
let note_name_str_len = unquote!(quote { $note_name_as_str.as_bytes().len() }); | ||
|
||
|
21 changes: 21 additions & 0 deletions
21
noir-projects/noir-contracts/contracts/nft_contract/src/hacky_partial_note.nr
This file contains 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,21 @@ | ||
use dep::aztec::{prelude::{NullifiableNote, PrivateContext}, macros::notes::note}; | ||
nventuro marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
// TODO(benesjan): Once nuking this nuke hack in contract_artifact.ts | ||
// This note has to have the same name as the standard `NFTNote` so that we get the same note type id. | ||
#[note] | ||
struct NFTNote { | ||
// The nullifying public key hash is used with the nsk_app to ensure that the note can be privately spent. | ||
npk_m_hash: Field, | ||
// Randomness of the note to hide its contents | ||
randomness: Field, | ||
} | ||
|
||
impl NullifiableNote for NFTNote { | ||
fn compute_nullifier(self, _context: &mut PrivateContext, _note_hash_for_nullify: Field) -> Field { | ||
0 | ||
} | ||
|
||
unconstrained fn compute_nullifier_without_context(self) -> Field { | ||
0 | ||
} | ||
} |
This file contains 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 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 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 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 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 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 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 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 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.
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 is a piece of code Grego gave me to make 1 contract work with 2 notes of the same name.
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.
Shouldn't hurt anything, since it uses a type as input for the hash...if two contracts import the same note (exactly, not only names) should resolve to the same value!