Skip to content

Commit

Permalink
Merge pull request #233 from 0xPolygonHermez/feature/check-256bits
Browse files Browse the repository at this point in the history
Feature/check 256bits
  • Loading branch information
krlosMata authored Jan 20, 2023
2 parents 0b2d675 + a872673 commit e5d2e12
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 8 deletions.
6 changes: 3 additions & 3 deletions counters/tests/addBatchHashByteByByte.zkasm
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@ operation:
;@in: A: bytes to add
;@in D: bytes length
12 => A
80 => D
31 => D
:CALL(addBatchHashByteByByte)

%ADDBATCHHASH_STEP*D - STEP:JMPN(failedCounters)
305 - CNT_BINARY :JMPNZ(failedCounters)
155 - CNT_BINARY :JMPNZ(failedCounters)
;%ADDBATCHHASH_CNT_BINARY*D + D - CNT_BINARY :JMPNZ(failedCounters)
81 - CNT_ARITH :JMPNZ(failedCounters)
31 - CNT_ARITH :JMPNZ(failedCounters)
;%ADDBATCHHASH_CNT_ARITH*D - CNT_ARITH :JMPNZ(failedCounters)
%ADDBATCHHASH_CNT_KECCAK_F - CNT_KECCAK_F :JMPNZ(failedCounters)
%ADDBATCHHASH_CNT_MEM_ALIGN - CNT_MEM_ALIGN :JMPNZ(failedCounters)
Expand Down
11 changes: 7 additions & 4 deletions main/opcodes/calldata-returndata-code.zkasm
Original file line number Diff line number Diff line change
Expand Up @@ -284,7 +284,8 @@ opCODECOPY:
C :MSTORE(lastMemOffset)
; store lastMemLength for memory expansion gas cost
E :MSTORE(lastMemLength)

; compute memory expansion gas cost
:CALL(saveMem); in: [lastMemOffset, lastMemLength]
; check out-of-gas
GAS - %GAS_FASTEST_STEP => GAS :JMPN(outOfGas)
;${3*((E+31)/32)}
Expand All @@ -301,8 +302,7 @@ opCODECOPY:

GAS - A => GAS :JMPN(outOfGas)

; compute memory expansion gas cost
:CALL(saveMem); in: [lastMemOffset, lastMemLength]

; if offset is above data len, length => offset
D => A
$ => B :MLOAD(bytecodeLength)
Expand Down Expand Up @@ -618,7 +618,10 @@ opRETURNDATACOPYfinal:

opRETURNDATACOPYEmpty:
; offset return data + len return data must be 0
E + C => B
E => A
C => B
$ => B :ADD, JMPC(outOfGas)
0 => A
$ :EQ, JMPC(readCode, outOfGas)

/**
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
"yargs": "^17.5.1"
},
"devDependencies": {
"@0xpolygonhermez/zkevm-proverjs": "github:0xPolygonHermez/zkevm-proverjs#a5584acbcfef38924c52d5788d326da3cec623dc",
"@0xpolygonhermez/zkevm-proverjs": "github:0xPolygonHermez/zkevm-proverjs#develop",
"@0xpolygonhermez/zkevm-testvectors": "github:0xPolygonHermez/zkevm-testvectors#develop",
"chai": "^4.3.6",
"chalk": "^3.0.0",
Expand Down

0 comments on commit e5d2e12

Please sign in to comment.