silentpayments: skip slow benchmarks for low iters count (<= 2)
What changed, and why it matters
This change only adjusts benchmark tests for a new Bitcoin privacy feature (silent payments). It skips some slow benchmark cases when tests are run with very low iteration counts, such as in automated CI runs. It does not change any production cryptography, wallet logic, or network code, and has no security impact on users.
No security action required. This is a benign CI/test optimization.
Security signals we found
No strong security signals were identified.
Evidence from the diff
The commit modifies src/modules/silentpayments/bench_impl.h to conditionally skip two classes of silentpayments scanning benchmarks when SECP256K1_BENCH_ITERS <= 2: (1) common-case scanning with N>10 outputs, and (2) all worst-case scanning benchmarks. This mirrors an existing pattern in bench_ecmult. The change is purely test/CI infrastructure tuning and does not alter library behavior, constants, or cryptographic algorithms.
Changed components
src/modules/silentpayments/bench_impl.hInspect captured patch +12 / −2
diff --git a/src/modules/silentpayments/bench_impl.h b/src/modules/silentpayments/bench_impl.h
index 2bb706c..cf0d789 100644
--- a/src/modules/silentpayments/bench_impl.h
+++ b/src/modules/silentpayments/bench_impl.h
@@ -194,7 +194,12 @@ static void run_silentpayments_bench(int iters, int argc, char** argv) {
data.num_outputs = num_outputs;
data.num_matches = 0;
sprintf(str, "silentpayments_scan_nomatch_N=%i", num_outputs);
- run_benchmark(str, bench_silentpayments_scan, bench_silentpayments_scan_setup, bench_silentpayments_scan_teardown, &data, 10, num_outputs < 100 ? iters : 1);
+ /* Don't run these slow benchmarks with low iterations (as used e.g. in CI) to prevent slow down */
+ if (iters <= 2 && num_outputs > 10) {
+ printf("Skipping benchmark \"%s\" due to SECP256K1_BENCH_ITERS <= 2\n", str);
+ } else {
+ run_benchmark(str, bench_silentpayments_scan, bench_silentpayments_scan_setup, bench_silentpayments_scan_teardown, &data, 10, num_outputs <= 10 ? iters : 1);
+ }
}
}
@@ -207,7 +212,12 @@ static void run_silentpayments_bench(int iters, int argc, char** argv) {
data.num_outputs = MAX_P2TR_OUTPUTS_PER_BLOCK;
data.num_matches = num_matches;
sprintf(str, "silentpayments_scan_worstcase_K=%i", num_matches);
- run_benchmark(str, bench_silentpayments_scan, bench_silentpayments_scan_setup, bench_silentpayments_scan_teardown, &data, 3, 1);
+ /* Don't run these slow benchmarks with low iterations (as used e.g. in CI) to prevent slow down */
+ if (iters <= 2) {
+ printf("Skipping benchmark \"%s\" due to SECP256K1_BENCH_ITERS <= 2\n", str);
+ } else {
+ run_benchmark(str, bench_silentpayments_scan, bench_silentpayments_scan_setup, bench_silentpayments_scan_teardown, &data, 3, 1);
+ }
}
}
Why this scored 15/100
Community notes
Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.
The AI analysis stands alone for now. Submit a note if you can add evidence or important context.