3 suggestions
Optional improvements
[suggestion] · label_lookup leaves the enforced scalar bound undocumented
scan_outputs now treats overflowing callback tweaks as illegal arguments and aborts by default, but the public callback contract does not state the range requirement.
Location: src/secp256k1/src/modules/silentpayments/main_impl.h:771 (head).
Details and suggested fix
At a label match, ARG_CHECK(!tweak_overflow) replaces the old failed-addition fallback that set the returned tweak to zero. The callback and scanning documentation in secp256k1_silentpayments.h specifies only a 32-byte tweak, while secp256k1.h promises that illegal callbacks correspond to explicitly documented violations. Keep the check and document upstream, in both callback and scanning descriptions, that the returned bytes must encode a big-endian scalar strictly below the group order and that overflow invokes the illegal callback. Successful secp256k1_silentpayments_recipient_label_create calls already satisfy this bound; the failure requires malformed caller-maintained cache data.
[suggestion] · full_check receive vectors still allow duplicate results
The new distinct-output guard skips full_check vectors, leaving a pre-existing coverage gap where repeating one complete result can hide a missing expected output.
Location: src/secp256k1/src/modules/silentpayments/tests_impl.h:989 (head).
Details and suggested fix
The existing multiple-output fixture expects two distinct outputs. In full_check, each found result searches the whole expected list without consuming its match. If a scanner regression repeated the first complete result and omitted the second, both copies would match the first expected entry. Signing with the same tweak and fixed MSG32/AUX32 would reproduce the same expected signature, and the count check would still pass. Move the new pairwise comparison loop to the common path after the detailed checks, upstream in libsecp256k1. This closes the gap without weakening the existing assertions.
[suggestion] · musig_ctx_sha256 fails on repeated sequential selection
Repeated sequential selection of musig_ctx_sha256 would fail on stale probe flags; this is inferred from source, not a test run, and normal single-pass execution is unaffected.
Location: src/secp256k1/src/modules/musig/tests_impl.h:656 (head).
Details and suggested fix
parse_target appends module and individual selections without deduplication, so ./tests -j=0 -t=musig -t=musig_ctx_sha256 runs this test twice in one process. DEFINE_SHA256_TRANSFORM_PROBE creates file-scope flags that the override calls set to 1. Nothing clears them before the next execution's CHECK(!sha256_musig_pubkey_agg_called), so that assertion would fail despite default compression working correctly. Reset all six flags before the default-compression run. The existing test_ecdh_ctx_sha256 has the same limitation; this correction belongs upstream in libsecp256k1.
Background
Ralph's summary of historical context for the behaviour affected by this change. The historical record reviewed here is incomplete.
Ralph's inferences
The different error paths reflect a trust boundary: ordinary transaction contents are expected external data, whereas cached label scalars are caller-maintained API artifacts expected to satisfy library invariants.
This explains why accepting empty transaction-derived collections as ordinary failure is compatible with treating overflowing label-cache values as illegal arguments. The distinction is about the origin and contract of the data, not simply whether either case can be represented mathematically.