Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/last optimizations #371

Closed
wants to merge 46 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
46 commits
Select commit Hold shift + click to select a range
72cd72d
Refactor and huge optmization of the ecrecover
hecmas Feb 5, 2024
2ec5cfa
allow gha on develop-feijoa
krlosMata Feb 5, 2024
89b55dd
Subtraction fix
hecmas Feb 6, 2024
279241f
readPush optimization
zkronos73 Dec 31, 2023
eee5f10
update counters read push
zkronos73 Jan 8, 2024
2f8e806
fix readPush call
zkronos73 Jan 8, 2024
19d7d93
update readPush test to use D,E for bytes
zkronos73 Jan 9, 2024
8ad87a6
run gha on develop-feijoa
krlosMata Feb 5, 2024
560a989
Counters recomputed and w.c. test added
hecmas Feb 6, 2024
100d364
adjust steps on counter verification
zkronos73 Feb 7, 2024
5f6306e
Upadte package
hecmas Feb 7, 2024
226299a
Upadte package and GHA
hecmas Feb 7, 2024
f41e59a
Merge pull request #326 from 0xPolygonHermez/feature/zk73-push
krlosMata Feb 7, 2024
c13a973
Merge pull request #327 from 0xPolygonHermez/feature/ecrecover-ref-optz
krlosMata Feb 7, 2024
b0d00da
update to fork.8
krlosMata Feb 7, 2024
09b0cc3
Merge pull request #333 from 0xPolygonHermez/feature/set-fork-8
krlosMata Feb 8, 2024
7a3d075
Merge branch 'develop-feijoa' into feature/sub-fix
krlosMata Feb 8, 2024
a302c6a
Merge pull request #329 from 0xPolygonHermez/feature/sub-fix
krlosMata Feb 8, 2024
c0bb8a5
update gha
krlosMata Feb 8, 2024
9711cb4
update proverjs branch
krlosMata Feb 8, 2024
bc22600
Merge pull request #334 from 0xPolygonHermez/feature/update-to-eldelb…
krlosMata Feb 8, 2024
3cd13ee
change block gas limit
krlosMata Feb 8, 2024
8293d48
Merge pull request #335 from 0xPolygonHermez/feature/change-block-gas…
krlosMata Feb 9, 2024
1ef22cd
Done small optimization in most used lines
ignasirv Feb 7, 2024
f34a496
Update counters tests
ignasirv Feb 7, 2024
3727abd
Bugfix
ignasirv Feb 8, 2024
44d3961
More optimizations + counters
ignasirv Feb 8, 2024
c94da9a
add recommendation review external
krlosMata Feb 9, 2024
d7c6601
arithdiv optimization
ignasirv Feb 9, 2024
e39558e
Audit optimizations 14, 16, 19
ignasirv Feb 9, 2024
9ae9dc4
Reg fixes
ignasirv Feb 9, 2024
39ee638
mstorex optimization using mem_align and unrolling short paths
zkronos73 Feb 11, 2024
2f90241
Uncomment zkasm tests
ignasirv Feb 11, 2024
0014454
Add flag to skip vcounters check at rom tests
ignasirv Feb 12, 2024
e08e26c
Remove unnecessary line
ignasirv Feb 13, 2024
e10c88b
Remove unnecessary line
ignasirv Feb 13, 2024
29cab9d
Merge branch 'feature/final-opts' of github.com:0xPolygonHermez/zkevm…
krlosMata Feb 14, 2024
5fb1462
control bounds branches
krlosMata Feb 14, 2024
700422f
update proverjs branch on package.json
zkronos73 Feb 14, 2024
49e5ec7
update proverjs branch again on package.json
zkronos73 Feb 14, 2024
ac1ced0
update package.json
zkronos73 Feb 14, 2024
e602aed
update zkevm-proverjs dependency of package.json
zkronos73 Feb 14, 2024
73da8a5
Log optimization
ignasirv Feb 14, 2024
ebc84cd
Binary + steps optimizations
ignasirv Feb 20, 2024
889cbcf
Merge branch 'develop-feijoa' into feature/final-opts
ignasirv Mar 28, 2024
9388567
Merge branch 'feature/final-opts' into develop-feijoa
ignasirv Mar 28, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 16
node-version: 20
- name: setup zkevm-rom
run: |
npm i
Expand All @@ -37,4 +37,4 @@ jobs:
run: |
export NUM_CPUS=31
npm run test:start
sh tools/parallel-testing/checker.sh
sh tools/parallel-testing/checker.sh
74 changes: 37 additions & 37 deletions counters/countersConstants.zkasm
Original file line number Diff line number Diff line change
Expand Up @@ -24,23 +24,23 @@ CONST %SHRARITHBIT_CNT_PADDING_PG = 0 + %DIVARITH_CNT_PADDING_PG
CONST %SHRARITHBIT_CNT_POSEIDON_G = 0 + %DIVARITH_CNT_POSEIDON_G
;offsetUtil
CONST %OFFSETUTIL_STEP = 20
CONST %OFFSETUTIL_CNT_BINARY = 1
CONST %OFFSETUTIL_CNT_BINARY = 0
CONST %OFFSETUTIL_CNT_ARITH = 0
CONST %OFFSETUTIL_CNT_KECCAK_F = 0
CONST %OFFSETUTIL_CNT_MEM_ALIGN = 0
CONST %OFFSETUTIL_CNT_PADDING_PG = 0
CONST %OFFSETUTIL_CNT_POSEIDON_G = 0
; SHLarith
CONST %SHLARITH_STEP = 100
CONST %SHLARITH_CNT_BINARY = 2
CONST %SHLARITH_CNT_BINARY = 1
CONST %SHLARITH_CNT_ARITH = 2
CONST %SHLARITH_CNT_KECCAK_F = 0
CONST %SHLARITH_CNT_MEM_ALIGN = 0
CONST %SHLARITH_CNT_PADDING_PG = 0
CONST %SHLARITH_CNT_POSEIDON_G = 0
; SHLarithBit
CONST %SHLARITHBIT_STEP = 100
CONST %SHLARITHBIT_CNT_BINARY = 2
CONST %SHLARITHBIT_CNT_BINARY = 1
CONST %SHLARITHBIT_CNT_ARITH = 1
CONST %SHLARITHBIT_CNT_KECCAK_F = 0
CONST %SHLARITHBIT_CNT_MEM_ALIGN = 0
Expand All @@ -55,7 +55,7 @@ CONST %MLOADX_CNT_MEM_ALIGN = 1 + %SHRARITH_CNT_MEM_ALIGN + %SHLARITH_CNT_MEM_AL
CONST %MLOADX_CNT_PADDING_PG = 0 + %SHRARITH_CNT_PADDING_PG + %SHLARITH_CNT_PADDING_PG + %OFFSETUTIL_CNT_PADDING_PG
CONST %MLOADX_CNT_POSEIDON_G = 0 + %SHRARITH_CNT_POSEIDON_G + %SHLARITH_CNT_POSEIDON_G + %OFFSETUTIL_CNT_POSEIDON_G
; MLOAD32
CONST %MLOAD32_STEP = 100 + %OFFSETUTIL_STEP
CONST %MLOAD32_STEP = 50 + %OFFSETUTIL_STEP
CONST %MLOAD32_CNT_BINARY = 1 + %OFFSETUTIL_CNT_BINARY
CONST %MLOAD32_CNT_ARITH = 0 + %OFFSETUTIL_CNT_ARITH
CONST %MLOAD32_CNT_KECCAK_F = 0 + %OFFSETUTIL_CNT_KECCAK_F
Expand All @@ -80,17 +80,17 @@ CONST %MULARITH_CNT_MEM_ALIGN = 0
CONST %MULARITH_CNT_PADDING_PG = 0
CONST %MULARITH_CNT_POSEIDON_G = 0
; getLenBytes
CONST %GETLENBYTES_STEP = 20
CONST %GETLENBYTES_CNT_BINARY = 0
CONST %GETLENBYTES_CNT_ARITH = 0
CONST %GETLENBYTES_STEP = 800
CONST %GETLENBYTES_CNT_BINARY = 61
CONST %GETLENBYTES_CNT_ARITH = 19
CONST %GETLENBYTES_CNT_KECCAK_F = 0
CONST %GETLENBYTES_CNT_MEM_ALIGN = 0
CONST %GETLENBYTES_CNT_PADDING_PG = 0
CONST %GETLENBYTES_CNT_POSEIDON_G = 0
; getLenBits
CONST %GETLENBITS_STEP = 20
CONST %GETLENBITS_CNT_BINARY = 0
CONST %GETLENBITS_CNT_ARITH = 0
CONST %GETLENBITS_STEP = 3000
CONST %GETLENBITS_CNT_BINARY = 321
CONST %GETLENBITS_CNT_ARITH = 79
CONST %GETLENBITS_CNT_KECCAK_F = 0
CONST %GETLENBITS_CNT_MEM_ALIGN = 0
CONST %GETLENBITS_CNT_PADDING_PG = 0
Expand Down Expand Up @@ -201,18 +201,18 @@ CONST %OPBLOCKHASH_CNT_PADDING_PG = 0
CONST %OPBLOCKHASH_CNT_POSEIDON_G = 2
; opCALLDATALOAD
CONST %OPCALLDATALOAD_STEP = 100 + %SHLARITH_STEP + %SHRARITH_STEP + %DIVARITH_STEP
CONST %OPCALLDATALOAD_CNT_BINARY = 3
CONST %OPCALLDATALOAD_CNT_BINARY = 2
CONST %OPCALLDATALOAD_CNT_ARITH = 0
CONST %OPCALLDATALOAD_CNT_KECCAK_F = 0 + %SHLARITH_CNT_KECCAK_F + %SHRARITH_CNT_KECCAK_F + %DIVARITH_CNT_KECCAK_F
CONST %OPCALLDATALOAD_CNT_MEM_ALIGN = 1
CONST %OPCALLDATALOAD_CNT_PADDING_PG = 0 + %SHLARITH_CNT_PADDING_PG + %SHRARITH_CNT_PADDING_PG + %DIVARITH_CNT_PADDING_PG
CONST %OPCALLDATALOAD_CNT_POSEIDON_G = 0 + %SHLARITH_CNT_POSEIDON_G + %SHRARITH_CNT_POSEIDON_G + %DIVARITH_CNT_POSEIDON_G
; opCALLDATACOPY - COMPLEX - hardcoded values at test
CONST %OPCALLDATACOPY_STEP = 500
CONST %OPCALLDATACOPY_CNT_BINARY = 21
CONST %OPCALLDATACOPY_CNT_ARITH = 8
CONST %OPCALLDATACOPY_CNT_BINARY = 8
CONST %OPCALLDATACOPY_CNT_ARITH = 2
CONST %OPCALLDATACOPY_CNT_KECCAK_F = 0
CONST %OPCALLDATACOPY_CNT_MEM_ALIGN = 2
CONST %OPCALLDATACOPY_CNT_MEM_ALIGN = 4
CONST %OPCALLDATACOPY_CNT_PADDING_PG = 0
CONST %OPCALLDATACOPY_CNT_POSEIDON_G = 0
; opRETURNDATACOPY - COMPLEX - hardcoded values at test
Expand All @@ -225,95 +225,95 @@ CONST %OPRETURNDATACOPY_CNT_PADDING_PG = 0
CONST %OPRETURNDATACOPY_CNT_POSEIDON_G = 0
; opCODECOPY - COMPLEX - hardcoded values at test
CONST %OPCODECOPY_STEP = 1700
CONST %OPCODECOPY_CNT_BINARY = 100
CONST %OPCODECOPY_CNT_ARITH = 4
CONST %OPCODECOPY_CNT_BINARY = 51
CONST %OPCODECOPY_CNT_ARITH = 2
CONST %OPCODECOPY_CNT_KECCAK_F = 0
CONST %OPCODECOPY_CNT_MEM_ALIGN = 43
CONST %OPCODECOPY_CNT_PADDING_PG = 0
CONST %OPCODECOPY_CNT_POSEIDON_G = 0
; opEXTCODECOPY - COMPLEX - hardcoded values at test
CONST %OPEXTCODECOPY_STEP = 2000
CONST %OPEXTCODECOPY_CNT_BINARY = 104
CONST %OPEXTCODECOPY_CNT_ARITH = 4
CONST %OPEXTCODECOPY_CNT_BINARY = 55
CONST %OPEXTCODECOPY_CNT_ARITH = 2
CONST %OPEXTCODECOPY_CNT_KECCAK_F = 0
CONST %OPEXTCODECOPY_CNT_MEM_ALIGN = 43
CONST %OPEXTCODECOPY_CNT_PADDING_PG = 0
CONST %OPEXTCODECOPY_CNT_POSEIDON_G = 8
; opCREATE - COMPLEX - hardcoded values at test
CONST %OPCREATE_STEP = 400
CONST %OPCREATE_CNT_BINARY = 16
CONST %OPCREATE_CNT_BINARY = 14
CONST %OPCREATE_CNT_ARITH = 1
CONST %OPCREATE_CNT_KECCAK_F = 0
CONST %OPCREATE_CNT_MEM_ALIGN = 0
CONST %OPCREATE_CNT_PADDING_PG = 0
CONST %OPCREATE_CNT_POSEIDON_G = 23
; opCREATE2 - COMPLEX - hardcoded values at test
CONST %OPCREATE2_STEP = 400
CONST %OPCREATE2_CNT_BINARY = 21
CONST %OPCREATE2_CNT_BINARY = 18
CONST %OPCREATE2_CNT_ARITH = 2
CONST %OPCREATE2_CNT_KECCAK_F = 0
CONST %OPCREATE2_CNT_MEM_ALIGN = 0
CONST %OPCREATE2_CNT_PADDING_PG = 0
CONST %OPCREATE2_CNT_POSEIDON_G = 27
; opCALL - COMPLEX - hardcoded values at test
CONST %OPCALL_STEP = 600
CONST %OPCALL_CNT_BINARY = 27
CONST %OPCALL_CNT_BINARY = 23
CONST %OPCALL_CNT_ARITH = 3
CONST %OPCALL_CNT_KECCAK_F = 0
CONST %OPCALL_CNT_MEM_ALIGN = 0
CONST %OPCALL_CNT_PADDING_PG = 0
CONST %OPCALL_CNT_POSEIDON_G = 14
; opCALLCODE - COMPLEX - hardcoded values at test
CONST %OPCALLCODE_STEP = 600
CONST %OPCALLCODE_CNT_BINARY = 26
CONST %OPCALLCODE_CNT_BINARY = 22
CONST %OPCALLCODE_CNT_ARITH = 3
CONST %OPCALLCODE_CNT_KECCAK_F = 0
CONST %OPCALLCODE_CNT_MEM_ALIGN = 0
CONST %OPCALLCODE_CNT_PADDING_PG = 0
CONST %OPCALLCODE_CNT_POSEIDON_G = 10
; opRETURN - COMPLEX - hardcoded values at test
CONST %OPRETURN_STEP = 700
CONST %OPRETURN_CNT_BINARY = 35
CONST %OPRETURN_CNT_ARITH = 11
CONST %OPRETURN_CNT_BINARY = 14
CONST %OPRETURN_CNT_ARITH = 5
CONST %OPRETURN_CNT_KECCAK_F = 0
CONST %OPRETURN_CNT_MEM_ALIGN = 4
CONST %OPRETURN_CNT_MEM_ALIGN = 5
CONST %OPRETURN_CNT_PADDING_PG = 0
CONST %OPRETURN_CNT_POSEIDON_G = 0
; opREVERT - COMPLEX - hardcoded values at test
CONST %OPREVERT_STEP = 700
CONST %OPREVERT_CNT_BINARY = 35
CONST %OPREVERT_CNT_ARITH = 11
CONST %OPREVERT_CNT_BINARY = 14
CONST %OPREVERT_CNT_ARITH = 5
CONST %OPREVERT_CNT_KECCAK_F = 0
CONST %OPREVERT_CNT_MEM_ALIGN = 4
CONST %OPREVERT_CNT_MEM_ALIGN = 5
CONST %OPREVERT_CNT_PADDING_PG = 0
CONST %OPREVERT_CNT_POSEIDON_G = 0
; opDELEGATECALL - COMPLEX - hardcoded values at test
CONST %OPDELEGATECALL_STEP = 600
CONST %OPDELEGATECALL_CNT_BINARY = 23
CONST %OPDELEGATECALL_CNT_BINARY = 19
CONST %OPDELEGATECALL_CNT_ARITH = 3
CONST %OPDELEGATECALL_CNT_KECCAK_F = 0
CONST %OPDELEGATECALL_CNT_MEM_ALIGN = 0
CONST %OPDELEGATECALL_CNT_PADDING_PG = 0
CONST %OPDELEGATECALL_CNT_POSEIDON_G = 6
; opSTATICCALL - COMPLEX - hardcoded values at test
CONST %OPSTATICCALL_STEP = 600
CONST %OPSTATICCALL_CNT_BINARY = 23
CONST %OPSTATICCALL_CNT_BINARY = 19
CONST %OPSTATICCALL_CNT_ARITH = 3
CONST %OPSTATICCALL_CNT_KECCAK_F = 0
CONST %OPSTATICCALL_CNT_MEM_ALIGN = 0
CONST %OPSTATICCALL_CNT_PADDING_PG = 0
CONST %OPSTATICCALL_CNT_POSEIDON_G = 6
; opSHA3 - COMPLEX - hardcoded values at test
CONST %OPSHA3_STEP = 3300
CONST %OPSHA3_CNT_BINARY = 146
CONST %OPSHA3_CNT_ARITH = 9
CONST %OPSHA3_CNT_BINARY = 76
CONST %OPSHA3_CNT_ARITH = 7
CONST %OPSHA3_CNT_KECCAK_F = 15
CONST %OPSHA3_CNT_MEM_ALIGN = 63
CONST %OPSHA3_CNT_PADDING_PG = 0
CONST %OPSHA3_CNT_POSEIDON_G = 0
; MSTORE32
CONST %MSTORE32_STEP = 50 + %OFFSETUTIL_STEP
CONST %MSTORE32_CNT_BINARY = 1 + %OFFSETUTIL_CNT_BINARY
CONST %MSTORE32_CNT_BINARY = %OFFSETUTIL_CNT_BINARY
CONST %MSTORE32_CNT_ARITH = 0 + %OFFSETUTIL_CNT_ARITH
CONST %MSTORE32_CNT_KECCAK_F = 0 + %OFFSETUTIL_CNT_KECCAK_F
CONST %MSTORE32_CNT_MEM_ALIGN = 1 + %OFFSETUTIL_CNT_MEM_ALIGN
Expand All @@ -324,7 +324,7 @@ CONST %MSTOREX_STEP = 100 + %MSTORE32_STEP + %SHRARITH_STEP*3 + %SHLARITH_STEP*2
CONST %MSTOREX_CNT_BINARY = 0 + %MSTORE32_CNT_BINARY + %SHRARITH_CNT_BINARY*3 + %SHLARITH_CNT_BINARY*2 + %OFFSETUTIL_CNT_BINARY
CONST %MSTOREX_CNT_ARITH = 0 + %MSTORE32_CNT_ARITH + %SHRARITH_CNT_ARITH*3 + %SHLARITH_CNT_ARITH*2 + %OFFSETUTIL_CNT_ARITH
CONST %MSTOREX_CNT_KECCAK_F = 0 + %MSTORE32_CNT_KECCAK_F + %SHRARITH_CNT_KECCAK_F*3 + %SHLARITH_CNT_KECCAK_F*2 + %OFFSETUTIL_CNT_KECCAK_F
CONST %MSTOREX_CNT_MEM_ALIGN = 0 + %MSTORE32_CNT_MEM_ALIGN + %SHRARITH_CNT_MEM_ALIGN*3 + %SHLARITH_CNT_MEM_ALIGN*2 + %OFFSETUTIL_CNT_MEM_ALIGN
CONST %MSTOREX_CNT_MEM_ALIGN = 2 + %MSTORE32_CNT_MEM_ALIGN + %SHRARITH_CNT_MEM_ALIGN*3 + %SHLARITH_CNT_MEM_ALIGN*2 + %OFFSETUTIL_CNT_MEM_ALIGN
CONST %MSTOREX_CNT_PADDING_PG = 0 + %MSTORE32_CNT_PADDING_PG + %SHRARITH_CNT_PADDING_PG*3 + %SHLARITH_CNT_PADDING_PG*2 + %OFFSETUTIL_CNT_PADDING_PG
CONST %MSTOREX_CNT_POSEIDON_G = 0 + %MSTORE32_CNT_POSEIDON_G + %SHRARITH_CNT_POSEIDON_G*3 + %SHLARITH_CNT_POSEIDON_G*2 + %OFFSETUTIL_CNT_POSEIDON_G
; isEmptyAccount
Expand All @@ -337,23 +337,23 @@ CONST %ISEMPTYACCOUNT_CNT_PADDING_PG = 0
CONST %ISEMPTYACCOUNT_CNT_POSEIDON_G = 6
; computeGasSendCall
CONST %COMPUTEGASSENDCALL_STEP = 30
CONST %COMPUTEGASSENDCALL_CNT_BINARY = 2
CONST %COMPUTEGASSENDCALL_CNT_BINARY = 1
CONST %COMPUTEGASSENDCALL_CNT_ARITH = 0
CONST %COMPUTEGASSENDCALL_CNT_KECCAK_F = 0
CONST %COMPUTEGASSENDCALL_CNT_MEM_ALIGN = 0
CONST %COMPUTEGASSENDCALL_CNT_PADDING_PG = 0
CONST %COMPUTEGASSENDCALL_CNT_POSEIDON_G = 0
; saveMem
CONST %SAVEMEM_STEP = 100 + %MULARITH_STEP + %DIVARITH_STEP
CONST %SAVEMEM_CNT_BINARY = 5 + %MULARITH_CNT_BINARY + %DIVARITH_CNT_BINARY
CONST %SAVEMEM_CNT_BINARY = 3 + %MULARITH_CNT_BINARY + %DIVARITH_CNT_BINARY
CONST %SAVEMEM_CNT_ARITH = 0 + %MULARITH_CNT_ARITH + %DIVARITH_CNT_ARITH
CONST %SAVEMEM_CNT_KECCAK_F = 0 + %MULARITH_CNT_KECCAK_F + %DIVARITH_CNT_KECCAK_F
CONST %SAVEMEM_CNT_MEM_ALIGN = 0 + %MULARITH_CNT_MEM_ALIGN + %DIVARITH_CNT_MEM_ALIGN
CONST %SAVEMEM_CNT_PADDING_PG = 0 + %MULARITH_CNT_PADDING_PG + %DIVARITH_CNT_PADDING_PG
CONST %SAVEMEM_CNT_POSEIDON_G = 0 + %MULARITH_CNT_POSEIDON_G + %DIVARITH_CNT_POSEIDON_G
;addBatchHash
CONST %ADDBATCHHASH_STEP = 10 + %SHRARITH_STEP
CONST %ADDBATCHHASH_CNT_BINARY = 155
CONST %ADDBATCHHASH_CNT_BINARY = 186
CONST %ADDBATCHHASH_CNT_ARITH = 31
CONST %ADDBATCHHASH_CNT_KECCAK_F = 0 + %SHRARITH_CNT_KECCAK_F
CONST %ADDBATCHHASH_CNT_MEM_ALIGN = 0 + %SHRARITH_CNT_MEM_ALIGN
Expand Down
2 changes: 1 addition & 1 deletion counters/tests/MLOADX.zkasm
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ operation:
:CALL(MLOADX)

%MLOADX_STEP - STEP :JMPN(failedCounters)
5 - CNT_BINARY :JMPNZ(failedCounters)
3 - CNT_BINARY :JMPNZ(failedCounters)
;%MLOADX_CNT_BINARY - CNT_BINARY :JMPNZ(failedCounters)
3 - CNT_ARITH :JMPNZ(failedCounters)
;%MLOADX_CNT_ARITH - CNT_ARITH :JMPNZ(failedCounters)
Expand Down
4 changes: 2 additions & 2 deletions counters/tests/MSTOREX.zkasm
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@ operation:
:CALL(MSTOREX)

%MSTOREX_STEP - STEP:JMPN(failedCounters)
12 - CNT_BINARY :JMPNZ(failedCounters)
0 - CNT_BINARY :JMPNZ(failedCounters)
;%MSTOREX_CNT_BINARY - CNT_BINARY :JMPNZ(failedCounters)
7 - CNT_ARITH :JMPNZ(failedCounters)
0 - CNT_ARITH :JMPNZ(failedCounters)
;%MSTOREX_CNT_ARITH - CNT_ARITH :JMPNZ(failedCounters)
%MSTOREX_CNT_KECCAK_F - CNT_KECCAK_F :JMPNZ(failedCounters)
%MSTOREX_CNT_MEM_ALIGN - CNT_MEM_ALIGN :JMPNZ(failedCounters)
Expand Down
2 changes: 1 addition & 1 deletion counters/tests/expAD.zkasm
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ operation:
%EXPAD_STEP + 300 - STEP:JMPN(failedCounters)
23 - CNT_BINARY :JMPNZ(failedCounters)
;%EXPAD_CNT_BINARY - CNT_BINARY :JMPNZ(failedCounters)
5 - CNT_ARITH :JMPNZ(failedCounters)
3 - CNT_ARITH :JMPNZ(failedCounters)
;%EXPAD_CNT_ARITH - CNT_ARITH :JMPNZ(failedCounters)
%EXPAD_CNT_KECCAK_F - CNT_KECCAK_F :JMPNZ(failedCounters)
%EXPAD_CNT_MEM_ALIGN - CNT_MEM_ALIGN :JMPNZ(failedCounters)
Expand Down
12 changes: 6 additions & 6 deletions counters/tests/getLenBits.zkasm
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,12 @@ operation:
80 => C
:CALL(getLenBits)
%GETLENBITS_STEP + %DIVARITH_STEP*C - STEP:JMPN(failedCounters)
%GETLENBITS_CNT_BINARY + %DIVARITH_CNT_BINARY*C + C - CNT_BINARY :JMPNZ(failedCounters)
%GETLENBITS_CNT_ARITH + %DIVARITH_CNT_ARITH*C - 1 - CNT_ARITH :JMPNZ(failedCounters)
%GETLENBITS_CNT_KECCAK_F + %DIVARITH_CNT_KECCAK_F*C - CNT_KECCAK_F :JMPNZ(failedCounters)
%GETLENBITS_CNT_MEM_ALIGN + %DIVARITH_CNT_MEM_ALIGN*C - CNT_MEM_ALIGN :JMPNZ(failedCounters)
%GETLENBITS_CNT_PADDING_PG + %DIVARITH_CNT_PADDING_PG*C - CNT_PADDING_PG :JMPNZ(failedCounters)
%GETLENBITS_CNT_POSEIDON_G + %DIVARITH_CNT_POSEIDON_G*C - CNT_POSEIDON_G :JMPNZ(failedCounters)
%GETLENBITS_CNT_BINARY - CNT_BINARY :JMPNZ(failedCounters)
%GETLENBITS_CNT_ARITH - CNT_ARITH :JMPNZ(failedCounters)
%GETLENBITS_CNT_KECCAK_F - CNT_KECCAK_F :JMPNZ(failedCounters)
%GETLENBITS_CNT_MEM_ALIGN - CNT_MEM_ALIGN :JMPNZ(failedCounters)
%GETLENBITS_CNT_PADDING_PG - CNT_PADDING_PG :JMPNZ(failedCounters)
%GETLENBITS_CNT_POSEIDON_G - CNT_POSEIDON_G :JMPNZ(failedCounters)

0 => A,B,C,D,E,CTX, SP, PC, GAS, SR, HASHPOS, RR ; Set all registers to 0
finalizeExecution:
Expand Down
14 changes: 7 additions & 7 deletions counters/tests/getLenBytes.zkasm
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,15 @@ operation:
0xFFFFFFFFFFFFFFFFFFFFn => B
19 => C
:CALL(getLenBytes)
%GETLENBYTES_STEP + %SHRARITH_STEP*C - STEP:JMPN(failedCounters)
%GETLENBYTES_CNT_BINARY + 60 - CNT_BINARY :JMPNZ(failedCounters)
%GETLENBYTES_STEP - STEP:JMPN(failedCounters)
%GETLENBYTES_CNT_BINARY - CNT_BINARY :JMPNZ(failedCounters)
;%GETLENBYTES_CNT_BINARY + %SHRARITH_CNT_BINARY*C + C + 1 - CNT_BINARY :JMPNZ(failedCounters)
%GETLENBYTES_CNT_ARITH + 19 - CNT_ARITH :JMPNZ(failedCounters)
%GETLENBYTES_CNT_ARITH - CNT_ARITH :JMPNZ(failedCounters)
;%GETLENBYTES_CNT_ARITH + %SHRARITH_CNT_ARITH*C - CNT_ARITH :JMPNZ(failedCounters)
%GETLENBYTES_CNT_KECCAK_F + %SHRARITH_CNT_KECCAK_F*C - CNT_KECCAK_F :JMPNZ(failedCounters)
%GETLENBYTES_CNT_MEM_ALIGN + %SHRARITH_CNT_MEM_ALIGN*C - CNT_MEM_ALIGN :JMPNZ(failedCounters)
%GETLENBYTES_CNT_PADDING_PG + %SHRARITH_CNT_PADDING_PG*C - CNT_PADDING_PG :JMPNZ(failedCounters)
%GETLENBYTES_CNT_POSEIDON_G + %SHRARITH_CNT_POSEIDON_G*C - CNT_POSEIDON_G :JMPNZ(failedCounters)
%GETLENBYTES_CNT_KECCAK_F - CNT_KECCAK_F :JMPNZ(failedCounters)
%GETLENBYTES_CNT_MEM_ALIGN - CNT_MEM_ALIGN :JMPNZ(failedCounters)
%GETLENBYTES_CNT_PADDING_PG - CNT_PADDING_PG :JMPNZ(failedCounters)
%GETLENBYTES_CNT_POSEIDON_G - CNT_POSEIDON_G :JMPNZ(failedCounters)

0 => A,B,C,D,E,CTX, SP, PC, GAS, SR, HASHPOS, RR ; Set all registers to 0
finalizeExecution:
Expand Down
7 changes: 0 additions & 7 deletions counters/tests/opCREATE2.zkasm
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,6 @@ operation:
1000 :MSTORE(SP++)
:JMP(opCREATE2)
checkCounters:
%OPCREATE2_STEP - STEP:JMPN(failedCounters)
%OPCREATE2_CNT_BINARY - CNT_BINARY :JMPNZ(failedCounters)
%OPCREATE2_CNT_ARITH - CNT_ARITH :JMPNZ(failedCounters)
%OPCREATE2_CNT_KECCAK_F - CNT_KECCAK_F :JMPNZ(failedCounters)
%OPCREATE2_CNT_MEM_ALIGN - CNT_MEM_ALIGN :JMPNZ(failedCounters)
%OPCREATE2_CNT_PADDING_PG - CNT_PADDING_PG :JMPNZ(failedCounters)
%OPCREATE2_CNT_POSEIDON_G - CNT_POSEIDON_G :JMPNZ(failedCounters)

0 => A,B,C,D,E,CTX, SP, PC, GAS, SR, HASHPOS, RR ; Set all registers to 0
finalizeExecution:
Expand Down
4 changes: 2 additions & 2 deletions counters/tests/opEXP.zkasm
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ operation:
:JMP(opEXP)
checkCounters:
400 - STEP:JMPN(failedCounters)
29 - CNT_BINARY :JMPNZ(failedCounters)
30 - CNT_BINARY :JMPNZ(failedCounters)
;%OPEXP_CNT_BINARY - CNT_BINARY :JMPNZ(failedCounters)
6 - CNT_ARITH :JMPNZ(failedCounters)
4 - CNT_ARITH :JMPNZ(failedCounters)
;%OPEXP_CNT_ARITH - CNT_ARITH :JMPNZ(failedCounters)
%OPEXP_CNT_KECCAK_F - CNT_KECCAK_F :JMPNZ(failedCounters)
%OPEXP_CNT_MEM_ALIGN - CNT_MEM_ALIGN :JMPNZ(failedCounters)
Expand Down
2 changes: 0 additions & 2 deletions main/l2-tx-hash.zkasm
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,6 @@ addL2HashTx:
;; Write 1 byte to l2TxHash: flag deployment = 1 ('0': no deployment transaction, '1': deployment transaction)
addL2HashTx_isDeploy:
; store temporary register values
A :MSTORE(tmpVar_A_L2HashTx)
E :MSTORE(tmpVar_E_L2HashTx)
HASHPOS :MSTORE(tmpVar_HASHPOS_L2HashTx)

Expand All @@ -76,7 +75,6 @@ addL2HashTx_isDeploy:
HASHPOS :MSTORE(l2HASHP)

; load temporary register values
$ => A :MLOAD(tmpVar_A_L2HashTx)
$ => E :MLOAD(tmpVar_E_L2HashTx)
$ => HASHPOS :MLOAD(tmpVar_HASHPOS_L2HashTx), RETURN

Expand Down
16 changes: 8 additions & 8 deletions main/load-change-l2-block.zkasm
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,16 @@ decodeChangeL2BlockTx:
%DELTA_TIMESTAMP_NUM_BYTES => D :CALL(getChangeL2TxBytes)
C + D => C
A :MSTORE(deltaTimestamp)

; Decode indexL1InfoTree / 4 bytes
%INDEX_L1INFOTREE_NUM_BYTES => D :CALL(getChangeL2TxBytes)
C + D => C
A :MSTORE(indexL1InfoTree)
1 :MSTORE(isChangeL2BlockTx), JMP(finishLoadChangeL2BlockTx)
1 :MSTORE(isChangeL2BlockTx)

finishLoadChangeL2BlockTx:
;; update bytes parsed
$ => A :MLOAD(batchL2DataParsed)
A + C :MSTORE(batchL2DataParsed)
;; increase number of transaction to process
$ => A :MLOAD(pendingTxs)
A + 1 :MSTORE(pendingTxs), JMP(txLoopRLP)
; update bytes parsed
$ => A :MLOAD(batchL2DataParsed)
A + C :MSTORE(batchL2DataParsed)
; increase number of transaction to process
$ => A :MLOAD(pendingTxs)
A + 1 :MSTORE(pendingTxs), JMP(txLoopRLP)
2 changes: 1 addition & 1 deletion main/modexp/modexp_utils.zkasm
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ modexp_saveModLen:
; if last value == 0 --> modexp_saveModLen
$ :EQ,JMPC(modexp_saveModLen)
; else Mlen == modExpArrayIndex + 1
E + 1 :MSTORE(modexp_Mlen),JMP(modexp_getReturn)
E + 1 :MSTORE(modexp_Mlen)

modexp_getReturn:
$ => RR :MLOAD(tmpZkPCmodexp)
Expand Down
Loading
Loading