Skip to content

Commit

Permalink
fix: correct type checking to handle false bools (#893)
Browse files Browse the repository at this point in the history
* fix: correct type checking to handle `false` bools

* chore: replace abi type match check for bools with explicit equality check
  • Loading branch information
TomAFrench authored Feb 22, 2023
1 parent 4fc94dc commit 6c7aa2f
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion crates/noirc_abi/src/input_parser/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,9 @@ impl InputValue {
(InputValue::Field(field_element), AbiType::Integer { width, .. }) => {
field_element.num_bits() <= *width
}
(InputValue::Field(field_element), AbiType::Boolean) => field_element.num_bits() == 1,
(InputValue::Field(field_element), AbiType::Boolean) => {
field_element.is_one() || field_element.is_zero()
}

(InputValue::Vec(field_elements), AbiType::Array { length, typ, .. }) => {
if field_elements.len() != *length as usize {
Expand Down

0 comments on commit 6c7aa2f

Please sign in to comment.