@izi-noir/sdk 0.1.11 → 0.1.12

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -169,18 +169,19 @@ var init_R1csBuilder = __esm({
169
169
  }
170
170
  /**
171
171
  * Register all circuit inputs as witnesses
172
- * Public inputs come first, then private inputs
172
+ * IMPORTANT: Noir orders witnesses as private first, then public
173
+ * We must match this order for the witness values to align correctly
173
174
  */
174
175
  registerInputs() {
175
- for (const param of this.parsedCircuit.publicParams) {
176
+ for (const param of this.parsedCircuit.privateParams) {
176
177
  const idx = this.nextWitnessIdx++;
177
178
  this.witnessMap.set(param.name, idx);
178
- this.publicIndices.push(idx);
179
+ this.privateIndices.push(idx);
179
180
  }
180
- for (const param of this.parsedCircuit.privateParams) {
181
+ for (const param of this.parsedCircuit.publicParams) {
181
182
  const idx = this.nextWitnessIdx++;
182
183
  this.witnessMap.set(param.name, idx);
183
- this.privateIndices.push(idx);
184
+ this.publicIndices.push(idx);
184
185
  }
185
186
  }
186
187
  /**
package/dist/index.d.cts CHANGED
@@ -73,9 +73,9 @@ declare class SolanaFormatter implements IChainFormatter<'solana'> {
73
73
  *
74
74
  * This builder converts parsed JavaScript circuit statements into R1CS constraints.
75
75
  *
76
- * Witness layout (arkworks convention):
76
+ * Witness layout (matching Noir's convention):
77
77
  * - w_0 = 1 (constant, always)
78
- * - w_1, w_2, ... = inputs (public first, then private)
78
+ * - w_1, w_2, ... = inputs (private first, then public - matches Noir)
79
79
  * - w_k, w_k+1, ... = intermediate variables
80
80
  */
81
81
 
@@ -119,7 +119,8 @@ declare class R1csBuilder {
119
119
  getWitnessIndex(name: string): number | undefined;
120
120
  /**
121
121
  * Register all circuit inputs as witnesses
122
- * Public inputs come first, then private inputs
122
+ * IMPORTANT: Noir orders witnesses as private first, then public
123
+ * We must match this order for the witness values to align correctly
123
124
  */
124
125
  private registerInputs;
125
126
  /**
package/dist/index.d.ts CHANGED
@@ -73,9 +73,9 @@ declare class SolanaFormatter implements IChainFormatter<'solana'> {
73
73
  *
74
74
  * This builder converts parsed JavaScript circuit statements into R1CS constraints.
75
75
  *
76
- * Witness layout (arkworks convention):
76
+ * Witness layout (matching Noir's convention):
77
77
  * - w_0 = 1 (constant, always)
78
- * - w_1, w_2, ... = inputs (public first, then private)
78
+ * - w_1, w_2, ... = inputs (private first, then public - matches Noir)
79
79
  * - w_k, w_k+1, ... = intermediate variables
80
80
  */
81
81
 
@@ -119,7 +119,8 @@ declare class R1csBuilder {
119
119
  getWitnessIndex(name: string): number | undefined;
120
120
  /**
121
121
  * Register all circuit inputs as witnesses
122
- * Public inputs come first, then private inputs
122
+ * IMPORTANT: Noir orders witnesses as private first, then public
123
+ * We must match this order for the witness values to align correctly
123
124
  */
124
125
  private registerInputs;
125
126
  /**
package/dist/index.js CHANGED
@@ -147,18 +147,19 @@ var init_R1csBuilder = __esm({
147
147
  }
148
148
  /**
149
149
  * Register all circuit inputs as witnesses
150
- * Public inputs come first, then private inputs
150
+ * IMPORTANT: Noir orders witnesses as private first, then public
151
+ * We must match this order for the witness values to align correctly
151
152
  */
152
153
  registerInputs() {
153
- for (const param of this.parsedCircuit.publicParams) {
154
+ for (const param of this.parsedCircuit.privateParams) {
154
155
  const idx = this.nextWitnessIdx++;
155
156
  this.witnessMap.set(param.name, idx);
156
- this.publicIndices.push(idx);
157
+ this.privateIndices.push(idx);
157
158
  }
158
- for (const param of this.parsedCircuit.privateParams) {
159
+ for (const param of this.parsedCircuit.publicParams) {
159
160
  const idx = this.nextWitnessIdx++;
160
161
  this.witnessMap.set(param.name, idx);
161
- this.privateIndices.push(idx);
162
+ this.publicIndices.push(idx);
162
163
  }
163
164
  }
164
165
  /**
@@ -72,18 +72,19 @@ var init_R1csBuilder = __esm({
72
72
  }
73
73
  /**
74
74
  * Register all circuit inputs as witnesses
75
- * Public inputs come first, then private inputs
75
+ * IMPORTANT: Noir orders witnesses as private first, then public
76
+ * We must match this order for the witness values to align correctly
76
77
  */
77
78
  registerInputs() {
78
- for (const param of this.parsedCircuit.publicParams) {
79
+ for (const param of this.parsedCircuit.privateParams) {
79
80
  const idx = this.nextWitnessIdx++;
80
81
  this.witnessMap.set(param.name, idx);
81
- this.publicIndices.push(idx);
82
+ this.privateIndices.push(idx);
82
83
  }
83
- for (const param of this.parsedCircuit.privateParams) {
84
+ for (const param of this.parsedCircuit.publicParams) {
84
85
  const idx = this.nextWitnessIdx++;
85
86
  this.witnessMap.set(param.name, idx);
86
- this.privateIndices.push(idx);
87
+ this.publicIndices.push(idx);
87
88
  }
88
89
  }
89
90
  /**
@@ -50,18 +50,19 @@ var init_R1csBuilder = __esm({
50
50
  }
51
51
  /**
52
52
  * Register all circuit inputs as witnesses
53
- * Public inputs come first, then private inputs
53
+ * IMPORTANT: Noir orders witnesses as private first, then public
54
+ * We must match this order for the witness values to align correctly
54
55
  */
55
56
  registerInputs() {
56
- for (const param of this.parsedCircuit.publicParams) {
57
+ for (const param of this.parsedCircuit.privateParams) {
57
58
  const idx = this.nextWitnessIdx++;
58
59
  this.witnessMap.set(param.name, idx);
59
- this.publicIndices.push(idx);
60
+ this.privateIndices.push(idx);
60
61
  }
61
- for (const param of this.parsedCircuit.privateParams) {
62
+ for (const param of this.parsedCircuit.publicParams) {
62
63
  const idx = this.nextWitnessIdx++;
63
64
  this.witnessMap.set(param.name, idx);
64
- this.privateIndices.push(idx);
65
+ this.publicIndices.push(idx);
65
66
  }
66
67
  }
67
68
  /**
@@ -169,18 +169,19 @@ var init_R1csBuilder = __esm({
169
169
  }
170
170
  /**
171
171
  * Register all circuit inputs as witnesses
172
- * Public inputs come first, then private inputs
172
+ * IMPORTANT: Noir orders witnesses as private first, then public
173
+ * We must match this order for the witness values to align correctly
173
174
  */
174
175
  registerInputs() {
175
- for (const param of this.parsedCircuit.publicParams) {
176
+ for (const param of this.parsedCircuit.privateParams) {
176
177
  const idx = this.nextWitnessIdx++;
177
178
  this.witnessMap.set(param.name, idx);
178
- this.publicIndices.push(idx);
179
+ this.privateIndices.push(idx);
179
180
  }
180
- for (const param of this.parsedCircuit.privateParams) {
181
+ for (const param of this.parsedCircuit.publicParams) {
181
182
  const idx = this.nextWitnessIdx++;
182
183
  this.witnessMap.set(param.name, idx);
183
- this.privateIndices.push(idx);
184
+ this.publicIndices.push(idx);
184
185
  }
185
186
  }
186
187
  /**
@@ -147,18 +147,19 @@ var init_R1csBuilder = __esm({
147
147
  }
148
148
  /**
149
149
  * Register all circuit inputs as witnesses
150
- * Public inputs come first, then private inputs
150
+ * IMPORTANT: Noir orders witnesses as private first, then public
151
+ * We must match this order for the witness values to align correctly
151
152
  */
152
153
  registerInputs() {
153
- for (const param of this.parsedCircuit.publicParams) {
154
+ for (const param of this.parsedCircuit.privateParams) {
154
155
  const idx = this.nextWitnessIdx++;
155
156
  this.witnessMap.set(param.name, idx);
156
- this.publicIndices.push(idx);
157
+ this.privateIndices.push(idx);
157
158
  }
158
- for (const param of this.parsedCircuit.privateParams) {
159
+ for (const param of this.parsedCircuit.publicParams) {
159
160
  const idx = this.nextWitnessIdx++;
160
161
  this.witnessMap.set(param.name, idx);
161
- this.privateIndices.push(idx);
162
+ this.publicIndices.push(idx);
162
163
  }
163
164
  }
164
165
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@izi-noir/sdk",
3
- "version": "0.1.11",
3
+ "version": "0.1.12",
4
4
  "description": "Write ZK circuits in JavaScript/TypeScript, generate Noir code and proofs automatically",
5
5
  "type": "module",
6
6
  "main": "./dist/index.cjs",