Skip to content

fix: corrupt low-order bytes in batch verifier test + skip WASM non-canonical test#22333

Merged
ludamad merged 1 commit intomerge-train/barretenbergfrom
claudebox/fix-fr-from-u64-ci
Apr 6, 2026
Merged

fix: corrupt low-order bytes in batch verifier test + skip WASM non-canonical test#22333
ludamad merged 1 commit intomerge-train/barretenbergfrom
claudebox/fix-fr-from-u64-ci

Conversation

@AztecBot
Copy link
Copy Markdown
Collaborator

@AztecBot AztecBot commented Apr 6, 2026

Summary

Fixes two CI failures in merge-train/barretenberg caused by the interaction of #22233 (Fr::from_u64 big-endian encoding) and #22311 (strict non-canonical field validation).

Fix 1: batch_verifier.test.ts — corrupt low-order bytes

The corruptProofFields() test helper was flipping high-order bytes (indices 0,1) of field elements, creating values exceeding the BN254 Fr modulus. The strict validation now rejects these at deserialization time with non-canonical encoding (value >= modulus) before they reach the verifier.

Fix: Flip low-order bytes (indices 30,31) instead — still corrupts the proof but keeps field values canonical.

Fix 2: PrimeFieldTest/MsgpackRejectsNonCanonical — skip in WASM

The test uses EXPECT_THROW to verify non-canonical field rejection, but WASM builds define BB_NO_EXCEPTIONS, so throw_or_abort calls abort() instead of throwing — crashing the test runner.

Fix: Wrap the test with #ifndef BB_NO_EXCEPTIONS and add a GTEST_SKIP() fallback, matching the existing pattern in c_bind_exception.test.cpp.

Test plan

  • batch_verifier.test.ts — all 4 tests pass locally
  • ecc_tests --gtest_filter=*MsgpackRejectsNonCanonical* — all 6 field types pass on native

@AztecBot AztecBot added ci-draft Run CI on draft PRs. claudebox Owned by claudebox. it can push to this PR. labels Apr 6, 2026
@ludamad ludamad marked this pull request as ready for review April 6, 2026 15:38
@ludamad ludamad enabled auto-merge (squash) April 6, 2026 15:38
@ludamad ludamad merged commit 2803219 into merge-train/barretenberg Apr 6, 2026
35 of 39 checks passed
@ludamad ludamad deleted the claudebox/fix-fr-from-u64-ci branch April 6, 2026 15:39
@AztecBot AztecBot changed the title fix: corrupt low-order bytes in batch verifier test to avoid non-canonical field encoding fix: corrupt low-order bytes in batch verifier test + skip WASM non-canonical test Apr 6, 2026
github-merge-queue bot pushed a commit that referenced this pull request Apr 6, 2026
BEGIN_COMMIT_OVERRIDE
fix: reject VK with log_circuit_size=0 in UltraKeccak verifier (#22319)
chore: merkle tree audit 2 (#21475)
fix: graceful failures in verifier code paths + other fixes (#22311)
fix: Fr::from_u64 big-endian encoding to match C++ msgpack format
(#22233)
fix: corrupt low-order bytes in batch verifier test to avoid
non-canonical field encoding (#22333)
fix: skip MsgpackRejectsNonCanonical test in WASM builds (#22335)
END_COMMIT_OVERRIDE
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