@zkasm/zkevm-rom 0.0.1-security → 6.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of @zkasm/zkevm-rom might be problematic. Click here for more details.
- package/.eslintrc.js +33 -0
- package/.github/CODEOWNERS +14 -0
- package/.github/ISSUE_TEMPLATE/bug.yml +38 -0
- package/.github/ISSUE_TEMPLATE/feature.yml +26 -0
- package/.github/ISSUE_TEMPLATE/question.yml +26 -0
- package/.github/workflows/main.yaml +40 -0
- package/LICENSE +636 -0
- package/README.md +23 -5
- package/audits/Hexens_Polygon_zkEVM_PUBLIC_27.02.23.pdf +0 -0
- package/audits/Polygon-zkEVM-Public-v1.1-verichains-19-03-2024.pdf +0 -0
- package/audits/zkEVM-ROM-upgrade-1-Spearbit-30-May.pdf +0 -0
- package/audits/zkEVM-ROM-upgrade-2-Spearbit-21-August.pdf +0 -0
- package/audits/zkEVM-engagement-1-Spearbit-27-March.pdf +0 -0
- package/audits/zkEVM-engagement-2-Spearbit-27-March.pdf +0 -0
- package/audits/zkEVM-engagement-3-Spearbit-6-April.pdf +0 -0
- package/counters/README.md +45 -0
- package/counters/counters-executor.js +80 -0
- package/counters/countersConstants.zkasm +370 -0
- package/counters/endIncludes.zkasm +18 -0
- package/counters/initIncludes.zkasm +2 -0
- package/counters/tests/MLOAD32.zkasm +27 -0
- package/counters/tests/MLOADX.zkasm +30 -0
- package/counters/tests/MSTORE32.zkasm +32 -0
- package/counters/tests/MSTOREX.zkasm +36 -0
- package/counters/tests/SHLarith.zkasm +28 -0
- package/counters/tests/SHLarithBit.zkasm +28 -0
- package/counters/tests/SHRarith.zkasm +28 -0
- package/counters/tests/SHRarithBit.zkasm +28 -0
- package/counters/tests/abs.zkasm +29 -0
- package/counters/tests/addBatchHashByteByByte.zkasm +31 -0
- package/counters/tests/computeGasSendCall.zkasm +30 -0
- package/counters/tests/divArith.zkasm +27 -0
- package/counters/tests/expAD.zkasm +30 -0
- package/counters/tests/getLenBits.zkasm +30 -0
- package/counters/tests/getLenBytes.zkasm +32 -0
- package/counters/tests/isEmptyAccount.zkasm +30 -0
- package/counters/tests/mulARITH.zkasm +28 -0
- package/counters/tests/offsetUtil.zkasm +29 -0
- package/counters/tests/opADDMOD.zkasm +28 -0
- package/counters/tests/opAdd.zkasm +27 -0
- package/counters/tests/opBLOCKHASH.zkasm +28 -0
- package/counters/tests/opCALL.zkasm +41 -0
- package/counters/tests/opCALLCODE.zkasm +41 -0
- package/counters/tests/opCALLDATACOPY.zkasm +28 -0
- package/counters/tests/opCALLDATALOAD.zkasm +27 -0
- package/counters/tests/opCODECOPY.zkasm +28 -0
- package/counters/tests/opCREATE.zkasm +35 -0
- package/counters/tests/opCREATE2.zkasm +35 -0
- package/counters/tests/opDELEGATECALL.zkasm +35 -0
- package/counters/tests/opDIV.zkasm +27 -0
- package/counters/tests/opEXP.zkasm +29 -0
- package/counters/tests/opEXTCODECOPY.zkasm +29 -0
- package/counters/tests/opMOD.zkasm +27 -0
- package/counters/tests/opMUL.zkasm +27 -0
- package/counters/tests/opMULMOD.zkasm +28 -0
- package/counters/tests/opRETURN.zkasm +32 -0
- package/counters/tests/opRETURNDATACOPY.zkasm +29 -0
- package/counters/tests/opREVERT.zkasm +32 -0
- package/counters/tests/opSDIV.zkasm +28 -0
- package/counters/tests/opSHA3.zkasm +28 -0
- package/counters/tests/opSIGNEXTEND.zkasm +27 -0
- package/counters/tests/opSMOD.zkasm +28 -0
- package/counters/tests/opSTATICCALL.zkasm +35 -0
- package/counters/tests/opSUB.zkasm +27 -0
- package/counters/tests/saveMem.zkasm +31 -0
- package/docs/opcode-cost-zk-counters.md +315 -0
- package/docs/usage-ecrecover.md +51 -0
- package/index.js +43 -0
- package/main/block-info.zkasm +204 -0
- package/main/constants.zkasm +145 -0
- package/main/ecrecover/addFpEc.zkasm +31 -0
- package/main/ecrecover/checkSqrtFpEc.zkasm +1558 -0
- package/main/ecrecover/constEc.zkasm +13 -0
- package/main/ecrecover/ecrecover.zkasm +280 -0
- package/main/ecrecover/invFnEc.zkasm +44 -0
- package/main/ecrecover/invFpEc.zkasm +45 -0
- package/main/ecrecover/mulFnEc.zkasm +36 -0
- package/main/ecrecover/mulFpEc.zkasm +36 -0
- package/main/ecrecover/mulPointEc.zkasm +311 -0
- package/main/ecrecover/sqFpEc.zkasm +38 -0
- package/main/ecrecover/sqrtFpEc.zkasm +70 -0
- package/main/end.zkasm +4 -0
- package/main/l2-tx-hash.zkasm +159 -0
- package/main/load-change-l2-block-utils.zkasm +11 -0
- package/main/load-change-l2-block.zkasm +28 -0
- package/main/load-tx-rlp-utils.zkasm +72 -0
- package/main/load-tx-rlp.zkasm +431 -0
- package/main/main.zkasm +237 -0
- package/main/map-opcodes.zkasm +274 -0
- package/main/modexp/array_lib/array_add_AGTB.zkasm +123 -0
- package/main/modexp/array_lib/array_add_short.zkasm +85 -0
- package/main/modexp/array_lib/array_div.zkasm +215 -0
- package/main/modexp/array_lib/array_div_long.zkasm +284 -0
- package/main/modexp/array_lib/array_div_short.zkasm +222 -0
- package/main/modexp/array_lib/array_mul.zkasm +97 -0
- package/main/modexp/array_lib/array_mul_long.zkasm +156 -0
- package/main/modexp/array_lib/array_mul_short.zkasm +127 -0
- package/main/modexp/array_lib/array_square.zkasm +246 -0
- package/main/modexp/array_lib/unused/array_add.zkasm +100 -0
- package/main/modexp/array_lib/unused/array_is_odd.zkasm +23 -0
- package/main/modexp/array_lib/unused/array_is_one.zkasm +33 -0
- package/main/modexp/array_lib/unused/array_is_zero.zkasm +34 -0
- package/main/modexp/array_lib/unused/array_sub_AGTB.zkasm +111 -0
- package/main/modexp/array_lib/unused/array_unshift.zkasm +37 -0
- package/main/modexp/array_lib/utils/array_compare.zkasm +82 -0
- package/main/modexp/array_lib/utils/array_trim.zkasm +49 -0
- package/main/modexp/constants.zkasm +5 -0
- package/main/modexp/modexp.zkasm +296 -0
- package/main/modexp/modexp_utils.zkasm +230 -0
- package/main/opcodes/arithmetic.zkasm +357 -0
- package/main/opcodes/block.zkasm +163 -0
- package/main/opcodes/calldata-returndata-code.zkasm +619 -0
- package/main/opcodes/comparison.zkasm +446 -0
- package/main/opcodes/context-information.zkasm +169 -0
- package/main/opcodes/create-terminate-context.zkasm +1011 -0
- package/main/opcodes/crypto.zkasm +96 -0
- package/main/opcodes/flow-control.zkasm +126 -0
- package/main/opcodes/logs.zkasm +193 -0
- package/main/opcodes/stack-operations.zkasm +658 -0
- package/main/opcodes/storage-memory.zkasm +313 -0
- package/main/pairings/BN254/addPointBN254.zkasm +245 -0
- package/main/pairings/BN254/ecAdd.zkasm +312 -0
- package/main/pairings/BN254/ecMul.zkasm +159 -0
- package/main/pairings/BN254/escalarMulBN254.zkasm +155 -0
- package/main/pairings/BN254/lineDiffPointsBN254.zkasm +83 -0
- package/main/pairings/BN254/lineSamePointsBN254.zkasm +96 -0
- package/main/pairings/FP12BN254/CYCLOFP12BN254/compressFp12BN254.zkasm +49 -0
- package/main/pairings/FP12BN254/CYCLOFP12BN254/decompressFp12BN254.zkasm +236 -0
- package/main/pairings/FP12BN254/CYCLOFP12BN254/expByXCompCycloFp12BN254.zkasm +444 -0
- package/main/pairings/FP12BN254/CYCLOFP12BN254/squareCompCycloFp12BN254.zkasm +212 -0
- package/main/pairings/FP12BN254/CYCLOFP12BN254/squareCycloFp12BN254.zkasm +228 -0
- package/main/pairings/FP12BN254/CYCLOFP12BN254/xBinDecompBN254.zkasm +64 -0
- package/main/pairings/FP12BN254/frob2Fp12BN254.zkasm +80 -0
- package/main/pairings/FP12BN254/frob3Fp12BN254.zkasm +96 -0
- package/main/pairings/FP12BN254/frobFp12BN254.zkasm +96 -0
- package/main/pairings/FP12BN254/inverseFp12BN254.zkasm +289 -0
- package/main/pairings/FP12BN254/mulFp12BN254.zkasm +408 -0
- package/main/pairings/FP12BN254/sparseMulAFp12BN254.zkasm +296 -0
- package/main/pairings/FP12BN254/sparseMulBFp12BN254.zkasm +291 -0
- package/main/pairings/FP12BN254/squareFp12BN254.zkasm +376 -0
- package/main/pairings/FP2BN254/addFp2BN254.zkasm +19 -0
- package/main/pairings/FP2BN254/escalarMulFp2BN254.zkasm +20 -0
- package/main/pairings/FP2BN254/invFp2BN254.zkasm +66 -0
- package/main/pairings/FP2BN254/mulFp2BN254.zkasm +19 -0
- package/main/pairings/FP2BN254/squareFp2BN254.zkasm +21 -0
- package/main/pairings/FP2BN254/subFp2BN254.zkasm +19 -0
- package/main/pairings/FP4BN254/squareFp4BN254.zkasm +76 -0
- package/main/pairings/FP6BN254/addFp6BN254.zkasm +59 -0
- package/main/pairings/FP6BN254/escalarMulFp6BN254.zkasm +51 -0
- package/main/pairings/FP6BN254/inverseFp6BN254.zkasm +208 -0
- package/main/pairings/FP6BN254/mulFp6BN254.zkasm +201 -0
- package/main/pairings/FP6BN254/sparseMulAFp6BN254.zkasm +65 -0
- package/main/pairings/FP6BN254/sparseMulBFp6BN254.zkasm +134 -0
- package/main/pairings/FP6BN254/sparseMulCFp6BN254.zkasm +128 -0
- package/main/pairings/FP6BN254/squareFp6BN254.zkasm +147 -0
- package/main/pairings/FP6BN254/subFp6BN254.zkasm +59 -0
- package/main/pairings/FPBN254/addFpBN254.zkasm +29 -0
- package/main/pairings/FPBN254/invFpBN254.zkasm +55 -0
- package/main/pairings/FPBN254/mulFpBN254.zkasm +29 -0
- package/main/pairings/FPBN254/reduceFpBN254.zkasm +25 -0
- package/main/pairings/FPBN254/squareFpBN254.zkasm +31 -0
- package/main/pairings/FPBN254/subFpBN254.zkasm +36 -0
- package/main/pairings/FRBN254/reduceFrBN254.zkasm +25 -0
- package/main/pairings/constants.zkasm +62 -0
- package/main/pairings/ecPairing.zkasm +244 -0
- package/main/pairings/finalExpBN254.zkasm +2095 -0
- package/main/pairings/halfPairingBN254.zkasm +428 -0
- package/main/pairings/loopLengthBN254.zkasm +75 -0
- package/main/pairings/millerLoopBN254.zkasm +741 -0
- package/main/pairings/pairingBN254.zkasm +481 -0
- package/main/pairings/unused/addFp12BN254.zkasm +130 -0
- package/main/pairings/unused/expByXCycloFp12BN254.zkasm +411 -0
- package/main/pairings/unused/expFp12BN254.zkasm +333 -0
- package/main/pairings/unused/subFp12BN254.zkasm +130 -0
- package/main/pairings/unused/xPseudoBinDecompBN254.zkasm +68 -0
- package/main/pairings/utilsTests/expCycloFp12BN254.zkasm +334 -0
- package/main/precompiled/end.zkasm +42 -0
- package/main/precompiled/identity.zkasm +99 -0
- package/main/precompiled/pre-ecAdd.zkasm +84 -0
- package/main/precompiled/pre-ecMul.zkasm +82 -0
- package/main/precompiled/pre-ecPairing.zkasm +72 -0
- package/main/precompiled/pre-ecrecover.zkasm +71 -0
- package/main/precompiled/pre-modexp.zkasm +367 -0
- package/main/precompiled/pre-sha2-256.zkasm +125 -0
- package/main/precompiled/revert-precompiled.zkasm +25 -0
- package/main/precompiled/selector.zkasm +77 -0
- package/main/process-change-l2-block.zkasm +147 -0
- package/main/process-tx.zkasm +587 -0
- package/main/tables/2-exp.zkasm +260 -0
- package/main/touched.zkasm +118 -0
- package/main/utils.zkasm +2335 -0
- package/main/vars.zkasm +117 -0
- package/package.json +62 -3
- package/test/bytes-length.zkasm +39 -0
- package/test/ecrecover.zkasm +538 -0
- package/test/lt4-test.zkasm +38 -0
- package/test/mstorex.zkasm +191 -0
- package/test/opcalldatacopy.ignore.zkasm +331 -0
- package/test/performance/read-push.zkasm +71 -0
- package/test/read-push.zkasm +304 -0
- package/test/testArrayArith.zkasm +1099 -0
- package/test/testArrayUtils.zkasm +335 -0
- package/test/testCycloFp12ArithBN254.zkasm +548 -0
- package/test/testEcAdd.zkasm +252 -0
- package/test/testEcMul.zkasm +231 -0
- package/test/testEcPairing.zkasm +436 -0
- package/test/testFinalExpBn254.zkasm +139 -0
- package/test/testFp12ArithBN254.zkasm +692 -0
- package/test/testFp2ArithBN254.zkasm +185 -0
- package/test/testFp4ArithBN254.zkasm +128 -0
- package/test/testFp6ArithBN254.zkasm +260 -0
- package/test/testFpArithBN254.zkasm +159 -0
- package/test/testFrArithBN254.zkasm +113 -0
- package/test/testHalfPairingBN254.zkasm +285 -0
- package/test/testModExp.zkasm +586 -0
- package/test/testModExpReturn.zkasm +81 -0
- package/test/testPairingBN254.zkasm +463 -0
- package/test/testPointArithBN254.zkasm +270 -0
- package/test/testSHA256.zkasm +27 -0
- package/test/touched-assert.zkasm +59 -0
- package/test/utils-expAD.zkasm +48 -0
- package/test/utils-getLenBytes.zkasm +36 -0
- package/tools/audit-tools/registry-op-checker.js +71 -0
- package/tools/get-not-used-labels.js +31 -0
- package/tools/helpers/helpers.js +47 -0
- package/tools/modexp-utils/README.md +5 -0
- package/tools/modexp-utils/modexp-test-gen.js +168 -0
- package/tools/modexp-utils/modexp-test-int.sage +37 -0
- package/tools/parallel-testing/checker.sh +6 -0
- package/tools/parallel-testing/gen-parallel-tests.js +78 -0
- package/tools/parallel-testing/parallel-tests-sample/sample.test.js +136 -0
- package/tools/run-tests-zkasm.js +83 -0
@@ -0,0 +1,289 @@
|
|
1
|
+
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
2
|
+
;; POST: The result is in the range [0,BN254_P) because if falls back to FP6 arithmetic
|
3
|
+
;;
|
4
|
+
;; inverseFp12BN254:
|
5
|
+
;; in: (a1 + a2·w) ∈ Fp12, where ai ∈ Fp6
|
6
|
+
;; out: (a1 + a2·w)⁻¹ = (c1 + c2·w) ∈ Fp12, where:
|
7
|
+
;; - c1 = a1·(a1² - a2²·v)⁻¹
|
8
|
+
;; - c2 = -a2·(a1² - a2²·v)⁻¹
|
9
|
+
;;
|
10
|
+
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
11
|
+
|
12
|
+
VAR GLOBAL inverseFp12BN254_a11_x
|
13
|
+
VAR GLOBAL inverseFp12BN254_a11_y
|
14
|
+
VAR GLOBAL inverseFp12BN254_a12_x
|
15
|
+
VAR GLOBAL inverseFp12BN254_a12_y
|
16
|
+
VAR GLOBAL inverseFp12BN254_a13_x
|
17
|
+
VAR GLOBAL inverseFp12BN254_a13_y
|
18
|
+
VAR GLOBAL inverseFp12BN254_a21_x
|
19
|
+
VAR GLOBAL inverseFp12BN254_a21_y
|
20
|
+
VAR GLOBAL inverseFp12BN254_a22_x
|
21
|
+
VAR GLOBAL inverseFp12BN254_a22_y
|
22
|
+
VAR GLOBAL inverseFp12BN254_a23_x
|
23
|
+
VAR GLOBAL inverseFp12BN254_a23_y
|
24
|
+
VAR GLOBAL inverseFp12BN254_c11_x
|
25
|
+
VAR GLOBAL inverseFp12BN254_c11_y
|
26
|
+
VAR GLOBAL inverseFp12BN254_c12_x
|
27
|
+
VAR GLOBAL inverseFp12BN254_c12_y
|
28
|
+
VAR GLOBAL inverseFp12BN254_c13_x
|
29
|
+
VAR GLOBAL inverseFp12BN254_c13_y
|
30
|
+
VAR GLOBAL inverseFp12BN254_c21_x
|
31
|
+
VAR GLOBAL inverseFp12BN254_c21_y
|
32
|
+
VAR GLOBAL inverseFp12BN254_c22_x
|
33
|
+
VAR GLOBAL inverseFp12BN254_c22_y
|
34
|
+
VAR GLOBAL inverseFp12BN254_c23_x
|
35
|
+
VAR GLOBAL inverseFp12BN254_c23_y
|
36
|
+
|
37
|
+
VAR GLOBAL inverseFp12BN254_a1square1_x
|
38
|
+
VAR GLOBAL inverseFp12BN254_a1square1_y
|
39
|
+
VAR GLOBAL inverseFp12BN254_a1square2_x
|
40
|
+
VAR GLOBAL inverseFp12BN254_a1square2_y
|
41
|
+
VAR GLOBAL inverseFp12BN254_a1square3_x
|
42
|
+
VAR GLOBAL inverseFp12BN254_a1square3_y
|
43
|
+
VAR GLOBAL inverseFp12BN254_a2square1_x
|
44
|
+
VAR GLOBAL inverseFp12BN254_a2square1_y
|
45
|
+
VAR GLOBAL inverseFp12BN254_a2square2_x
|
46
|
+
VAR GLOBAL inverseFp12BN254_a2square2_y
|
47
|
+
VAR GLOBAL inverseFp12BN254_a2square3_x
|
48
|
+
VAR GLOBAL inverseFp12BN254_a2square3_y
|
49
|
+
|
50
|
+
VAR GLOBAL inverseFp12BN254_a1sqsubva2sq1_x
|
51
|
+
VAR GLOBAL inverseFp12BN254_a1sqsubva2sq1_y
|
52
|
+
VAR GLOBAL inverseFp12BN254_a1sqsubva2sq2_x
|
53
|
+
VAR GLOBAL inverseFp12BN254_a1sqsubva2sq2_y
|
54
|
+
VAR GLOBAL inverseFp12BN254_a1sqsubva2sq3_x
|
55
|
+
VAR GLOBAL inverseFp12BN254_a1sqsubva2sq3_y
|
56
|
+
VAR GLOBAL inverseFp12BN254_va2square1_x
|
57
|
+
VAR GLOBAL inverseFp12BN254_va2square1_y
|
58
|
+
VAR GLOBAL inverseFp12BN254_va2square2_x
|
59
|
+
VAR GLOBAL inverseFp12BN254_va2square2_y
|
60
|
+
VAR GLOBAL inverseFp12BN254_va2square3_x
|
61
|
+
VAR GLOBAL inverseFp12BN254_va2square3_y
|
62
|
+
|
63
|
+
VAR GLOBAL inverseFp12BN254_final1_x
|
64
|
+
VAR GLOBAL inverseFp12BN254_final1_y
|
65
|
+
VAR GLOBAL inverseFp12BN254_final2_x
|
66
|
+
VAR GLOBAL inverseFp12BN254_final2_y
|
67
|
+
VAR GLOBAL inverseFp12BN254_final3_x
|
68
|
+
VAR GLOBAL inverseFp12BN254_final3_y
|
69
|
+
|
70
|
+
VAR GLOBAL inverseFp12BN254_RR
|
71
|
+
|
72
|
+
inverseFp12BN254:
|
73
|
+
RR :MSTORE(inverseFp12BN254_RR)
|
74
|
+
|
75
|
+
; 1] a1²
|
76
|
+
$ => A :MLOAD(inverseFp12BN254_a11_x)
|
77
|
+
$ => B :MLOAD(inverseFp12BN254_a11_y)
|
78
|
+
A :MSTORE(squareFp6BN254_a1_x)
|
79
|
+
B :MSTORE(squareFp6BN254_a1_y)
|
80
|
+
$ => A :MLOAD(inverseFp12BN254_a12_x)
|
81
|
+
$ => B :MLOAD(inverseFp12BN254_a12_y)
|
82
|
+
A :MSTORE(squareFp6BN254_a2_x)
|
83
|
+
B :MSTORE(squareFp6BN254_a2_y)
|
84
|
+
$ => A :MLOAD(inverseFp12BN254_a13_x)
|
85
|
+
$ => B :MLOAD(inverseFp12BN254_a13_y)
|
86
|
+
A :MSTORE(squareFp6BN254_a3_x)
|
87
|
+
B :MSTORE(squareFp6BN254_a3_y), CALL(squareFp6BN254)
|
88
|
+
$ => A :MLOAD(squareFp6BN254_c1_x)
|
89
|
+
$ => B :MLOAD(squareFp6BN254_c1_y)
|
90
|
+
A :MSTORE(inverseFp12BN254_a1square1_x)
|
91
|
+
B :MSTORE(inverseFp12BN254_a1square1_y)
|
92
|
+
$ => A :MLOAD(squareFp6BN254_c2_x)
|
93
|
+
$ => B :MLOAD(squareFp6BN254_c2_y)
|
94
|
+
A :MSTORE(inverseFp12BN254_a1square2_x)
|
95
|
+
B :MSTORE(inverseFp12BN254_a1square2_y)
|
96
|
+
$ => A :MLOAD(squareFp6BN254_c3_x)
|
97
|
+
$ => B :MLOAD(squareFp6BN254_c3_y)
|
98
|
+
A :MSTORE(inverseFp12BN254_a1square3_x)
|
99
|
+
B :MSTORE(inverseFp12BN254_a1square3_y)
|
100
|
+
|
101
|
+
; 2] a2²
|
102
|
+
$ => A :MLOAD(inverseFp12BN254_a21_x)
|
103
|
+
$ => B :MLOAD(inverseFp12BN254_a21_y)
|
104
|
+
A :MSTORE(squareFp6BN254_a1_x)
|
105
|
+
B :MSTORE(squareFp6BN254_a1_y)
|
106
|
+
$ => A :MLOAD(inverseFp12BN254_a22_x)
|
107
|
+
$ => B :MLOAD(inverseFp12BN254_a22_y)
|
108
|
+
A :MSTORE(squareFp6BN254_a2_x)
|
109
|
+
B :MSTORE(squareFp6BN254_a2_y)
|
110
|
+
$ => A :MLOAD(inverseFp12BN254_a23_x)
|
111
|
+
$ => B :MLOAD(inverseFp12BN254_a23_y)
|
112
|
+
A :MSTORE(squareFp6BN254_a3_x)
|
113
|
+
B :MSTORE(squareFp6BN254_a3_y), CALL(squareFp6BN254)
|
114
|
+
$ => A :MLOAD(squareFp6BN254_c1_x)
|
115
|
+
$ => B :MLOAD(squareFp6BN254_c1_y)
|
116
|
+
A :MSTORE(inverseFp12BN254_a2square1_x)
|
117
|
+
B :MSTORE(inverseFp12BN254_a2square1_y)
|
118
|
+
$ => A :MLOAD(squareFp6BN254_c2_x)
|
119
|
+
$ => B :MLOAD(squareFp6BN254_c2_y)
|
120
|
+
A :MSTORE(inverseFp12BN254_a2square2_x)
|
121
|
+
B :MSTORE(inverseFp12BN254_a2square2_y)
|
122
|
+
$ => A :MLOAD(squareFp6BN254_c3_x)
|
123
|
+
$ => B :MLOAD(squareFp6BN254_c3_y)
|
124
|
+
A :MSTORE(inverseFp12BN254_a2square3_x)
|
125
|
+
B :MSTORE(inverseFp12BN254_a2square3_y)
|
126
|
+
|
127
|
+
; 3] (a1² - v·a2²)⁻¹
|
128
|
+
$ => A :MLOAD(inverseFp12BN254_a2square1_x)
|
129
|
+
$ => B :MLOAD(inverseFp12BN254_a2square1_y)
|
130
|
+
A :MSTORE(sparseMulAFp6BN254_a1_x)
|
131
|
+
B :MSTORE(sparseMulAFp6BN254_a1_y)
|
132
|
+
$ => A :MLOAD(inverseFp12BN254_a2square2_x)
|
133
|
+
$ => B :MLOAD(inverseFp12BN254_a2square2_y)
|
134
|
+
A :MSTORE(sparseMulAFp6BN254_a2_x)
|
135
|
+
B :MSTORE(sparseMulAFp6BN254_a2_y)
|
136
|
+
$ => A :MLOAD(inverseFp12BN254_a2square3_x)
|
137
|
+
$ => B :MLOAD(inverseFp12BN254_a2square3_y)
|
138
|
+
A :MSTORE(sparseMulAFp6BN254_a3_x)
|
139
|
+
B :MSTORE(sparseMulAFp6BN254_a3_y)
|
140
|
+
1n :MSTORE(sparseMulAFp6BN254_b2_x)
|
141
|
+
0n :MSTORE(sparseMulAFp6BN254_b2_y), CALL(sparseMulAFp6BN254)
|
142
|
+
$ => A :MLOAD(sparseMulAFp6BN254_c1_x)
|
143
|
+
$ => B :MLOAD(sparseMulAFp6BN254_c1_y)
|
144
|
+
A :MSTORE(inverseFp12BN254_va2square1_x)
|
145
|
+
B :MSTORE(inverseFp12BN254_va2square1_y)
|
146
|
+
$ => A :MLOAD(sparseMulAFp6BN254_c2_x)
|
147
|
+
$ => B :MLOAD(sparseMulAFp6BN254_c2_y)
|
148
|
+
A :MSTORE(inverseFp12BN254_va2square2_x)
|
149
|
+
B :MSTORE(inverseFp12BN254_va2square2_y)
|
150
|
+
$ => A :MLOAD(sparseMulAFp6BN254_c3_x)
|
151
|
+
$ => B :MLOAD(sparseMulAFp6BN254_c3_y)
|
152
|
+
A :MSTORE(inverseFp12BN254_va2square3_x)
|
153
|
+
B :MSTORE(inverseFp12BN254_va2square3_y)
|
154
|
+
|
155
|
+
$ => A :MLOAD(inverseFp12BN254_a1square1_x)
|
156
|
+
$ => B :MLOAD(inverseFp12BN254_a1square1_y)
|
157
|
+
A :MSTORE(subFp6BN254_a1_x)
|
158
|
+
B :MSTORE(subFp6BN254_a1_y)
|
159
|
+
$ => A :MLOAD(inverseFp12BN254_a1square2_x)
|
160
|
+
$ => B :MLOAD(inverseFp12BN254_a1square2_y)
|
161
|
+
A :MSTORE(subFp6BN254_a2_x)
|
162
|
+
B :MSTORE(subFp6BN254_a2_y)
|
163
|
+
$ => A :MLOAD(inverseFp12BN254_a1square3_x)
|
164
|
+
$ => B :MLOAD(inverseFp12BN254_a1square3_y)
|
165
|
+
A :MSTORE(subFp6BN254_a3_x)
|
166
|
+
B :MSTORE(subFp6BN254_a3_y)
|
167
|
+
$ => A :MLOAD(inverseFp12BN254_va2square1_x)
|
168
|
+
$ => B :MLOAD(inverseFp12BN254_va2square1_y)
|
169
|
+
A :MSTORE(subFp6BN254_b1_x)
|
170
|
+
B :MSTORE(subFp6BN254_b1_y)
|
171
|
+
$ => A :MLOAD(inverseFp12BN254_va2square2_x)
|
172
|
+
$ => B :MLOAD(inverseFp12BN254_va2square2_y)
|
173
|
+
A :MSTORE(subFp6BN254_b2_x)
|
174
|
+
B :MSTORE(subFp6BN254_b2_y)
|
175
|
+
$ => A :MLOAD(inverseFp12BN254_va2square3_x)
|
176
|
+
$ => B :MLOAD(inverseFp12BN254_va2square3_y)
|
177
|
+
A :MSTORE(subFp6BN254_b3_x)
|
178
|
+
B :MSTORE(subFp6BN254_b3_y), CALL(subFp6BN254)
|
179
|
+
$ => A :MLOAD(subFp6BN254_c1_x)
|
180
|
+
$ => B :MLOAD(subFp6BN254_c1_y)
|
181
|
+
A :MSTORE(inverseFp6BN254_a1_x)
|
182
|
+
B :MSTORE(inverseFp6BN254_a1_y)
|
183
|
+
$ => A :MLOAD(subFp6BN254_c2_x)
|
184
|
+
$ => B :MLOAD(subFp6BN254_c2_y)
|
185
|
+
A :MSTORE(inverseFp6BN254_a2_x)
|
186
|
+
B :MSTORE(inverseFp6BN254_a2_y)
|
187
|
+
$ => A :MLOAD(subFp6BN254_c3_x)
|
188
|
+
$ => B :MLOAD(subFp6BN254_c3_y)
|
189
|
+
A :MSTORE(inverseFp6BN254_a3_x)
|
190
|
+
B :MSTORE(inverseFp6BN254_a3_y), CALL(inverseFp6BN254)
|
191
|
+
$ => A :MLOAD(inverseFp6BN254_c1_x)
|
192
|
+
$ => B :MLOAD(inverseFp6BN254_c1_y)
|
193
|
+
A :MSTORE(inverseFp12BN254_final1_x)
|
194
|
+
B :MSTORE(inverseFp12BN254_final1_y)
|
195
|
+
$ => A :MLOAD(inverseFp6BN254_c2_x)
|
196
|
+
$ => B :MLOAD(inverseFp6BN254_c2_y)
|
197
|
+
A :MSTORE(inverseFp12BN254_final2_x)
|
198
|
+
B :MSTORE(inverseFp12BN254_final2_y)
|
199
|
+
$ => A :MLOAD(inverseFp6BN254_c3_x)
|
200
|
+
$ => B :MLOAD(inverseFp6BN254_c3_y)
|
201
|
+
A :MSTORE(inverseFp12BN254_final3_x)
|
202
|
+
B :MSTORE(inverseFp12BN254_final3_y)
|
203
|
+
|
204
|
+
; 4] c1 = a1·(a1² - a2²·v)⁻¹
|
205
|
+
$ => A :MLOAD(inverseFp12BN254_a11_x)
|
206
|
+
$ => B :MLOAD(inverseFp12BN254_a11_y)
|
207
|
+
A :MSTORE(mulFp6BN254_a1_x)
|
208
|
+
B :MSTORE(mulFp6BN254_a1_y)
|
209
|
+
$ => A :MLOAD(inverseFp12BN254_a12_x)
|
210
|
+
$ => B :MLOAD(inverseFp12BN254_a12_y)
|
211
|
+
A :MSTORE(mulFp6BN254_a2_x)
|
212
|
+
B :MSTORE(mulFp6BN254_a2_y)
|
213
|
+
$ => A :MLOAD(inverseFp12BN254_a13_x)
|
214
|
+
$ => B :MLOAD(inverseFp12BN254_a13_y)
|
215
|
+
A :MSTORE(mulFp6BN254_a3_x)
|
216
|
+
B :MSTORE(mulFp6BN254_a3_y)
|
217
|
+
$ => A :MLOAD(inverseFp12BN254_final1_x)
|
218
|
+
$ => B :MLOAD(inverseFp12BN254_final1_y)
|
219
|
+
A :MSTORE(mulFp6BN254_b1_x)
|
220
|
+
B :MSTORE(mulFp6BN254_b1_y)
|
221
|
+
$ => A :MLOAD(inverseFp12BN254_final2_x)
|
222
|
+
$ => B :MLOAD(inverseFp12BN254_final2_y)
|
223
|
+
A :MSTORE(mulFp6BN254_b2_x)
|
224
|
+
B :MSTORE(mulFp6BN254_b2_y)
|
225
|
+
$ => A :MLOAD(inverseFp12BN254_final3_x)
|
226
|
+
$ => B :MLOAD(inverseFp12BN254_final3_y)
|
227
|
+
A :MSTORE(mulFp6BN254_b3_x)
|
228
|
+
B :MSTORE(mulFp6BN254_b3_y), CALL(mulFp6BN254)
|
229
|
+
$ => A :MLOAD(mulFp6BN254_c1_x)
|
230
|
+
$ => B :MLOAD(mulFp6BN254_c1_y)
|
231
|
+
A :MSTORE(inverseFp12BN254_c11_x)
|
232
|
+
B :MSTORE(inverseFp12BN254_c11_y)
|
233
|
+
$ => A :MLOAD(mulFp6BN254_c2_x)
|
234
|
+
$ => B :MLOAD(mulFp6BN254_c2_y)
|
235
|
+
A :MSTORE(inverseFp12BN254_c12_x)
|
236
|
+
B :MSTORE(inverseFp12BN254_c12_y)
|
237
|
+
$ => A :MLOAD(mulFp6BN254_c3_x)
|
238
|
+
$ => B :MLOAD(mulFp6BN254_c3_y)
|
239
|
+
A :MSTORE(inverseFp12BN254_c13_x)
|
240
|
+
B :MSTORE(inverseFp12BN254_c13_y)
|
241
|
+
|
242
|
+
; 4] c2 = -a2·(a1² - a2²·v)⁻¹
|
243
|
+
%BN254_P => A
|
244
|
+
$ => B :MLOAD(inverseFp12BN254_a21_x)
|
245
|
+
$ :SUB, MSTORE(mulFp6BN254_a1_x)
|
246
|
+
%BN254_P => A
|
247
|
+
$ => B :MLOAD(inverseFp12BN254_a21_y)
|
248
|
+
$ :SUB, MSTORE(mulFp6BN254_a1_y)
|
249
|
+
%BN254_P => A
|
250
|
+
$ => B :MLOAD(inverseFp12BN254_a22_x)
|
251
|
+
$ :SUB, MSTORE(mulFp6BN254_a2_x)
|
252
|
+
%BN254_P => A
|
253
|
+
$ => B :MLOAD(inverseFp12BN254_a22_y)
|
254
|
+
$ :SUB, MSTORE(mulFp6BN254_a2_y)
|
255
|
+
%BN254_P => A
|
256
|
+
$ => B :MLOAD(inverseFp12BN254_a23_x)
|
257
|
+
$ :SUB, MSTORE(mulFp6BN254_a3_x)
|
258
|
+
%BN254_P => A
|
259
|
+
$ => B :MLOAD(inverseFp12BN254_a23_y)
|
260
|
+
$ :SUB, MSTORE(mulFp6BN254_a3_y)
|
261
|
+
|
262
|
+
$ => A :MLOAD(inverseFp12BN254_final1_x)
|
263
|
+
$ => B :MLOAD(inverseFp12BN254_final1_y)
|
264
|
+
A :MSTORE(mulFp6BN254_b1_x)
|
265
|
+
B :MSTORE(mulFp6BN254_b1_y)
|
266
|
+
$ => A :MLOAD(inverseFp12BN254_final2_x)
|
267
|
+
$ => B :MLOAD(inverseFp12BN254_final2_y)
|
268
|
+
A :MSTORE(mulFp6BN254_b2_x)
|
269
|
+
B :MSTORE(mulFp6BN254_b2_y)
|
270
|
+
$ => A :MLOAD(inverseFp12BN254_final3_x)
|
271
|
+
$ => B :MLOAD(inverseFp12BN254_final3_y)
|
272
|
+
A :MSTORE(mulFp6BN254_b3_x)
|
273
|
+
B :MSTORE(mulFp6BN254_b3_y), CALL(mulFp6BN254)
|
274
|
+
$ => A :MLOAD(mulFp6BN254_c1_x)
|
275
|
+
$ => B :MLOAD(mulFp6BN254_c1_y)
|
276
|
+
A :MSTORE(inverseFp12BN254_c21_x)
|
277
|
+
B :MSTORE(inverseFp12BN254_c21_y)
|
278
|
+
$ => A :MLOAD(mulFp6BN254_c2_x)
|
279
|
+
$ => B :MLOAD(mulFp6BN254_c2_y)
|
280
|
+
A :MSTORE(inverseFp12BN254_c22_x)
|
281
|
+
B :MSTORE(inverseFp12BN254_c22_y)
|
282
|
+
$ => A :MLOAD(mulFp6BN254_c3_x)
|
283
|
+
$ => B :MLOAD(mulFp6BN254_c3_y)
|
284
|
+
A :MSTORE(inverseFp12BN254_c23_x)
|
285
|
+
B :MSTORE(inverseFp12BN254_c23_y)
|
286
|
+
|
287
|
+
|
288
|
+
$ => RR :MLOAD(inverseFp12BN254_RR)
|
289
|
+
:RETURN
|