Skip to content

feat(tests): extend EIP-2537 MAP_FP_TO_G1 and MAP_FP2_TO_G2 edge-case coverage - #3945

Open
rorupuntou wants to merge 1 commit into
ethereum:forks/bogotafrom
rorupuntou:feat/eip2537-map-fp-to-curve-hardening
Open

rorupuntou wants to merge 1 commit into
ethereum:forks/bogotafrom
rorupuntou:feat/eip2537-map-fp-to-curve-hardening

Conversation

@rorupuntou

@rorupuntou rorupuntou commented Oct 30, 2026 •

Copy link
Copy Markdown
Contributor

Description

Extends test coverage for EIP-2537 MAP_FP_TO_G1 (precompile 0x10) and MAP_FP2_TO_G2 (precompile 0x11), focusing on input padding, boundary validation, and coordinate modulus checks:

  1. Top-16 Byte Big-Endian Zero Padding Violations:
    • Tests non-zero bytes across byte indices 0..15 of the 64-byte field representations (e.g. byte 15 0x01, high bit 0x80, mid-padding byte 8, and dirty padding paired with a valid Spec.P - 1 coordinate), verifying that implementations do not ignore dirty upper padding before coordinate validation.
    • For MAP_FP2_TO_G2, covers dirty padding individually on $c_0$ (0..15), individually on $c_1$ (64..79), and simultaneously on both $c_0$ and $c_1$.
  2. Modulus Overflows:
    • Values $\ge P$ including $P$, $P + 1$, $2^{381} - 1$, $2^{384} - 1$, and $P + 2^{128}$ for single coordinate inputs and simultaneous $(c_0, c_1)$ coordinates.
  3. Calldata Length Violations:
    • Truncated inputs: 32 bytes (single word) and 64 bytes (single Fp for Fp2).

All 66 test fixtures generate cleanly against the Prague fork (uv run fill).

Related Issues or PRs

Follow-up to #3641 (rebased onto forks/bogota from #3821).

Checklist

  • Ran fast static checks to avoid CI fails, see Code Standards & Verifying Changes: just static
  • PR title has the form <type>(<area>): <description>, where <type> and <area> come from an appropriate C-<type>, respectively A-<area>, label. The title should match the target squash commit message.

Cute Animal Picture

Capybara

@rorupuntou

Copy link
Copy Markdown
Contributor Author

Hi @spencer-tb @marioevz! Whenever you have a moment, could you approve the pending CI workflow run and take a quick look at these negative boundary test cases for MAP_FP_TO_G1 (0x10) and MAP_FP2_TO_G2 (0x11) on forks/bogota? All 66 Prague fixtures fill cleanly locally and pass just static. Thanks!

This branch has not been deployed

No deployments
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