Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error: values must be emitted before tables in nargo prove #934

Closed
2 of 4 tasks
sirasistant opened this issue Mar 1, 2023 · 1 comment · Fixed by #936
Closed
2 of 4 tasks

Error: values must be emitted before tables in nargo prove #934

sirasistant opened this issue Mar 1, 2023 · 1 comment · Fixed by #936
Labels
bug Something isn't working

Comments

@sirasistant
Copy link
Contributor

Description

Nargo fails to prove a circuit with specific public input structure. Related to toml parsing/writing.

Aim

Tried to prove a circuit using nargo with public inputs that included structs and arrays

Expected behavior

nargo prove should succeed

Bug

nargo prove test 
Error: input.toml file is badly formed, could not parse, values must be emitted before tables

Location:
    crates/nargo/src/cli/mod.rs:63:5

To reproduce

using this main:

struct Inner {
    foo: Field,
    bar: Field,
}

struct Outer {
    inner: Inner,
    baz: Field,
    last: [Field; 1],
}

fn main(outer: pub Outer){
    constrain outer.inner.foo == 0;
}

and this Prover.toml

[outer]
baz = "2"
last = ["1"]

[outer.inner]
foo = "0"
bar = "1"

Environment

  • Using nargo:

    • Binary:
    • Compiled from source: a92d12e
  • Using TypeScript:

    • @noir-lang/noir_wasm:
    • @noir-lang/barretenberg:
    • @noir-lang/aztec_backend:

Additional context

I have tried reordering the Prover.toml with no success, and toml linters say that it's valid toml and the JSON equivalent is as expected.
I think that it's having trouble emitting the Verifier.toml with the public inputs.

@sirasistant sirasistant added the bug Something isn't working label Mar 1, 2023
@sirasistant sirasistant changed the title Error: values must be emitted before tables Error: values must be emitted before tables in nargo prove Mar 1, 2023
@sirasistant
Copy link
Contributor Author

Workaround:
Comment out in prove_cmd.rs:

write_inputs_to_file(
  &public_inputs,
  &return_value,
  &program_dir,
  VERIFIER_INPUT_FILE,
  Format::Toml,
)?;

TomAFrench added a commit that referenced this issue Mar 1, 2023
TomAFrench added a commit that referenced this issue Mar 1, 2023
* chore: add regression test for #934

* fix: properly order nested toml tables

* chore: remove unnecessary `to_owned()`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant