chore: replace u1 type with bool across noir-projects#22377
Draft
chore: replace u1 type with bool across noir-projects#22377
Conversation
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Replaces all uses of the
u1type withboolacross noir-projects, in preparation for noir-lang/noir#11753 which removesu1from user-facing Noir.Changes
Type replacements
[u1; N]→[bool; N](bit arrays fromto_le_bits/to_be_bits)-> u1→-> bool(function return types, especially AVM oracles)(x as u1) != 0→x != 0(field-to-boolean extraction)Removed duplicate trait impls
Since
boolalready hadFromField,ToField,Empty,Serialize, andDeserializeimpls, the formeru1impls (now duplicates after renaming) were removed entirely:traits/from_field.nr— removed duplicateimpl FromField for booltraits/to_field.nr— removed duplicateimpl ToField for booltraits/empty.nr— removed duplicateimpl Empty for boolserde/type_impls.nr— removed duplicateimpl Serialize for boolandimpl Deserialize for bool, plus unusedU1_SERIALIZED_LENconstantFiles changed (17)
aztec-nr/aztec/src/oracle/avm.nr— oracle return typesaztec-nr/aztec/src/state_vars/mod.nr— doc commentsnoir-contracts/.../card_game_contract/src/game.nr— field extractionnoir-contracts/.../orderbook_contract/src/order.nr— field extractionnoir-contracts/.../aztec_sublib/src/oracle/avm.nr— oracle return typesnoir-contracts/.../avm_test_contract/src/main.nr— bit array typesnoir-protocol-circuits/crates/blob/...— bit arraysnoir-protocol-circuits/crates/serde/...— removed u1 trait implsnoir-protocol-circuits/crates/types/...— bit arrays, trait impls, field utilsClaudeBox log: https://claudebox.work/s/d72e1449fb744a16?run=9