Skip to content

Commit

Permalink
refactor: cleanup of Aztec.nr encryption code (#8780)
Browse files Browse the repository at this point in the history
  • Loading branch information
benesjan authored and Rumata888 committed Sep 27, 2024
1 parent 3ddd542 commit b4eff88
Show file tree
Hide file tree
Showing 11 changed files with 163 additions and 528 deletions.
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);
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);
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

0 comments on commit b4eff88

Please sign in to comment.