noir-lang / noir

Noir is a domain specific language for zero knowledge proofs
https://noir-lang.org
Apache License 2.0
822 stars 177 forks source link

ICE encountered when calling a function marked with `#[fold]` from brillig #5130

Open TomAFrench opened 1 month ago

TomAFrench commented 1 month ago

See PR https://github.com/noir-lang/noir/pull/5128

Most of the test cases for folding fail to compile if we force it to be compiled into brillig with an ICE. See below:

tom at tom-desktop in ~/Programming/aztec/noir/test_programs/execution_success/fold_fibonacci on tf/enforce-testing-in-brillig [$]
$ nargo compile --force-brillig
error: Internal Consistency Evaluators Errors: 

                    This is likely a bug. Consider opening an issue at https://github.com/noir-lang/noir/issues
  ┌─ std/aes128.nr:1:1
  │
1 │ #[foreign(aes128_encrypt)]
  │ - ICE: "Cannot find linked fn f1"
  │

Aborting due to 1 previous error

If we're compiling in brillig can make a call to a #[fold] function we should be able to just ignore that and treat it as a regular brillig function.

Also this diagnostic is quite odd, not sure why this is pointing at aes128.

TomAFrench commented 1 month ago

Would probably benefit from #5121