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

Template with no inputs looses outputs #45

Open
3sGgpQ8H opened this issue Oct 28, 2019 · 1 comment
Open

Template with no inputs looses outputs #45

3sGgpQ8H opened this issue Oct 28, 2019 · 1 comment

Comments

@3sGgpQ8H
Copy link

3sGgpQ8H commented Oct 28, 2019

I have the following circuit:

template Foo () {
//  signal input y;
  signal output x;
  x <== 13;
}
template Bar () {
  component foo = Foo ();
//  foo.y <== 12;
  foo.x === 13;
}
component main = Bar ();

It compiles successfully, but what I run snarkjs calculatewitness it reports the following error:

Error: Signal not initialized: main.foo.x
    at RTCtx.getSignalFullName (/usr/local/lib/node_modules/snarkjs/src/calculateWitness.js:220:19)
    at RTCtx.getPin (/usr/local/lib/node_modules/snarkjs/src/calculateWitness.js:214:21)
    at Object.__f [as Bar] (eval at Circuit (/usr/local/lib/node_modules/snarkjs/src/circuit.js:46:33), <anonymous>:2:20)
    at RTCtx.triggerComponent (/usr/local/lib/node_modules/snarkjs/src/calculateWitness.js:126:41)
    at calculateWitness (/usr/local/lib/node_modules/snarkjs/src/calculateWitness.js:43:45)
    at Circuit.calculateWitness (/usr/local/lib/node_modules/snarkjs/src/circuit.js:59:16)
    at Object.<anonymous> (/usr/local/lib/node_modules/snarkjs/cli.js:308:29)
    at Module._compile (internal/modules/cjs/loader.js:701:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:712:10)
    at Module.load (internal/modules/cjs/loader.js:600:32)
ERROR: Error: Signal not initialized: main.foo.x

I played with this code a bit and it seems that in case template has no inputs, something bad happens with its outputs. Uncommenting commented lines makes it work.

> circom --version
0.0.31
> snarkjs --version
0.1.18
> uname -a
Darwin MacBookPro 19.0.0 Darwin Kernel Version 19.0.0: Wed Sep 25 20:18:50 PDT 2019; root:xnu-6153.11.26~2/RELEASE_X86_64 x86_64
@3sGgpQ8H 3sGgpQ8H changed the title Template with no inputs does looses outputs Template with no inputs looses outputs Oct 28, 2019
@adamalexandru4
Copy link

I also have the same type of error. Any solution?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants