Skip to content

EIP-3855: PUSH0 #640

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

Merged
merged 14 commits into from
Apr 29, 2025
Merged
Show file tree
Hide file tree
Changes from 3 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
1 change: 1 addition & 0 deletions constants/constants.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@
EVM_INST_GAS 0x5A
EVM_INST_JUMPDEST 0x5B
;; Push Operations
EVM_INST_PUSH0 0x5F
EVM_INST_PUSH1 0x60
EVM_INST_PUSH2 0x61
EVM_INST_PUSH3 0x62
Expand Down
11 changes: 9 additions & 2 deletions hub/constraints/instruction-handling/push_pop.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
(defun (push-pop-instruction---result-hi) [ stack/STACK_ITEM_VALUE_HI 4 ])
(defun (push-pop-instruction---result-lo) [ stack/STACK_ITEM_VALUE_LO 4 ])
(defun (push-pop-instruction---is-POP) [ stack/DEC_FLAG 1 ])
(defun (push-pop-instruction---is-PUSH) [ stack/DEC_FLAG 2 ]) ;; ""
(defun (push-pop-instruction---is-PUSH) [ stack/DEC_FLAG 2 ])
(defun (push-pop-instruction---is-PUSH-ZERO) [ stack/DEC_FLAG 3 ]) ;; ""

(defconstraint push-pop-instruction---setting-the-stack-pattern---POP-case
(:guard (push-pop-instruction---standard-hypothesis))
Expand All @@ -13,7 +14,7 @@

(defconstraint push-pop-instruction---setting-the-stack-pattern---PUSH-case
(:guard (push-pop-instruction---standard-hypothesis))
(if-not-zero (push-pop-instruction---is-PUSH)
(if-not-zero (+ (push-pop-instruction---is-PUSH) (push-pop-instruction---is-PUSH-ZERO) )
(stack-pattern-0-1)))

(defconstraint push-pop-instruction---setting-NSR
Expand All @@ -36,6 +37,12 @@
(begin (eq! (push-pop-instruction---result-hi) stack/PUSH_VALUE_HI)
(eq! (push-pop-instruction---result-lo) stack/PUSH_VALUE_LO))))

(defconstraint push-pop-instruction---setting-stack-values---PUSH0-case
(:guard (push-pop-instruction---standard-hypothesis))
(if-not-zero (push-pop-instruction---is-PUSH-ZERO)
(begin (vanishes! (push-pop-instruction---result-hi))
(vanishes! (push-pop-instruction---result-lo)))))

(defconstraint push-pop-instruction---setting-PC_NEW---POP-case
(:guard (push-pop-instruction---standard-hypothesis))
(if-not-zero (push-pop-instruction---is-POP)
Expand Down
Loading