Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use precomputed tables #790

Open
wants to merge 5 commits into
base: develop
Choose a base branch
from
Open

Use precomputed tables #790

wants to merge 5 commits into from

Conversation

SethDusek
Copy link
Collaborator

@SethDusek SethDusek commented Dec 3, 2024

Use pre-computed multiplication tables for generator where possible (secret key -> pk, generating public image of nonce in signing/verification, etc). Also pre-compute DlogProverInput.public_image() to avoid repeated EC operations in signing (helps performance when there are many secrets in Wallet).

Some benchmarks (Wallet with 1000 secrets, signing N inputs):

  • cachedpk is with only eagerly-evaluated public image (a410eaf)
  • precomputed+cachedpk uses generator table optimization + cachedpk
  • Final is the result of all optimizations, along with some other smaller optimizations
    plot

Some small improvements to verification as well, tested on dbd86fdce57f3a5124e88ec1ee4b7289e450e059e21a74c303bf13bf0b924945, time to verify is down from 0.2s to 0.17s

@SethDusek SethDusek force-pushed the precomputedtables branch 4 times, most recently from 0cbe43e to 8c3e8c2 Compare December 5, 2024 06:28
@SethDusek SethDusek marked this pull request as ready for review December 5, 2024 07:06
@SethDusek SethDusek requested a review from kushti December 5, 2024 07:06
@SethDusek SethDusek force-pushed the precomputedtables branch 2 times, most recently from 79c0f07 to 4c4ce08 Compare December 5, 2024 07:11
@SethDusek SethDusek force-pushed the precomputedtables branch 3 times, most recently from 8c71d15 to 2b95ee3 Compare January 3, 2025 06:54
@coveralls
Copy link

coveralls commented Jan 3, 2025

Pull Request Test Coverage Report for Build 12594306876

Details

  • 62 of 69 (89.86%) changed or added relevant lines in 16 files are covered.
  • 11 unchanged lines in 2 files lost coverage.
  • Overall coverage increased (+0.002%) to 78.463%

Changes Missing Coverage Covered Lines Changed/Added Lines %
ergo-lib/src/chain/transaction/unsigned.rs 0 1 0.0%
ergotree-interpreter/src/eval/create_provedlog.rs 0 1 0.0%
ergotree-interpreter/src/sigma_protocol/private_input.rs 14 15 93.33%
ergo-lib/src/wallet/ext_secret_key.rs 9 13 69.23%
Files with Coverage Reduction New Missed Lines %
ergotree-interpreter/src/sigma_protocol/private_input.rs 1 90.32%
ergotree-ir/src/serialization/types.rs 10 82.52%
Totals Coverage Status
Change from base Build 12589822362: 0.002%
Covered Lines: 11079
Relevant Lines: 14120

💛 - Coveralls

This avoids repeated multiplications by group element when signing
Now that DlogProverInput eagerly evaluates public key, it's a bad fit for ExtSecretKey since it causes unnecessary EC operations
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants