Skip to content

fix(bb): push missing q_5 in QArith3Gate test to unbreak nightly debug build#23266

Closed
AztecBot wants to merge 1 commit into
nextfrom
claudebox/fix-nightly-bb-debug-build-to-next
Closed

fix(bb): push missing q_5 in QArith3Gate test to unbreak nightly debug build#23266
AztecBot wants to merge 1 commit into
nextfrom
claudebox/fix-nightly-bb-debug-build-to-next

Conversation

@AztecBot
Copy link
Copy Markdown
Collaborator

Why

The nightly Barretenberg debug build failed again on next this morning — same root cause as run 25781836067 yesterday. The UltraCircuitBuilderArithmetic.QArith3Gate test in circuit_checker_tests trips a debug-only assertion:

[ RUN      ] UltraCircuitBuilderArithmetic.QArith3Gate
C++ exception with description "Assertion failed: (block_selectors[idx].size() == nominal_size)
  Actual  : 1
  Expected: 2" thrown in the test body.
[  FAILED  ] UltraCircuitBuilderArithmetic.QArith3Gate

The assertion fires inside UltraCircuitBuilder_::check_selector_length_consistency (stdlib_circuit_builders/ultra_circuit_builder.hpp), which is gated by #if NDEBUG ... #else and so only runs in debug builds — that is why no other CI mode caught it.

QArith3Gate builds two arithmetic gates manually by pushing each selector individually. Every in-tree gate constructor (create_arithmetic_gate, fix_witness, create_add_gate, etc.) follows q_4().emplace_back(...) with q_5().emplace_back(0); this test was the only manual-construction site that omitted the q_5 push.

Pre-merge-train, the consistency check used a per-flavour curated get_selectors() for UltraTraceArithmeticBlock that did not include q_5, so the omission was invisible. PR #23137 (feat: merge-train/barretenberg, landed 2026-05-12) refactored ExecutionTraceBlock so get_selectors() returns non_gate_selectors (7 entries including q_5) concatenated with gate_selectors, expanding the consistency check to cover q_5. The test has been silently broken w.r.t. the new check ever since that landed.

What

Add the missing builder.blocks.arithmetic.q_5().emplace_back(0) to both manually-constructed gates in QArith3Gate, matching the existing convention.

Relationship to #23229

#23229 is the same fix, opened yesterday against merge-train/barretenberg per the barretenberg PR guidelines. It has not merged yet (~24h later), so the cron fired again on the unchanged next HEAD and triggered another ClaudeBox dispatch. This PR is a duplicate targeting next directly so the nightly is unblocked while the merge-train PR proceeds normally. Whichever lands first resolves the recurrence; the second becomes a no-op merge.

Verification

Carried over from yesterday's reproduce on the byte-identical patch (session 3064b2e43c917621):

cd barretenberg/cpp
rm -rf build-debug
AVM=0 AVM_TRANSPILER=0 cmake --preset debug -DAVM=OFF
cmake --build build-debug --target circuit_checker_tests
./build-debug/bin/circuit_checker_tests --gtest_filter='UltraCircuitBuilderArithmetic.QArith3Gate'
# -> [       OK ] UltraCircuitBuilderArithmetic.QArith3Gate

Full circuit_checker_tests (79 tests) plus a sanity-run of polynomials_tests, common_tests, relations_tests all pass after the fix. I did not re-run the debug build in this session — the patch is byte-identical to what was verified against next yesterday, and the affected file has not changed.

Full analysis: https://gist.github.com/AztecBot/cf1bfc054a8a570d9663b89d53dcf810

ClaudeBox log: https://claudebox.work/s/bd69ed5ede2fd589?run=1

ClaudeBox log: https://claudebox.work/s/bd69ed5ede2fd589?run=1

@AztecBot AztecBot added ci-draft Run CI on draft PRs. claudebox Owned by claudebox. it can push to this PR. labels May 14, 2026
@federicobarbacovi
Copy link
Copy Markdown
Contributor

Handled here #23229

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ci-draft Run CI on draft PRs. claudebox Owned by claudebox. it can push to this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants