File tree 10 files changed +34
-43
lines changed
hub/constraints/instruction-handling/halting 10 files changed +34
-43
lines changed Original file line number Diff line number Diff line change 15
15
16
16
- name : Install Go Corset
17
17
shell : bash
18
- run : go install github.com/consensys/go-corset/cmd/go-corset@v1.0.7
18
+ run : go install github.com/consensys/go-corset/cmd/go-corset@v1.1.1
19
19
20
20
- name : Build Constraints
21
21
run : make -B zkevm.bin
Original file line number Diff line number Diff line change 1
1
(module bin)
2
2
3
- (defpurefun (if-eq-else A B THEN ELSE)
4
- (if-zero (- A B)
5
- THEN
6
- ELSE))
7
-
8
3
; ; 2.2 Shorthands
9
4
(defun (flag-su m )
10
5
(+ IS_AND IS_OR IS_XOR IS_NOT IS_BYTE IS_SIGNEXTEND))
Original file line number Diff line number Diff line change 91
91
(revert-instruction---type-safe-return-data-size) ; ; type safe rds
92
92
)))
93
93
94
- (defun (revert-instruction---trigger_MM U ) (* (- 1 XAHOY)
95
- (- 1 (revert-instruction---current-context-is-root))
96
- (is-not-zero (* (revert-instruction---size-lo)
97
- (revert-instruction---r@c)))))
98
-
99
94
(defconstraint revert-instruction---setting-the-miscellaneous-row-module-flags (:guard (revert-instruction---standard-precondition))
100
- (eq! (weighted-MISC-flag-sum ROFF_REVERT___MISC_ROW)
101
- (+ MISC_WEIGHT_MXP
102
- (* MISC_WEIGHT_MMU (revert-instruction---trigger_MMU)))))
95
+ (let ((FLAG (weighted-MISC-flag-sum ROFF_REVERT___MISC_ROW)))
96
+ ; ;
97
+ (if (or!
98
+ (eq! XAHOY 1 )
99
+ (eq! (revert-instruction---current-context-is-root) 1 )
100
+ (eq! (revert-instruction---size-lo) 0 )
101
+ (eq! (revert-instruction---r@c) 0 ))
102
+ ; ; trigger_MMU == 0
103
+ (eq! FLAG MISC_WEIGHT_MXP)
104
+ ; ; trigger_MMU == 1
105
+ (eq! FLAG (+ MISC_WEIGHT_MXP MISC_WEIGHT_MMU)))))
103
106
104
107
(defconstraint revert-instruction---setting-the-MXP-data (:guard (revert-instruction---standard-precondition))
105
108
(set-MXP-instruction-type-4 ROFF_REVERT___MISC_ROW ; ; row offset kappa
Original file line number Diff line number Diff line change 1
1
(module loginfo)
2
2
3
- (defun (if-not-eq A B then)
4
- (if-not-zero (- A B)
5
- then))
6
-
7
3
; ;;;;;;;;;;;;;;;;;;;;;;;;
8
4
; ; ;;
9
5
; ; 2.1 Heartbeat ;;
Original file line number Diff line number Diff line change 90
90
(begin (if-not-zero (+ [MXP_TYPE 1] [MXP_TYPE 2] [MXP_TYPE 3])
91
91
(eq! NOOP [MXP_TYPE 1]))
92
92
(if-eq [MXP_TYPE 4] 1
93
- (eq! NOOP (is-zero SIZE_1_LO)))
93
+ (if (eq! SIZE_1_LO 0 )
94
+ (eq! NOOP 1 )
95
+ (eq! NOOP 0 )))
94
96
(if-eq [MXP_TYPE 5] 1
95
- (eq! NOOP
96
- (* (is-zero SIZE_1_LO) (is-zero SIZE_2_LO)))))))
97
+ (if (and! (eq! SIZE_1_LO 0 ) (eq! SIZE_2_LO 0 ))
98
+ (eq! NOOP 1 )
99
+ (eq! NOOP 0 ))))))
97
100
98
101
(defconstraint noop-consequences (:guard NOOP)
99
102
(begin (vanishes! QUAD_COST)
273
276
; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
274
277
275
278
(defun (offsets-are-in-bound s )
276
- (* (is-zero ( - CT CT_MAX_NON_TRIVIAL) )
277
- (- 1 MXPX)))
279
+ (if (eq! CT CT_MAX_NON_TRIVIAL)
280
+ (- 1 MXPX) 0 ))
278
281
279
282
(defconstraint size-in-evm-words (:guard (* (standing-hypothesis) (offsets-are-in-bounds)))
280
283
(if-eq [MXP_TYPE 4] 1
Original file line number Diff line number Diff line change 132
132
(begin (vanishes! (shift INDEX -7 ))
133
133
(eq! ACC NONCE)
134
134
(eq! BIT_ACC BYTE1)
135
- (if-zero (+ (~ (eq! ACC_BYTESIZE 1 ))
136
- (shift BIT1 -7 ))
137
- (eq! 1 TINY_NON_ZERO_NONCE)
138
- (vanishes! TINY_NON_ZERO_NONCE))
135
+ (if (and! (eq! ACC_BYTESIZE 1 ) (eq! (shift BIT1 -7 ) 0 ))
136
+ (eq! 1 TINY_NON_ZERO_NONCE)
137
+ (vanishes! TINY_NON_ZERO_NONCE))
139
138
(eq! (+ (shift LC -4 ) (shift LC -3 ))
140
139
1 )
141
140
(eq! (shift LIMB -3 )
Original file line number Diff line number Diff line change 147
147
148
148
; ; 2.3.2.4
149
149
(defconstraint ABS_TX_NUM-evolution ()
150
- (eq! ABS_TX_NUM
151
- (+ (prev ABS_TX_NUM)
152
- (* IS_PHASE_RLP_PREFIX (remained-constant! IS_PHASE_RLP_PREFIX)))))
150
+ (if (or! (eq! IS_PHASE_RLP_PREFIX 0 ) (remained-constant! IS_PHASE_RLP_PREFIX))
151
+ ; ; no change
152
+ (remained-constant! ABS_TX_NUM)
153
+ ; ; increment
154
+ (did-inc! ABS_TX_NUM 1 )))
153
155
154
156
(defconstraint set-to-hash-by-prover-flag ()
155
157
(eq! TO_HASH_BY_PROVER (* LC LX)))
Original file line number Diff line number Diff line change 1
1
(module rlptxrcpt)
2
2
3
- (defpurefun (if-not-eq x y then)
4
- (if-not-zero (- x y)
5
- then))
6
-
7
3
; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
8
4
; ; ;;
9
5
; ; 4.1 Global Constraints ;;
96
92
(reduce + (for i [5] [PHASE i])))))
97
93
98
94
(defconstraint ABS_TX_NUM-evolution ()
99
- (eq! ABS_TX_NUM
100
- (+ (prev ABS_TX_NUM)
101
- (* [PHASE 1] (remained-constant! [PHASE 1])))))
95
+ (if (or! (eq! [PHASE 1] 0 ) (remained-constant! [PHASE 1]))
96
+ ; ; no change
97
+ (remained-constant! ABS_TX_NUM)
98
+ ; ; increment
99
+ (did-inc! ABS_TX_NUM 1 )))
102
100
103
101
(defconstraint ABS_LOG_NUM-evolution ()
104
102
(if-zero (+ (- 1 [PHASE 5]) (- 1 DEPTH_1) (- 1 IS_PREFIX) IS_TOPIC IS_DATA CT)
Original file line number Diff line number Diff line change 192
192
; ; ;;
193
193
; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
194
194
195
- (defun (call---first-row-commo n ) (* (remained-constant! STAMP) (is_call)))
195
+ (defun (call---first-row-commo n ) (* (remained-constant STAMP) (is_call)))
196
196
(defun (call---first-row-unexceptiona l ) (* (call---first-row-common) (- 1 OOGX)))
197
197
198
198
Original file line number Diff line number Diff line change 1
1
(module txndata)
2
2
3
- (defpurefun (if-not-eq A B then else)
4
- (if-not-zero (- A B)
5
- then
6
- else))
7
-
8
3
; ; sum of transaction type flags
9
4
(defun (tx-type-su m ) (force-bin (+ TYPE0
10
5
TYPE1
You can’t perform that action at this time.
0 commit comments