Skip to content

Commit

Permalink
Merge pull request #305 from 0xPolygonHermez/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
krlosMata authored Sep 20, 2023
2 parents 23189df + 7ea4356 commit c17c166
Show file tree
Hide file tree
Showing 44 changed files with 986 additions and 754 deletions.
3 changes: 1 addition & 2 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,9 @@ module.exports = {
'class-methods-use-this': [0],
'no-bitwise': [0],
'no-param-reassign': 'off',
'no-console': [2, { allow: ['warn', 'error'] }],
'no-console': 'off',
'import/prefer-default-export': [0],
'lines-between-class-members': ['error', 'always', { exceptAfterSingleLine: true }],
'multiline-comment-style': 'error',
'no-await-in-loop': 'off',
'newline-before-return': 'error',
},
Expand Down
14 changes: 14 additions & 0 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# global owner
* @krlosMata @laisolizq @invocamanman @ignasirv

# ecrecover owner
/main/ecrecover @zkronos73 @krlosMata

# counters folder owner
/counters/ @ignasirv @krlosMata

# tests owner
/test/ @laisolizq @krlosMata

# tools owner
/tools/ @laisolizq @krlosMata
38 changes: 38 additions & 0 deletions .github/ISSUE_TEMPLATE/bug.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: Bug Report
description: File a bug report
title: "[Bug]: "
labels: ["bug"]
assignees: [krlosMata, laisolizq, invocamanman, ignasirv]
body:
- type: markdown
attributes:
value: |
Fill in all necessary information to report a bug
- type: input
id: version
attributes:
label: Version
description: What version are you using ?
placeholder: 'ex: v1.0.0'
validations:
required: true
- type: textarea
id: description
attributes:
label: Description
description: Explain the bug found and the expected result
validations:
required: true
- type: textarea
id: steps
attributes:
label: Steps to reproduce
description: Please share detailed information about ho to reproduce the bug
validations:
required: true
- type: textarea
id: logs
attributes:
label: Relevant log
description: Please copy and paste any relevant log output
render: shell
26 changes: 26 additions & 0 deletions .github/ISSUE_TEMPLATE/feature.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: Feature Request
description: File a bug report
title: "[Feature]: "
labels: ["feature"]
assignees:
- krlosMata
body:
- type: markdown
attributes:
value: |
Fill in all necessary information to request a feature
- type: input
id: version
attributes:
label: Version
description: What version the features should be added ?
placeholder: 'ex: v1.0.0'
validations:
required: true
- type: textarea
id: description
attributes:
label: Description
description: Explain the feature
validations:
required: true
26 changes: 26 additions & 0 deletions .github/ISSUE_TEMPLATE/question.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: Question
description: Submit a question
title: "[Question]: "
labels: ["question"]
assignees:
- krlosMata
body:
- type: markdown
attributes:
value: |
Fill in all necessary information to submit a question
- type: input
id: version
attributes:
label: Version
description: What version the question is refering to ?
placeholder: 'ex: v1.0.0'
validations:
required: true
- type: textarea
id: question
attributes:
label: Description
description: Explain the question
validations:
required: true
3 changes: 3 additions & 0 deletions .github/workflows/main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@ jobs:
- name: run counters tests
run: |
npm run test:counters
- name: run zkasm tests
run: |
npm run test:zkasm
- name: Generate tests
run: |
npm run test:gen
Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -73,3 +73,5 @@ build
# testvectors files
tools/parallel-tests


.vscode/launch.json
Binary file added audits/zkEVM-ROM-upgrade-1-Spearbit-30-May.pdf
Binary file not shown.
Binary file not shown.
Binary file added audits/zkEVM-engagement-3-Spearbit-6-April.pdf
Binary file not shown.
47 changes: 20 additions & 27 deletions counters/countersConstants.zkasm
Original file line number Diff line number Diff line change
Expand Up @@ -70,14 +70,7 @@ CONST %ABS_CNT_KECCAK_F = 0
CONST %ABS_CNT_MEM_ALIGN = 0
CONST %ABS_CNT_PADDING_PG = 0
CONST %ABS_CNT_POSEIDON_G = 0
; copySP
CONST %COPYSP_STEP = 20 + %MLOADX_STEP
CONST %COPYSP_CNT_BINARY = 0 + %MLOADX_CNT_BINARY
CONST %COPYSP_CNT_ARITH = 0 + %MLOADX_CNT_ARITH
CONST %COPYSP_CNT_KECCAK_F = 0 + %MLOADX_CNT_KECCAK_F
CONST %COPYSP_CNT_MEM_ALIGN = 0 + %MLOADX_CNT_MEM_ALIGN
CONST %COPYSP_CNT_PADDING_PG = 0 + %MLOADX_CNT_PADDING_PG
CONST %COPYSP_CNT_POSEIDON_G = 0 + %MLOADX_CNT_POSEIDON_G

; mulARITH
CONST %MULARITH_STEP = 50
CONST %MULARITH_CNT_BINARY = 1
Expand Down Expand Up @@ -208,7 +201,7 @@ 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 = 2
CONST %OPCALLDATALOAD_CNT_BINARY = 3
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
Expand Down Expand Up @@ -248,34 +241,34 @@ 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 = 23
CONST %OPCREATE_CNT_ARITH = 4
CONST %OPCREATE_CNT_BINARY = 16
CONST %OPCREATE_CNT_ARITH = 1
CONST %OPCREATE_CNT_KECCAK_F = 0
CONST %OPCREATE_CNT_MEM_ALIGN = 2
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 = 500
CONST %OPCREATE2_CNT_BINARY = 29
CONST %OPCREATE2_CNT_ARITH = 5
CONST %OPCREATE2_CNT_BINARY = 22
CONST %OPCREATE2_CNT_ARITH = 2
CONST %OPCREATE2_CNT_KECCAK_F = 0
CONST %OPCREATE2_CNT_MEM_ALIGN = 2
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 = 34
CONST %OPCALL_CNT_ARITH = 6
CONST %OPCALL_CNT_BINARY = 27
CONST %OPCALL_CNT_ARITH = 3
CONST %OPCALL_CNT_KECCAK_F = 0
CONST %OPCALL_CNT_MEM_ALIGN = 2
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 = 33
CONST %OPCALLCODE_CNT_ARITH = 6
CONST %OPCALLCODE_CNT_BINARY = 26
CONST %OPCALLCODE_CNT_ARITH = 3
CONST %OPCALLCODE_CNT_KECCAK_F = 0
CONST %OPCALLCODE_CNT_MEM_ALIGN = 2
CONST %OPCALLCODE_CNT_MEM_ALIGN = 0
CONST %OPCALLCODE_CNT_PADDING_PG = 0
CONST %OPCALLCODE_CNT_POSEIDON_G = 10
; opRETURN - COMPLEX - hardcoded values at test
Expand All @@ -296,18 +289,18 @@ 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 = 30
CONST %OPDELEGATECALL_CNT_ARITH = 6
CONST %OPDELEGATECALL_CNT_BINARY = 23
CONST %OPDELEGATECALL_CNT_ARITH = 3
CONST %OPDELEGATECALL_CNT_KECCAK_F = 0
CONST %OPDELEGATECALL_CNT_MEM_ALIGN = 2
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 = 30
CONST %OPSTATICCALL_CNT_ARITH = 6
CONST %OPSTATICCALL_CNT_BINARY = 23
CONST %OPSTATICCALL_CNT_ARITH = 3
CONST %OPSTATICCALL_CNT_KECCAK_F = 0
CONST %OPSTATICCALL_CNT_MEM_ALIGN = 2
CONST %OPSTATICCALL_CNT_MEM_ALIGN = 0
CONST %OPSTATICCALL_CNT_PADDING_PG = 0
CONST %OPSTATICCALL_CNT_POSEIDON_G = 6
; opSHA3 - COMPLEX - hardcoded values at test
Expand Down
38 changes: 0 additions & 38 deletions counters/tests/copySP.zkasm

This file was deleted.

5 changes: 3 additions & 2 deletions main/constants.zkasm
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
; ZK_EVM
CONSTL %ADDRESS_GLOBAL_EXIT_ROOT_MANAGER_L2 = 0xa40D5f56745a118D0906a34E69aeC8C0Db1cB8fAn
CONSTL %ADDRESS_SYSTEM = 0x000000000000000000000000000000005ca1ab1en
CONST %CALLDATA_OFFSET = 1024
CONST %MAX_STACK_SIZE = 1024
CONST %BATCH_DIFFICULTY = 0
CONST %TX_GAS_LIMIT = 30000000
CONST %GLOBAL_EXIT_ROOT_STORAGE_POS = 0
CONST %LOCAL_EXIT_ROOT_STORAGE_POS = 1
CONST %LAST_TX_STORAGE_POS = 0
CONST %STATE_ROOT_STORAGE_POS = 1
CONST %MAX_MEM_EXPANSION_BYTES = 0x3fffe0
CONST %FORK_ID = 4
CONST %FORK_ID = 5
CONST %CALLDATA_RESERVED_CTX = 1

; RLP
CONST %MIN_VALUE_SHORT = 128
Expand Down
2 changes: 1 addition & 1 deletion main/ecrecover/ecrecover.zkasm
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ ecrecover_store_args:
0n => A
$ :EQ,JMPC(ecrecover_s_is_zero)

; r and s in [1, FNEC-1]
; compute r inverse
$ => A :MLOAD(ecrecover_r),CALL(invFnEc)
B :MSTORE(ecrecover_r_inv)

Expand Down
Loading

0 comments on commit c17c166

Please sign in to comment.