You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When compiling a noir program and specifying the expression-width (amount of witnesses in an expression), the compiler expects a width > 2. This is most likely the correct behaviour, but nargo panics with the following message:
The application panicked (crashed).
Message: assertion failed: width > 2
Location: acvm-repo/acvm/src/compiler/transformers/csat.rs:27
This is a bug. We may have already fixed this in newer versions of Nargo so try searching for similar issues at https://github.com/noir-lang/noir/issues/.
If there isn't an open issue for this bug, consider opening one at https://github.com/noir-lang/noir/issues/new?labels=bug&template=bug_report.yml
Expected Behavior
The program should terminate and tell me that nargo expects an expression-width > 2, instead of a panic and indicating that there is a bug.
# Description
## Problem\*
Resolves#5560
## Summary\*
Rejects an invalid `--expression-value` in the CLI, which would later
cause a panic in `acvm::compiler::transformers::csat`.
An example error message looks like:
```text
error: invalid value '1' for '--expression-width <EXPRESSION_WIDTH>': minimum value is 3
```
## Additional Context
The issue suggests that
[CSatTransformer::new](https://github.com/noir-lang/noir/blob/ae87d287ab1fae0f999dfd0d1166fbddb927ba97/acvm-repo/acvm/src/compiler/transformers/csat.rs#L24-L27)
should return a `Result` explaining the problem it has with `width`,
rather than doing an `assert!` (without any message) and crashing the
program. I agree, however looking at the chain of calls, none of the
half-dozen functions we go through to reach this use `Result`, and the
`CSatTransformer` is the only option we have. This suggests to me that
this limitation is perhaps supposed to be well-known to the user, ie.
it's not the case that one transformer has X limit and another has Y
limit.
For this reason I added a `pub const MIN_EXPRESSION_WIDTH: usize = 3;`
to the `acvm::compiler` module and using that as a common value for the
assertion as well as the validation in the CLI. Should the assumption of
a single global value change, removing that will force us to update the
validation logic as well.
That said if you prefer going the `Result` route I'm not against it, it
just seemed like an overkill for this single use case.
## Documentation\*
Check one:
- [x] No documentation needed.
- [ ] Documentation included in this PR.
- [ ] **[For Experimental Features]** Documentation to be submitted in a
separate PR.
# PR Checklist\*
- [x] I have tested the changes locally.
- [ ] I have formatted the changes with [Prettier](https://prettier.io/)
and/or `cargo fmt` on default settings.
Aim
When compiling a noir program and specifying the expression-width (amount of witnesses in an expression), the compiler expects a width > 2. This is most likely the correct behaviour, but nargo panics with the following message:
Expected Behavior
The program should terminate and tell me that nargo expects an expression-width > 2, instead of a panic and indicating that there is a bug.
Bug
The problem is here:
Here the CSat Solver asserts that the expression-width is > 2. It should return an Result instead telling the user to provide an expression-width > 2
To Reproduce
nargo new wrong_expr_width && cd wrong_expr_width
nargo compile --expression-width 1
Project Impact
None
Impact Context
No response
Workaround
None
Workaround Description
No response
Additional Context
No response
Installation Method
Binary (
noirup
default)Nargo Version
noirc version = 0.30.0+af57471035e4fa7eaffa71693219df6d029dbcde
NoirJS Version
No response
Would you like to submit a PR for this Issue?
Maybe
Support Needs
No response
The text was updated successfully, but these errors were encountered: