Skip to content
This repository has been archived by the owner on Dec 18, 2023. It is now read-only.

Replace ATE_LOOP_COUNT with its 2-NAF for MNT curves #107

Merged
merged 6 commits into from
Sep 2, 2022

Conversation

mmagician
Copy link
Member

Description

Companion to arkworks-rs/algebra#445


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
  • 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

@@ -28,7 +28,15 @@ impl MNT4Parameters for Parameters {
// ```
const TWIST_COEFF_A: Fq2 = Fq2::new(G1_COEFF_A_NON_RESIDUE, Fq::ZERO);

const ATE_LOOP_COUNT: &'static [u64] = &[993502997770534912, 5071219579242586943, 2027349];
// https://github.com/o1-labs/snarky/blob/9c21ab2bb23874604640740d646a932e813432c3/snarkette/mnt4_80.ml#L88
const ATE_LOOP_COUNT_2: &'static [i8] = &[
Copy link
Member

Choose a reason for hiding this comment

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

Maybe we should make this a const fn? So that we don't have to return arbitrary-looking arrays? (Not that the original constants have much meaning lol)

Copy link
Member Author

Choose a reason for hiding this comment

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

How about attaching a sage script (since there's already a directory with such scripts for most curves)?
I think that if it's documented well where these consts come from, then the current approach is cleaner, especially that this constant is only ever used in its non-adjacent form (after this change).

Copy link
Member Author

Choose a reason for hiding this comment

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

@Pratyush ping here and for the related PR arkworks-rs/algebra#445

@weikengchen weikengchen merged commit 4228924 into arkworks-rs:master Sep 2, 2022
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.

3 participants