Open anonnice1999 opened 4 months ago
I have a simple function as following:
pragma circom 2.1.7; function get_gkr__ext__evaluations(i) { if (i == 1) { return [1]; // one-element array } if (i == 2) { return [1, 2, 3, 4]; } return [0]; } template X() { signal input x; var a[4] = get_gkr__ext__evaluations(2); for (var i = 0; i < 4; i++) { log("a[", i, "]", a[i]); } } component main {public [x]} = X();
When I try to get the values in the branch i==2, it will returns an array with weird values.
i==2
a[ 0 ] 1 a[ 1 ] 1701549928 a[ 2 ] 2108807937 a[ 3 ] 0
But when I change the value in the first branch i==1 to a two-element array, the error will not happen anymore.
i==1
pragma circom 2.1.7; function get_gkr__ext__evaluations(i) { if (i == 1) { return [1, 1]; // change to two-element array } if (i == 2) { return [1, 2, 3, 4]; } return [0]; } template X() { signal input x; var a[4] = get_gkr__ext__evaluations(2); for (var i = 0; i < 4; i++) { log("a[", i, "]", a[i]); } } component main {public [x]} = X();
a[ 0 ] 1 a[ 1 ] 2 a[ 2 ] 3 a[ 3 ] 4
I have a simple function as following:
When I try to get the values in the branch
i==2
, it will returns an array with weird values.But when I change the value in the first branch
i==1
to a two-element array, the error will not happen anymore.