Skip to content

Commit

Permalink
Uncomment zkasm tests
Browse files Browse the repository at this point in the history
  • Loading branch information
ignasirv committed Feb 11, 2024
1 parent 39ee638 commit 2f90241
Show file tree
Hide file tree
Showing 8 changed files with 52 additions and 52 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,10 @@ jobs:
npm run test:build:gasLimit:v3
- name: run counters tests
run: |
# npm run test:counters
npm run test:counters
- name: run zkasm tests
run: |
# npm run test:zkasm
npm run test:zkasm
- name: Generate tests
run: |
npm run test:gen
Expand Down
62 changes: 31 additions & 31 deletions counters/countersConstants.zkasm
Original file line number Diff line number Diff line change
Expand Up @@ -32,15 +32,15 @@ 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 Down Expand Up @@ -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 @@ -209,10 +209,10 @@ CONST %OPCALLDATALOAD_CNT_PADDING_PG = 0 + %SHLARITH_CNT_PADDING_PG + %SHRARITH_
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 = 16
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,23 +225,23 @@ 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 = 55
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 = 59
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 = 13
CONST %OPCREATE_CNT_BINARY = 14
CONST %OPCREATE_CNT_ARITH = 1
CONST %OPCREATE_CNT_KECCAK_F = 0
CONST %OPCREATE_CNT_MEM_ALIGN = 0
Expand All @@ -257,63 +257,63 @@ 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 = 22
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 = 21
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 = 25
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 = 25
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 = 18
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 = 18
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 = 81
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 Down Expand Up @@ -353,7 +353,7 @@ CONST %SAVEMEM_CNT_PADDING_PG = 0 + %MULARITH_CNT_PADDING_PG + %DIVARITH_CNT_PAD
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)
4 - 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)
11 - 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
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

0 comments on commit 2f90241

Please sign in to comment.