Skip to content

Commit

Permalink
fix: Fix Translator composer test instability (#4751)
Browse files Browse the repository at this point in the history
Pads the test with values that produce non-point-at-infinity
commitments. I tried to add an ASSERT to detect when those values are
trying to get into the transcript, but then AVM starts failing.
  • Loading branch information
Rumata888 authored Feb 25, 2024
1 parent 3bbe167 commit 842ba7a
Showing 1 changed file with 12 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -49,12 +49,24 @@ TEST_F(GoblinTranslatorComposerTests, Basic)
using Fr = fr;
using Fq = fq;

// Add an element and scalar the accumulation of which leaves no Point-at-Infinity commitments
const auto x = uint256_t(0xd3c208c16d87cfd3, 0xd97816a916871ca8, 0x9b85045b68181585, 0x30644e72e131a02);
const auto y = uint256_t(0x3ce1cc9c7e645a83, 0x2edac647851e3ac5, 0xd0cbe61fced2bc53, 0x1a76dae6d3272396);
auto padding_element = G1(x, y);
auto padding_scalar = -Fr::one();

auto P1 = G1::random_element();
auto P2 = G1::random_element();
auto z = Fr::random_element();

// Add the same operations to the ECC op queue; the native computation is performed under the hood.
auto op_queue = std::make_shared<bb::ECCOpQueue>();

// Accumulate padding so that we don't produce Point-at-Infinity commitments. Currently our transcript can't handle
// them
op_queue->mul_accumulate(padding_element, padding_scalar);

// Push everything else
for (size_t i = 0; i < 500; i++) {
op_queue->add_accumulate(P1);
op_queue->mul_accumulate(P2, z);
Expand Down

0 comments on commit 842ba7a

Please sign in to comment.