-
Notifications
You must be signed in to change notification settings - Fork 310
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: Improve input validation in bootstrap.sh and refactor bit_traits.rs #9406
Conversation
- Refactored the BitsQueryable trait to avoid code duplication for numeric types. - Implemented the get_msb function using the leading_zeros() method for better efficiency. - Ensured compatibility with u8, u16, u32, u64, u128, and usize through a generalized implementation. - Maintained individual implementations for FieldElement and MemoryAddress to prevent type-related issues.
- Enhanced the input validation logic for the 'clean' command. - Now accepts various forms of confirmation such as 'y', 'Y', 'yes', and 'YES'. - This change makes the script more user-friendly and less prone to input errors.
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.
Thank you for this! We'll look into it asap. Our CI doesn't work well with external contributors so we need to do a few manual steps.
Hi Cypherpepe, this PR does not build: https://github.com/AztecProtocol/aztec-packages/runs/32359062333
|
- Removed the blanket implementation of the `BitsQueryable` trait for all types `T: Into<u128> + Copy`, which was causing a conflict with the existing implementation for `FieldElement`. - Added explicit implementations of the `BitsQueryable` trait for primitive integer types (`u8`, `u16`, `u32`, `u64`, `u128`, `usize`) using the `impl_bits_queryable_for_integers!` macro. - This change resolves the compilation error related to conflicting trait implementations and makes the code more robust against future changes.
Hi, I've removed the universal implementation and instead provided explicit implementations for the primitive integer types using a macro. This avoids the conflict with |
avm-transpiler/src/bit_traits.rs
Outdated
@@ -65,19 +27,27 @@ impl BitsQueryable for MemoryAddress { | |||
} | |||
} | |||
|
|||
macro_rules! impl_bits_queryable_for_integers { |
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.
I've consulted with a few people and we think we prefer the explicit BitsQueryable implementations instead of the macro. The rest looks good and still valuable (if small).
Could you make this changes and merge master? Then I can duplicate the PR again, run CI and if it passes we merge.
@fcarreiro, I've made the changes you requested:
|
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.
CI passes in #9637
We can merge
bootstrap.sh
to accept various forms of confirmation such as 'y', 'Y', 'yes', and 'YES'.bit_traits.rs
to reduce code duplication and improve efficiency:leading_zeros()
to optimize theget_msb
function.BitsQueryable
trait for numeric types, reducing the need for multiple implementations.FieldElement
andMemoryAddress
to prevent type-related issues.