bench: integrate Spark component benchmarks into bench_firo#1859
bench: integrate Spark component benchmarks into bench_firo#1859navidR wants to merge 3 commits into
Conversation
…d::array and adding missing link dependencies
|
User rahimi.nv@gmail.com does not have a PR Review subscription. Go to Team management and add this email to the PR Review subscription. |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Run ID: ⛔ Files ignored due to path filters (1)
📒 Files selected for processing (12)
🚧 Files skipped from review as they are similar to previous changes (9)
Summary by CodeRabbit
WalkthroughThis PR introduces a comprehensive benchmark suite for four Spark cryptographic protocols by adding a build-time option ( ChangesSpark Cryptographic Benchmarks
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Suggested reviewers
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@src/bench/spark_chaum.cpp`:
- Around line 57-63: The loop currently calls x[i].randomize() then uses
x[i].inverse() to compute T[i], which can fail if x[i]==0; modify the loop that
sets x[i] so it guarantees a non-zero scalar before computing T[i] (e.g.,
replace x[i].randomize() with a non-zero sampler or add a small retry loop that
calls x[i].randomize() until !x[i].isZero()), then compute T[i] = (U + G *
y[i].negate()) * x[i].inverse(); reference symbols: x, x[i].randomize(),
x[i].inverse(), T, y, z.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro
Run ID: 2f4d321f-2c9a-46f7-998d-097828d5c4b7
⛔ Files ignored due to path filters (1)
.github/workflows/ci-master.ymlis excluded by!**/*.yml
📒 Files selected for processing (13)
CMakeLists.txtcmake/script/GenerateHeaderFromRaw.cmakecmake/utilities.cmakesrc/CMakeLists.txtsrc/bench/CMakeLists.txtsrc/bench/bench_bitcoin.cppsrc/bench/checkblock.cppsrc/bench/coin_selection.cppsrc/bench/mempool_eviction.cppsrc/bench/spark_bpplus.cppsrc/bench/spark_chaum.cppsrc/bench/spark_grootle.cppsrc/bench/spark_schnorr.cpp
| for (std::size_t i = 0; i < n; ++i) { | ||
| x[i].randomize(); | ||
| y[i].randomize(); | ||
| z[i].randomize(); | ||
|
|
||
| S[i] = F * x[i] + G * y[i] + H * z[i]; | ||
| T[i] = (U + G * y[i].negate()) * x[i].inverse(); |
There was a problem hiding this comment.
Avoid inverting a possibly zero scalar.
Line 63 takes x[i].inverse() immediately after randomization. If x[i] is ever zero, this benchmark can generate invalid inputs or fail nondeterministically in CI. Please resample or otherwise enforce non-zero x[i] before computing T[i].
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@src/bench/spark_chaum.cpp` around lines 57 - 63, The loop currently calls
x[i].randomize() then uses x[i].inverse() to compute T[i], which can fail if
x[i]==0; modify the loop that sets x[i] so it guarantees a non-zero scalar
before computing T[i] (e.g., replace x[i].randomize() with a non-zero sampler or
add a small retry loop that calls x[i].randomize() until !x[i].isZero()), then
compute T[i] = (U + G * y[i].negate()) * x[i].inverse(); reference symbols: x,
x[i].randomize(), x[i].inverse(), T, y, z.
4a8f36d to
95842af
Compare
This PR integrates Spark cryptographic component benchmarks for BPPlus, Grootle, Chaum, and Schnorr into the existing bench_firo runner behind BUILD_BENCH_SPARK, replacing the duplicate standalone benchmark harness and enabling benchmark builds in GitHub CI. It fixes the exposed BUILD_BENCH path by ensuring generated benchmark data directories exist, declaring target-owned link dependencies, propagating crash-hook wrapper link requirements from static libraries, and initializing runtime state needed by existing benchmarks, including mainnet chain params, secp256k1 verification context, and minimal InstantSend state for wallet coin selection. The Spark benchmark sources now use benchmark::State, valid secp_primitives types, and proof verification checks, while the legacy Bitcoin block benchmark keeps structural validation but skips Firo PoW for its foreign Bitcoin Core block vector.