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

Remove unused ecMul functions #72

Merged
merged 1 commit into from
Sep 15, 2023
Merged

Conversation

ColoCarletti
Copy link
Member

@ColoCarletti ColoCarletti commented Sep 14, 2023

Close: Issue 63

Remove functions:

  • THREE()
  • P_MINUS_ONE()
  • montgomeryModExp()
  • projectivePointIsOnCurve()

@ColoCarletti ColoCarletti linked an issue Sep 14, 2023 that may be closed by this pull request
@ColoCarletti ColoCarletti changed the title Eemove unused ecmul functions Remove unused ecMul functions Sep 14, 2023
@ilitteri ilitteri merged commit e9bf3f2 into main Sep 15, 2023
@ilitteri ilitteri deleted the remove_unused_ecmu_functionsl branch September 15, 2023 00:47
ilitteri added a commit that referenced this pull request Sep 19, 2023
* document constant functions

* add documentation

* removeunused functions (#72)

* remove_unnecessary_mod (#71)

* implement suggested optimization (#70)

* remove constant funcitons (#73)

* fix point comparison (#74)

* Fix field order naming (#75)

* fix field order naming

* replace GROUP_ORDER for FIELD_ORDER

* Removes_unnecessary_checking_in_ecMul (#78)

* Add tests for points outside the field (#79)

* improves overflowAdd (#80)

* fix typos

* Removes unnecessary handling of a special case on addition. (#77)

* removes unecesary check

* resolve confilct

* improves_binaryExtendedEuclideanAlgorithm (#81)

* Revert "Merge branch 'ecPairing' into ecPairing_documentation"

This reverts commit 86a6e52, reversing
changes made to 5684c15.

* Fix documentation with no utf8 characters

* Delete unused g2 function

* Add TODO comment

---------

Co-authored-by: Nacho Avecilla <nachoavecilla@gmail.com>
Co-authored-by: IAvecilla <iavecilla@fi.uba.ar>
Co-authored-by: Iván Litteri <ilitteri@fi.uba.ar>
ilitteri added a commit that referenced this pull request Sep 21, 2023
* ecadd tests

* ecmul tests

* Add test utils

* Add test suit generator

* Remove old tests

* Update tests

* Fix ecadd

* Fix ecmul

* Handle modexp tests

* Add modexp tests

* Update call helper function

* Fix helper function

* Fix test utils

* Improve ecmul precompile

* Add test helper

* Add python script to test double and add algorithm (#13)

* Add montgomery reduction algorithm

* Add Rust playground crate

* Update montgomery reduction script

* Add Montgomery reduction precompile

* ecAdd refactor

* Montgomery fix

* Add montgomery inv & modexp

* Fix N'

* Fix REDC

* Fix Montgomery modular inverse

* Remove comments

* Fix prints

* Change to bytes comparison instead of decoded output

* Patch tests with extra check for errors in ecadd and ecmul

* Add EOL

* Update modexp precompile

* Finish optimizing ecAdd & ecMul

* Implement optimized montgomery invmod

* modexpGasCost

* Cleanup

* Last version of ecAdd, ecMul & modexp

* Fix modexp tests calldata

* Fix modexp tests to pass with actual vm state

* Update Montgomery precompile

* Rename montgomery lib

* Add alt_bn128 projective point lib

* Add quadratic extension field arithmetic lib

* Add alt_bn128 pairing script

* Finish quadratic extension field arithmetics

Co-authored-by: Nacho Avecilla <nachoavecilla@gmail.com>

* Fix Montgomery lib

Co-authored-by: Nacho Avecilla <nachoavecilla@gmail.com>

* Implement double and addition steps

Co-authored-by: Nacho Avecilla <nachoavecilla@gmail.com>

* Arithmetics over Fp2 in Python (#14)

* Finish fp2 arithmetic

* Add more precomputed values

* Fix fp2 inv

* Add EOF

* Rename module

* Fix point at infinity

* Rename lib

* Arithmetics over Fp6 in Python (#15)

* Finish fp2 arithmetic

* Add more precomputed values

* Add arithmetic operations for fp6

* Update constant name

Co-authored-by: Ivan Litteri <67517699+ilitteri@users.noreply.github.com>

* Replace epsilon for XI

* Change script name

* Add multiplication by xi in fp2 and fp6

* Add alternative inverse method

* Fix inverse operation

---------

Co-authored-by: Iván Litteri <ilitteri@fi.uba.ar>
Co-authored-by: Ivan Litteri <67517699+ilitteri@users.noreply.github.com>

* Fp12 arithmetic (#21)

* WIP

* add fp12 arithmetics

* fix typo

* add addition tests

* add sub test

* rename gamma function

* add mul tests

* fix function call

* fix typo

* mul fixes

* fix mul by 1

* fix square

* fix fp12 inverse

* add multiply by 2 asserts

* add EOF

---------

Co-authored-by: Iván Litteri <ilitteri@fi.uba.ar>

* Add jacobian coordinates in Python (#22)

* Rename file

* Add implementation for jacobian projective coordinates

* Fix fp12 merge error

* Fix addition

* Rename function to check inifinity and add extra comments

* Fp2, Fp6 and Fp12 arithmetics in Yul (#23)

* Add fp2 arithmetics

* Add fp6 arithmetics

* Rename funcs

* Fix compilation errors in fp6 operations

* Add tests for inverse and sub for fp2

* Fix square and multiplication for fp6

* Add tests for add, mul, sub and square in fp6

* add fp12 arithmetic

* Fix inverse in fp6

* Add tests for inverse in fp6

* add fp12 tests

* add inverse test for fp12

* changes mul for sub

---------

Co-authored-by: Iván Litteri <ilitteri@fi.uba.ar>
Co-authored-by: Joaquin Carletti <joaquin.carletti@lambdaclass.com>

* Add point addition and line evaluation algorithm (#24)

* Point doubling and line evaluation (#25)

* Refactor for line evaluation functions (#29)

* Move point doubling and line evaluation to pairing file

* Change return type in point adding and line evaluation to match with doubling

* Remove incorrect parameter

* Change name to match with other pairing function

* add mul by gamma functions (#31)

* Improve fp6 and fp12 arithmetics return type (#35)

* Change fp6 return type to single tuple

* change return to single tuple

---------

Co-authored-by: Joaquin Carletti <joaquin.carletti@lambdaclass.com>

* add millers loop (#30)

* add millers loop basics

* add PI functions to loop

* add neg of a G2 point

* add loop counter

* fix return of negate funciton

* fix loop_counter values

* rename utils file

* fix imports

* change constants to fp6 file

* fix miller loop set up

* add comment

* fix comment

* fix typo

* Add Final exponentiation (#32)

* Add ten in montgomery form as constant

* Add frobenius operations

* Add negate operation for fp6

* Add conjugate operation for fp2

* Add operations in fp2 used in final exponentiation

* Add final exponentiation function

* Fix return types to match with new changes

* Add corrections to n_square function

* Use montgomery for gamma factors and add frobenius tests

* Add test for cyclotomic square

* Add another final exponentiation implementation and test

* fix fp6 arithmetic (#42)

* Precompute Frobenius constants (#44)

* Add pairing tests for python implementation (#36)

* Add function utils to check elements in curve and twisted curve

* Add conditional for g2 from affine

* Add tests for conjugate in fp12 and fp2

* Fix miller loop errors

* Add pair function

* Add pairing test from eth tests

* Correct NAF representation

* Change exponentiation impl to be able to test it correctly

* Correct point doubling and miller loop

* Add test for point doubling and line evaluation

* add addition tests

* Add tests for frobenius

* Add line evaluation test after point addition

* Add point doubling and adding functions for projective coordinates

* Fix in miller loop function

* Add test refactors with new functions

* Fix constant for fp12

* Add functions for g2 in projective and affine

* Fix NAF representation

* add eth tests

* add tests names

* add expt

* change final_exp

* fix fp6 square

* Delete test generator for pairing in python

* Delete unnecesary comments

* Delete unused exponentiation function

* Delete unused import and old todo

* Improve naming of doubling and addition steps in miller loop

---------

Co-authored-by: Joaquin Carletti <joaquin.carletti@lambdaclass.com>

* Frobenius Operator in Yul (#43)

* Implement Frobenius operator in Yul

* Fix Frobenius functions returns

* Fix Frobenius functions returns

* Add tests

* Update comment

* add mix addition in yul (#45)

* Add function utils to check elements in curve and twisted curve

* Add conditional for g2 from affine

* Add tests for conjugate in fp12 and fp2

* Fix miller loop errors

* Add pair function

* Add pairing test from eth tests

* Correct NAF representation

* Change exponentiation impl to be able to test it correctly

* Correct point doubling and miller loop

* Add test for point doubling and line evaluation

* add addition tests

* Add tests for frobenius

* Add line evaluation test after point addition

* Add point doubling and adding functions for projective coordinates

* Fix in miller loop function

* Add test refactors with new functions

* Fix constant for fp12

* Add functions for g2 in projective and affine

* Fix NAF representation

* add eth tests

* add tests names

* add expt

* change final_exp

* fix fp6 square

* Delete test generator for pairing in python

* Delete unnecesary comments

* Delete unused exponentiation function

* Delete unused import and old todo

* Improve naming of doubling and addition steps in miller loop

* add mix addition in yul

* fix function

* Update precompiles/Playground.yul

Co-authored-by: Ivan Litteri <67517699+ilitteri@users.noreply.github.com>

---------

Co-authored-by: IAvecilla <iavecilla@fi.uba.ar>
Co-authored-by: Iván Litteri <ilitteri@fi.uba.ar>
Co-authored-by: Ivan Litteri <67517699+ilitteri@users.noreply.github.com>

* Add cyclotomicSquare and nSquare (#47)

* Add function utils to check elements in curve and twisted curve

* Add conditional for g2 from affine

* Add tests for conjugate in fp12 and fp2

* Fix miller loop errors

* Add pair function

* Add pairing test from eth tests

* Correct NAF representation

* Change exponentiation impl to be able to test it correctly

* Correct point doubling and miller loop

* Add test for point doubling and line evaluation

* add addition tests

* Add tests for frobenius

* Add line evaluation test after point addition

* Add point doubling and adding functions for projective coordinates

* Fix in miller loop function

* Add test refactors with new functions

* Fix constant for fp12

* Add functions for g2 in projective and affine

* Fix NAF representation

* add eth tests

* add tests names

* add expt

* change final_exp

* fix fp6 square

* Delete test generator for pairing in python

* Delete unnecesary comments

* Delete unused exponentiation function

* Delete unused import and old todo

* Improve naming of doubling and addition steps in miller loop

* add cyclotomic square

* fix assignments

* add nSquare

---------

Co-authored-by: IAvecilla <iavecilla@fi.uba.ar>
Co-authored-by: Iván Litteri <ilitteri@fi.uba.ar>

* Add `t` exponentiation for fp12 in Yul (#48)

* Add function utils to check elements in curve and twisted curve

* Add conditional for g2 from affine

* Add tests for conjugate in fp12 and fp2

* Fix miller loop errors

* Add pair function

* Add pairing test from eth tests

* Correct NAF representation

* Change exponentiation impl to be able to test it correctly

* Correct point doubling and miller loop

* Add test for point doubling and line evaluation

* add addition tests

* Add tests for frobenius

* Add line evaluation test after point addition

* Add point doubling and adding functions for projective coordinates

* Fix in miller loop function

* Add test refactors with new functions

* Fix constant for fp12

* Add functions for g2 in projective and affine

* Fix NAF representation

* add eth tests

* add tests names

* add expt

* change final_exp

* fix fp6 square

* Delete test generator for pairing in python

* Delete unnecesary comments

* Delete unused exponentiation function

* Delete unused import and old todo

* Improve naming of doubling and addition steps in miller loop

* Add implementation for exponentiation by t for fp12

---------

Co-authored-by: Joaquin Carletti <joaquin.carletti@lambdaclass.com>
Co-authored-by: Iván Litteri <ilitteri@fi.uba.ar>

* Add final exp in yul (#49)

* Add function utils to check elements in curve and twisted curve

* Add conditional for g2 from affine

* Add tests for conjugate in fp12 and fp2

* Fix miller loop errors

* Add pair function

* Add pairing test from eth tests

* Correct NAF representation

* Change exponentiation impl to be able to test it correctly

* Correct point doubling and miller loop

* Add test for point doubling and line evaluation

* add addition tests

* Add tests for frobenius

* Add line evaluation test after point addition

* Add point doubling and adding functions for projective coordinates

* Fix in miller loop function

* Add test refactors with new functions

* Fix constant for fp12

* Add functions for g2 in projective and affine

* Fix NAF representation

* add eth tests

* add tests names

* add expt

* change final_exp

* fix fp6 square

* Delete test generator for pairing in python

* Delete unnecesary comments

* Delete unused exponentiation function

* Delete unused import and old todo

* Improve naming of doubling and addition steps in miller loop

* add final exponentiation

* Update precompiles/Playground.yul

Co-authored-by: Ivan Litteri <67517699+ilitteri@users.noreply.github.com>

---------

Co-authored-by: IAvecilla <iavecilla@fi.uba.ar>
Co-authored-by: Ivan Litteri <67517699+ilitteri@users.noreply.github.com>

* Point doubling step of the miller loop in Yul (#46)

* Add function utils to check elements in curve and twisted curve

* Add conditional for g2 from affine

* Add tests for conjugate in fp12 and fp2

* Fix miller loop errors

* Add pair function

* Add pairing test from eth tests

* Correct NAF representation

* Change exponentiation impl to be able to test it correctly

* Correct point doubling and miller loop

* Add test for point doubling and line evaluation

* add addition tests

* Add tests for frobenius

* Add line evaluation test after point addition

* Add point doubling and adding functions for projective coordinates

* Fix in miller loop function

* Add test refactors with new functions

* Fix constant for fp12

* Add functions for g2 in projective and affine

* Fix NAF representation

* add eth tests

* add tests names

* add expt

* change final_exp

* fix fp6 square

* Delete test generator for pairing in python

* Delete unnecesary comments

* Delete unused exponentiation function

* Delete unused import and old todo

* Improve naming of doubling and addition steps in miller loop

* Add implementation for point doubling step of the miller loop

* Fix fp2 neg function parameters

* Fix typo in parameters to return

* Add precomputation for inverse of two

---------

Co-authored-by: Joaquin Carletti <joaquin.carletti@lambdaclass.com>

* G2 Twist in Yul (#50)

* Add basic functionality for G2 Twist

* Rename neg to g2Neg

* Rename functions and fix compilation errors

* Miller loop in yul (#52)

* move from playground to ecPairing

* add pair function

* Fix pair check

* Transform calldata into Montgomery form

* Remove console logs

* Add check for points in twisted curve

* Checks for points in group order

* Fix pairing tests to match with L1 response

* Update README.md

* Some refactor

* Start g2 scalar mul implementation

* Fix compilation errors from new g2 operations

* Correct some test assertions

* Clean pairing precompile

* Ec pairing documentation (#68)

* document constant functions

* add documentation

* removeunused functions (#72)

* remove_unnecessary_mod (#71)

* implement suggested optimization (#70)

* remove constant funcitons (#73)

* fix point comparison (#74)

* Fix field order naming (#75)

* fix field order naming

* replace GROUP_ORDER for FIELD_ORDER

* Removes_unnecessary_checking_in_ecMul (#78)

* Add tests for points outside the field (#79)

* improves overflowAdd (#80)

* fix typos

* Removes unnecessary handling of a special case on addition. (#77)

* removes unecesary check

* resolve confilct

* improves_binaryExtendedEuclideanAlgorithm (#81)

* Revert "Merge branch 'ecPairing' into ecPairing_documentation"

This reverts commit 86a6e52, reversing
changes made to 5684c15.

* Fix documentation with no utf8 characters

* Delete unused g2 function

* Add TODO comment

---------

Co-authored-by: Nacho Avecilla <nachoavecilla@gmail.com>
Co-authored-by: IAvecilla <iavecilla@fi.uba.ar>
Co-authored-by: Iván Litteri <ilitteri@fi.uba.ar>

* Apply previous audit fixes (#97)

* Add missing docs (#96)

* Fix ecPairing (#103)

* Add missing docs (#96)

* Apply previous audit fixes (#97)

* Fix `ecPairing` tests (#107)

* Fix tests

* Fix clippy lint

* `ecPairing` refactors & cleanup (#98)

* Refactor g2AffinePointIsOnCurve

* Refactor `g1AffinePointIsOnCurve`

* Refactor `g1AffinePointIsOnCurve`

Use Montgomery Form

* Refactor `g1AffinePointIsInfinity`

Reduce one operation

* Reorder & refactor checks

- g1AffinePointIsInfinity now uses the point coordinates in Montgomery Form
- g1AffinePointIsOnCurve assumes that the point is not the point at infinity

* Remove 8 ops in pair check

* Remove useless constant functions

* Rename snake case function to camel case

* Rename function calls

* Add an explanatory comment

---------

Co-authored-by: Iván Litteri <ilitteri@fi.uba.ar>
Co-authored-by: IAvecilla <iavecilla@fi.uba.ar>
Co-authored-by: Nacho Avecilla <nachoavecilla@gmail.com>
Co-authored-by: Ivan Litteri <67517699+ilitteri@users.noreply.github.com>
ilitteri added a commit that referenced this pull request Oct 27, 2023
* ecadd tests

* ecmul tests

* Add test utils

* Add test suit generator

* Remove old tests

* Update tests

* Fix ecadd

* Fix ecmul

* Handle modexp tests

* Add modexp tests

* Update call helper function

* Fix helper function

* Fix test utils

* Improve ecmul precompile

* Add test helper

* Add python script to test double and add algorithm (#13)

* Add montgomery reduction algorithm

* Add Rust playground crate

* Update montgomery reduction script

* Add Montgomery reduction precompile

* ecAdd refactor

* Montgomery fix

* Add montgomery inv & modexp

* Fix N'

* Fix REDC

* Fix Montgomery modular inverse

* Remove comments

* Fix prints

* Change to bytes comparison instead of decoded output

* Patch tests with extra check for errors in ecadd and ecmul

* Add EOL

* Update modexp precompile

* Finish optimizing ecAdd & ecMul

* Implement optimized montgomery invmod

* modexpGasCost

* Cleanup

* Last version of ecAdd, ecMul & modexp

* Fix modexp tests calldata

* Fix modexp tests to pass with actual vm state

* Update Montgomery precompile

* Rename montgomery lib

* Add alt_bn128 projective point lib

* Add quadratic extension field arithmetic lib

* Add alt_bn128 pairing script

* Finish quadratic extension field arithmetics

Co-authored-by: Nacho Avecilla <nachoavecilla@gmail.com>

* Fix Montgomery lib

Co-authored-by: Nacho Avecilla <nachoavecilla@gmail.com>

* Implement double and addition steps

Co-authored-by: Nacho Avecilla <nachoavecilla@gmail.com>

* Arithmetics over Fp2 in Python (#14)

* Finish fp2 arithmetic

* Add more precomputed values

* Fix fp2 inv

* Add EOF

* Rename module

* Fix point at infinity

* Rename lib

* Arithmetics over Fp6 in Python (#15)

* Finish fp2 arithmetic

* Add more precomputed values

* Add arithmetic operations for fp6

* Update constant name

Co-authored-by: Ivan Litteri <67517699+ilitteri@users.noreply.github.com>

* Replace epsilon for XI

* Change script name

* Add multiplication by xi in fp2 and fp6

* Add alternative inverse method

* Fix inverse operation

---------

Co-authored-by: Iván Litteri <ilitteri@fi.uba.ar>
Co-authored-by: Ivan Litteri <67517699+ilitteri@users.noreply.github.com>

* Fp12 arithmetic (#21)

* WIP

* add fp12 arithmetics

* fix typo

* add addition tests

* add sub test

* rename gamma function

* add mul tests

* fix function call

* fix typo

* mul fixes

* fix mul by 1

* fix square

* fix fp12 inverse

* add multiply by 2 asserts

* add EOF

---------

Co-authored-by: Iván Litteri <ilitteri@fi.uba.ar>

* Add jacobian coordinates in Python (#22)

* Rename file

* Add implementation for jacobian projective coordinates

* Fix fp12 merge error

* Fix addition

* Rename function to check inifinity and add extra comments

* Fp2, Fp6 and Fp12 arithmetics in Yul (#23)

* Add fp2 arithmetics

* Add fp6 arithmetics

* Rename funcs

* Fix compilation errors in fp6 operations

* Add tests for inverse and sub for fp2

* Fix square and multiplication for fp6

* Add tests for add, mul, sub and square in fp6

* add fp12 arithmetic

* Fix inverse in fp6

* Add tests for inverse in fp6

* add fp12 tests

* add inverse test for fp12

* changes mul for sub

---------

Co-authored-by: Iván Litteri <ilitteri@fi.uba.ar>
Co-authored-by: Joaquin Carletti <joaquin.carletti@lambdaclass.com>

* Add point addition and line evaluation algorithm (#24)

* Point doubling and line evaluation (#25)

* Refactor for line evaluation functions (#29)

* Move point doubling and line evaluation to pairing file

* Change return type in point adding and line evaluation to match with doubling

* Remove incorrect parameter

* Change name to match with other pairing function

* add mul by gamma functions (#31)

* Improve fp6 and fp12 arithmetics return type (#35)

* Change fp6 return type to single tuple

* change return to single tuple

---------

Co-authored-by: Joaquin Carletti <joaquin.carletti@lambdaclass.com>

* add millers loop (#30)

* add millers loop basics

* add PI functions to loop

* add neg of a G2 point

* add loop counter

* fix return of negate funciton

* fix loop_counter values

* rename utils file

* fix imports

* change constants to fp6 file

* fix miller loop set up

* add comment

* fix comment

* fix typo

* Add Final exponentiation (#32)

* Add ten in montgomery form as constant

* Add frobenius operations

* Add negate operation for fp6

* Add conjugate operation for fp2

* Add operations in fp2 used in final exponentiation

* Add final exponentiation function

* Fix return types to match with new changes

* Add corrections to n_square function

* Use montgomery for gamma factors and add frobenius tests

* Add test for cyclotomic square

* Add another final exponentiation implementation and test

* fix fp6 arithmetic (#42)

* Precompute Frobenius constants (#44)

* Add pairing tests for python implementation (#36)

* Add function utils to check elements in curve and twisted curve

* Add conditional for g2 from affine

* Add tests for conjugate in fp12 and fp2

* Fix miller loop errors

* Add pair function

* Add pairing test from eth tests

* Correct NAF representation

* Change exponentiation impl to be able to test it correctly

* Correct point doubling and miller loop

* Add test for point doubling and line evaluation

* add addition tests

* Add tests for frobenius

* Add line evaluation test after point addition

* Add point doubling and adding functions for projective coordinates

* Fix in miller loop function

* Add test refactors with new functions

* Fix constant for fp12

* Add functions for g2 in projective and affine

* Fix NAF representation

* add eth tests

* add tests names

* add expt

* change final_exp

* fix fp6 square

* Delete test generator for pairing in python

* Delete unnecesary comments

* Delete unused exponentiation function

* Delete unused import and old todo

* Improve naming of doubling and addition steps in miller loop

---------

Co-authored-by: Joaquin Carletti <joaquin.carletti@lambdaclass.com>

* Frobenius Operator in Yul (#43)

* Implement Frobenius operator in Yul

* Fix Frobenius functions returns

* Fix Frobenius functions returns

* Add tests

* Update comment

* add mix addition in yul (#45)

* Add function utils to check elements in curve and twisted curve

* Add conditional for g2 from affine

* Add tests for conjugate in fp12 and fp2

* Fix miller loop errors

* Add pair function

* Add pairing test from eth tests

* Correct NAF representation

* Change exponentiation impl to be able to test it correctly

* Correct point doubling and miller loop

* Add test for point doubling and line evaluation

* add addition tests

* Add tests for frobenius

* Add line evaluation test after point addition

* Add point doubling and adding functions for projective coordinates

* Fix in miller loop function

* Add test refactors with new functions

* Fix constant for fp12

* Add functions for g2 in projective and affine

* Fix NAF representation

* add eth tests

* add tests names

* add expt

* change final_exp

* fix fp6 square

* Delete test generator for pairing in python

* Delete unnecesary comments

* Delete unused exponentiation function

* Delete unused import and old todo

* Improve naming of doubling and addition steps in miller loop

* add mix addition in yul

* fix function

* Update precompiles/Playground.yul

Co-authored-by: Ivan Litteri <67517699+ilitteri@users.noreply.github.com>

---------

Co-authored-by: IAvecilla <iavecilla@fi.uba.ar>
Co-authored-by: Iván Litteri <ilitteri@fi.uba.ar>
Co-authored-by: Ivan Litteri <67517699+ilitteri@users.noreply.github.com>

* Add cyclotomicSquare and nSquare (#47)

* Add function utils to check elements in curve and twisted curve

* Add conditional for g2 from affine

* Add tests for conjugate in fp12 and fp2

* Fix miller loop errors

* Add pair function

* Add pairing test from eth tests

* Correct NAF representation

* Change exponentiation impl to be able to test it correctly

* Correct point doubling and miller loop

* Add test for point doubling and line evaluation

* add addition tests

* Add tests for frobenius

* Add line evaluation test after point addition

* Add point doubling and adding functions for projective coordinates

* Fix in miller loop function

* Add test refactors with new functions

* Fix constant for fp12

* Add functions for g2 in projective and affine

* Fix NAF representation

* add eth tests

* add tests names

* add expt

* change final_exp

* fix fp6 square

* Delete test generator for pairing in python

* Delete unnecesary comments

* Delete unused exponentiation function

* Delete unused import and old todo

* Improve naming of doubling and addition steps in miller loop

* add cyclotomic square

* fix assignments

* add nSquare

---------

Co-authored-by: IAvecilla <iavecilla@fi.uba.ar>
Co-authored-by: Iván Litteri <ilitteri@fi.uba.ar>

* Add `t` exponentiation for fp12 in Yul (#48)

* Add function utils to check elements in curve and twisted curve

* Add conditional for g2 from affine

* Add tests for conjugate in fp12 and fp2

* Fix miller loop errors

* Add pair function

* Add pairing test from eth tests

* Correct NAF representation

* Change exponentiation impl to be able to test it correctly

* Correct point doubling and miller loop

* Add test for point doubling and line evaluation

* add addition tests

* Add tests for frobenius

* Add line evaluation test after point addition

* Add point doubling and adding functions for projective coordinates

* Fix in miller loop function

* Add test refactors with new functions

* Fix constant for fp12

* Add functions for g2 in projective and affine

* Fix NAF representation

* add eth tests

* add tests names

* add expt

* change final_exp

* fix fp6 square

* Delete test generator for pairing in python

* Delete unnecesary comments

* Delete unused exponentiation function

* Delete unused import and old todo

* Improve naming of doubling and addition steps in miller loop

* Add implementation for exponentiation by t for fp12

---------

Co-authored-by: Joaquin Carletti <joaquin.carletti@lambdaclass.com>
Co-authored-by: Iván Litteri <ilitteri@fi.uba.ar>

* Add final exp in yul (#49)

* Add function utils to check elements in curve and twisted curve

* Add conditional for g2 from affine

* Add tests for conjugate in fp12 and fp2

* Fix miller loop errors

* Add pair function

* Add pairing test from eth tests

* Correct NAF representation

* Change exponentiation impl to be able to test it correctly

* Correct point doubling and miller loop

* Add test for point doubling and line evaluation

* add addition tests

* Add tests for frobenius

* Add line evaluation test after point addition

* Add point doubling and adding functions for projective coordinates

* Fix in miller loop function

* Add test refactors with new functions

* Fix constant for fp12

* Add functions for g2 in projective and affine

* Fix NAF representation

* add eth tests

* add tests names

* add expt

* change final_exp

* fix fp6 square

* Delete test generator for pairing in python

* Delete unnecesary comments

* Delete unused exponentiation function

* Delete unused import and old todo

* Improve naming of doubling and addition steps in miller loop

* add final exponentiation

* Update precompiles/Playground.yul

Co-authored-by: Ivan Litteri <67517699+ilitteri@users.noreply.github.com>

---------

Co-authored-by: IAvecilla <iavecilla@fi.uba.ar>
Co-authored-by: Ivan Litteri <67517699+ilitteri@users.noreply.github.com>

* Point doubling step of the miller loop in Yul (#46)

* Add function utils to check elements in curve and twisted curve

* Add conditional for g2 from affine

* Add tests for conjugate in fp12 and fp2

* Fix miller loop errors

* Add pair function

* Add pairing test from eth tests

* Correct NAF representation

* Change exponentiation impl to be able to test it correctly

* Correct point doubling and miller loop

* Add test for point doubling and line evaluation

* add addition tests

* Add tests for frobenius

* Add line evaluation test after point addition

* Add point doubling and adding functions for projective coordinates

* Fix in miller loop function

* Add test refactors with new functions

* Fix constant for fp12

* Add functions for g2 in projective and affine

* Fix NAF representation

* add eth tests

* add tests names

* add expt

* change final_exp

* fix fp6 square

* Delete test generator for pairing in python

* Delete unnecesary comments

* Delete unused exponentiation function

* Delete unused import and old todo

* Improve naming of doubling and addition steps in miller loop

* Add implementation for point doubling step of the miller loop

* Fix fp2 neg function parameters

* Fix typo in parameters to return

* Add precomputation for inverse of two

---------

Co-authored-by: Joaquin Carletti <joaquin.carletti@lambdaclass.com>

* G2 Twist in Yul (#50)

* Add basic functionality for G2 Twist

* Rename neg to g2Neg

* Rename functions and fix compilation errors

* Miller loop in yul (#52)

* move from playground to ecPairing

* add pair function

* Fix pair check

* Transform calldata into Montgomery form

* Remove console logs

* Add check for points in twisted curve

* Checks for points in group order

* Fix pairing tests to match with L1 response

* Update README.md

* Some refactor

* Start g2 scalar mul implementation

* Fix compilation errors from new g2 operations

* Correct some test assertions

* Clean pairing precompile

* Ec pairing documentation (#68)

* document constant functions

* add documentation

* removeunused functions (#72)

* remove_unnecessary_mod (#71)

* implement suggested optimization (#70)

* remove constant funcitons (#73)

* fix point comparison (#74)

* Fix field order naming (#75)

* fix field order naming

* replace GROUP_ORDER for FIELD_ORDER

* Removes_unnecessary_checking_in_ecMul (#78)

* Add tests for points outside the field (#79)

* improves overflowAdd (#80)

* fix typos

* Removes unnecessary handling of a special case on addition. (#77)

* removes unecesary check

* resolve confilct

* improves_binaryExtendedEuclideanAlgorithm (#81)

* Revert "Merge branch 'ecPairing' into ecPairing_documentation"

This reverts commit 86a6e52, reversing
changes made to 5684c15.

* Fix documentation with no utf8 characters

* Delete unused g2 function

* Add TODO comment

---------

Co-authored-by: Nacho Avecilla <nachoavecilla@gmail.com>
Co-authored-by: IAvecilla <iavecilla@fi.uba.ar>
Co-authored-by: Iván Litteri <ilitteri@fi.uba.ar>

* Add subgroup check for G2 points

* Fix merge errors

* Revert "Merge branch 'main' into ecpairing_subgroup_check"
- For some reason merging main breaks the console_log functionality

This reverts commit b6823fc, reversing
changes made to 93d66fd.

* Fix precompiles with incorrect merge

* Add playground file to test subgroup check

* fix g2Add

* wip

* Clean scalar mul function for g2 points

* wip

* Update add function for g2 points

* Update pairing with new algorithms for g2 operations

* Update docs for new g2 function to check subgroup inclusion

* Update pairing tests with new output from test node

* Fix tests format

* Delete playground file

* Update precompiles with main

* Add docs for helper functions

* Fix typos in docs

Co-authored-by: Ivan Litteri <67517699+ilitteri@users.noreply.github.com>

* Delete unnecesary checks in g2 addition

Co-authored-by: Ivan Litteri <67517699+ilitteri@users.noreply.github.com>

* Delete unnecesary infinity check

---------

Co-authored-by: Iván Litteri <ilitteri@fi.uba.ar>
Co-authored-by: Ivan Litteri <67517699+ilitteri@users.noreply.github.com>
Co-authored-by: Joaquin Carletti <56092489+ColoCarletti@users.noreply.github.com>
Co-authored-by: Joaquin Carletti <joaquin.carletti@lambdaclass.com>
IAvecilla added a commit that referenced this pull request Feb 29, 2024
814ae72 Update subtree with new precompiles
f832eb9 Merge pull request #226 from lambdaclass/fix-subtree
9031cb5 Update subtree
3e5f82a Merge commit '55210e4632566a4f74503d83aed246b7a4e69233' as '.test-node-subtree'
3e386d4 Remove old subtree
16c494e Add ecAddG2 precompile (#211)
787f7fe Add ecAddG2 precompile (#211)
2fdb9d0 Add ecMulG2 precompile (#220)
9469bb6 Add ecMulG2 precompile (#220)
0e8e9e1 Update contracts in subtree (#218)
f5e645b Update contracts in subtree (#218)
5ae9408 Makefile fixes (#217)
d9c5563 Subtree era test node (#215)
73e2469 Subtree era test node (#215)
fc8fe32 Add ignore to test that is stopping the test suite (#213)
9bfb1c3 Improve makefile (#212)
fe92e93 Fix repo setup (#210)
0d6c0f2 update gas_consumption (#206)
52be222 Update docs (#204)
7be1914 Update README.md
80f543f P256verify audit fixes (#200)
d047659 Add verifier integration test (#179)
a7a5ed4 `modexp` big integers arithmetics (#124)
bee001d Add P256Verify tests (#178)
2753d37 Subgroup check for points in `G2` in `ecPairing` (#92)
0e961c2 Update Readme and gas tables (#174)
3067c76 fix projectiveAdd (#173)
9118195 adds shamir´s trick (#172)
710813d Implement strauss shamir trick (#171)
ea7c283 [CI] build precompiles (#165)
23fb8d0 update submodules (#167)
b7d1311 secp256k1VERIFY Precompile (#160)
63f0214 add p256 s input check (#166)
87186ca add r check (#163)
f272068 Update `README.md` (#162)
2da5282 P256VERIFY precompile contract (#55)
228e0e3 Add your own precompiles guide (#152)
b23a364 Replace invalid call to burnGas (#157)
b01b3c1 Optimize first iterations of miller loop (#119)
6347ae1 Add edge case tests for modexp precompile (#109)
dc3a750 Replace addmod/submod with Montgomery counterparts (#145)
a891bb8 Remove unnecessary checks in `ecAdd` (#144)
3044527 Store zero before returning in ecmul trivial cases (#123)
cc25b14 Add documentation for BEE (#120)
6ff795d Add extra checks to fix some edge cases (#118)
062fbcf Document montgomeryAdd and montgomerySub (#116)
f7430f3 Delete precompiles/Montgomery.yul (#101)
f660dca Improve `montgomeryAdd` implementation (#113)
e155896 remove_switch_in_projectiveIntoAffine (#115)
637ea8e Make `modexp` consistent with the other precompiles (#117)
76bef0f ecPairing (#53)
724a49b Replace `burnGas` with `invalid` (#105)
fa1dc58 Apply audit changes to ecAdd (#102)
8173484 Add CI (#18)
95e75d2 improves_binaryExtendedEuclideanAlgorithm (#81)
2c1d38d Removes unnecessary handling of a special case on addition. (#77)
56e342d improves overflowAdd (#80)
f7e551d Add tests for points outside the field (#79)
62cf99f Removes_unnecessary_checking_in_ecMul (#78)
1f1b863 Fix field order naming (#75)
1e2b0e4 fix point comparison (#74)
f203e46 remove constant funcitons (#73)
f376abf implement suggested optimization (#70)
d9bed40 remove_unnecessary_mod (#71)
e9bf3f2 removeunused functions (#72)
cf7fbab Remove Playground.yul (#54)
e2e7e5e Python implementation for bn254 (alt_bn128) pairing (#16)
de71908 Fix format for section separators (#39)
ff93e4d Update precompiles to latest improvements (#38)
b72ee59 Clean code commets and console_log calls on main (#34)
75ac242 Remove playground crate (turned out to be useless) (#28)
8ccbe1d Add basic documentation (#20)
5c2c9f8 Update README.md
e2f7d55 Update README.md (#27)
c52393c Update README.md
281af62 Update README.md
4b90112 Update README.md
fdbcdc3 Update LICENSE (#26)
5d0380a Update README.md
d571657 Setup repo for precompile development (#17)
5b99326 Add Ethereum Execution Tests (#5)
8d1d6ae Update EcAdd.yul
0bff51f Update ModExp.yul
a3b2e1a Update EcMul.yul
87bf237 [Feature] `ecAdd` precompile (#1)
3b1bcfd [Feature] `ecMul` precompile (#2)
f7eae0d [Feature] `modexp` precompile (#3)
bb2b95f update readme
2036029 Update README.md
e50177f Repo cleanup (#4)
aae80c5 cargo init w/ extra steps
fcd4c44 Precompiles scaffolding
fc42e54 Update README.md
50f4b1e Initial commit

git-subtree-dir: .test-node-subtree
git-subtree-split: 814ae72cc5cf1d1842b3ed4ceeb8b78de43baf9c
ColoCarletti added a commit that referenced this pull request Feb 29, 2024
814ae72 Update subtree with new precompiles
f832eb9 Merge pull request #226 from lambdaclass/fix-subtree
9031cb5 Update subtree
3e5f82a Merge commit '55210e4632566a4f74503d83aed246b7a4e69233' as '.test-node-subtree'
3e386d4 Remove old subtree
16c494e Add ecAddG2 precompile (#211)
787f7fe Add ecAddG2 precompile (#211)
2fdb9d0 Add ecMulG2 precompile (#220)
9469bb6 Add ecMulG2 precompile (#220)
0e8e9e1 Update contracts in subtree (#218)
f5e645b Update contracts in subtree (#218)
5ae9408 Makefile fixes (#217)
d9c5563 Subtree era test node (#215)
73e2469 Subtree era test node (#215)
fc8fe32 Add ignore to test that is stopping the test suite (#213)
9bfb1c3 Improve makefile (#212)
fe92e93 Fix repo setup (#210)
0d6c0f2 update gas_consumption (#206)
52be222 Update docs (#204)
7be1914 Update README.md
80f543f P256verify audit fixes (#200)
d047659 Add verifier integration test (#179)
a7a5ed4 `modexp` big integers arithmetics (#124)
bee001d Add P256Verify tests (#178)
2753d37 Subgroup check for points in `G2` in `ecPairing` (#92)
0e961c2 Update Readme and gas tables (#174)
3067c76 fix projectiveAdd (#173)
9118195 adds shamir´s trick (#172)
710813d Implement strauss shamir trick (#171)
ea7c283 [CI] build precompiles (#165)
23fb8d0 update submodules (#167)
b7d1311 secp256k1VERIFY Precompile (#160)
63f0214 add p256 s input check (#166)
87186ca add r check (#163)
f272068 Update `README.md` (#162)
2da5282 P256VERIFY precompile contract (#55)
228e0e3 Add your own precompiles guide (#152)
b23a364 Replace invalid call to burnGas (#157)
b01b3c1 Optimize first iterations of miller loop (#119)
6347ae1 Add edge case tests for modexp precompile (#109)
dc3a750 Replace addmod/submod with Montgomery counterparts (#145)
a891bb8 Remove unnecessary checks in `ecAdd` (#144)
3044527 Store zero before returning in ecmul trivial cases (#123)
cc25b14 Add documentation for BEE (#120)
6ff795d Add extra checks to fix some edge cases (#118)
062fbcf Document montgomeryAdd and montgomerySub (#116)
f7430f3 Delete precompiles/Montgomery.yul (#101)
f660dca Improve `montgomeryAdd` implementation (#113)
e155896 remove_switch_in_projectiveIntoAffine (#115)
637ea8e Make `modexp` consistent with the other precompiles (#117)
76bef0f ecPairing (#53)
724a49b Replace `burnGas` with `invalid` (#105)
fa1dc58 Apply audit changes to ecAdd (#102)
8173484 Add CI (#18)
95e75d2 improves_binaryExtendedEuclideanAlgorithm (#81)
2c1d38d Removes unnecessary handling of a special case on addition. (#77)
56e342d improves overflowAdd (#80)
f7e551d Add tests for points outside the field (#79)
62cf99f Removes_unnecessary_checking_in_ecMul (#78)
1f1b863 Fix field order naming (#75)
1e2b0e4 fix point comparison (#74)
f203e46 remove constant funcitons (#73)
f376abf implement suggested optimization (#70)
d9bed40 remove_unnecessary_mod (#71)
e9bf3f2 removeunused functions (#72)
cf7fbab Remove Playground.yul (#54)
e2e7e5e Python implementation for bn254 (alt_bn128) pairing (#16)
de71908 Fix format for section separators (#39)
ff93e4d Update precompiles to latest improvements (#38)
b72ee59 Clean code commets and console_log calls on main (#34)
75ac242 Remove playground crate (turned out to be useless) (#28)
8ccbe1d Add basic documentation (#20)
5c2c9f8 Update README.md
e2f7d55 Update README.md (#27)
c52393c Update README.md
281af62 Update README.md
4b90112 Update README.md
fdbcdc3 Update LICENSE (#26)
5d0380a Update README.md
d571657 Setup repo for precompile development (#17)
5b99326 Add Ethereum Execution Tests (#5)
8d1d6ae Update EcAdd.yul
0bff51f Update ModExp.yul
a3b2e1a Update EcMul.yul
87bf237 [Feature] `ecAdd` precompile (#1)
3b1bcfd [Feature] `ecMul` precompile (#2)
f7eae0d [Feature] `modexp` precompile (#3)
bb2b95f update readme
2036029 Update README.md
e50177f Repo cleanup (#4)
aae80c5 cargo init w/ extra steps
fcd4c44 Precompiles scaffolding
fc42e54 Update README.md
50f4b1e Initial commit

git-subtree-dir: .test-node-subtree
git-subtree-split: 814ae72cc5cf1d1842b3ed4ceeb8b78de43baf9c
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.

Unused functions in EcMul
2 participants