-
Notifications
You must be signed in to change notification settings - Fork 377
Closed
Description
pub unconstrained fn foo(input: Field) -> Field {
// moving the `!= 0` from `bar` to here fixes the panic:
(input == 0) as Field
}
pub fn bar(input: Field) {
// Safety: test
let output = unsafe { foo(input) };
// removing the empty assert message fixes the panic:
assert(output != 0, "");
}
mod test {
use crate::bar;
// this panics:
#[test]
fn test_local() {
bar(0);
}
global x_global: Field = 0;
// this panics:
#[test]
fn test_global() {
bar(x_global);
}
}
// it works when calling or inlining `bar` in `main` (with `input = 0`)
fn main(input: Field) {
bar(input)
}Expected Behavior
Expected the tests to pass, as they do with nargo from noirup:
❯ ~/.nargo/bin/nargo --version
nargo version = 1.0.0-beta.2
noirc version = 1.0.0-beta.2+97afa52f5212be2d05af26b9e8dde9c3ea7a1d2e
(git version hash: 97afa52f5212be2d05af26b9e8dde9c3ea7a1d2e, is dirty: false)
❯ ~/.nargo/bin/nargo test
[regression_noir_sort] Running 2 test functions
[regression_noir_sort] Testing test::test_local ... ok
[regression_noir_sort] Testing test::test_global ... ok
[regression_noir_sort] 2 tests passedBug
The tests fail with overflow errors:
❯ cargo run test
Compiling noir_debugger v1.0.0-beta.4 (/home/michael/coding/rust/noir/tooling/debugger)
Compiling nargo_cli v1.0.0-beta.4 (/home/michael/coding/rust/noir/tooling/nargo_cli)
Finished `dev` profile [optimized + debuginfo] target(s) in 6.15s
Running `/home/michael/coding/rust/noir/target/debug/nargo test`
[regression_7372] Running 2 test functions
The application panicked (crashed).
Message: attempt to subtract with overflow
Location: compiler/noirc_evaluator/src/acir/acir_context/generated_acir/mod.rs:646
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
[regression_7372] Testing test::test_local ... FAIL
attempt to subtract with overflow
The application panicked (crashed).
Message: attempt to subtract with overflow
Location: compiler/noirc_evaluator/src/acir/acir_context/generated_acir/mod.rs:646
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
[regression_7372] Testing test::test_global ... FAIL
attempt to subtract with overflow
[regression_7372] Failures:
test::test_local
test::test_global
[regression_7372] 2 tests failedWhere the panicking line is in GeneratedAcir::last_acir_opcode_location:
OpcodeLocation::Acir(self.opcodes.len() - 1)To Reproduce
Workaround
None
Workaround Description
No response
Additional Context
No response
Project Impact
None
Blocker Context
No response
Nargo Version
No response
NoirJS Version
No response
Proving Backend Tooling & Version
No response
Would you like to submit a PR for this Issue?
None
Support Needs
No response
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels