Skip to content

MXP redesign #625

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

Open
wants to merge 63 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
63 commits
Select commit Hold shift + click to select a range
b707770
feat: file structure
OlivierBBB Mar 21, 2025
b50c1af
feat: common columns
OlivierBBB Mar 22, 2025
080f806
feat: decoder columns
OlivierBBB Mar 22, 2025
1ff1f3e
feat: macro columns
OlivierBBB Mar 22, 2025
91a335b
feat: scenario columns + shorthands
OlivierBBB Mar 22, 2025
1e128e2
feat: computation columns + module call macros
OlivierBBB Mar 22, 2025
be08f06
feat: some generalities/
OlivierBBB Mar 22, 2025
2544eee
feat: generalities/heartbeat constraints
OlivierBBB Mar 22, 2025
60f5df0
feat: generalities/perspectives constraints
OlivierBBB Mar 22, 2025
039c693
ras
OlivierBBB Mar 22, 2025
e31d36e
feat: make it compile
OlivierBBB Mar 22, 2025
a215f63
feat: computations/generalities constraints
OlivierBBB Mar 22, 2025
d07abd7
ras: reorganizing constants / shorthands ...
OlivierBBB Mar 22, 2025
bc9e3be
feat: computations/generalities and msize
OlivierBBB Mar 22, 2025
b2813fe
feat: computations/non_msize constraints
OlivierBBB Mar 22, 2025
e86a28c
feat: computations/not_msize_nor_trivial constraints
OlivierBBB Mar 22, 2025
ed78461
feat: computations/state_update constraints
OlivierBBB Mar 22, 2025
d759c11
feat: computations/state_update_word_pricing
OlivierBBB Mar 23, 2025
a973fc8
feat: computations/state_update_byte_pricing
OlivierBBB Mar 23, 2025
f806bc1
feat: make it compile
OlivierBBB Mar 24, 2025
5ff1078
feat: consistency arguments
OlivierBBB Mar 24, 2025
1958222
feat: new columns in the instruction decoder
OlivierBBB Mar 24, 2025
d6fd41e
ras: debug.bin now requires reference tables
OlivierBBB Mar 24, 2025
3f20381
feat: remove IS_CALL column from MXP module
OlivierBBB Mar 24, 2025
e01f9b1
ras
OlivierBBB Mar 24, 2025
2b5f9a5
feat: MXP into EUC lookup
OlivierBBB Mar 24, 2025
8e62ab0
feat: MXP into WCP lookup
OlivierBBB Mar 24, 2025
504ba39
feat: MXP into ID lookup
OlivierBBB Mar 24, 2025
51fbc69
ras: make it compile again
OlivierBBB Mar 24, 2025
5a2b692
feat: added `(wcp-call-to-LEQ ...)` to MXP module
OlivierBBB Mar 29, 2025
3d687c8
feat: LT -> LEQ for comparisons against MXPX_THRESHOLD
OlivierBBB Mar 29, 2025
e2d7666
fix: make compile + noop in MSIZE case is debug
OlivierBBB Mar 29, 2025
6d50192
renamed mxp_v3 to mxp and old mxp to mxp_v2 and substituted force-boo…
lorenzogentile404 Apr 4, 2025
3ce5433
added MCOPY bytecode
lorenzogentile404 Apr 22, 2025
9bfc1cc
add mxp previous design columns and consts
amkCha May 5, 2025
e1a8e36
feat: merge mxp and mxp_v2 into one folder and rename
amkCha May 7, 2025
badf7bd
feat: add EVM_FORK constants
amkCha May 13, 2025
3a9f378
add conditional in module mxp
amkCha May 13, 2025
459c75a
fix constraints with go-corset 1.1.4
amkCha May 13, 2025
9c2b775
feat: updated instruction decoder
OlivierBBB May 14, 2025
a829fc8
feat: remove IS_MXP_INSTRUCTION from MXP and ID
OlivierBBB May 14, 2025
ec776a3
feat: adding MCOPY_FLAG to hub/stack perspective
OlivierBBB May 14, 2025
39524de
feat: new MXP instructions from HUB pov
OlivierBBB May 14, 2025
95c10ef
ras: splitting of the stack patterns
OlivierBBB May 14, 2025
459c050
feat: instruction handling for MCOPY
OlivierBBB May 14, 2025
d676791
feat: old and new instruction decoder
OlivierBBB May 14, 2025
66d2d36
fix: typos
OlivierBBB May 14, 2025
2cf3717
feat: ras
OlivierBBB May 14, 2025
a398824
feat: fully remove T4MTNTOP columns and shorthands
OlivierBBB May 15, 2025
c9690c8
feat: adding FAMILY_MCOPY to inst_decoder_cancun
OlivierBBB May 15, 2025
b1acffc
feat: retire MXP instruction of TYPE_1 (for MSIZE opcode)
OlivierBBB May 15, 2025
72c3b5a
feat: retire MXP instruction of TYPE_5 (for CALL family)
OlivierBBB May 15, 2025
efb127f
feat: retire MXP instruction of TYPE_4 (for COPY family)
OlivierBBB May 15, 2025
ed7aff6
feat: retire MXP instruction of TYPE_4 (for CREATE family)
OlivierBBB May 15, 2025
c98107a
feat: retire MXP instruction of TYPE_4 (for RETURN opcode)
OlivierBBB May 15, 2025
2b73de2
feat: retire MXP instruction of TYPE_4 (for KEC family)
OlivierBBB May 15, 2025
3143831
feat: retire MXP instruction of TYPE_4 (for LOG family)
OlivierBBB May 15, 2025
2bcea23
feat: retire MXP instruction of TYPE_2/3 (for STACKRAM family)
OlivierBBB May 15, 2025
4b5f7ad
feat: duplicate + update lookup HUB -> MXP
OlivierBBB May 15, 2025
3594e3c
feat: retire MXP instruction of TYPE_4 (for REVERT opcode)
OlivierBBB May 15, 2025
52b0e40
ras: formatting for REVERT opcode
OlivierBBB May 15, 2025
fed1cf9
feat: remove deprecated TYPE_1/2/3/4/5 MXP instructions
OlivierBBB May 15, 2025
0f7629f
ras
OlivierBBB May 15, 2025
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
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
debug.bin
zkevm.bin
zkevm.go.bin
zkevm_for_reference_tests.bin
Expand Down
21 changes: 21 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,20 @@ MMIO := mmio

MXP := mxp

# mxp cancun version, while waiting for forks feat
# MXPCAN := $(wildcard mxp/mxpcan/columns/*.lisp) \
$(wildcard mxp/mxpcan/columns/computation/*.lisp) \
$(wildcard mxp/mxpcan/columns/scenario/*.lisp) \
$(wildcard mxp/mxpcan/computations/*.lisp) \
$(wildcard mxp/mxpcan/consistency/*.lisp) \
$(wildcard mxp/mxpcan/generalities/*.lisp) \
$(wildcard mxp/mxpcan/generalities/perspectives/*.lisp) \
$(wildcard mxp/mxpcan/lookups/*.lisp) \

# mxp london version, while waiting for forks feat
# MXPLON := $(wildcard mxp/mxplon/*.lisp) \
$(wildcard mxp/mxplon/lookups/*.lisp) \

OOB := oob

RLP_ADDR := rlpaddr
Expand Down Expand Up @@ -103,3 +117,10 @@ ZKEVM_MODULES := ${CONSTANTS} \

zkevm.bin: ${ZKEVM_MODULES}
${GO_CORSET_COMPILE} -o $@ ${ZKEVM_MODULES}

# for debugging purposes

DEBUGGING := ${CONSTANTS} ${WCP} ${EUC} ${TABLES}

debug.bin: ${DEBUGGING}
${GO_CORSET_COMPILE} -o $@ ${DEBUGGING}
17 changes: 14 additions & 3 deletions constants/constants.lisp
Original file line number Diff line number Diff line change
@@ -1,4 +1,16 @@
(defconst
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; EVM Forks ;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
EVM_LONDON 14
EVM_PARIS (+ 1 EVM_LONDON)
EVM_SHANGHAI (+ 2 EVM_LONDON)
EVM_CANCUN (+ 3 EVM_LONDON)
EVM_PRAGUE (+ 4 EVM_LONDON)
;; Default fork
(EVM_FORK :i8 :extern) EVM_LONDON
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; EVM INSTRUCTIONS ;;
Expand Down Expand Up @@ -74,6 +86,7 @@
EVM_INST_MSIZE 0x59
EVM_INST_GAS 0x5A
EVM_INST_JUMPDEST 0x5B
EVM_INST_MCOPY 0x5E
;; Push Operations
EVM_INST_PUSH0 0x5F ;; post Shanghai
EVM_INST_PUSH1 0x60
Expand Down Expand Up @@ -486,6 +499,4 @@
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
WCP_INST_GEQ 0x0E
WCP_INST_LEQ 0x0F)


WCP_INST_LEQ 0x0F)
1 change: 0 additions & 1 deletion hub/columns/miscellaneous.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@
( MXP_SIZE_2_LO :i128 )
( MXP_WORDS :i128 )
( MXP_GAS_MXP :i128 )
( MXP_MTNTOP :binary@prove )
( MXP_SIZE_1_NONZERO_NO_MXPX :binary@prove )
( MXP_SIZE_2_NONZERO_NO_MXPX :binary@prove )

Expand Down
1 change: 1 addition & 0 deletions hub/columns/stack.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
( CALL_FLAG :binary )
( CON_FLAG :binary )
( COPY_FLAG :binary )
( MCOPY_FLAG :binary )
( CREATE_FLAG :binary )
( DUP_FLAG :binary )
( EXT_FLAG :binary )
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,17 +82,17 @@

(defconstraint call-instruction---setting-MXP-instruction-parameters (:guard (call-instruction---standard-precondition))
(if-not-zero (shift misc/MXP_FLAG CALL_misc_row___row_offset)
(set-MXP-instruction-type-5 CALL_misc_row___row_offset ;; row offset kappa
(call-instruction---STACK-instruction) ;; instruction
(call-instruction---STACK-cdo-hi) ;; call data offset high
(call-instruction---STACK-cdo-lo) ;; call data offset low
(call-instruction---STACK-cds-hi) ;; call data size high
(call-instruction---STACK-cds-lo) ;; call data size low
(call-instruction---STACK-r@o-hi) ;; return at offset high
(call-instruction---STACK-r@o-lo) ;; return at offset low
(call-instruction---STACK-r@c-hi) ;; return at capacity high
(call-instruction---STACK-r@c-lo) ;; return at capacity low
)
(set-MXP-instruction---for-CALL-type CALL_misc_row___row_offset ;; row offset kappa
(call-instruction---STACK-instruction) ;; instruction
(call-instruction---STACK-cdo-hi) ;; call data offset high
(call-instruction---STACK-cdo-lo) ;; call data offset low
(call-instruction---STACK-cds-hi) ;; call data size high
(call-instruction---STACK-cds-lo) ;; call data size low
(call-instruction---STACK-r@o-hi) ;; return at offset high
(call-instruction---STACK-r@o-lo) ;; return at offset low
(call-instruction---STACK-r@c-hi) ;; return at capacity high
(call-instruction---STACK-r@c-lo) ;; return at capacity low
)
))

(defconstraint call-instruction---justifying-mxpx (:guard (call-instruction---standard-precondition))
Expand Down
16 changes: 8 additions & 8 deletions hub/constraints/instruction-handling/copy/generalities.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@

(defun (copy-instruction---trigger_OOB) (copy-instruction---is-RETURNDATACOPY))
(defun (copy-instruction---trigger_MXP) (- 1 stack/RDCX))
(defun (copy-instruction---trigger_MMU) (* (- 1 XAHOY) (shift misc/MXP_MTNTOP ROFF_COPY_INST_MISCELLANEOUS_ROW)))
(defun (copy-instruction---trigger_MMU) (* (- 1 XAHOY) (shift misc/MXP_SIZE_1_NONZERO_NO_MXPX ROFF_COPY_INST_MISCELLANEOUS_ROW)))

(defconstraint copy-instruction---misc-row---setting-OOB-instruction (:guard (copy-instruction---standard-precondition))
(if-not-zero (shift misc/OOB_FLAG ROFF_COPY_INST_MISCELLANEOUS_ROW)
Expand All @@ -178,13 +178,13 @@

(defconstraint copy-instruction---misc-row---setting-MXP-instruction (:guard (copy-instruction---standard-precondition))
(if-not-zero (shift misc/MXP_FLAG ROFF_COPY_INST_MISCELLANEOUS_ROW)
(set-MXP-instruction-type-4 ROFF_COPY_INST_MISCELLANEOUS_ROW ;; row offset kappa
stack/INSTRUCTION ;; instruction
0 ;; deploys (bit modifying the behaviour of RETURN pricing)
(copy-instruction---target-offset-hi) ;; offset high
(copy-instruction---target-offset-lo) ;; offset low
(copy-instruction---size-hi) ;; size high
(copy-instruction---size-lo)))) ;; size low
(set-MXP-instruction---single-mxp-offset-instructions ROFF_COPY_INST_MISCELLANEOUS_ROW ;; row offset kappa
stack/INSTRUCTION ;; instruction
0 ;; deploys (bit modifying the behaviour of RETURN pricing)
(copy-instruction---target-offset-hi) ;; offset high
(copy-instruction---target-offset-lo) ;; offset low
(copy-instruction---size-hi) ;; size high
(copy-instruction---size-lo)))) ;; size low

(defconstraint copy-instruction---misc-row---setting-MXPX (:guard (copy-instruction---standard-precondition))
(if-zero (shift misc/MXP_FLAG ROFF_COPY_INST_MISCELLANEOUS_ROW)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,13 +47,13 @@

(defconstraint create-instruction---setting-the-MXP-instruction (:guard (create-instruction---generic-precondition))
(if-not-zero (shift misc/MXP_FLAG CREATE_miscellaneous_row___row_offset)
(set-MXP-instruction-type-4 CREATE_miscellaneous_row___row_offset ;; row offset kappa
(create-instruction---instruction) ;; instruction
0 ;; bit modifying the behaviour of RETURN pricing
(create-instruction---STACK-offset-hi) ;; offset high
(create-instruction---STACK-offset-lo) ;; offset low
(create-instruction---STACK-size-hi) ;; size high
(create-instruction---STACK-size-lo)) ;; size low
(set-MXP-instruction---single-mxp-offset-instructions CREATE_miscellaneous_row___row_offset ;; row offset kappa
(create-instruction---instruction) ;; instruction
0 ;; bit modifying the behaviour of RETURN pricing
(create-instruction---STACK-offset-hi) ;; offset high
(create-instruction---STACK-offset-lo) ;; offset low
(create-instruction---STACK-size-hi) ;; size high
(create-instruction---STACK-size-lo)) ;; size low
))

(defconstraint create-instruction---setting-the-memory-expansion-exception (:guard (create-instruction---generic-precondition))
Expand Down Expand Up @@ -126,7 +126,7 @@
(:guard (create-instruction---generic-precondition))
(if-not-zero (scenario-shorthand---CREATE---not-rebuffed)
(eq! (scenario-shorthand---CREATE---not-rebuffed-nonempty-init-code)
(create-instruction---MXP-mtntop))))
(create-instruction---MXP-s1nznomxpx))))

(defconstraint create-instruction---setting-the-CREATE-scenario---not-rebuffed-nonempty-init-code
(:guard (create-instruction---generic-precondition))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
(defun (create-instruction---OOB-failure-condition) (shift [misc/OOB_DATA 8] CREATE_miscellaneous_row___row_offset))
(defun (create-instruction---MXP-mxpx) (shift misc/MXP_MXPX CREATE_miscellaneous_row___row_offset))
(defun (create-instruction---MXP-gas) (shift misc/MXP_GAS_MXP CREATE_miscellaneous_row___row_offset))
(defun (create-instruction---MXP-mtntop) (shift misc/MXP_MTNTOP CREATE_miscellaneous_row___row_offset))
(defun (create-instruction---MXP-s1nznomxpx) (shift misc/MXP_SIZE_1_NONZERO_NO_MXPX CREATE_miscellaneous_row___row_offset))
(defun (create-instruction---STP-gas-paid-out-of-pocket) (shift misc/STP_GAS_PAID_OUT_OF_POCKET CREATE_miscellaneous_row___row_offset))
(defun (create-instruction---STP-oogx) (shift misc/STP_OOGX CREATE_miscellaneous_row___row_offset))
(defun (create-instruction---compute-createe-address) (shift account/RLPADDR_FLAG CREATE_first_creator_account_row___row_offset))
Expand Down
4 changes: 2 additions & 2 deletions hub/constraints/instruction-handling/create/triggers.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@

(defun (create-instruction---trigger_HASHINFO) (* (create-instruction---is-CREATE2)
(+ (* (scenario-shorthand---CREATE---failure-condition)
(create-instruction---MXP-mtntop))
(create-instruction---MXP-s1nznomxpx))
(scenario-shorthand---CREATE---not-rebuffed-nonempty-init-code))))

(defun (create-instruction---trigger_RLPADDR) (scenario-shorthand---CREATE---compute-deployment-address))
Expand All @@ -39,7 +39,7 @@

;; auxiliary shorthands required for (create-instruction---trigger_MMU)
(defun (create-instruction---hash-init-code) (* (scenario-shorthand---CREATE---failure-condition)
(create-instruction---MXP-mtntop)
(create-instruction---MXP-s1nznomxpx)
(create-instruction---is-CREATE2)))

(defun (create-instruction---hash-init-code-and-send-to-ROM) (* (scenario-shorthand---CREATE---not-rebuffed-nonempty-init-code)
Expand Down
Loading
Loading