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

Splitting of SELFDESTRUCT's setting NSR and peeking flags constraint #534

Merged
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
103 changes: 60 additions & 43 deletions hub/constraints/instruction-handling/halting/selfdestruct.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -105,49 +105,66 @@
(eq! scenario/SELFDESTRUCT_WONT_REVERT_ALREADY_MARKED (selfdestruct-instruction---is-marked))
(eq! scenario/SELFDESTRUCT_WONT_REVERT_NOT_YET_MARKED (- 1 (selfdestruct-instruction---is-marked)))))))

(defconstraint selfdestruct-instruction---setting-NSR-and-peeking-flags (:guard (selfdestruct-instruction---scenario-precondition))
(begin
(if-not-zero (selfdestruct-instruction---STATICX)
(begin
(eq! (shift NSR ROFF_SELFDESTRUCT___STACK_ROW) 3)
(eq! (shift NSR ROFF_SELFDESTRUCT___STACK_ROW) (+ (shift PEEK_AT_SCENARIO ROFF_SELFDESTRUCT___SCENARIO_ROW )
(shift PEEK_AT_CONTEXT ROFF_SELFDESTRUCT___1ST_CONTEXT_ROW)
(shift PEEK_AT_CONTEXT 2)))))
(if-not-zero (selfdestruct-instruction---OOGX)
(begin
(eq! (shift NSR ROFF_SELFDESTRUCT___STACK_ROW) 5)
(eq! (shift NSR ROFF_SELFDESTRUCT___STACK_ROW) (+ (shift PEEK_AT_SCENARIO ROFF_SELFDESTRUCT___SCENARIO_ROW )
(shift PEEK_AT_CONTEXT ROFF_SELFDESTRUCT___1ST_CONTEXT_ROW )
(shift PEEK_AT_ACCOUNT ROFF_SELFDESTRUCT___ACCOUNT___1ST_DOING_ROW)
(shift PEEK_AT_ACCOUNT ROFF_SELFDESTRUCT___ACCOUNT___2ND_DOING_ROW)
(shift PEEK_AT_CONTEXT 4)))))
(if-not-zero scenario/SELFDESTRUCT_WILL_REVERT
(begin
(eq! (shift NSR ROFF_SELFDESTRUCT___STACK_ROW) 7)
(eq! (shift NSR ROFF_SELFDESTRUCT___STACK_ROW) (+ (shift PEEK_AT_SCENARIO ROFF_SELFDESTRUCT___SCENARIO_ROW )
(shift PEEK_AT_CONTEXT ROFF_SELFDESTRUCT___1ST_CONTEXT_ROW )
(shift PEEK_AT_ACCOUNT ROFF_SELFDESTRUCT___ACCOUNT___1ST_DOING_ROW )
(shift PEEK_AT_ACCOUNT ROFF_SELFDESTRUCT___ACCOUNT___2ND_DOING_ROW )
(shift PEEK_AT_ACCOUNT ROFF_SELFDESTRUCT___ACCOUNT___1ST_UNDOING_ROW)
(shift PEEK_AT_ACCOUNT ROFF_SELFDESTRUCT___ACCOUNT___2ND_UNDOING_ROW)
(shift PEEK_AT_CONTEXT 6)))))
(if-not-zero scenario/SELFDESTRUCT_WONT_REVERT_ALREADY_MARKED
(begin
(eq! (shift NSR ROFF_SELFDESTRUCT___STACK_ROW) 5)
(eq! (shift NSR ROFF_SELFDESTRUCT___STACK_ROW) (+ (shift PEEK_AT_SCENARIO ROFF_SELFDESTRUCT___SCENARIO_ROW )
(shift PEEK_AT_CONTEXT ROFF_SELFDESTRUCT___1ST_CONTEXT_ROW )
(shift PEEK_AT_ACCOUNT ROFF_SELFDESTRUCT___ACCOUNT___1ST_DOING_ROW)
(shift PEEK_AT_ACCOUNT ROFF_SELFDESTRUCT___ACCOUNT___2ND_DOING_ROW)
(shift PEEK_AT_CONTEXT 4)))))
(if-not-zero scenario/SELFDESTRUCT_WONT_REVERT_NOT_YET_MARKED
(begin
(eq! (shift NSR ROFF_SELFDESTRUCT___STACK_ROW) 6)
(eq! (shift NSR ROFF_SELFDESTRUCT___STACK_ROW) (+ (shift PEEK_AT_SCENARIO ROFF_SELFDESTRUCT___SCENARIO_ROW )
(shift PEEK_AT_CONTEXT ROFF_SELFDESTRUCT___1ST_CONTEXT_ROW )
(shift PEEK_AT_ACCOUNT ROFF_SELFDESTRUCT___ACCOUNT___1ST_DOING_ROW)
(shift PEEK_AT_ACCOUNT ROFF_SELFDESTRUCT___ACCOUNT___2ND_DOING_ROW)
(shift PEEK_AT_ACCOUNT ROFF_SELFDESTRUCT___ACCOUNT_DELETION_ROW )
(shift PEEK_AT_CONTEXT 5)))))))
(defconstraint selfdestruct-instruction---setting-NSR-and-peeking-flags---STATICX-case
(:guard (selfdestruct-instruction---scenario-precondition))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(if-not-zero (selfdestruct-instruction---STATICX)
(begin
(eq! (shift NSR ROFF_SELFDESTRUCT___STACK_ROW) 3)
(eq! (shift NSR ROFF_SELFDESTRUCT___STACK_ROW) (+ (shift PEEK_AT_SCENARIO ROFF_SELFDESTRUCT___SCENARIO_ROW )
(shift PEEK_AT_CONTEXT ROFF_SELFDESTRUCT___1ST_CONTEXT_ROW)
(shift PEEK_AT_CONTEXT 2))))))

(defconstraint selfdestruct-instruction---setting-NSR-and-peeking-flags---OOGX-case
(:guard (selfdestruct-instruction---scenario-precondition))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(if-not-zero (selfdestruct-instruction---OOGX)
(begin
(eq! (shift NSR ROFF_SELFDESTRUCT___STACK_ROW) 5)
(eq! (shift NSR ROFF_SELFDESTRUCT___STACK_ROW) (+ (shift PEEK_AT_SCENARIO ROFF_SELFDESTRUCT___SCENARIO_ROW )
(shift PEEK_AT_CONTEXT ROFF_SELFDESTRUCT___1ST_CONTEXT_ROW )
(shift PEEK_AT_ACCOUNT ROFF_SELFDESTRUCT___ACCOUNT___1ST_DOING_ROW)
(shift PEEK_AT_ACCOUNT ROFF_SELFDESTRUCT___ACCOUNT___2ND_DOING_ROW)
(shift PEEK_AT_CONTEXT 4))))))

(defconstraint selfdestruct-instruction---setting-NSR-and-peeking-flags---WILL_REVERT-case
(:guard (selfdestruct-instruction---scenario-precondition))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(if-not-zero scenario/SELFDESTRUCT_WILL_REVERT
(begin
(eq! (shift NSR ROFF_SELFDESTRUCT___STACK_ROW) 7)
(eq! (shift NSR ROFF_SELFDESTRUCT___STACK_ROW) (+ (shift PEEK_AT_SCENARIO ROFF_SELFDESTRUCT___SCENARIO_ROW )
(shift PEEK_AT_CONTEXT ROFF_SELFDESTRUCT___1ST_CONTEXT_ROW )
(shift PEEK_AT_ACCOUNT ROFF_SELFDESTRUCT___ACCOUNT___1ST_DOING_ROW )
(shift PEEK_AT_ACCOUNT ROFF_SELFDESTRUCT___ACCOUNT___2ND_DOING_ROW )
(shift PEEK_AT_ACCOUNT ROFF_SELFDESTRUCT___ACCOUNT___1ST_UNDOING_ROW)
(shift PEEK_AT_ACCOUNT ROFF_SELFDESTRUCT___ACCOUNT___2ND_UNDOING_ROW)
(shift PEEK_AT_CONTEXT 6))))))

(defconstraint selfdestruct-instruction---setting-NSR-and-peeking-flags---WONT_REVERT_ALREADY_MARKED-case
(:guard (selfdestruct-instruction---scenario-precondition))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(if-not-zero scenario/SELFDESTRUCT_WONT_REVERT_ALREADY_MARKED
(begin
(eq! (shift NSR ROFF_SELFDESTRUCT___STACK_ROW) 5)
(eq! (shift NSR ROFF_SELFDESTRUCT___STACK_ROW) (+ (shift PEEK_AT_SCENARIO ROFF_SELFDESTRUCT___SCENARIO_ROW )
(shift PEEK_AT_CONTEXT ROFF_SELFDESTRUCT___1ST_CONTEXT_ROW )
(shift PEEK_AT_ACCOUNT ROFF_SELFDESTRUCT___ACCOUNT___1ST_DOING_ROW)
(shift PEEK_AT_ACCOUNT ROFF_SELFDESTRUCT___ACCOUNT___2ND_DOING_ROW)
(shift PEEK_AT_CONTEXT 4))))))

(defconstraint selfdestruct-instruction---setting-NSR-and-peeking-flags---WONT_REVERT_NOT_YET_MARKED-case
(:guard (selfdestruct-instruction---scenario-precondition))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(if-not-zero scenario/SELFDESTRUCT_WONT_REVERT_NOT_YET_MARKED
(begin
(eq! (shift NSR ROFF_SELFDESTRUCT___STACK_ROW) 6)
(eq! (shift NSR ROFF_SELFDESTRUCT___STACK_ROW) (+ (shift PEEK_AT_SCENARIO ROFF_SELFDESTRUCT___SCENARIO_ROW )
(shift PEEK_AT_CONTEXT ROFF_SELFDESTRUCT___1ST_CONTEXT_ROW )
(shift PEEK_AT_ACCOUNT ROFF_SELFDESTRUCT___ACCOUNT___1ST_DOING_ROW)
(shift PEEK_AT_ACCOUNT ROFF_SELFDESTRUCT___ACCOUNT___2ND_DOING_ROW)
(shift PEEK_AT_ACCOUNT ROFF_SELFDESTRUCT___ACCOUNT_DELETION_ROW )
(shift PEEK_AT_CONTEXT 5))))))

(defconstraint selfdestruct-instruction---reading-context-data (:guard (selfdestruct-instruction---scenario-precondition))
(read-context-data ROFF_SELFDESTRUCT___1ST_CONTEXT_ROW ;; row offset
Expand Down
Loading