Skip to content

fix: avoid debug checker crash on failed circuits#24797

Closed
AztecBot wants to merge 1 commit into
nextfrom
cb/bb-debug-failed-circuit-check
Closed

fix: avoid debug checker crash on failed circuits#24797
AztecBot wants to merge 1 commit into
nextfrom
cb/bb-debug-failed-circuit-check

Conversation

@AztecBot

Copy link
Copy Markdown
Collaborator

Summary

  • Skip CircuitChecker::check in Chonk debug logging when the incoming circuit has already recorded a builder failure, so the original circuit.err() is reported instead of running a secondary structural check on invalid state.
  • Run the ACIR components static analyzer on a bounds-safe builder copy when real_variable_index is shorter than the variables vector, while preserving the original builder for witness classification so missing witnesses still report UNCONSTRAINED.
  • Ignore range-list entries whose witness index no longer has a real-variable mapping.

Root Cause

The nightly debug build runs with libstdc++ debug checks enabled. The ACIR components checker can inspect intentionally failed or corrupted builders, including the existing DetectsUnconstrainedWitnesses regression path where real_variable_index is truncated. cdg::StaticAnalyzer_ indexes real_variable_index while walking all builder variables, so debug-mode vector bounds checks abort before the checker can classify the witness as unconstrained.

Chonk's debug-only logging made the same class of issue easier to hit by calling CircuitChecker::check(circuit) before checking circuit.failed(). For a circuit that had already failed during construction, the debug logging could run a second checker over invalid builder state and mask the useful builder error.

Original failed CI run: https://github.com/AztecProtocol/barretenberg-claude/actions/runs/29675727468

Testing

  • clang-format-20 -i barretenberg/cpp/src/barretenberg/acir_components_check/components_check.cpp barretenberg/cpp/src/barretenberg/chonk/chonk.cpp
  • cmake --build --preset debug --target acir_components_check_tests chonk_tests from barretenberg/cpp
  • NATIVE_PRESET=debug barretenberg/cpp/scripts/run_test.sh acir_components_check_tests AcirComponentsCheckTest.DetectsUnconstrainedWitnesses
  • NATIVE_PRESET=debug barretenberg/cpp/scripts/run_test.sh acir_components_check_tests AcirComponentsCheckTest.*
  • NATIVE_PRESET=debug barretenberg/cpp/scripts/run_test.sh chonk_tests ChonkTests.Basic

Created by claudebox · group: slackbot

@AztecBot AztecBot added ci-barretenberg Run all barretenberg/cpp checks. ci-draft Run CI on draft PRs. ci-no-fail-fast Sets NO_FAIL_FAST in the CI so the run is not aborted on the first failure claudebox Owned by claudebox. it can push to this PR. labels Jul 19, 2026
@AztecBot

Copy link
Copy Markdown
Collaborator Author

Automatically closing this stale claudebox draft PR (no updates for 5+ days). Re-open if still needed.

@AztecBot AztecBot closed this Jul 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ci-barretenberg Run all barretenberg/cpp checks. ci-draft Run CI on draft PRs. ci-no-fail-fast Sets NO_FAIL_FAST in the CI so the run is not aborted on the first failure claudebox Owned by claudebox. it can push to this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant