tests: cover Silent Payments label scanning #1898

pull l0rinc wants to merge 2 commits into bitcoin-core:master from l0rinc:l0rinc/silentpayments-ctime-label-scan changing 1 files +27 −13
  1. l0rinc commented at 11:53 PM on July 27, 2026: contributor

    Problem: The constant-time test generates an output using one scan key, then mutates the key before scanning, so the scan cannot find it. It also passes no label callback, leaving label-candidate serialization and batching unexecuted. The test still passes because it only covers the initial shared-secret computation with the undefined scan key.

    Fix: Regenerate the output for the actual scan key and prepend a nonmatching output. Use a callback to check each serialized 33-byte candidate is defined and count misses, and require one direct, unlabeled output match.

  2. tests: make Silent Payments ctime scan find output
    The ctime test marks the scan key undefined, but generates its output for a scan public key created before later key mutations.
    The scan therefore cannot find that output, leaving the successful-match path untested even though the test passes.
    
    Regenerate the output for the actual scan key and prepend a nonmatching output for the label-batch scenario.
    Remove the earlier scan-public-key creation and sender call because this setup replaces both.
    f7de6f7bdf
  3. tests: cover Silent Payments label scanning
    The ctime test passes no label callback, so label-candidate serialization and batching never run while the scan key is marked undefined.
    
    Check that every serialized 33-byte candidate is defined, count callback misses, and require one direct unlabeled output match.
    For `k = 0`, the first output contributes two candidates that flush before the second output matches directly; for `k = 1`, both outputs miss and four candidates flush at the end.
    
    The six callback calls prove both flush paths execute, `SECP256K1_CHECKMEM_CHECK` proves the candidate bytes are defined, and the result assertions prove the intended direct match is still found.
    The six-call argument relies on `LABEL_BATCH_SIZE >= 2` (currently 8); at one, the first miss would flush immediately and no longer cover the pre-direct-match flush.
    b561d6c58c
  4. l0rinc force-pushed on Jul 28, 2026
  5. l0rinc marked this as a draft on Jul 28, 2026
  6. real-or-random added the label assurance on Jul 28, 2026
  7. real-or-random added the label tweak/refactor on Jul 28, 2026
  8. l0rinc renamed this:
    RFC/tests: cover Silent Payments label scanning
    tests: cover Silent Payments label scanning
    on Jul 29, 2026
  9. l0rinc marked this as ready for review on Jul 29, 2026
Contributors

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-08-03 21:15 UTC

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