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

fix(rlpTxn): constraint ADDR during AccessList tuple & ChainId #403

Merged
Show file tree
Hide file tree
Changes from 4 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
9 changes: 9 additions & 0 deletions rlptxn/constants.lisp
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
(module rlptxn)

(defconst
UNPROTECTED_V 27
UNPROTECTED_V_PO (+ UNPROTECTED_V 1)
PROTECTED_BASE_V 35
PROTECTED_BASE_V_PO (+ PROTECTED_BASE_V 1))


28 changes: 18 additions & 10 deletions rlptxn/constraints.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -690,11 +690,11 @@
(eq! (next DATA_GAS_COST) (shift DATA_GAS_COST 2)))
(vanishes! (next LC_CORRECTION))))))))

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; ;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; ;;
;; 4.5 Phase 10 : AccessList ;;
;; ;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; ;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(defconstraint phaseAccessList-stillphase-noend (:guard IS_PHASE_ACCESS_LIST)
(if-not-zero PHASE_SIZE
(vanishes! PHASE_END)))
Expand Down Expand Up @@ -829,10 +829,11 @@

;; 4.5.2.15
(defconstraint phaseAccessList-updateAddrLookUp (:guard IS_PHASE_ACCESS_LIST)
(if-zero (+ [DEPTH 2]
(- (prev nADDR) nADDR))
(begin (remained-constant! ADDR_HI)
(remained-constant! ADDR_LO))))
(if-not-zero (* [DEPTH 1]
(- nADDR
(- (prev nADDR) 1)))
(begin (remained-constant! ADDR_HI)
(remained-constant! ADDR_LO))))

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; ;;
Expand All @@ -845,7 +846,12 @@
(eq! nSTEP 8))))

(defun (w-minus-two-seven)
(- [INPUT 1] 27))
(- [INPUT 1] UNPROTECTED_V))

(defun (w-minus-two-beta-minus-protected-base-V)
(- [INPUT 1]
(+ (* 2 (next [INPUT 1]))
PROTECTED_BASE_V)))

(defconstraint phaseBeta-rlp-w (:guard IS_PHASE_BETA)
(if-not-zero (* LT (- 1 LX))
Expand All @@ -858,7 +864,9 @@
(begin (vanishes! (+ PHASE_END
(next LT)
(- 1 (next LX))
(- 1 (next IS_PREFIX)))))))))))
(- 1 (next IS_PREFIX))))
(eq! (^ (w-minus-two-beta-minus-protected-base-V) 2)
(w-minus-two-beta-minus-protected-base-V)))))))))
letypequividelespoubelles marked this conversation as resolved.
Show resolved Hide resolved

(defconstraint phaseBeta-rlp-beta (:guard IS_PHASE_BETA)
(if-not-zero (* LX IS_PREFIX)
Expand Down
Loading