Skip to content

refactor: encrypted logs - address minor pr review comments#11554

Closed
iAmMichaelConnor wants to merge 14 commits intonextfrom
mc/address-nico-comments
Closed

refactor: encrypted logs - address minor pr review comments#11554
iAmMichaelConnor wants to merge 14 commits intonextfrom
mc/address-nico-comments

Conversation

@iAmMichaelConnor
Copy link
Contributor

Addresses the comments from here #11503

Comment on lines +217 to +225
// 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);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tried before pushing, but couldn't trigger the bug in a smaller example. Will find time to try further.

Comment on lines +141 to +142
/// 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.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this not true for constrained fns?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Apparently not; Jake and Tom were debating it here noir-lang/noir#7200 (comment)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

iAmMichaelConnor and others added 2 commits January 28, 2025 15:34
…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>
Comment on lines -105 to -108
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>();
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@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.

Copy link
Contributor

@benesjan benesjan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good. Just pls address the minor comments I did before merging

@iAmMichaelConnor
Copy link
Contributor Author

Bootstrapping now hangs forever when compiling the Noir contracts. It worked yesterday.
I can't get anything from the Noir compiler about why it's hanging. Even a nargo test in aztec_nr is hanging. What's happening?!

@iAmMichaelConnor iAmMichaelConnor changed the base branch from master to next June 5, 2025 15:14
@iAmMichaelConnor
Copy link
Contributor Author

Closing as stale and outdated.

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.

3 participants