Closed jayden-sudo closed 11 months ago
Additionally, Why did I submit code in the test path: The current code does not have a code format. In order to make it easier to review the code diffs in the submitted code, I did not format the code. However, for the sake of maintainability, I hope we can unify the style of the formal code (https://github.com/rdubois-crypto/FreshCryptoLib/blob/master/solidity) before making a formal code PR, for example, by using the "solidity.formatter": "forge" plugin. I hope this suggestion can be considered. Thank you.
Those lines seems false:
Please do not modify API, as the function are integrated elsewhere.
Could you use forge environment please ? There are tests vectors not assesed in hardhat (hardhat deprecated now).
got! thanks
With the code equivalent, executing ecZZ_mulmuladd_S_asm reduced gas cost by 3167 gas:
Testing step:
Open the file: /solidity/tests/WebAuthn_hardhat/test/Webauthn.js
Uncomment line 80: let keyPair = ec.keyFromPrivate( "97ddae0f3a25b92268175400149d65d6887b9cefaf28ea2c078e05cdc15a3c01");
Comment lines 82-83.
npx hardhat test | grep gasused
The purpose of using a fixed key is to perform gas tests with deterministic data.
list:
(uint[2] calldata rs,uint[2] calldata Q) -> (uint256 r,uint256 s,uint256 Qx,uint256 Qy)
save 393 gasif (rs[0] == 0 || rs[0] >= n || rs[1] == 0||rs[1]>=n) -> iszero(mul(mul(r, s), and(gt(n, r), gt(n, s))))
save 118 gasUpdate
ecAff_isOnCurve
save 176 gasuint[6] memory -> let pointer := mload(0x40)
save 135 gasif eq(y2,0) -> if iszero(y2)
save 1170 gas... and more