lambdaclass / zksync_era_precompiles

Yul precompile library to speedup elliptic curves operations.
Apache License 2.0
51 stars 19 forks source link

No need to initialize `let l00, l01, l10, l11, l20, l21, l30, l31, l40, l41, l50, l51` #246

Closed IAvecilla closed 6 months ago

IAvecilla commented 7 months ago

Context: EcPairing.yul#L1480

Description: l00, l01, l10, l11, l20, l21, l30, l31, l40, l41, l50, l51 are overridden and never read before. We don't have to initialize them.

Recommendation: Initialization of these values can be safety removed.

diff --git a/precompiles/EcPairing.yul b/precompiles/EcPairing.yul
index d9e08c5..96c8b1e 100644
--- a/precompiles/EcPairing.yul
+++ b/precompiles/EcPairing.yul
@@ -1503,7 +1503,7 @@ object "EcPairing" {
                 f000, f001, f010, f011, f020, f021, f100, f101, f110, f111, f120, f121 := FP12_ONE()
                 let naf := NAF_REPRESENTATIVE()
                 let n_iter := 63
-                let l00, l01, l10, l11, l20, l21, l30, l31, l40, l41, l50, l51 := FP12_ONE()
+                let l00, l01, l10, l11, l20, l21, l30, l31, l40, l41, l50, l51

                 // Computes the first iteration of Millers loop outside to avoid unecesariy square
                 // NAF[64] == 0

No GAS savings

zkSync:

Spearbit: