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

faster is_in_correct_subgroup_assuming_on_curve when cofactor is one #771

Merged
merged 3 commits into from
Feb 2, 2024

Conversation

tess-eract
Copy link
Contributor

@tess-eract tess-eract commented Feb 1, 2024

Description

This is a two-line fix to speed up the function is_in_correct_subgroup_assuming_on_curve for short Weierstrass curve points:
if the cofactor is one, it skips the expensive operation of performing a scalar multiplication by the scalar field's characteristic.

The cofactor is always one when the curve forms part of a cycle, so this is relevant for the curves used for most
recursive SNARKs (e.g. bn254, etc.).

This speeds up operations like CanonicalDeserialize::deserialize_compressed, which can otherwise take a very
long time for large vectors of curve points. It should also reduce the number of constraints needed to allocate
a curve variable.


Before we can merge this PR, please make sure that all the following items have been
checked off. If any of the checklist items are not applicable, please leave them but
write a little note why.

  • Targeted PR against correct branch (master)
  • Linked to GitHub issue with discussion and accepted design OR have an explanation in the PR that describes this work.
  • Wrote unit tests
    • existing test coverage should suffice, since no new functionality is introduced.
  • Updated relevant documentation in the code
  • Added a relevant changelog entry to the Pending section in CHANGELOG.md
  • Re-reviewed Files changed in the GitHub PR explorer

Copy link
Member

@Pratyush Pratyush left a comment

Choose a reason for hiding this comment

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

Looks good! Thanks for the PR!

@tess-eract tess-eract marked this pull request as ready for review February 2, 2024 00:19
@tess-eract tess-eract requested review from a team as code owners February 2, 2024 00:19
@tess-eract tess-eract requested review from z-tech, mmagician, weikengchen and Pratyush and removed request for a team February 2, 2024 00:19
CHANGELOG.md Outdated Show resolved Hide resolved
@Pratyush Pratyush enabled auto-merge February 2, 2024 00:44
@Pratyush Pratyush added this pull request to the merge queue Feb 2, 2024
Merged via the queue into arkworks-rs:master with commit 2a80c54 Feb 2, 2024
37 checks passed
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