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

Some example code issues in https://docs.circom.io/ #306

Open
yushihang opened this issue Oct 9, 2024 · 0 comments
Open

Some example code issues in https://docs.circom.io/ #306

yushihang opened this issue Oct 9, 2024 · 0 comments

Comments

@yushihang
Copy link

yushihang commented Oct 9, 2024

Issue 1~3 are fixed by #307

  1. The following example code in https://docs.circom.io/circom-language/templates-and-components/#components is missing an assignment for a.in.
image
template A(N){
   signal input in;
   signal output out;
   out <== in;
}

template C(N){
   signal output out;
   out <== N;
}
template B(N){
  signal output out;
  component a;
  if(N > 0){
     a = A(N);
  }
  else{
     a = A(0);
  }
  a.in <== 1  //add this line
}

component main = B(1);
  1. Possible missing var in for loop?

https://docs.circom.io/circom-language/templates-and-components/#components

image
component rollupTx[nTx];
for (var i = 0; i < nTx; i++) { //add var
        rollupTx[i] = parallel RollupTx(nLevels, maxFeeTx);
}
  1. https://docs.circom.io/circom-language/code-quality/inspect/
image
pragma circom 2.1.0; //add pragma version

template B() { //remove arg n
  signal input in;
  signal output out;  //input -> output
  out <== in + 1;
}

template A(n) {
  signal aux;
  signal out;
  if(n == 2) {
    aux <== 2;
    out <== B()(aux);
  } else {
    out <== 5;
  }
}

component main = A(3);
  1. https://docs.circom.io/circom-language/code-quality/inspect/
image

raise an error while being compiled
image

@yushihang yushihang changed the title A code issue in https://docs.circom.io/ Some code issues in https://docs.circom.io/ Oct 9, 2024
@yushihang yushihang changed the title Some code issues in https://docs.circom.io/ Some example code issues in https://docs.circom.io/ Oct 9, 2024
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

1 participant