Skip to content

Commit 63fd432

Browse files
iakovenkosclaude
andcommitted
update gate counts and fix constant renames
- Update BLOCK_RETURNDATA gate count (23 → 11) for 2-limb representation - Update PairingPointsTests expected gate counts (Ultra: 1853, Mega: 8) - Fix constant renames: DEFAULT_PAIRING_POINTS_* → DEFAULT_PAIRING_POINT_* Co-Authored-By: Claude Opus 4.5 <[email protected]>
1 parent 5267c57 commit 63fd432

File tree

3 files changed

+14
-9
lines changed

3 files changed

+14
-9
lines changed

barretenberg/cpp/src/barretenberg/chonk/chonk.test.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -162,8 +162,8 @@ class ChonkTests : public ::testing::Test {
162162
case KernelIOField::PAIRING_INPUTS: {
163163
// Replace with valid default pairing points (different from actual accumulated values)
164164
using namespace bb::stdlib::recursion;
165-
kernel_io.pairing_inputs.P0 = Commitment(DEFAULT_PAIRING_POINTS_P0_X, DEFAULT_PAIRING_POINTS_P0_Y);
166-
kernel_io.pairing_inputs.P1 = Commitment(DEFAULT_PAIRING_POINTS_P1_X, DEFAULT_PAIRING_POINTS_P1_Y);
165+
kernel_io.pairing_inputs.P0 = Commitment(DEFAULT_PAIRING_POINT_P0_X, DEFAULT_PAIRING_POINT_P0_Y);
166+
kernel_io.pairing_inputs.P1 = Commitment(DEFAULT_PAIRING_POINT_P1_X, DEFAULT_PAIRING_POINT_P1_Y);
167167
EXPECT_TRUE(kernel_io.pairing_inputs.check());
168168
break;
169169
}

barretenberg/cpp/src/barretenberg/dsl/acir_format/gate_count_constants.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ template <typename Builder> inline constexpr size_t BLOCK_ROM_READ = 9 + ZERO_GA
4848
template <typename Builder> inline constexpr size_t BLOCK_RAM_READ = 18 + ZERO_GATE + MEGA_OFFSET<Builder>;
4949
template <typename Builder> inline constexpr size_t BLOCK_RAM_WRITE = 18 + ZERO_GATE + MEGA_OFFSET<Builder>;
5050
template <typename Builder> inline constexpr size_t BLOCK_CALLDATA = 1 + ZERO_GATE + MEGA_OFFSET<Builder>;
51-
template <typename Builder> inline constexpr size_t BLOCK_RETURNDATA = 23 + ZERO_GATE + MEGA_OFFSET<Builder>;
51+
template <typename Builder> inline constexpr size_t BLOCK_RETURNDATA = 11 + ZERO_GATE + MEGA_OFFSET<Builder>;
5252
template <typename Builder> inline constexpr size_t ASSERT_EQUALITY = ZERO_GATE + MEGA_OFFSET<Builder>;
5353

5454
// ========================================

barretenberg/cpp/src/barretenberg/stdlib/primitives/pairing_points.test.cpp

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,14 @@ TYPED_TEST_SUITE(PairingPointsTests, Curves);
1818

1919
TYPED_TEST(PairingPointsTests, ConstructDefault)
2020
{
21-
static constexpr size_t NUM_GATES_ADDED = 28;
21+
using Builder = typename TypeParam::Builder;
22+
// Ultra uses bigfield which requires range constraints for self_reduce() when setting public inputs.
23+
// This looks expensive (1853 gates) but gets amortized in real circuits since most range tables
24+
// already exist from other bigfield operations.
25+
// Mega uses goblin_field (2 limbs) which is much cheaper (8 gates).
26+
static constexpr size_t NUM_GATES_ADDED = IsMegaBuilder<Builder> ? 8 : 1853;
2227

23-
typename TypeParam::Builder builder;
28+
Builder builder;
2429

2530
size_t num_gates = builder.num_gates();
2631
PairingPoints<TypeParam>::set_default_to_public(&builder);
@@ -38,8 +43,8 @@ TYPED_TEST(PairingPointsTests, TestDefault)
3843

3944
Builder builder;
4045

41-
Group P0(DEFAULT_PAIRING_POINTS_P0_X, DEFAULT_PAIRING_POINTS_P0_Y, /*assert_on_curve=*/false);
42-
Group P1(DEFAULT_PAIRING_POINTS_P1_X, DEFAULT_PAIRING_POINTS_P1_Y, /*assert_on_curve=*/false);
46+
Group P0(DEFAULT_PAIRING_POINT_P0_X, DEFAULT_PAIRING_POINT_P0_Y, /*assert_on_curve=*/false);
47+
Group P1(DEFAULT_PAIRING_POINT_P1_X, DEFAULT_PAIRING_POINT_P1_Y, /*assert_on_curve=*/false);
4348
P0.convert_constant_to_fixed_witness(&builder);
4449
P1.convert_constant_to_fixed_witness(&builder);
4550
PairingPoints<TypeParam> pp(P0, P1);
@@ -210,8 +215,8 @@ TYPED_TEST(PairingPointsTests, AggregateMultipleWithDuplicatePoints)
210215
Builder builder;
211216

212217
// Use default pairing points that are known to satisfy the pairing equation
213-
Group P0(DEFAULT_PAIRING_POINTS_P0_X, DEFAULT_PAIRING_POINTS_P0_Y, /*assert_on_curve=*/false);
214-
Group P1(DEFAULT_PAIRING_POINTS_P1_X, DEFAULT_PAIRING_POINTS_P1_Y, /*assert_on_curve=*/false);
218+
Group P0(DEFAULT_PAIRING_POINT_P0_X, DEFAULT_PAIRING_POINT_P0_Y, /*assert_on_curve=*/false);
219+
Group P1(DEFAULT_PAIRING_POINT_P1_X, DEFAULT_PAIRING_POINT_P1_Y, /*assert_on_curve=*/false);
215220
P0.convert_constant_to_fixed_witness(&builder);
216221
P1.convert_constant_to_fixed_witness(&builder);
217222

0 commit comments

Comments
 (0)