Fix allocated public inputs indexes (#1)

* fix: manage already allocated public inputs with a custom mapping

* fix: initialize CircomCircuit with empty allocated public input variables

* feat: add ability to choose to allocate inputs as witnesses or instances

* chore: remove outdated comment

* test: add relevant tests and asserts for generate_constraints

* chore: add files used for tests

* chore: replace assert_eq with match statement
This commit is contained in:
Pierre
2024-05-28 12:30:59 +02:00
committed by GitHub
parent 48f2915b64
commit a8b03b56e1
7 changed files with 275 additions and 37 deletions

View File

@@ -0,0 +1,15 @@
template Multiplier() {
signal input a; // 3
signal input b; // 3
signal input c; // 3
signal temp;
signal output d; // 27
signal output e; // 9
temp <== a*b;
d <== temp*c;
e <== b*c;
}
component main{public [a, b]} = Multiplier();

Binary file not shown.

View File

@@ -0,0 +1,6 @@
1,1,0,main.d
2,2,0,main.e
3,3,0,main.a
4,4,0,main.b
5,5,0,main.c
6,6,0,main.temp

Binary file not shown.

View File

@@ -0,0 +1,7 @@
{
"constraints": [
[{"3":"21888242871839275222246405745257275088548364400416034343698204186575808495616"},{"4":"1"},{"6":"21888242871839275222246405745257275088548364400416034343698204186575808495616"}],
[{"6":"21888242871839275222246405745257275088548364400416034343698204186575808495616"},{"5":"1"},{"1":"21888242871839275222246405745257275088548364400416034343698204186575808495616"}],
[{"4":"21888242871839275222246405745257275088548364400416034343698204186575808495616"},{"5":"1"},{"2":"21888242871839275222246405745257275088548364400416034343698204186575808495616"}]
]
}