Skip to content
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

Merged
merged 6 commits into from
Sep 26, 2024

Conversation

benesjan
Copy link
Contributor

@benesjan benesjan commented Sep 25, 2024

There were multiple issues with how encryption was done:

  1. We had 2 functions: compute_encrypted_note_log and compute_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,
  2. we had EncryptedLogIncomingBody and EncryptedLogOutgoingBody structs but in all the cases we always just constructed them and then we immediately called compute_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 and compute_outgoing_body_ciphertext functions.

If the reviewers agree with changes in this PR I will proceed with doing the same in TS.

Copy link
Contributor Author

benesjan commented Sep 25, 2024

This stack of pull requests is managed by Graphite. Learn more about stacking.

Join @benesjan and the rest of your teammates on Graphite Graphite

@benesjan benesjan marked this pull request as ready for review September 25, 2024 15:08
@benesjan benesjan changed the title feat: encryption cleanup refactor: cleanup of noir encryption code Sep 25, 2024
@benesjan benesjan changed the title refactor: cleanup of noir encryption code refactor: cleanup of Aztec.nr encryption code Sep 25, 2024
Copy link
Contributor

@nventuro nventuro left a 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);
Copy link
Contributor

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);
Copy link
Contributor

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.

@benesjan benesjan force-pushed the janb/partial-notes-encoding-revert branch from cabff17 to 013bc7a Compare September 26, 2024 06:25
Base automatically changed from janb/partial-notes-encoding-revert to master September 26, 2024 06:58
@benesjan benesjan enabled auto-merge (squash) September 26, 2024 07:01
@benesjan benesjan merged commit 0bfcbba into master Sep 26, 2024
51 checks passed
@benesjan benesjan deleted the 09-25-feat_encryption_cleanup branch September 26, 2024 07:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants