AztecProtocol / barretenberg

Apache License 2.0
129 stars 78 forks source link

Skip condition for lookup relation #952

Open ledwards2225 opened 3 months ago

ledwards2225 commented 3 months ago

The following skip condition applies for the lookup relation:

// From the definition of the lookup grand product, if the inputs are trivial,
// Z_lookup is updated as Z_lookup_{i+1} = Z_lookup_i * \gamma * (1 + \beta). If this condition holds, the
// contribution of the given inputs will be the zero polynomial.
auto gamma_by_one_plus_beta = params.gamma * (params.beta + 1);
bool is_active = !(in.z_lookup_shift.value_at(0) == in.z_lookup.value_at(0) * gamma_by_one_plus_beta &&
                           in.z_lookup_shift.value_at(1) == in.z_lookup.value_at(1) * gamma_by_one_plus_beta);

Applying this for sumcheck (proof construction, decider) passes all tests (and skips many trivial contributions if the circuit does not have a large number of lookups/tables). However, there are sporadic failures in bb acir tests. The error is repeatable on CI, but not between CI and local. Any test seems to pass when run individually. All tests pass when built in debug, eve if all run sequentially.