Skip to content

Commit

Permalink
Merge branch 'develop-feijoa' into feature/ecrecover-ref-optz-copy
Browse files Browse the repository at this point in the history
  • Loading branch information
hecmas authored Mar 22, 2024
2 parents 117d955 + cbc754f commit 0a90e9c
Show file tree
Hide file tree
Showing 30 changed files with 1,664 additions and 1,069 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,13 @@ 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
- name: Generate tests
run: |
node tools/parallel-testing/gen-parallel-tests.js
node tools/parallel-testing/gen-parallel-tests.js --skipVCounters
- name: Run tests
run: |
export NUM_CPUS=31
Expand Down
31 changes: 0 additions & 31 deletions counters/tests/addBatchHashByteByByte.zkasm

This file was deleted.

3 changes: 2 additions & 1 deletion counters/tests/opBLOCKHASH.zkasm
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ start:
1000000 => GAS

operation:
2 :HASHK1(0)
0 => E
2 :HASHK1(E)
10 :MSTORE(blockNum)
1 :MSTORE(SP++)
:JMP(opBLOCKHASH)
Expand Down
3 changes: 2 additions & 1 deletion counters/tests/opSHA3.zkasm
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ start:
1000000 => GAS

operation:
2 :HASHK1(0)
0 => E
2 :HASHK1(E)
2000 :MSTORE(SP++)
100 :MSTORE(SP++)
:JMP(opSHA3)
Expand Down
2 changes: 1 addition & 1 deletion main/constants.zkasm
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ CONST %BATCH_DIFFICULTY = 0
CONST %TX_GAS_LIMIT = 30000000
CONSTL %BLOCK_GAS_LIMIT = 2**50
CONST %MAX_MEM_EXPANSION_BYTES = 0x3fffe0
CONST %FORK_ID = 8
CONST %FORK_ID = 9
CONST %L1INFO_TREE_LEVELS = 32
CONST %CALLDATA_RESERVED_CTX = 1
CONSTL %FOUR_GOLDILOCKS = 0xffffffff00000001ffffffff00000001ffffffff00000001ffffffff00000001n
Expand Down
7 changes: 3 additions & 4 deletions main/ecrecover/ecrecover.zkasm
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,7 @@ ecrecover_store_args:
%MAX_CNT_ARITH - CNT_ARITH - 1100 :JMPN(outOfCountersArith)
%MAX_CNT_STEPS - STEP - 6400 :JMPN(outOfCountersStep)

$ => A :MLOAD(cntKeccakPreProcess)
%MAX_CNT_KECCAK_F - CNT_KECCAK_F - A - 1 :JMPN(outOfCountersKeccak)
%MAX_CNT_KECCAK_F - CNT_KECCAK_F - 1 :JMPN(outOfCountersKeccak)

; save RR to call return at end of routine
RR :MSTORE(ecrecover_RR)
Expand Down Expand Up @@ -216,8 +215,8 @@ k1_calculated:
; [steps: 6368, bin: 16, arith: 527]

; generate keccak of public key to obtain ethereum address
$ => E :MLOAD(lastHashKIdUsed)
E + 1 => E :MSTORE(lastHashKIdUsed)
$ => E :MLOAD(nextHashKId)
E + 1 :MSTORE(nextHashKId)
0 => HASHPOS
32 => D

Expand Down
4 changes: 2 additions & 2 deletions main/end.zkasm
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
finalWait:
${beforeLast()} :JMPN(finalWait)
; Set all registers to 0 except inputs: B (oldStateRoot), C (oldAccInputHash), SP (oldNumBatch), GAS (chainID) & CTX (forkID)
0 => A, D, E, PC, SR, HASHPOS, RR, RCX :JMP(start)
; Set registers to its initials values
$ => SR :RESTORE, JMP(start)
9 changes: 6 additions & 3 deletions main/load-change-l2-block-utils.zkasm
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ getChangeL2TxBytes:
$ => A :MLOAD(batchL2DataLength)
$ => B :MLOAD(batchL2DataParsed)
A - B - C - D :JMPN(invalidDecodeChangeL2Block)
${getTxs(p,D)} => A
$${p = p + D}
:RETURN
$ => E :MLOAD(batchHashDataPointer)
$ => HASHPOS :MLOAD(batchHashPos)
$ => A :HASHP(E)
HASHPOS :MSTORE(batchHashPos)
C => HASHPOS
$ => E :MLOAD(txHashPointer), RETURN
4 changes: 2 additions & 2 deletions main/load-change-l2-block.zkasm
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@ decodeChangeL2BlockTx:

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

Expand Down
Loading

0 comments on commit 0a90e9c

Please sign in to comment.