-
Notifications
You must be signed in to change notification settings - Fork 298
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: random fixes and readability improvements #11129
refactor: random fixes and readability improvements #11129
Conversation
This stack of pull requests is managed by Graphite. Learn more about stacking. |
35f4b12
to
b7b7b66
Compare
8a4cad3
to
8f11ff7
Compare
noir-projects/aztec-nr/aztec/src/macros/functions/initialization_utils.nr
Show resolved
Hide resolved
+ (U128::from_integer(self.post.unwrap_unchecked()) << 32) | ||
+ (U128::from_integer(self.block_of_change) << 64) | ||
+ (U128::from_integer(self.post.is_some()) << 96) | ||
+ (U128::from_integer(self.pre.is_some()) << 97); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Warnings fix. As discussed in a PR down the stack now I don't work with u64
limbs but I just pack directly. I needed to use U128 here to avoid overflows.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can't we use Field
directly? If Field
doesn't support shifts then lets just multiply by the corresponding power of two. U128 will make this unnecessarily expensive.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Decided to not tackle this for now because I will need access the the low and high limbs in my other PR..
For this reason this seemed like a waste of time and I have just reverted changes done to this file.
Asked Tom how to proceed here in DMs:
noir-projects/noir-protocol-circuits/crates/types/src/abis/sponge_blob.nr
Outdated
Show resolved
Hide resolved
noir-projects/noir-protocol-circuits/crates/types/src/merkle_tree/variable_merkle_tree.nr
Outdated
Show resolved
Hide resolved
+ (U128::from_integer(self.post.unwrap_unchecked()) << 32) | ||
+ (U128::from_integer(self.block_of_change) << 64) | ||
+ (U128::from_integer(self.post.is_some()) << 96) | ||
+ (U128::from_integer(self.pre.is_some()) << 97); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can't we use Field
directly? If Field
doesn't support shifts then lets just multiply by the corresponding power of two. U128 will make this unnecessarily expensive.
noir-projects/noir-protocol-circuits/crates/types/src/merkle_tree/variable_merkle_tree.nr
Outdated
Show resolved
Hide resolved
noir-projects/noir-protocol-circuits/crates/types/src/merkle_tree/variable_merkle_tree.nr
Outdated
Show resolved
Hide resolved
c9df6c8
to
7e6e87e
Compare
2cd801b
to
30efc51
Compare
Fixes underconstrained bug Nico spotted [here](#11129 (comment)). ### Note on severity The bug could not be exploited because the `VariableMerkleTree` is only used when computing an `out_hash` [here](https://github.com/AztecProtocol/aztec-packages/blob/ccf28f56c408381867a4ac9435c5f0cc46690271/noir-projects/noir-protocol-circuits/crates/rollup-lib/src/components.nr#L128) and `out_hash` is checked on L1 against a hash computed on L1. For this reason the severity of the bug is low. But it makes sense to fix because it could become an issue in case the implementation would get used somewhere else later on. The bug is explained in comments.
7e6e87e
to
cbae56a
Compare
e07e245
to
b2d3266
Compare
e1f8440
to
fc91f1f
Compare
e1f0f1e
to
8349c06
Compare
5f03dfa
to
2676ce0
Compare
3e094bc
to
80d9ab4
Compare
2676ce0
to
ad05ac9
Compare
609e9ad
to
daea821
Compare
ecb70d1
to
7acb1e4
Compare
@@ -59,6 +59,8 @@ contract EcdsaKAccount { | |||
let public_key = storage.public_key.get_note(); | |||
|
|||
// Load auth witness | |||
/// Safety: The witness is only used as a "magical value" that makes the signature verification below pass. | |||
/// Hence it's safe. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Forgot to push this fix in a PR down the stack before it got merged.
@@ -57,6 +57,8 @@ contract EcdsaRAccount { | |||
let public_key = storage.public_key.get_note(); | |||
|
|||
// Load auth witness | |||
/// Safety: The witness is only used as a "magical value" that makes the signature verification below pass. | |||
/// Hence it's safe. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Forgot to push this fix in a PR down the stack before it got merged.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👌
7acb1e4
to
4684eff
Compare
In a PR down the stack I fixed safety warnings. When doing that I stumbled upon a random hodgepodge of issues. I am fixing them in this PR to not clutter the original one.