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: Gray code indexing #17

Merged
merged 1 commit into from
Jan 5, 2024
Merged

Conversation

AaronFeickert
Copy link
Collaborator

@AaronFeickert AaronFeickert commented Jan 4, 2024

During verification, the verifier must compute a product of f terms that depends on index decomposition. This ends up being quite inefficient.

As noted in #16, it's possible to replace standard index decomposition with a Gray code design. This is beneficial since successive indexes will differ only in a single digit. This means that successive products of f terms can be computed with only two multiplications, one of which is the inverse of a scalar element of f. We can further take advantage of the curve library's scalar batch inversion functionality to efficiently compute all such inverses at once.

This PR adds this functionality. It introduces a new GrayIterator that iteratively identifies digit changes between successive index decompositions, and modifies the prover and verifier to account for the change.

Closes #16.

@AaronFeickert AaronFeickert marked this pull request as draft January 4, 2024 22:09
@AaronFeickert AaronFeickert marked this pull request as ready for review January 4, 2024 22:25
@AaronFeickert AaronFeickert merged commit 3e726e5 into tari-project:main Jan 5, 2024
5 checks passed
@AaronFeickert AaronFeickert deleted the gray branch January 5, 2024 21:44
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.

Consider using Gray coding for indexes
1 participant