Skip to content

fix precompile tests, add precompile test cases from besu-native#18

Merged
garyschulte merged 2 commits intoConsensys:mainfrom
garyschulte:fix/bn254_point_checks
Apr 2, 2026
Merged

fix precompile tests, add precompile test cases from besu-native#18
garyschulte merged 2 commits intoConsensys:mainfrom
garyschulte:fix/bn254_point_checks

Conversation

@garyschulte
Copy link
Copy Markdown
Collaborator

@garyschulte garyschulte commented Apr 2, 2026

fix main test target to include precompile tests, fix errors, add test cases from besu-native


Note

Medium Risk
Changes affect cryptographic precompile input validation and pairing semantics (e.g., empty BLS12 pairing input), which can alter execution outcomes; however, behavior is now backed by extensive upstream test vectors.

Overview
Wires src/precompile/main.zig into the Zig build as a dedicated b.addTest target so precompile unit tests run via the normal test step (instead of only via a custom CI zig test invocation), and ensures main.zig actually executes tests.zig via a top-level test block.

Tightens precompile correctness: bls12PairingRun now rejects empty input per EIP-2537 expectations, and BN254 point validation is upgraded from a stub to enforce EIP-196/197 field-modulus bounds (with explicit infinity handling). Also fixes a RIPEMD-160 long-message expected digest.

Adds large, vector-driven test coverage for BN254 and BLS12-381 precompiles by porting Besu CSV suites (new *_tests.zig plus embedded testdata/*.csv), including error-path cases and gas checks for fixed-cost operations.

Written by Cursor Bugbot for commit c8dda4d. This will update automatically on new commits. Configure here.

Signed-off-by: garyschulte <garyschulte@gmail.com>
Signed-off-by: garyschulte <garyschulte@gmail.com>
@garyschulte garyschulte merged commit 81f7f0e into Consensys:main Apr 2, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant