Skip to content

fix: clamp batch_invert range in logderivative computation to fix nightly debug build#22314

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

fix: clamp batch_invert range in logderivative computation to fix nightly debug build#22314
AztecBot wants to merge 1 commit into
nextfrom
claudebox/fix-bb-debug-build-logderiv

Conversation

@AztecBot

@AztecBot AztecBot commented Apr 4, 2026

Copy link
Copy Markdown
Collaborator

Summary

Fixes the nightly barretenberg debug build which has been failing for 5+ consecutive nights with exit code 134 (SIGABRT).

Root cause: In compute_logderivative_inverse(), the multi-threaded path splits work by circuit_size, but inverse_polynomial.coeffs() only covers the actual (non-virtual) data. When a thread chunk's start exceeds the polynomial's actual size, coeffs()[start] is out of bounds — caught by _GLIBCXX_DEBUG's span bounds checking.

Fix: Clamp start/end to the polynomial's actual data range before batch_invert. Virtual zero elements need no inversion.

Detailed analysis: https://gist.github.com/AztecBot/8f68f04f3d19414f42636111e9ee20b1

Verification

  • AvmVerifierTests.GoodPublicInputs: PASS (was SIGABRT)
  • AvmRecursiveTests.TwoLayerAvmRecursionFailsWithWrongPIs: PASS (was SIGABRT)
  • ultra_honk_tests (263), commitment_schemes_tests (88): no regression

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

…ive computation

In compute_logderivative_inverse, the multi-threaded path splits work by
circuit_size, but the inverse polynomial may have fewer actual elements due to
virtual zero padding. The batch_invert call accessed coeffs()[start] where start
could exceed the polynomial's actual size, triggering a _GLIBCXX_DEBUG span
bounds assertion in the nightly debug build.

Fix: clamp start/end to the polynomial's actual data range before batch_invert.
Virtual zero elements need no inversion.
@AztecBot AztecBot added ci-draft Run CI on draft PRs. claudebox Owned by claudebox. it can push to this PR. labels Apr 4, 2026
github-merge-queue Bot pushed a commit that referenced this pull request Apr 6, 2026
…#22312)

## Summary
Fixes nightly barretenberg debug build which crashes with SIGABRT (exit
code 134) in test
`AvmRecursiveTests.TwoLayerAvmRecursionFailsWithWrongPIs`.

**Root cause:** In `compute_logderivative_inverse()`, the multi-threaded
path splits work by `circuit_size`, but `inverse_polynomial.coeffs()`
only covers the actual (non-virtual) data. When a thread chunk's `start`
exceeds the polynomial's actual size, `coeffs()[start]` is out of bounds
— caught by `_GLIBCXX_DEBUG`'s span bounds checking in the debug build
preset.

**Fix:** Clamp `start`/`end` to the polynomial's actual data range
before `batch_invert`. Virtual zero elements need no inversion.

Note: The `batch_invert` reserve→resize fix from the original PR #22312
is no longer needed as it was already applied on `next`. PR #22314 can
be closed as duplicate.
@AztecBot

AztecBot commented Apr 6, 2026

Copy link
Copy Markdown
Collaborator Author

This issue was automatically closed because it was referenced in PR #22312 which has been merged to the default branch.

View workflow run

@AztecBot AztecBot closed this Apr 6, 2026
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.

1 participant