From dea4bdc2d13bee3e359c5b98eb1968f97d1f87f2 Mon Sep 17 00:00:00 2001 From: Rumata888 Date: Thu, 6 Jun 2024 15:16:35 +0000 Subject: [PATCH] Fixing 0 naf --- .../stdlib/primitives/biggroup/biggroup.test.cpp | 6 +----- .../stdlib/primitives/biggroup/biggroup_nafs.hpp | 4 ++++ 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/barretenberg/cpp/src/barretenberg/stdlib/primitives/biggroup/biggroup.test.cpp b/barretenberg/cpp/src/barretenberg/stdlib/primitives/biggroup/biggroup.test.cpp index 02c2cf12859..49c8a471ca5 100644 --- a/barretenberg/cpp/src/barretenberg/stdlib/primitives/biggroup/biggroup.test.cpp +++ b/barretenberg/cpp/src/barretenberg/stdlib/primitives/biggroup/biggroup.test.cpp @@ -1278,11 +1278,7 @@ HEAVY_TYPED_TEST(stdlib_biggroup, batch_mul_edge_case_set1) HEAVY_TYPED_TEST(stdlib_biggroup, batch_mul_edge_case_set2) { - if constexpr (HasGoblinBuilder) { - TestFixture::test_batch_mul_edge_case_set2(); - } else { - GTEST_SKIP() << "https://github.com/AztecProtocol/barretenberg/issues/1000"; - }; + TestFixture::test_batch_mul_edge_case_set2(); } HEAVY_TYPED_TEST(stdlib_biggroup, chain_add) { diff --git a/barretenberg/cpp/src/barretenberg/stdlib/primitives/biggroup/biggroup_nafs.hpp b/barretenberg/cpp/src/barretenberg/stdlib/primitives/biggroup/biggroup_nafs.hpp index ad1663c46fc..f27bc803b4c 100644 --- a/barretenberg/cpp/src/barretenberg/stdlib/primitives/biggroup/biggroup_nafs.hpp +++ b/barretenberg/cpp/src/barretenberg/stdlib/primitives/biggroup/biggroup_nafs.hpp @@ -485,6 +485,10 @@ std::vector> element::compute_naf(const Fr& scalar, cons C* ctx = scalar.context; uint512_t scalar_multiplier_512 = uint512_t(uint256_t(scalar.get_value()) % Fr::modulus); uint256_t scalar_multiplier = scalar_multiplier_512.lo; + // NAF can't handl 0 + if (scalar_multiplier == 0) { + scalar_multiplier = Fr::modulus; + } const size_t num_rounds = (max_num_bits == 0) ? Fr::modulus.get_msb() + 1 : max_num_bits; std::vector naf_entries(num_rounds + 1);