refactor: encrypted logs - address minor pr review comments#11554
refactor: encrypted logs - address minor pr review comments#11554iAmMichaelConnor wants to merge 14 commits intonextfrom
Conversation
noir-projects/aztec-nr/aztec/src/encrypted_logs/log_assembly_strategies/default_aes128/event.nr
Show resolved
Hide resolved
| // Note: this tidier approach did not work: it broke the compiler with some kind of | ||
| // stack too deep error, maybe as a result of the huge arithmetic generic statements | ||
| // it needed to evaluate to get the fields_padding array size. | ||
| // let final_log_random_fields_padding = get_arr_of_size__fields_padding__from_plaintext(final_plaintext_bytes); | ||
| // for i in 0..final_log_random_fields_padding.len() { | ||
| // /// Safety: randomness cannot be constrained. | ||
| // final_log[i] = unsafe { random() }; | ||
| // } | ||
| // let final_log = array_concat_3([tag, eph_pk.x], log_bytes_as_fields, final_log_random_fields_padding); |
There was a problem hiding this comment.
It'd be nice to report this, you can likely create a small reproducible example to show them. I don't think we're doing anything too unreasonable here, and I don't like being at the very boundary of what's allowed.
There was a problem hiding this comment.
I tried before pushing, but couldn't trigger the bug in a smaller example. Will find time to try further.
noir-projects/aztec-nr/aztec/src/encrypted_logs/log_assembly_strategies/default_aes128/event.nr
Outdated
Show resolved
Hide resolved
noir-projects/aztec-nr/aztec/src/encrypted_logs/log_assembly_strategies/default_aes128/event.nr
Outdated
Show resolved
Hide resolved
noir-projects/aztec-nr/aztec/src/encrypted_logs/log_assembly_strategies/default_aes128/event.nr
Outdated
Show resolved
Hide resolved
| /// Within an unconstrained function, this is more efficient than using `array_concat` | ||
| /// twice, since this doesn't have redundant `for` loops. It is uglier, though. |
There was a problem hiding this comment.
Is this not true for constrained fns?
There was a problem hiding this comment.
Apparently not; Jake and Tom were debating it here noir-lang/noir#7200 (comment)
There was a problem hiding this comment.
I'd expect brilling to be fast enough that this is not an issue. If there were extra constraints then sure we'd have the more efficient ones, but if it's just some more brilling I'd not really care.
…trategies/default_aes128/event.nr Co-authored-by: Nicolás Venturo <nicolas.venturo@gmail.com>
…trategies/default_aes128/event.nr Co-authored-by: Nicolás Venturo <nicolas.venturo@gmail.com>
noir-projects/aztec-nr/aztec/src/encrypted_logs/log_assembly_strategies/default_aes128/event.nr
Outdated
Show resolved
Hide resolved
…trategies/default_aes128/event.nr
| let mut log_bytes_padding_to_mult_31 = get_arr_of_size__log_bytes_padding__from_PT::<2 + N>(); | ||
| let mut log_bytes_padding_to_mult_31 = | ||
| get_arr_of_size__log_bytes_padding__from_plaintext(final_plaintext); | ||
| /// Safety: this randomness won't be constrained to be random. It's in the | ||
| /// interest of the executor of this fn to encrypt with random bytes. | ||
| log_bytes_padding_to_mult_31 = unsafe { get_random_bytes() }; | ||
|
|
||
| let mut log_bytes = get_arr_of_size__log_bytes__from_PT::<2 + N>(); |
There was a problem hiding this comment.
@nventuro there was a bug in the code I merged the other day. This should be N; not 2 + N. The 2 + N is from the previous log encoding. I guess we got lucky (or unlucky) with the size of N in all of our tests not triggering a case where 2 + N resulted in a different amount of padding.
Anyway, this is (accidentally, but luckily) fixed in this PR. People might run into issues of partial notes not syncing until this fix is merged.
noir-projects/aztec-nr/aztec/src/encrypted_logs/log_assembly_strategies/default_aes128/event.nr
Show resolved
Hide resolved
noir-projects/aztec-nr/aztec/src/encrypted_logs/log_assembly_strategies/default_aes128/event.nr
Outdated
Show resolved
Hide resolved
noir-projects/aztec-nr/aztec/src/encrypted_logs/log_assembly_strategies/default_aes128/note.nr
Show resolved
Hide resolved
...cts/aztec-nr/aztec/src/encrypted_logs/log_assembly_strategies/default_aes128/partial_note.nr
Outdated
Show resolved
Hide resolved
…ztec-packages into mc/address-nico-comments
|
Bootstrapping now hangs forever when compiling the Noir contracts. It worked yesterday. |
|
Closing as stale and outdated. |
Addresses the comments from here #11503