-
Notifications
You must be signed in to change notification settings - Fork 184
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
refactor: cleanup of Aztec.nr
encryption code
#8780
Conversation
This stack of pull requests is managed by Graphite. Learn more about stacking. |
...es/src/logs/l1_payload/encrypted_log_incoming_body/encrypted_event_log_incoming_body.test.ts
Show resolved
Hide resolved
Aztec.nr
encryption code
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.
Looks very reasonable, thanks for looking into this! While you're at it you could also nuke the variant of encode_and_encrypt
that requires addresses instead of keys 😛
recipient, | ||
event | ||
); | ||
let plaintext = event.private_to_be_bytes(randomness); |
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.
Unrelated to this PR, but private_to_be_bytes
needs a rename yesterday.
recipient, | ||
note | ||
); | ||
let plaintext = note.to_be_bytes(storage_slot); |
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.
Actually, to_be_bytes
in general needs a renaming. Thoroughly confused as to why this might receive a storage slot.
cabff17
to
013bc7a
Compare
12826ad
to
1cb97db
Compare
1cb97db
to
8d1132a
Compare
There were multiple issues with how encryption was done:
compute_encrypted_note_log
andcompute_encrypted_event_log
doing essentially the same thing but we had it duplicate because instead of accepting plaintext it accepted specific abstract types which were not even needed for anything,EncryptedLogIncomingBody
andEncryptedLogOutgoingBody
structs but in all the cases we always just constructed them and then we immediately calledcompute_ciphertext(...)
on the struct.I tackled issue 1. by merging the functions and just having a plaintext on the input and I tackled 2 by replacing the structs with
compute_incoming_body_ciphertext
andcompute_outgoing_body_ciphertext
functions.If the reviewers agree with changes in this PR I will proceed with doing the same in TS.