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

feat: compute verifier challenge sum more efficiently #59

Merged
merged 2 commits into from Aug 24, 2023

Conversation

AaronFeickert
Copy link
Contributor

@AaronFeickert AaronFeickert commented Aug 9, 2023

As part of proof verification, the verifier must compute the sum of consecutive nonzero powers of one of the Fiat-Shamir challenges. Currently, this is done naively by iteratively computing powers and adding them into an accumulator. Because the number of powers is equal to the product of the bit length and aggregation factor, this is nontrivial.

The computation can be made far more efficient. Because the sum of powers is a partial sum of a geometric series, it can be computed using a well-known formula (which is already used elsewhere in the verifier).

The change requires computation of an additional scalar inverse. As part of the optimization, all scalar inversions performed by the verifier are now included in a single batch operation per proof, which is more efficient.

Documentation is also updated to reflect the efficiency gain.

Overall, the result is an impressive improvement in verification. A single 64-bit range proof now verifies 7% faster.

Copy link
Contributor

@hansieodendaal hansieodendaal left a comment

Choose a reason for hiding this comment

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

ACK

@SWvheerden SWvheerden merged commit 7315a61 into tari-project:main Aug 24, 2023
6 checks passed
@AaronFeickert AaronFeickert deleted the challenge-sum branch August 24, 2023 15:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants