aztec-2.0
aztec-2.0 copied to clipboard
Implementation differs from comment in evaluate_non_native_field_addition
Maybe just a typo in a comment but worth investigating.
This method has the following block comment:
/**
* we want the following layout in program memory
* (x - y = z)
*
* | 1 | 2 | 3 | 4 |
* |-----|-----|-----|-----|
* | y.p | x.0 | y.0 | x.p | (b.p + c.p - a.p = 0) AND (a.0 - b.0 - c.0 = 0)
* | z.p | x.1 | y.1 | z.0 | (a.1 - b.1 - c.1 = 0)
* | x.2 | y.2 | z.2 | z.1 | (a.2 - b.2 - c.2 = 0)
* | x.3 | y.3 | z.3 | --- | (a.3 - b.3 - c.3 = 0)
*
* By setting `q_arith` to `3`, we can validate `x_p + y_p + q_m = z_p`
**/
// GATE 1
// | 1 | 2 | 3 | 4 |
// |-----|-----|-----|-----|
// | y.p | x.0 | y.0 | z.p | (b.p + b.p - c.p = 0) AND (a.0 + b.0 - c.0 = 0)
// | x.p | x.1 | y.1 | z.0 | (a.1 + b.1 - c.1 = 0)
// | x.2 | y.2 | z.2 | z.1 | (a.2 + b.2 - c.2 = 0)
// | x.3 | y.3 | z.3 | --- | (a.3 + b.3 - c.3 = 0)
First of all, these two comments seem to be redundant and/or disagree? The implementation matches the first and not the second, i.e.:
blocks.main.populate_wires(y_p, x_0, y_0, x_p);
blocks.main.populate_wires(z_p, x_1, y_1, z_0);
blocks.main.populate_wires(x_2, y_2, z_2, z_1);
blocks.main.populate_wires(x_3, y_3, z_3, this->zero_idx);
Note: I went back and checked to ensure that the PR (#4741) that introduced the populate_wires method did not introduce any of these discrepancies. It did not.