@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,35 @@
|
|
1
|
+
INCLUDE "../initIncludes.zkasm"
|
2
|
+
|
3
|
+
start:
|
4
|
+
1000000 => GAS
|
5
|
+
|
6
|
+
operation:
|
7
|
+
1 => CTX
|
8
|
+
50 :MSTORE(storageAddr)
|
9
|
+
50 => A
|
10
|
+
0 => B, C
|
11
|
+
10000 => D
|
12
|
+
$ => SR :SSTORE
|
13
|
+
43 :MSTORE(SP++)
|
14
|
+
54 :MSTORE(SP++)
|
15
|
+
1000 :MSTORE(SP++)
|
16
|
+
:JMP(opCREATE)
|
17
|
+
checkCounters:
|
18
|
+
%OPCREATE_STEP - STEP:JMPN(failedCounters)
|
19
|
+
%OPCREATE_CNT_BINARY - CNT_BINARY :JMPNZ(failedCounters)
|
20
|
+
%OPCREATE_CNT_ARITH - CNT_ARITH :JMPNZ(failedCounters)
|
21
|
+
%OPCREATE_CNT_KECCAK_F - CNT_KECCAK_F :JMPNZ(failedCounters)
|
22
|
+
%OPCREATE_CNT_MEM_ALIGN - CNT_MEM_ALIGN :JMPNZ(failedCounters)
|
23
|
+
%OPCREATE_CNT_PADDING_PG - CNT_PADDING_PG :JMPNZ(failedCounters)
|
24
|
+
%OPCREATE_CNT_POSEIDON_G - CNT_POSEIDON_G :JMPNZ(failedCounters)
|
25
|
+
|
26
|
+
0 => A,B,C,D,E,CTX, SP, PC, GAS, SR, HASHPOS, RR ; Set all registers to 0
|
27
|
+
finalizeExecution:
|
28
|
+
:JMP(finalWait)
|
29
|
+
readCode:
|
30
|
+
txType:
|
31
|
+
:JMP(checkCounters)
|
32
|
+
failedCounters:
|
33
|
+
2 => A
|
34
|
+
1 :ASSERT
|
35
|
+
INCLUDE "../endIncludes.zkasm"
|
@@ -0,0 +1,35 @@
|
|
1
|
+
INCLUDE "../initIncludes.zkasm"
|
2
|
+
|
3
|
+
start:
|
4
|
+
1000000 => GAS
|
5
|
+
|
6
|
+
operation:
|
7
|
+
1 => CTX
|
8
|
+
50 :MSTORE(storageAddr)
|
9
|
+
50 => A
|
10
|
+
0 => B, C
|
11
|
+
10000 => D
|
12
|
+
$ => SR :SSTORE
|
13
|
+
43 :MSTORE(SP++)
|
14
|
+
54 :MSTORE(SP++)
|
15
|
+
1000 :MSTORE(SP++)
|
16
|
+
:JMP(opCREATE2)
|
17
|
+
checkCounters:
|
18
|
+
%OPCREATE2_STEP - STEP:JMPN(failedCounters)
|
19
|
+
%OPCREATE2_CNT_BINARY - CNT_BINARY :JMPNZ(failedCounters)
|
20
|
+
%OPCREATE2_CNT_ARITH - CNT_ARITH :JMPNZ(failedCounters)
|
21
|
+
%OPCREATE2_CNT_KECCAK_F - CNT_KECCAK_F :JMPNZ(failedCounters)
|
22
|
+
%OPCREATE2_CNT_MEM_ALIGN - CNT_MEM_ALIGN :JMPNZ(failedCounters)
|
23
|
+
%OPCREATE2_CNT_PADDING_PG - CNT_PADDING_PG :JMPNZ(failedCounters)
|
24
|
+
%OPCREATE2_CNT_POSEIDON_G - CNT_POSEIDON_G :JMPNZ(failedCounters)
|
25
|
+
|
26
|
+
0 => A,B,C,D,E,CTX, SP, PC, GAS, SR, HASHPOS, RR ; Set all registers to 0
|
27
|
+
finalizeExecution:
|
28
|
+
:JMP(finalWait)
|
29
|
+
readCode:
|
30
|
+
txType:
|
31
|
+
:JMP(checkCounters)
|
32
|
+
failedCounters:
|
33
|
+
2 => A
|
34
|
+
1 :ASSERT
|
35
|
+
INCLUDE "../endIncludes.zkasm"
|
@@ -0,0 +1,35 @@
|
|
1
|
+
INCLUDE "../initIncludes.zkasm"
|
2
|
+
|
3
|
+
start:
|
4
|
+
1000000 => GAS
|
5
|
+
|
6
|
+
operation:
|
7
|
+
1 => CTX
|
8
|
+
; stack input: [gas, address, argsOffset, argsSize, retOffset, retSize]
|
9
|
+
; stack output: [success]
|
10
|
+
1000 :MSTORE(SP++)
|
11
|
+
43 :MSTORE(SP++)
|
12
|
+
54 :MSTORE(SP++)
|
13
|
+
8 :MSTORE(SP++)
|
14
|
+
100 :MSTORE(SP++)
|
15
|
+
1000 :MSTORE(SP++)
|
16
|
+
:JMP(opDELEGATECALL)
|
17
|
+
checkCounters:
|
18
|
+
%OPDELEGATECALL_STEP - STEP:JMPN(failedCounters)
|
19
|
+
%OPDELEGATECALL_CNT_BINARY - CNT_BINARY :JMPNZ(failedCounters)
|
20
|
+
%OPDELEGATECALL_CNT_ARITH - CNT_ARITH :JMPNZ(failedCounters)
|
21
|
+
%OPDELEGATECALL_CNT_KECCAK_F - CNT_KECCAK_F :JMPNZ(failedCounters)
|
22
|
+
%OPDELEGATECALL_CNT_MEM_ALIGN - CNT_MEM_ALIGN :JMPNZ(failedCounters)
|
23
|
+
%OPDELEGATECALL_CNT_PADDING_PG - CNT_PADDING_PG :JMPNZ(failedCounters)
|
24
|
+
%OPDELEGATECALL_CNT_POSEIDON_G - CNT_POSEIDON_G :JMPNZ(failedCounters)
|
25
|
+
|
26
|
+
0 => A,B,C,D,E,CTX, SP, PC, GAS, SR, HASHPOS, RR ; Set all registers to 0
|
27
|
+
finalizeExecution:
|
28
|
+
:JMP(finalWait)
|
29
|
+
readCode:
|
30
|
+
txType:
|
31
|
+
:JMP(checkCounters)
|
32
|
+
failedCounters:
|
33
|
+
2 => A
|
34
|
+
1 :ASSERT
|
35
|
+
INCLUDE "../endIncludes.zkasm"
|
@@ -0,0 +1,27 @@
|
|
1
|
+
INCLUDE "../initIncludes.zkasm"
|
2
|
+
|
3
|
+
start:
|
4
|
+
1000000 => GAS
|
5
|
+
|
6
|
+
operation:
|
7
|
+
2 :MSTORE(SP++)
|
8
|
+
10 :MSTORE(SP++)
|
9
|
+
:JMP(opDIV)
|
10
|
+
checkCounters:
|
11
|
+
%OPDIV_STEP - STEP:JMPN(failedCounters)
|
12
|
+
%OPDIV_CNT_BINARY - CNT_BINARY :JMPNZ(failedCounters)
|
13
|
+
%OPDIV_CNT_ARITH - CNT_ARITH :JMPNZ(failedCounters)
|
14
|
+
%OPDIV_CNT_KECCAK_F - CNT_KECCAK_F :JMPNZ(failedCounters)
|
15
|
+
%OPDIV_CNT_MEM_ALIGN - CNT_MEM_ALIGN :JMPNZ(failedCounters)
|
16
|
+
%OPDIV_CNT_PADDING_PG - CNT_PADDING_PG :JMPNZ(failedCounters)
|
17
|
+
%OPDIV_CNT_POSEIDON_G - CNT_POSEIDON_G :JMPNZ(failedCounters)
|
18
|
+
|
19
|
+
0 => A,B,C,D,E,CTX, SP, PC, GAS, SR, HASHPOS, RR ; Set all registers to 0
|
20
|
+
finalizeExecution:
|
21
|
+
:JMP(finalWait)
|
22
|
+
readCode:
|
23
|
+
:JMP(checkCounters)
|
24
|
+
failedCounters:
|
25
|
+
2 => A
|
26
|
+
1 :ASSERT
|
27
|
+
INCLUDE "../endIncludes.zkasm"
|
@@ -0,0 +1,29 @@
|
|
1
|
+
INCLUDE "../initIncludes.zkasm"
|
2
|
+
|
3
|
+
start:
|
4
|
+
1000000 => GAS
|
5
|
+
|
6
|
+
operation:
|
7
|
+
2 :MSTORE(SP++)
|
8
|
+
2 :MSTORE(SP++)
|
9
|
+
:JMP(opEXP)
|
10
|
+
checkCounters:
|
11
|
+
400 - STEP:JMPN(failedCounters)
|
12
|
+
29 - CNT_BINARY :JMPNZ(failedCounters)
|
13
|
+
;%OPEXP_CNT_BINARY - CNT_BINARY :JMPNZ(failedCounters)
|
14
|
+
6 - CNT_ARITH :JMPNZ(failedCounters)
|
15
|
+
;%OPEXP_CNT_ARITH - CNT_ARITH :JMPNZ(failedCounters)
|
16
|
+
%OPEXP_CNT_KECCAK_F - CNT_KECCAK_F :JMPNZ(failedCounters)
|
17
|
+
%OPEXP_CNT_MEM_ALIGN - CNT_MEM_ALIGN :JMPNZ(failedCounters)
|
18
|
+
%OPEXP_CNT_PADDING_PG - CNT_PADDING_PG :JMPNZ(failedCounters)
|
19
|
+
%OPEXP_CNT_POSEIDON_G - CNT_POSEIDON_G :JMPNZ(failedCounters)
|
20
|
+
|
21
|
+
0 => A,B,C,D,E,CTX, SP, PC, GAS, SR, HASHPOS, RR ; Set all registers to 0
|
22
|
+
finalizeExecution:
|
23
|
+
:JMP(finalWait)
|
24
|
+
readCode:
|
25
|
+
:JMP(checkCounters)
|
26
|
+
failedCounters:
|
27
|
+
2 => A
|
28
|
+
1 :ASSERT
|
29
|
+
INCLUDE "../endIncludes.zkasm"
|
@@ -0,0 +1,29 @@
|
|
1
|
+
INCLUDE "../initIncludes.zkasm"
|
2
|
+
|
3
|
+
start:
|
4
|
+
1000000 => GAS
|
5
|
+
|
6
|
+
operation:
|
7
|
+
43 :MSTORE(SP++)
|
8
|
+
54 :MSTORE(SP++)
|
9
|
+
432543 :MSTORE(SP++)
|
10
|
+
43 :MSTORE(SP++)
|
11
|
+
:JMP(opEXTCODECOPY)
|
12
|
+
checkCounters:
|
13
|
+
%OPEXTCODECOPY_STEP - STEP:JMPN(failedCounters)
|
14
|
+
%OPEXTCODECOPY_CNT_BINARY - CNT_BINARY :JMPNZ(failedCounters)
|
15
|
+
%OPEXTCODECOPY_CNT_ARITH - CNT_ARITH :JMPNZ(failedCounters)
|
16
|
+
%OPEXTCODECOPY_CNT_KECCAK_F - CNT_KECCAK_F :JMPNZ(failedCounters)
|
17
|
+
%OPEXTCODECOPY_CNT_MEM_ALIGN - CNT_MEM_ALIGN :JMPNZ(failedCounters)
|
18
|
+
%OPEXTCODECOPY_CNT_PADDING_PG - CNT_PADDING_PG :JMPNZ(failedCounters)
|
19
|
+
%OPEXTCODECOPY_CNT_POSEIDON_G - CNT_POSEIDON_G :JMPNZ(failedCounters)
|
20
|
+
|
21
|
+
0 => A,B,C,D,E,CTX, SP, PC, GAS, SR, HASHPOS, RR ; Set all registers to 0
|
22
|
+
finalizeExecution:
|
23
|
+
:JMP(finalWait)
|
24
|
+
readCode:
|
25
|
+
:JMP(checkCounters)
|
26
|
+
failedCounters:
|
27
|
+
2 => A
|
28
|
+
1 :ASSERT
|
29
|
+
INCLUDE "../endIncludes.zkasm"
|
@@ -0,0 +1,27 @@
|
|
1
|
+
INCLUDE "../initIncludes.zkasm"
|
2
|
+
|
3
|
+
start:
|
4
|
+
1000000 => GAS
|
5
|
+
|
6
|
+
operation:
|
7
|
+
2 :MSTORE(SP++)
|
8
|
+
10 :MSTORE(SP++)
|
9
|
+
:JMP(opMOD)
|
10
|
+
checkCounters:
|
11
|
+
%OPMOD_STEP - STEP:JMPN(failedCounters)
|
12
|
+
%OPMOD_CNT_BINARY - CNT_BINARY :JMPNZ(failedCounters)
|
13
|
+
%OPMOD_CNT_ARITH - CNT_ARITH :JMPNZ(failedCounters)
|
14
|
+
%OPMOD_CNT_KECCAK_F - CNT_KECCAK_F :JMPNZ(failedCounters)
|
15
|
+
%OPMOD_CNT_MEM_ALIGN - CNT_MEM_ALIGN :JMPNZ(failedCounters)
|
16
|
+
%OPMOD_CNT_PADDING_PG - CNT_PADDING_PG :JMPNZ(failedCounters)
|
17
|
+
%OPMOD_CNT_POSEIDON_G - CNT_POSEIDON_G :JMPNZ(failedCounters)
|
18
|
+
|
19
|
+
0 => A,B,C,D,E,CTX, SP, PC, GAS, SR, HASHPOS, RR ; Set all registers to 0
|
20
|
+
finalizeExecution:
|
21
|
+
:JMP(finalWait)
|
22
|
+
readCode:
|
23
|
+
:JMP(checkCounters)
|
24
|
+
failedCounters:
|
25
|
+
2 => A
|
26
|
+
1 :ASSERT
|
27
|
+
INCLUDE "../endIncludes.zkasm"
|
@@ -0,0 +1,27 @@
|
|
1
|
+
INCLUDE "../initIncludes.zkasm"
|
2
|
+
|
3
|
+
start:
|
4
|
+
1000000 => GAS
|
5
|
+
|
6
|
+
operation:
|
7
|
+
2 :MSTORE(SP++)
|
8
|
+
2 :MSTORE(SP++)
|
9
|
+
:JMP(opMUL)
|
10
|
+
checkCounters:
|
11
|
+
%OPMUL_STEP - STEP:JMPN(failedCounters)
|
12
|
+
%OPMUL_CNT_BINARY - CNT_BINARY :JMPNZ(failedCounters)
|
13
|
+
%OPMUL_CNT_ARITH - CNT_ARITH :JMPNZ(failedCounters)
|
14
|
+
%OPMUL_CNT_KECCAK_F - CNT_KECCAK_F :JMPNZ(failedCounters)
|
15
|
+
%OPMUL_CNT_MEM_ALIGN - CNT_MEM_ALIGN :JMPNZ(failedCounters)
|
16
|
+
%OPMUL_CNT_PADDING_PG - CNT_PADDING_PG :JMPNZ(failedCounters)
|
17
|
+
%OPMUL_CNT_POSEIDON_G - CNT_POSEIDON_G :JMPNZ(failedCounters)
|
18
|
+
|
19
|
+
0 => A,B,C,D,E,CTX, SP, PC, GAS, SR, HASHPOS, RR ; Set all registers to 0
|
20
|
+
finalizeExecution:
|
21
|
+
:JMP(finalWait)
|
22
|
+
readCode:
|
23
|
+
:JMP(checkCounters)
|
24
|
+
failedCounters:
|
25
|
+
2 => A
|
26
|
+
1 :ASSERT
|
27
|
+
INCLUDE "../endIncludes.zkasm"
|
@@ -0,0 +1,28 @@
|
|
1
|
+
INCLUDE "../initIncludes.zkasm"
|
2
|
+
|
3
|
+
start:
|
4
|
+
1000000 => GAS
|
5
|
+
|
6
|
+
operation:
|
7
|
+
10 :MSTORE(SP++)
|
8
|
+
0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFn :MSTORE(SP++)
|
9
|
+
0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFn :MSTORE(SP++)
|
10
|
+
:JMP(opMULMOD)
|
11
|
+
checkCounters:
|
12
|
+
%OPMULMOD_STEP - STEP:JMPN(failedCounters)
|
13
|
+
%OPMULMOD_CNT_BINARY - CNT_BINARY :JMPNZ(failedCounters)
|
14
|
+
%OPMULMOD_CNT_ARITH - CNT_ARITH :JMPNZ(failedCounters)
|
15
|
+
%OPMULMOD_CNT_KECCAK_F - CNT_KECCAK_F :JMPNZ(failedCounters)
|
16
|
+
%OPMULMOD_CNT_MEM_ALIGN - CNT_MEM_ALIGN :JMPNZ(failedCounters)
|
17
|
+
%OPMULMOD_CNT_PADDING_PG - CNT_PADDING_PG :JMPNZ(failedCounters)
|
18
|
+
%OPMULMOD_CNT_POSEIDON_G - CNT_POSEIDON_G :JMPNZ(failedCounters)
|
19
|
+
|
20
|
+
0 => A,B,C,D,E,CTX, SP, PC, GAS, SR, HASHPOS, RR ; Set all registers to 0
|
21
|
+
finalizeExecution:
|
22
|
+
:JMP(finalWait)
|
23
|
+
readCode:
|
24
|
+
:JMP(checkCounters)
|
25
|
+
failedCounters:
|
26
|
+
2 => A
|
27
|
+
1 :ASSERT
|
28
|
+
INCLUDE "../endIncludes.zkasm"
|
@@ -0,0 +1,32 @@
|
|
1
|
+
INCLUDE "../initIncludes.zkasm"
|
2
|
+
|
3
|
+
start:
|
4
|
+
1000000 => GAS
|
5
|
+
|
6
|
+
operation:
|
7
|
+
2 => CTX
|
8
|
+
1 :MSTORE(originCTX)
|
9
|
+
2 :MSTORE(currentCTX)
|
10
|
+
10000 :MSTORE(retCallLength)
|
11
|
+
100 :MSTORE(SP++)
|
12
|
+
1000 :MSTORE(SP++)
|
13
|
+
:JMP(opRETURN)
|
14
|
+
checkCounters:
|
15
|
+
%OPRETURN_STEP - STEP:JMPN(failedCounters)
|
16
|
+
%OPRETURN_CNT_BINARY - CNT_BINARY :JMPNZ(failedCounters)
|
17
|
+
%OPRETURN_CNT_ARITH - CNT_ARITH :JMPNZ(failedCounters)
|
18
|
+
%OPRETURN_CNT_KECCAK_F - CNT_KECCAK_F :JMPNZ(failedCounters)
|
19
|
+
%OPRETURN_CNT_MEM_ALIGN - CNT_MEM_ALIGN :JMPNZ(failedCounters)
|
20
|
+
%OPRETURN_CNT_PADDING_PG - CNT_PADDING_PG :JMPNZ(failedCounters)
|
21
|
+
%OPRETURN_CNT_POSEIDON_G - CNT_POSEIDON_G :JMPNZ(failedCounters)
|
22
|
+
|
23
|
+
0 => A,B,C,D,E,CTX, SP, PC, GAS, SR, HASHPOS, RR ; Set all registers to 0
|
24
|
+
finalizeExecution:
|
25
|
+
:JMP(finalWait)
|
26
|
+
readCode:
|
27
|
+
txType:
|
28
|
+
:JMP(checkCounters)
|
29
|
+
failedCounters:
|
30
|
+
2 => A
|
31
|
+
1 :ASSERT
|
32
|
+
INCLUDE "../endIncludes.zkasm"
|
@@ -0,0 +1,29 @@
|
|
1
|
+
INCLUDE "../initIncludes.zkasm"
|
2
|
+
|
3
|
+
start:
|
4
|
+
1000000 => GAS
|
5
|
+
|
6
|
+
operation:
|
7
|
+
1 => CTX
|
8
|
+
10000 :MSTORE(retDataLength)
|
9
|
+
5 :MSTORE(retDataOffset)
|
10
|
+
2 => CTX
|
11
|
+
1 :MSTORE(originCTX)
|
12
|
+
1 :MSTORE(retDataCTX)
|
13
|
+
43 :MSTORE(SP++)
|
14
|
+
54 :MSTORE(SP++)
|
15
|
+
4000 :MSTORE(SP++)
|
16
|
+
:JMP(opRETURNDATACOPY)
|
17
|
+
checkCounters:
|
18
|
+
1000 - STEP:JMPN(failedCounters)
|
19
|
+
|
20
|
+
|
21
|
+
0 => A,B,C,D,E,CTX, SP, PC, GAS, SR, HASHPOS, RR ; Set all registers to 0
|
22
|
+
finalizeExecution:
|
23
|
+
:JMP(finalWait)
|
24
|
+
readCode:
|
25
|
+
:JMP(checkCounters)
|
26
|
+
failedCounters:
|
27
|
+
2 => A
|
28
|
+
1 :ASSERT
|
29
|
+
INCLUDE "../endIncludes.zkasm"
|
@@ -0,0 +1,32 @@
|
|
1
|
+
INCLUDE "../initIncludes.zkasm"
|
2
|
+
|
3
|
+
start:
|
4
|
+
1000000 => GAS
|
5
|
+
|
6
|
+
operation:
|
7
|
+
2 => CTX
|
8
|
+
1 :MSTORE(originCTX)
|
9
|
+
2 :MSTORE(currentCTX)
|
10
|
+
10000 :MSTORE(retCallLength)
|
11
|
+
100 :MSTORE(SP++)
|
12
|
+
1000 :MSTORE(SP++)
|
13
|
+
:JMP(opREVERT)
|
14
|
+
checkCounters:
|
15
|
+
%OPREVERT_STEP - STEP:JMPN(failedCounters)
|
16
|
+
%OPREVERT_CNT_BINARY - CNT_BINARY :JMPNZ(failedCounters)
|
17
|
+
%OPREVERT_CNT_ARITH - CNT_ARITH :JMPNZ(failedCounters)
|
18
|
+
%OPREVERT_CNT_KECCAK_F - CNT_KECCAK_F :JMPNZ(failedCounters)
|
19
|
+
%OPREVERT_CNT_MEM_ALIGN - CNT_MEM_ALIGN :JMPNZ(failedCounters)
|
20
|
+
%OPREVERT_CNT_PADDING_PG - CNT_PADDING_PG :JMPNZ(failedCounters)
|
21
|
+
%OPREVERT_CNT_POSEIDON_G - CNT_POSEIDON_G :JMPNZ(failedCounters)
|
22
|
+
|
23
|
+
0 => A,B,C,D,E,CTX, SP, PC, GAS, SR, HASHPOS, RR ; Set all registers to 0
|
24
|
+
finalizeExecution:
|
25
|
+
:JMP(finalWait)
|
26
|
+
readCode:
|
27
|
+
txType:
|
28
|
+
:JMP(checkCounters)
|
29
|
+
failedCounters:
|
30
|
+
2 => A
|
31
|
+
1 :ASSERT
|
32
|
+
INCLUDE "../endIncludes.zkasm"
|
@@ -0,0 +1,28 @@
|
|
1
|
+
INCLUDE "../initIncludes.zkasm"
|
2
|
+
|
3
|
+
start:
|
4
|
+
1000000 => GAS
|
5
|
+
|
6
|
+
operation:
|
7
|
+
0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFn :MSTORE(SP++)
|
8
|
+
3 :MSTORE(SP++)
|
9
|
+
:JMP(opSDIV)
|
10
|
+
checkCounters:
|
11
|
+
%OPSDIV_STEP - STEP:JMPN(failedCounters)
|
12
|
+
7 - CNT_BINARY :JMPNZ(failedCounters)
|
13
|
+
;%OPSDIV_CNT_BINARY - CNT_BINARY :JMPNZ(failedCounters)
|
14
|
+
%OPSDIV_CNT_ARITH - CNT_ARITH :JMPNZ(failedCounters)
|
15
|
+
%OPSDIV_CNT_KECCAK_F - CNT_KECCAK_F :JMPNZ(failedCounters)
|
16
|
+
%OPSDIV_CNT_MEM_ALIGN - CNT_MEM_ALIGN :JMPNZ(failedCounters)
|
17
|
+
%OPSDIV_CNT_PADDING_PG - CNT_PADDING_PG :JMPNZ(failedCounters)
|
18
|
+
%OPSDIV_CNT_POSEIDON_G - CNT_POSEIDON_G :JMPNZ(failedCounters)
|
19
|
+
|
20
|
+
0 => A,B,C,D,E,CTX, SP, PC, GAS, SR, HASHPOS, RR ; Set all registers to 0
|
21
|
+
finalizeExecution:
|
22
|
+
:JMP(finalWait)
|
23
|
+
readCode:
|
24
|
+
:JMP(checkCounters)
|
25
|
+
failedCounters:
|
26
|
+
2 => A
|
27
|
+
1 :ASSERT
|
28
|
+
INCLUDE "../endIncludes.zkasm"
|
@@ -0,0 +1,28 @@
|
|
1
|
+
INCLUDE "../initIncludes.zkasm"
|
2
|
+
|
3
|
+
start:
|
4
|
+
1000000 => GAS
|
5
|
+
|
6
|
+
operation:
|
7
|
+
2 :HASHK1(0)
|
8
|
+
2000 :MSTORE(SP++)
|
9
|
+
100 :MSTORE(SP++)
|
10
|
+
:JMP(opSHA3)
|
11
|
+
checkCounters:
|
12
|
+
%OPSHA3_STEP - STEP:JMPN(failedCounters)
|
13
|
+
%OPSHA3_CNT_BINARY - CNT_BINARY :JMPNZ(failedCounters)
|
14
|
+
%OPSHA3_CNT_ARITH - CNT_ARITH :JMPNZ(failedCounters)
|
15
|
+
%OPSHA3_CNT_KECCAK_F - CNT_KECCAK_F :JMPNZ(failedCounters)
|
16
|
+
%OPSHA3_CNT_MEM_ALIGN - CNT_MEM_ALIGN :JMPNZ(failedCounters)
|
17
|
+
%OPSHA3_CNT_PADDING_PG - CNT_PADDING_PG :JMPNZ(failedCounters)
|
18
|
+
%OPSHA3_CNT_POSEIDON_G - CNT_POSEIDON_G :JMPNZ(failedCounters)
|
19
|
+
|
20
|
+
0 => A,B,C,D,E,CTX, SP, PC, GAS, SR, HASHPOS, RR ; Set all registers to 0
|
21
|
+
finalizeExecution:
|
22
|
+
:JMP(finalWait)
|
23
|
+
readCode:
|
24
|
+
:JMP(checkCounters)
|
25
|
+
failedCounters:
|
26
|
+
2 => A
|
27
|
+
1 :ASSERT
|
28
|
+
INCLUDE "../endIncludes.zkasm"
|
@@ -0,0 +1,27 @@
|
|
1
|
+
INCLUDE "../initIncludes.zkasm"
|
2
|
+
|
3
|
+
start:
|
4
|
+
1000000 => GAS
|
5
|
+
|
6
|
+
operation:
|
7
|
+
0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFn :MSTORE(SP++)
|
8
|
+
10 :MSTORE(SP++)
|
9
|
+
:JMP(opSIGNEXTEND)
|
10
|
+
checkCounters:
|
11
|
+
%OPSIGNEXTEND_STEP - STEP:JMPN(failedCounters)
|
12
|
+
%OPSIGNEXTEND_CNT_BINARY - CNT_BINARY :JMPNZ(failedCounters)
|
13
|
+
%OPSIGNEXTEND_CNT_ARITH - CNT_ARITH :JMPNZ(failedCounters)
|
14
|
+
%OPSIGNEXTEND_CNT_KECCAK_F - CNT_KECCAK_F :JMPNZ(failedCounters)
|
15
|
+
%OPSIGNEXTEND_CNT_MEM_ALIGN - CNT_MEM_ALIGN :JMPNZ(failedCounters)
|
16
|
+
%OPSIGNEXTEND_CNT_PADDING_PG - CNT_PADDING_PG :JMPNZ(failedCounters)
|
17
|
+
%OPSIGNEXTEND_CNT_POSEIDON_G - CNT_POSEIDON_G :JMPNZ(failedCounters)
|
18
|
+
|
19
|
+
0 => A,B,C,D,E,CTX, SP, PC, GAS, SR, HASHPOS, RR ; Set all registers to 0
|
20
|
+
finalizeExecution:
|
21
|
+
:JMP(finalWait)
|
22
|
+
readCode:
|
23
|
+
:JMP(checkCounters)
|
24
|
+
failedCounters:
|
25
|
+
2 => A
|
26
|
+
1 :ASSERT
|
27
|
+
INCLUDE "../endIncludes.zkasm"
|
@@ -0,0 +1,28 @@
|
|
1
|
+
INCLUDE "../initIncludes.zkasm"
|
2
|
+
|
3
|
+
start:
|
4
|
+
1000000 => GAS
|
5
|
+
|
6
|
+
operation:
|
7
|
+
0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFn :MSTORE(SP++)
|
8
|
+
3 :MSTORE(SP++)
|
9
|
+
:JMP(opSMOD)
|
10
|
+
checkCounters:
|
11
|
+
%OPSMOD_STEP - STEP:JMPN(failedCounters)
|
12
|
+
6 - CNT_BINARY :JMPNZ(failedCounters)
|
13
|
+
;%OPSMOD_CNT_BINARY - CNT_BINARY :JMPNZ(failedCounters)
|
14
|
+
%OPSMOD_CNT_ARITH - CNT_ARITH :JMPNZ(failedCounters)
|
15
|
+
%OPSMOD_CNT_KECCAK_F - CNT_KECCAK_F :JMPNZ(failedCounters)
|
16
|
+
%OPSMOD_CNT_MEM_ALIGN - CNT_MEM_ALIGN :JMPNZ(failedCounters)
|
17
|
+
%OPSMOD_CNT_PADDING_PG - CNT_PADDING_PG :JMPNZ(failedCounters)
|
18
|
+
%OPSMOD_CNT_POSEIDON_G - CNT_POSEIDON_G :JMPNZ(failedCounters)
|
19
|
+
|
20
|
+
0 => A,B,C,D,E,CTX, SP, PC, GAS, SR, HASHPOS, RR ; Set all registers to 0
|
21
|
+
finalizeExecution:
|
22
|
+
:JMP(finalWait)
|
23
|
+
readCode:
|
24
|
+
:JMP(checkCounters)
|
25
|
+
failedCounters:
|
26
|
+
2 => A
|
27
|
+
1 :ASSERT
|
28
|
+
INCLUDE "../endIncludes.zkasm"
|
@@ -0,0 +1,35 @@
|
|
1
|
+
INCLUDE "../initIncludes.zkasm"
|
2
|
+
|
3
|
+
start:
|
4
|
+
1000000 => GAS
|
5
|
+
|
6
|
+
operation:
|
7
|
+
1 => CTX
|
8
|
+
; stack input: [gas, address, argsOffset, argsSize, retOffset, retSize]
|
9
|
+
; stack output: [success]
|
10
|
+
1000 :MSTORE(SP++)
|
11
|
+
43 :MSTORE(SP++)
|
12
|
+
54 :MSTORE(SP++)
|
13
|
+
8 :MSTORE(SP++)
|
14
|
+
100 :MSTORE(SP++)
|
15
|
+
1000 :MSTORE(SP++)
|
16
|
+
:JMP(opSTATICCALL)
|
17
|
+
checkCounters:
|
18
|
+
%OPSTATICCALL_STEP - STEP:JMPN(failedCounters)
|
19
|
+
%OPSTATICCALL_CNT_BINARY - CNT_BINARY :JMPNZ(failedCounters)
|
20
|
+
%OPSTATICCALL_CNT_ARITH - CNT_ARITH :JMPNZ(failedCounters)
|
21
|
+
%OPSTATICCALL_CNT_KECCAK_F - CNT_KECCAK_F :JMPNZ(failedCounters)
|
22
|
+
%OPSTATICCALL_CNT_MEM_ALIGN - CNT_MEM_ALIGN :JMPNZ(failedCounters)
|
23
|
+
%OPSTATICCALL_CNT_PADDING_PG - CNT_PADDING_PG :JMPNZ(failedCounters)
|
24
|
+
%OPSTATICCALL_CNT_POSEIDON_G - CNT_POSEIDON_G :JMPNZ(failedCounters)
|
25
|
+
|
26
|
+
0 => A,B,C,D,E,CTX, SP, PC, GAS, SR, HASHPOS, RR ; Set all registers to 0
|
27
|
+
finalizeExecution:
|
28
|
+
:JMP(finalWait)
|
29
|
+
readCode:
|
30
|
+
txType:
|
31
|
+
:JMP(checkCounters)
|
32
|
+
failedCounters:
|
33
|
+
2 => A
|
34
|
+
1 :ASSERT
|
35
|
+
INCLUDE "../endIncludes.zkasm"
|
@@ -0,0 +1,27 @@
|
|
1
|
+
INCLUDE "../initIncludes.zkasm"
|
2
|
+
|
3
|
+
start:
|
4
|
+
1000000 => GAS
|
5
|
+
|
6
|
+
operation:
|
7
|
+
2 :MSTORE(SP++)
|
8
|
+
2 :MSTORE(SP++)
|
9
|
+
:CALL(opSUB)
|
10
|
+
checkCounters:
|
11
|
+
%OPSUB_STEP - STEP:JMPN(failedCounters)
|
12
|
+
%OPSUB_CNT_BINARY - CNT_BINARY :JMPNZ(failedCounters)
|
13
|
+
%OPSUB_CNT_ARITH - CNT_ARITH :JMPNZ(failedCounters)
|
14
|
+
%OPSUB_CNT_KECCAK_F - CNT_KECCAK_F :JMPNZ(failedCounters)
|
15
|
+
%OPSUB_CNT_MEM_ALIGN - CNT_MEM_ALIGN :JMPNZ(failedCounters)
|
16
|
+
%OPSUB_CNT_PADDING_PG - CNT_PADDING_PG :JMPNZ(failedCounters)
|
17
|
+
%OPSUB_CNT_POSEIDON_G - CNT_POSEIDON_G :JMPNZ(failedCounters)
|
18
|
+
|
19
|
+
0 => A,B,C,D,E,CTX, SP, PC, GAS, SR, HASHPOS, RR ; Set all registers to 0
|
20
|
+
finalizeExecution:
|
21
|
+
:JMP(finalWait)
|
22
|
+
readCode:
|
23
|
+
:JMP(checkCounters)
|
24
|
+
failedCounters:
|
25
|
+
2 => A
|
26
|
+
1 :ASSERT
|
27
|
+
INCLUDE "../endIncludes.zkasm"
|
@@ -0,0 +1,31 @@
|
|
1
|
+
INCLUDE "../initIncludes.zkasm"
|
2
|
+
|
3
|
+
start:
|
4
|
+
1000000 => GAS
|
5
|
+
|
6
|
+
operation:
|
7
|
+
; @info compute memory expansion gas cost
|
8
|
+
; @in: lastMemOffset: offset to copy bytes
|
9
|
+
; @in: lastMemLength: size of the bytes to copy
|
10
|
+
10000 :MSTORE(lastMemOffset)
|
11
|
+
10000 :MSTORE(lastMemLength)
|
12
|
+
:CALL(saveMem)
|
13
|
+
|
14
|
+
%SAVEMEM_STEP - STEP:JMPN(failedCounters)
|
15
|
+
%SAVEMEM_CNT_BINARY - CNT_BINARY :JMPNZ(failedCounters)
|
16
|
+
%SAVEMEM_CNT_ARITH - CNT_ARITH :JMPNZ(failedCounters)
|
17
|
+
%SAVEMEM_CNT_KECCAK_F - CNT_KECCAK_F :JMPNZ(failedCounters)
|
18
|
+
%SAVEMEM_CNT_MEM_ALIGN - CNT_MEM_ALIGN :JMPNZ(failedCounters)
|
19
|
+
%SAVEMEM_CNT_PADDING_PG - CNT_PADDING_PG :JMPNZ(failedCounters)
|
20
|
+
%SAVEMEM_CNT_POSEIDON_G - CNT_POSEIDON_G :JMPNZ(failedCounters)
|
21
|
+
|
22
|
+
0 => A,B,C,D,E,CTX, SP, PC, GAS, SR, HASHPOS, RR ; Set all registers to 0
|
23
|
+
finalizeExecution:
|
24
|
+
:JMP(finalWait)
|
25
|
+
readCode:
|
26
|
+
:RETURN
|
27
|
+
failedCounters:
|
28
|
+
2 => A
|
29
|
+
1 :ASSERT
|
30
|
+
|
31
|
+
INCLUDE "../endIncludes.zkasm"
|