Skip to content

Faster RP commits with multi-exponentiation - #184

Closed
dvdplm wants to merge 31 commits into
masterfrom
dp-faster-commit-with-multi-exp-bis
Closed

Faster RP commits with multi-exponentiation#184
dvdplm wants to merge 31 commits into
masterfrom
dp-faster-commit-with-multi-exp-bis

Conversation

@dvdplm

@dvdplm dvdplm commented Jan 30, 2025

Copy link
Copy Markdown
Contributor

Use the MultiExponentiationBoundedExp trait to speed up commitment creation, which is common operation in some of our ZK Proofs.

This optimization had better results for the proofs in CGGMP'21. In the '24 version the impact is less pronounced and we should seriously consider whether the (small) gains are actually worth it.

group                                      master                          mine
-----                                      ------                          ----
AffG proof/prove                           1.27     88.3±0.10ms            1.00     69.5±1.17ms        
AffG proof/verify                          1.09     65.9±7.31ms            1.00     60.2±5.24ms        
AffG* proof/prove                          1.00      11.8±0.03s            1.00      11.8±0.03s        
AffG* proof/verify                         1.00      10.6±0.02s            1.00      10.6±0.02s        
Dec proof/prove                            1.00       7.7±0.01s            1.00       7.7±0.02s        
Dec proof/verify                           1.01       5.8±0.07s            1.00       5.7±0.01s        
Elog proof/prove                           1.00    140.5±0.78µs            1.00    140.7±0.93µs        
Elog proof/verify                          1.00    220.6±0.37µs            1.00    221.3±0.79µs        
EncElg proof/prove                         1.33     34.3±1.05ms            1.00     25.7±0.05ms        
EncElg proof/verify                        1.12     23.2±1.88ms            1.00     20.6±0.06ms        
Fac proof/prove                            1.65     58.1±0.86ms            1.00     35.3±0.09ms        
Fac proof/verify                           1.27     39.2±3.45ms            1.00     30.9±2.70ms        
Paillier-Blum modulus proof/prove          1.01   1088.7±5.12ms            1.00   1083.3±1.84ms        
Paillier-Blum modulus proof/verify         1.00    860.2±5.90ms            1.00    857.9±1.54ms        
Pedersen Ring params (prm) proof/prove     1.01    370.9±2.24ms            1.00    367.7±0.86ms        
Pedersen Ring params (prm) proof/verify    1.01    370.0±0.33ms            1.00    367.5±0.52ms        
Schnorr (sch) proof/prove                  1.00      9.4±0.02µs            1.00      9.4±0.03µs        
Schnorr (sch) proof/verify                 1.00     63.8±0.14µs            1.00     63.7±0.10µs        

Performance is essentially unchanged, except for EncElg and Fac.

The price we pay is a "powerset" proliferation of normal/wide and secret/public methods. Worth it?

@codecov

codecov Bot commented Jan 30, 2025

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 99.00000% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 89.32%. Comparing base (48fb491) to head (93dd378).
⚠️ Report is 72 commits behind head on master.

Files with missing lines Patch % Lines
synedrion/src/cggmp21/sigma/aff_g.rs 85.71% 1 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##           master     #184   +/-   ##
=======================================
  Coverage   89.31%   89.32%           
=======================================
  Files          40       40           
  Lines       10999    11016   +17     
=======================================
+ Hits         9824     9840   +16     
- Misses       1175     1176    +1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@dvdplm dvdplm self-assigned this Mar 8, 2025
@dvdplm
dvdplm marked this pull request as ready for review March 10, 2025 14:19
Comment thread synedrion/Cargo.toml
Comment on lines +67 to +71
[[bench]]
bench = true
name = "pow"
harness = false
path = "benches/pow.rs"

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@fjarri I left these in, but they are not particularly useful long-term I think. I wrote them to check on progress as I was changing code, but I think we should remove them now.

@dvdplm
dvdplm marked this pull request as draft April 11, 2025 10:13
@dvdplm

dvdplm commented Apr 11, 2025

Copy link
Copy Markdown
Contributor Author

Putting this back as draft because:

  • it could have some merit to leverage the optimized multi-exp impl in different places in the code
  • or, by way of a larger refactor of the way setup comittments, find a way to use multi-exp for RP commits

EIther way it's non-urgent and the gains likely minor.

@dvdplm dvdplm closed this Sep 15, 2025
@github-actions github-actions Bot locked and limited conversation to collaborators Sep 15, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant