Skip to content

tests: add BIP352 test vectors as unit tests

Cirrus CI / lint failed Jul 16, 2025 in 1m 10s

Task Summary

Instruction lint failed in 00:29

Details

✅ 00:03 clone
✅ 00:01 merge_base
✅ 00:34 unshallow
❌ 00:29 lint

[09:11:15.215]   *                               returns a NULL pointer (NULL if labels are not
[09:11:15.215]   *                               used)
[09:11:15.215]   *                label_context: pointer to a label context object (NULL if
[09:11:15.215] - *                               labels are not used or context is not needed)
[09:11:15.215] + *                               labels are not used)
[09:11:15.215]   */
[09:11:15.215]  SECP256K1_API SECP256K1_WARN_UNUSED_RESULT int secp256k1_silentpayments_recipient_scan_outputs(
[09:11:15.215]      const secp256k1_context *ctx,
[09:11:15.215] diff --git a/src/modules/silentpayments/main_impl.h b/src/modules/silentpayments/main_impl.h
[09:11:15.215] index 3fc42f54f0..458c703190 100644
[09:11:15.215] --- a/src/modules/silentpayments/main_impl.h
[09:11:15.215] +++ b/src/modules/silentpayments/main_impl.h
[09:11:15.215] @@ -613,7 +613,7 @@ int secp256k1_silentpayments_recipient_scan_outputs(
[09:11:15.215]                  break;
[09:11:15.215]              }
[09:11:15.215]  
[09:11:15.215] -            /* If not found, proceed to check for labels (if a label lookup function is provided) */
[09:11:15.215] +            /* If not found, proceed to check for labels (if the labels cache is present) */
[09:11:15.215]              if (label_lookup != NULL) {
[09:11:15.215]                  secp256k1_ge P_output_negated_ge, tx_output_ge;
[09:11:15.215]                  secp256k1_gej tx_output_gej, label_gej;
[09:11:15.215] diff --git a/src/modules/silentpayments/tests_impl.h b/src/modules/silentpayments/tests_impl.h
[09:11:15.215] index a1acab7d63..aeffd9d70b 100644
[09:11:15.215] --- a/src/modules/silentpayments/tests_impl.h
[09:11:15.215] +++ b/src/modules/silentpayments/tests_impl.h
[09:11:15.215] @@ -111,13 +111,8 @@ struct labels_cache {
[09:11:15.215]  };
[09:11:15.215]  struct labels_cache labels_cache;
[09:11:15.215]  const unsigned char* label_lookup(const unsigned char* key, const void* cache_ptr) {
[09:11:15.215] -    const struct labels_cache* cache;
[09:11:15.215] +    const struct labels_cache* cache = (const struct labels_cache*)cache_ptr;
[09:11:15.215]      size_t i;
[09:11:15.215] -
[09:11:15.215] -    if (cache_ptr == NULL) {
[09:11:15.215] -        return NULL;
[09:11:15.215] -    }
[09:11:15.215] -    cache = (const struct labels_cache*)cache_ptr;
[09:11:15.215]      for (i = 0; i < cache->entries_used; i++) {
[09:11:15.215]          if (secp256k1_memcmp_var(cache->entries[i].label, key, 33) == 0) {
[09:11:15.215]              return cache->entries[i].label_tweak;
[09:11:15.215] @@ -370,7 +365,6 @@ static void test_recipient_api(void) {
[09:11:15.215]      n_f = 0;
[09:11:15.215]      labels_cache.entries_used = 0;
[09:11:15.215]      CHECK(secp256k1_silentpayments_recipient_scan_outputs(CTX, fp, &n_f, tp, 1, ALICE_SECKEY, &pd, &p, &label_lookup, &labels_cache));
[09:11:15.215] -    CHECK(secp256k1_silentpayments_recipient_scan_outputs(CTX, fp, &n_f, tp, 1, ALICE_SECKEY, &pd, &p, &label_lookup, NULL));
[09:11:15.215]      CHECK(secp256k1_silentpayments_recipient_scan_outputs(CTX, fp, &n_f, tp, 1, ALICE_SECKEY, &pd, &p, NULL, NULL));
[09:11:15.215]      CHECK_ILLEGAL(CTX, secp256k1_silentpayments_recipient_scan_outputs(CTX, NULL, &n_f, tp, 1, ALICE_SECKEY, &pd, &p, &label_lookup, &labels_cache));
[09:11:15.215]      CHECK_ILLEGAL(CTX, secp256k1_silentpayments_recipient_scan_outputs(CTX, fp, NULL, tp, 1, ALICE_SECKEY, &pd, &p, &label_lookup, &labels_cache));
[09:11:15.215] FAIL: subtree directory was touched without subtree merge
[09:11:15.216] ^^^
[09:11:15.216] 
[09:11:15.216] ^---- ⚠️ Failure generated from lint check 'subtree' (Check that subtrees are pure subtrees)!
[09:11:15.216] 
[09:11:15.216] 
[09:11:32.343] Success: no issues found in 299 source files
����