feat: merge-train/barretenberg#21474
Merged
Merged
Conversation
Addresses the following in the merkle tree module: - thread failures in `perform_updates_without_witness` were not propagated, making the update path to report success even when threads failed - `NullifierMemoryTree` did not enforce its leaf capacity bound and allowed inserts beyond the maximum tree size - Add tests to validate the above two - `execute_and_report` does not report exceptions thrown by completion callbacks, which could hide failures and potentially lead to hangs - update `execute_and_report` to log the error and abort the process
### 🧾 Audit Context Final PR in the ecc/curves audit. Removes the `small_elements` member which is now unused. Add `bb::g2` to element.test.cpp so that we don't duplicate tests. ### 🛠️ Changes Made - Remove `small_elements` member from curves (unused) - Add `bb::g2` to `element.test.cpp` to avoid duplicating tests ### ✅ Checklist - [ ] Audited all methods of the relevant module/class - [ ] Audited the interface of the module/class with other (relevant) components - [ ] Documented existing functionality and any changes made (as per Doxygen requirements) - [ ] Resolved and/or closed all issues/TODOs pertaining to the audited files - [ ] Confirmed and documented any security or other issues found (if applicable) - [ ] Verified that tests cover all critical paths (and added tests if necessary) - [ ] Updated audit tracking for the files audited (check the start of each file you audited) ### 📌 Notes for Reviewers
…hmetic (#21178) * Adds debug-only assertions (`BB_ASSERT_DEBUG`) to verify that field elements remain within the coarse representation range `[0, 2p)` after arithmetic operations. This serves as partially checked documentation of the coarse-form invariant used by 254-bit fields (base and scalar fields of BN-254). * killed a bit of dead code * micro-optimization in unary negation, which was easiest way of fixing the debug-assert being triggered in an edge case. ** This was _not_ a real issue, but the debug assert nonetheless was triggered: formerly, the computation `-(x)` would first compute `2p - x` and then `reduce_once()`, and the debug-assert would fail when `x==0` for the first computation. Instead, we just compute `p-x` and let the asm handle the underflow. ## Changes - **`field_declarations.hpp`**: Added `assert_coarse_form()` helper that checks `val < twice_modulus` for small moduli in debug builds. Compiles to nothing in release (`NDEBUG`). - **`field_declarations.hpp`**: Removed dead code: `conditionally_subtract_from_double_modulus` (never called, had the same 2p bug pattern), `sqr_512` (declared but never defined), `__swap` (never called), `wnaf_table` (never instantiated). Removed `#include <execinfo.h>` and backtrace instrumentation (non-portable, redundant with ASAN). - **`field_impl.hpp`**: Added `assert_coarse_form()` calls after every asm coarse-reduction path (`operator+`, `+=`, `-`, `-=`, `*`, `*=`, `sqr`, `self_sqr`). - **`field_impl.hpp`**: Micro-optimization in `operator-()` and `self_neg()`: use `p` instead of `2p` as minuend. `subtract(p, x)` already handles `x > p` via underflow correction (+2p), so the result is always in `[0, 2p)` strict without needing `reduce_once()`. This removes one conditional subtraction per negation (~5% faster on `fr_bench`) and avoids the false-positive `assert_coarse_form()` trigger when `x = 0`. - **`field_impl_generic.hpp`**: Added output assertions to the generic `add()`, `subtract()`, `montgomery_mul()`, and `montgomery_square()` implementations for the small-modulus branch, guarded by `if (!std::is_constant_evaluated())`. ## Testing - `ecc_tests`: all 809 tests pass (both ASAN and Release builds) - `fr_bench`: no performance regression; unary negation ~5% faster Resolves AztecProtocol/barretenberg#1429 ClaudeBox log: http://ci.aztec-labs.com/d1479c5106ce0b7a-1 --------- Co-authored-by: notnotraju <raju@aztec-labs.com>
Cleaned up audit scope docs and added audit status headers to field source files. --------- Co-authored-by: notnotraju <raju@aztec-labs.com>
Reduce chonk proof size using #21246 and #21376 Closes AztecProtocol/barretenberg#1639
Collaborator
Author
|
🤖 Auto-merge enabled after 4 hours of inactivity. This PR will be merged automatically once all checks pass. |
Fix some tests that would fail in debug build
Collaborator
Author
|
🤖 Auto-merge enabled after 4 hours of inactivity. This PR will be merged automatically once all checks pass. |
we use ProofCompression module to reduce Chonk proof size without PI, the PI are padded (`PRIVATE_TO_ROLLUP_KERNEL_CIRCUIT_PUBLIC_INPUTS_LENGTH = 1281`), and most of these fields are zero, so gz compresses those efficiently, now we can track this size in the main flows' benches
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
BEGIN_COMMIT_OVERRIDE
chore: merkle tree audit (#21251)
chore: Ecc/curves audit - remove unused members (#21476)
feat: add debug-only asserts for 2p coarse modular form in field arithmetic (#21178)
chore: clean up native field audit scope (#21490)
feat!: integrate batched honk-translator proving into chonk (#21263)
fix: Fix tests in debug mode (#21542)
chore: bench compressed chonk proof size (#21616)
END_COMMIT_OVERRIDE