tests: add exhaustive extrakeys tweak coverage #1836

pull mangoostaa wants to merge 1 commits into bitcoin-core:master from mangoostaa:add-exhaustive-tweak-tests-extrakeys changing 1 files +70 −1
  1. mangoostaa commented at 8:50 pm on March 12, 2026: none

    Motivation

    • Cover the previously-untested TODO in test_exhaustive_extrakeys to ensure x-only pubkey and keypair tweak APIs are exhaustively validated.
    • Validate success/failure behavior for every non-zero internal key and every tweak scalar in the exhaustive test group.
    • Ensure consistency between xonly_pubkey_tweak_add, xonly_pubkey_tweak_add_check, and keypair_xonly_tweak_add
      and detect edge cases (resulting infinity, parity/x-coordinate mismatches).

    Description

    Replaced the TODO in src/modules/extrakeys/tests_exhaustive_impl.h with nested loops that exercise every internal non-zero key and every tweak scalar and compute the expected resulting group element and parity. For each case the test exercises secp256k1_xonly_pubkey_tweak_add, secp256k1_keypair_xonly_tweak_add, secp256k1_xonly_pubkey_tweak_add_check, and verifies serialized compressed pubkey bytes and x-only serialization against the expected group point. Fixed test-side issues: call secp256k1_fe_get_b32 without wrapping in CHECK (avoids invalid use of EXPECT), normalize field elements before checking parity and exporting to bytes, reset serialized_pklen prior to reuse, and derive the keypair secret bytes via secp256k1_scalar_get_b32 for deterministic keypair creation in the exhaustive loop. All changes are contained in src/modules/extrakeys/tests_exhaustive_impl.h and only affect the exhaustive test code

  2. tests: add exhaustive extrakeys tweak coverage 61796cb68c
  3. real-or-random added the label assurance on Mar 13, 2026
  4. real-or-random added the label tweak/refactor on Mar 13, 2026
  5. real-or-random approved
  6. real-or-random commented at 9:00 am on March 17, 2026: contributor
    ACK 61796cb68c574ac43a0fe749c9a8c0bae7387e7e

github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin-core/secp256k1. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2026-03-29 14:15 UTC

This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me