rdubois-crypto / FreshCryptoLib

Cryptographic Primitives for Blockchain Systems (solidity, cairo, C and rust)
MIT License
124 stars 22 forks source link

Reduced gas cost #10

Closed jayden-sudo closed 11 months ago

jayden-sudo commented 11 months ago

With the code equivalent, executing ecZZ_mulmuladd_S_asm reduced gas cost by 811 gas:

Gas
Before 208444 gas
After 207633 gas
rdubois-crypto commented 11 months ago

Thx for the PR, beware that hardhat environment is not maintained (and there is a code duplication with the /FCL/solidity directory).

jayden-sudo commented 11 months ago

Thank you! The goal of this project is to reduce gas consumption while ensuring security. I simply identified some potential gas reduction opportunities in the code and submitted them to the test cases (rather than the formal code). I would like to confirm your thoughts on whether similar optimizations make sense, as I plan to submit PRs with some conventional code optimizations in the coming days.

Also, thanks for your work on P-256!

By the way, we are already trying to use this code to build a test version of the wallet! Link to PR