Skip to content

Commit

Permalink
fix: Fix for the flaky issue (I hope) (#6923)
Browse files Browse the repository at this point in the history
There was a flaky assert_equal problem in bigfield in biggroup batch mul
with masking (not in the code we actually use, just for tests). Reducing
the scalar helped get rid of the problem (I ran the test in a loop and
it didn't appear).
  • Loading branch information
Rumata888 authored Jun 6, 2024
1 parent ecd5e29 commit 39747b9
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1943,8 +1943,9 @@ template <typename Builder, typename T> void bigfield<Builder, T>::assert_equal(
const uint512_t modulus(target_basis.modulus);

const auto [quotient_512, remainder_512] = (diff_val).divmod(modulus);
if (remainder_512 != 0)
if (remainder_512 != 0) {
std::cerr << "bigfield: remainder not zero!" << std::endl;
}
ASSERT(remainder_512 == 0);
bigfield quotient;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,9 @@ std::pair<std::vector<element<C, Fq, Fr, G>>, std::vector<Fr>> element<C, Fq, Fr

// Add a scalar -(<(1,2,4,...,2ⁿ⁻¹ ),(scalar₀,...,scalarₙ₋₁)> / 2ⁿ)
scalars.push_back(-last_scalar);
if constexpr (Fr::is_composite) {
scalars.back().self_reduce();
}
// Add in-circuit G_offset to points
points.push_back(element(native_offset_generator * generator_coefficient));

Expand Down Expand Up @@ -91,8 +94,8 @@ std::pair<std::vector<element<C, Fq, Fr, G>>, std::vector<Fr>> element<C, Fq, Fr

points.push_back(point);
scalars.push_back(scalar);
// TODO(https://github.com/AztecProtocol/barretenberg/issues/1002): if both point and scalar are constant, don't
// bother adding constraints
// TODO(https://github.com/AztecProtocol/barretenberg/issues/1002): if both point and scalar are constant,
// don't bother adding constraints
}

return { points, scalars };
Expand Down

0 comments on commit 39747b9

Please sign in to comment.