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

Comments comparison opcodes #176

Merged
merged 3 commits into from
Nov 28, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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: 3 additions & 1 deletion main/constants.zkasm
Original file line number Diff line number Diff line change
Expand Up @@ -38,5 +38,7 @@ CONST %MAX_CNT_KECCAK_F = (%MAX_CNT_STEPS / 158418) * 9
CONST %MAX_CNT_PADDING_PG = (%MAX_CNT_STEPS / 56)
CONST %MAX_CNT_POSEIDON_G = (%MAX_CNT_STEPS / 30)
CONST %MIN_CNT_KECCAK_BATCH = 1 ; minimum necessary keccaks to compute global hash

; ETHEREUM CONSTANTS
CONSTL %MAX_NONCE = 0xffffffffffffffffn
CONSTL %MAX_NONCE = 0xffffffffffffffffn
CONSTL %MAX_UINT_256 = 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffn
2 changes: 1 addition & 1 deletion main/map-opcodes.zkasm
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
INCLUDE "opcodes/arithmetic.zkasm"
INCLUDE "opcodes/block.zkasm"
INCLUDE "opcodes/comparision.zkasm"
INCLUDE "opcodes/comparison.zkasm"
INCLUDE "opcodes/context-information.zkasm"
INCLUDE "opcodes/create-terminate-context.zkasm"
INCLUDE "opcodes/crypto.zkasm"
Expand Down
9 changes: 4 additions & 5 deletions main/opcodes/arithmetic.zkasm
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ opADD:
$ => A :MLOAD(SP--) ; [a => A]
$ => B :MLOAD(SP) ; [b => B]

; call arith state machine and push to the stack
$ :ADD, MSTORE(SP++) ; [a + b => SP]
; call binary:add state machine and push to the stack
$ :ADD, MSTORE(SP++)

; continue read bytecode
:JMP(readCode)
Expand Down Expand Up @@ -252,7 +252,7 @@ opMULMOD:
C :MSTORE(SP++)
:JMP(readCode)

opEXP: ; //TODO: test exp == 0
opEXP:

%MAX_CNT_BINARY - CNT_BINARY - 5 :JMPN(outOfCountersBinary)
%MAX_CNT_STEPS - STEP - 120 :JMPN(outOfCountersStep)
Expand Down Expand Up @@ -280,7 +280,6 @@ opSIGNEXTEND: ; following this impl https://github.com/ethereumjs/ethereumjs-mon
$ => D :MLOAD(SP) ; number to convert
30 => A
$ :LT, JMPC(opSIGNEXTENDEnd); if signByte is 31 or more, means basically let the number as it is
; TODO we could divide this opcode in a table with constants, only 31 cases
B * 8 + 7 => D ; B is less than 31, no need for binary
D*2 => RR
zkPC+2 :MSTORE(tmpSHXZkPC)
Expand All @@ -297,7 +296,7 @@ opSIGNEXTEND: ; following this impl https://github.com/ethereumjs/ethereumjs-mon
0 => A
$ :EQ, JMPC(opSIGNEXTENDPositive) ; If 0 means the sign bit was 0 --> positive
C => A ; mask
0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffn => B
%MAX_UINT_256 => B
$ => B :XOR ; not mask
D => A
$ => D :OR
Expand Down
234 changes: 0 additions & 234 deletions main/opcodes/comparision.zkasm

This file was deleted.

Loading