keep-starknet-strange / garaga

State-of-the-art Elliptic Curve operations and SNARKS verification for Cairo & Starknet 🐺.
https://felt.gitbook.io/garaga
MIT License
181 stars 39 forks source link

Implement pure python Hints for inverse functions to prepare for whitelisting #47

Closed feltroidprime closed 1 year ago

feltroidprime commented 1 year ago

Currently, inverse functions in e2 and e12 are using hints for efficient computations. The inverse is computed using the gnark library.

They should be computed in pure python to allow whitelisting of the hints on Starknet. Some possible working code for pure python inversion is available in tests/cairo_programs/libs/

Update the inverse hints in src/bn254/towers/e2.cairo and e12.cairo All protostar tests should pass. Try to make the python hints as clean/succint as possible. It must be self-contained, ie: no imports. Define the function inside the hint.