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
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use crate::{
context::PrivateContext, event::event_interface::EventInterface,
encrypted_logs::payload::compute_encrypted_event_log,
encrypted_logs::payload::compute_encrypted_log,
keys::{getters::get_public_keys, public_keys::{OvpkM, IvpkM}},
oracle::logs_traits::LensForEncryptedEvent, oracle::unsafe_rand::unsafe_rand
};
Expand Down Expand Up @@ -35,15 +35,8 @@ fn compute<Event, let N: u32, let OB: u32>(
recipient: AztecAddress,
event: Event
) -> ([u8; OB], Field) where Event: EventInterface<N>, [u8; N * 32 + 64]: LensForEncryptedEvent<N * 32 + 64, OB> {
let encrypted_log: [u8; OB] = compute_encrypted_event_log(
contract_address,
randomness,
ovsk_app,
ovpk,
ivpk,
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.

let encrypted_log: [u8; OB] = compute_encrypted_log(contract_address, ovsk_app, ovpk, ivpk, recipient, plaintext);
let log_hash = sha256_to_field(encrypted_log);
(encrypted_log, log_hash)
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use crate::{
context::PrivateContext, note::{note_emission::NoteEmission, note_interface::NoteInterface},
keys::{getters::{get_public_keys, get_ovsk_app}, public_keys::{OvpkM, IvpkM}},
encrypted_logs::payload::compute_encrypted_note_log, oracle::logs_traits::LensForEncryptedLog
encrypted_logs::payload::compute_encrypted_log, oracle::logs_traits::LensForEncryptedLog
};
use dep::protocol_types::{hash::sha256_to_field, address::AztecAddress, abis::note_hash::NoteHash};

Expand All @@ -23,15 +23,8 @@ fn compute_raw_note_log<Note, let N: u32, let M: u32>(

let contract_address: AztecAddress = context.this_address();

let encrypted_log: [u8; M] = compute_encrypted_note_log(
contract_address,
storage_slot,
ovsk_app,
ovpk,
ivpk,
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.

let encrypted_log: [u8; M] = compute_encrypted_log(contract_address, ovsk_app, ovpk, ivpk, recipient, plaintext);
let log_hash = sha256_to_field(encrypted_log);

(note_hash_counter, encrypted_log, log_hash)
Expand Down
286 changes: 0 additions & 286 deletions noir-projects/aztec-nr/aztec/src/encrypted_logs/incoming_body.nr

This file was deleted.

2 changes: 0 additions & 2 deletions noir-projects/aztec-nr/aztec/src/encrypted_logs/mod.nr
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
mod header;
mod incoming_body;
mod outgoing_body;
mod payload;
mod encrypted_note_emission;
mod encrypted_event_emission;
Loading
Loading