-
Notifications
You must be signed in to change notification settings - Fork 301
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Update the encrypted note log format (#6411)
Fixes #5901. Uses the new format to match the keys and logs spec. The current implementation here is still using a typescript implementation to encrypt the data, mainly using the new flow. The intention is that #6408 and #1139 can be addresses separately and than we can just replace the import to use the constrained version instead of the oracle at that point. Note, that the outgoing logs are currently less than meaningful, as some of the infrastructure is not yet in place to handle those nicely, see #6410 for more on that. What was called the encrypted_log_payload in #6348 have been moved into the l1_payload, to better integrate with the rest of the setup.
- Loading branch information
Showing
40 changed files
with
505 additions
and
608 deletions.
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
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
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,32 +1,40 @@ | ||
use dep::protocol_types::{address::AztecAddress, grumpkin_point::GrumpkinPoint}; | ||
|
||
// TODO(1139): Should take encrypted data. | ||
// Currently returns encrypted data to be hashed | ||
// = 112 + 32 * (N + 3) bytes = N + 7 fields | ||
// = 480 + 32 * N bytes | ||
#[oracle(emitEncryptedNoteLog)] | ||
fn emit_encrypted_note_log_oracle<M>(_note_hash: Field, _encrypted_note: [u8; M], _counter: u32) {} | ||
|
||
unconstrained pub fn emit_encrypted_note_log<M>( | ||
note_hash: Field, | ||
encrypted_note: [u8; M], | ||
counter: u32 | ||
) { | ||
emit_encrypted_note_log_oracle(note_hash, encrypted_note, counter) | ||
} | ||
|
||
#[oracle(emitEncryptedLog)] | ||
fn emit_encrypted_log_oracle<N, M>( | ||
fn emit_encrypted_log_oracle<M>(_encrypted_note: [u8; M], _counter: u32) {} | ||
|
||
unconstrained pub fn emit_encrypted_log<M>(encrypted_note: [u8; M], counter: u32) { | ||
emit_encrypted_log_oracle(encrypted_note, counter) | ||
} | ||
|
||
// = 480 + 32 * N bytes | ||
#[oracle(computeEncryptedLog)] | ||
fn compute_encrypted_log_oracle<N, M>( | ||
_contract_address: AztecAddress, | ||
_storage_slot: Field, | ||
_note_type_id: Field, | ||
_encryption_pub_key: GrumpkinPoint, | ||
_preimage: [Field; N], | ||
_counter: u32 | ||
) -> [Field; M] {} | ||
_preimage: [Field; N] | ||
) -> [u8; M] {} | ||
|
||
unconstrained pub fn emit_encrypted_log<N, M>( | ||
unconstrained pub fn compute_encrypted_log<N, M>( | ||
contract_address: AztecAddress, | ||
storage_slot: Field, | ||
note_type_id: Field, | ||
ivpk_m: GrumpkinPoint, | ||
preimage: [Field; N], | ||
counter: u32 | ||
) -> [Field; M] { | ||
emit_encrypted_log_oracle( | ||
contract_address, | ||
storage_slot, | ||
note_type_id, | ||
ivpk_m, | ||
preimage, | ||
counter | ||
) | ||
preimage: [Field; N] | ||
) -> [u8; M] { | ||
compute_encrypted_log_oracle(contract_address, storage_slot, note_type_id, ivpk_m, preimage) | ||
} |
Oops, something went wrong.