Skip to content

Commit 499a70f

Browse files
committed
Make variable names match the specs
1 parent 2052633 commit 499a70f

File tree

25 files changed

+692
-696
lines changed

25 files changed

+692
-696
lines changed

src/compiler.rs

Lines changed: 57 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -108,33 +108,37 @@ impl Compiler {
108108
let mut q_l = vec![BlsScalar::zero(); size];
109109
let mut q_r = vec![BlsScalar::zero(); size];
110110
let mut q_o = vec![BlsScalar::zero(); size];
111-
let mut q_4 = vec![BlsScalar::zero(); size];
111+
let mut q_f = vec![BlsScalar::zero(); size];
112112
let mut q_c = vec![BlsScalar::zero(); size];
113113
let mut q_arith = vec![BlsScalar::zero(); size];
114114
let mut q_range = vec![BlsScalar::zero(); size];
115115
let mut q_logic = vec![BlsScalar::zero(); size];
116116
let mut q_fixed_group_add = vec![BlsScalar::zero(); size];
117117
let mut q_variable_group_add = vec![BlsScalar::zero(); size];
118118

119-
prover.constraints.iter().enumerate().for_each(|(i, c)| {
120-
q_m[i] = c.q_m;
121-
q_l[i] = c.q_l;
122-
q_r[i] = c.q_r;
123-
q_o[i] = c.q_o;
124-
q_4[i] = c.q_4;
125-
q_c[i] = c.q_c;
126-
q_arith[i] = c.q_arith;
127-
q_range[i] = c.q_range;
128-
q_logic[i] = c.q_logic;
129-
q_fixed_group_add[i] = c.q_fixed_group_add;
130-
q_variable_group_add[i] = c.q_variable_group_add;
131-
});
119+
prover
120+
.constraints
121+
.iter()
122+
.enumerate()
123+
.for_each(|(i, constraint)| {
124+
q_m[i] = constraint.q_m;
125+
q_l[i] = constraint.q_l;
126+
q_r[i] = constraint.q_r;
127+
q_o[i] = constraint.q_o;
128+
q_f[i] = constraint.q_f;
129+
q_c[i] = constraint.q_c;
130+
q_arith[i] = constraint.q_arith;
131+
q_range[i] = constraint.q_range;
132+
q_logic[i] = constraint.q_logic;
133+
q_fixed_group_add[i] = constraint.q_fixed_group_add;
134+
q_variable_group_add[i] = constraint.q_variable_group_add;
135+
});
132136

133137
let q_m_poly = domain.ifft(&q_m);
134138
let q_l_poly = domain.ifft(&q_l);
135139
let q_r_poly = domain.ifft(&q_r);
136140
let q_o_poly = domain.ifft(&q_o);
137-
let q_4_poly = domain.ifft(&q_4);
141+
let q_f_poly = domain.ifft(&q_f);
138142
let q_c_poly = domain.ifft(&q_c);
139143
let q_arith_poly = domain.ifft(&q_arith);
140144
let q_range_poly = domain.ifft(&q_range);
@@ -146,7 +150,7 @@ impl Compiler {
146150
let q_l_poly = Polynomial::from_coefficients_vec(q_l_poly);
147151
let q_r_poly = Polynomial::from_coefficients_vec(q_r_poly);
148152
let q_o_poly = Polynomial::from_coefficients_vec(q_o_poly);
149-
let q_4_poly = Polynomial::from_coefficients_vec(q_4_poly);
153+
let q_f_poly = Polynomial::from_coefficients_vec(q_f_poly);
150154
let q_c_poly = Polynomial::from_coefficients_vec(q_c_poly);
151155
let q_arith_poly = Polynomial::from_coefficients_vec(q_arith_poly);
152156
let q_range_poly = Polynomial::from_coefficients_vec(q_range_poly);
@@ -160,72 +164,69 @@ impl Compiler {
160164
let [s_sigma_1_poly, s_sigma_2_poly, s_sigma_3_poly, s_sigma_4_poly] =
161165
perm.compute_sigma_polynomials(size, &domain);
162166

163-
let q_m_poly_commit = commit_key.commit(&q_m_poly).unwrap_or_default();
164-
let q_l_poly_commit = commit_key.commit(&q_l_poly).unwrap_or_default();
165-
let q_r_poly_commit = commit_key.commit(&q_r_poly).unwrap_or_default();
166-
let q_o_poly_commit = commit_key.commit(&q_o_poly).unwrap_or_default();
167-
let q_4_poly_commit = commit_key.commit(&q_4_poly).unwrap_or_default();
168-
let q_c_poly_commit = commit_key.commit(&q_c_poly).unwrap_or_default();
169-
let q_arith_poly_commit =
170-
commit_key.commit(&q_arith_poly).unwrap_or_default();
171-
let q_range_poly_commit =
172-
commit_key.commit(&q_range_poly).unwrap_or_default();
173-
let q_logic_poly_commit =
174-
commit_key.commit(&q_logic_poly).unwrap_or_default();
175-
let q_fixed_group_add_poly_commit = commit_key
167+
let q_m_comm = commit_key.commit(&q_m_poly).unwrap_or_default();
168+
let q_l_comm = commit_key.commit(&q_l_poly).unwrap_or_default();
169+
let q_r_comm = commit_key.commit(&q_r_poly).unwrap_or_default();
170+
let q_o_comm = commit_key.commit(&q_o_poly).unwrap_or_default();
171+
let q_f_comm = commit_key.commit(&q_f_poly).unwrap_or_default();
172+
let q_c_comm = commit_key.commit(&q_c_poly).unwrap_or_default();
173+
let q_arith_comm = commit_key.commit(&q_arith_poly).unwrap_or_default();
174+
let q_range_comm = commit_key.commit(&q_range_poly).unwrap_or_default();
175+
let q_logic_comm = commit_key.commit(&q_logic_poly).unwrap_or_default();
176+
let q_fixed_group_add_comm = commit_key
176177
.commit(&q_fixed_group_add_poly)
177178
.unwrap_or_default();
178-
let q_variable_group_add_poly_commit = commit_key
179+
let q_variable_group_add_comm = commit_key
179180
.commit(&q_variable_group_add_poly)
180181
.unwrap_or_default();
181182

182-
let s_sigma_1_poly_commit = commit_key.commit(&s_sigma_1_poly)?;
183-
let s_sigma_2_poly_commit = commit_key.commit(&s_sigma_2_poly)?;
184-
let s_sigma_3_poly_commit = commit_key.commit(&s_sigma_3_poly)?;
185-
let s_sigma_4_poly_commit = commit_key.commit(&s_sigma_4_poly)?;
183+
let s_sigma_1_comm = commit_key.commit(&s_sigma_1_poly)?;
184+
let s_sigma_2_comm = commit_key.commit(&s_sigma_2_poly)?;
185+
let s_sigma_3_comm = commit_key.commit(&s_sigma_3_poly)?;
186+
let s_sigma_4_comm = commit_key.commit(&s_sigma_4_poly)?;
186187

187188
// verifier Key for arithmetic circuits
188189
let arithmetic_verifier_key = widget::arithmetic::VerifierKey {
189-
q_m: q_m_poly_commit,
190-
q_l: q_l_poly_commit,
191-
q_r: q_r_poly_commit,
192-
q_o: q_o_poly_commit,
193-
q_4: q_4_poly_commit,
194-
q_c: q_c_poly_commit,
195-
q_arith: q_arith_poly_commit,
190+
q_m: q_m_comm,
191+
q_l: q_l_comm,
192+
q_r: q_r_comm,
193+
q_o: q_o_comm,
194+
q_f: q_f_comm,
195+
q_c: q_c_comm,
196+
q_arith: q_arith_comm,
196197
};
197198

198199
// verifier Key for range circuits
199200
let range_verifier_key = widget::range::VerifierKey {
200-
q_range: q_range_poly_commit,
201+
q_range: q_range_comm,
201202
};
202203

203204
// verifier Key for logic circuits
204205
let logic_verifier_key = widget::logic::VerifierKey {
205-
q_c: q_c_poly_commit,
206-
q_logic: q_logic_poly_commit,
206+
q_c: q_c_comm,
207+
q_logic: q_logic_comm,
207208
};
208209

209210
// verifier Key for ecc circuits
210211
let ecc_verifier_key =
211212
widget::ecc::scalar_mul::fixed_base::VerifierKey {
212-
q_l: q_l_poly_commit,
213-
q_r: q_r_poly_commit,
214-
q_fixed_group_add: q_fixed_group_add_poly_commit,
213+
q_l: q_l_comm,
214+
q_r: q_r_comm,
215+
q_fixed_group_add: q_fixed_group_add_comm,
215216
};
216217

217218
// verifier Key for curve addition circuits
218219
let curve_addition_verifier_key =
219220
widget::ecc::curve_addition::VerifierKey {
220-
q_variable_group_add: q_variable_group_add_poly_commit,
221+
q_variable_group_add: q_variable_group_add_comm,
221222
};
222223

223224
// verifier Key for permutation argument
224225
let permutation_verifier_key = widget::permutation::VerifierKey {
225-
s_sigma_1: s_sigma_1_poly_commit,
226-
s_sigma_2: s_sigma_2_poly_commit,
227-
s_sigma_3: s_sigma_3_poly_commit,
228-
s_sigma_4: s_sigma_4_poly_commit,
226+
s_sigma_1: s_sigma_1_comm,
227+
s_sigma_2: s_sigma_2_comm,
228+
s_sigma_3: s_sigma_3_comm,
229+
s_sigma_4: s_sigma_4_comm,
229230
};
230231

231232
let verifier_key = widget::VerifierKey {
@@ -243,7 +244,7 @@ impl Compiler {
243244
q_l: q_l_poly,
244245
q_r: q_r_poly,
245246
q_o: q_o_poly,
246-
q_4: q_4_poly,
247+
q_f: q_f_poly,
247248
q_c: q_c_poly,
248249
q_arith: q_arith_poly,
249250
q_range: q_range_poly,
@@ -282,8 +283,8 @@ impl Compiler {
282283
domain_8n.coset_fft(&selectors.q_c),
283284
domain_8n,
284285
);
285-
let q_4_eval_8n = Evaluations::from_vec_and_domain(
286-
domain_8n.coset_fft(&selectors.q_4),
286+
let q_f_eval_8n = Evaluations::from_vec_and_domain(
287+
domain_8n.coset_fft(&selectors.q_f),
287288
domain_8n,
288289
);
289290
let q_arith_eval_8n = Evaluations::from_vec_and_domain(
@@ -334,7 +335,7 @@ impl Compiler {
334335
q_l: (selectors.q_l.clone(), q_l_eval_8n.clone()),
335336
q_r: (selectors.q_r.clone(), q_r_eval_8n.clone()),
336337
q_o: (selectors.q_o, q_o_eval_8n),
337-
q_4: (selectors.q_4, q_4_eval_8n),
338+
q_f: (selectors.q_f, q_f_eval_8n),
338339
q_c: (selectors.q_c.clone(), q_c_eval_8n.clone()),
339340
q_arith: (selectors.q_arith, q_arith_eval_8n),
340341
};

0 commit comments

Comments
 (0)