iden3/circom_tester

getDecoratedOutput and assertOut errors

Opened this issue · 4 comments

I am trying to test my circom circuit but am getting errors.

Generating the witness using let witness = await circuit.calculateWitness({ a: inputA, b: inputB }); works as expected.

Then I am trying these two functions but I get errors:
await circuit.getDecoratedOutput(witness) gives ReferenceError: utils is not defined

and
await circuit.assertOut(witness, expectedOutput) gives AssertionError: Output variable not defined: main[0]

I have no idea what this means and how to fix it. Does someone have any idea?

getting the same issue re: utils not being defined.

it's coming from the following line in the autogenerated /wasm/tester.js file:
if (utils.isDefined(witness[self.symbols[n].varIdx])) {

with utils obviously being undefined.

@alrubio, it looks like isDefined isn't itself defined in /wasm/utils.js. and also, the const utils variable defined on line 55 isn't accessible in the scope of getDecoratedOutput.

mimoo commented

just modify that line to

if (witness[self.symbols[n].varIdx] !== undefined)

in node_modules/circom_tester/wasm/tester.js

Thanks @mimoo, your answer from exactly 1 year ago 🫨 just worked for me. However, I'd really appreciate a proper fix from the contributor here 👀