Skip to content

Commit

Permalink
fix: plug txnData constraints
Browse files Browse the repository at this point in the history
  • Loading branch information
letypequividelespoubelles committed Nov 28, 2023
1 parent 547f5a6 commit 7413d7f
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 13 deletions.
4 changes: 4 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,10 @@ LOG_DATA := logData/columns.lisp logData/constraints.lisp \
LOG_INFO := logInfo/columns.lisp logInfo/constraints.lisp \
logInfo/lookups/loginfo-to-rlprcpt.lisp logInfo/lookups/loginfo-to-logdata.lisp

TXN_DATA := txn_data/columns.lisp txn_data/constraints.lisp \
txn_data/lookups/into_rlp_addr.lisp txn_data/lookups/into_rlp_txn.lisp txn_data/lookups/into_rlp_txrcpt.lisp txn_data/lookups/into_rom_lex.lisp txn_data/lookups/into_wcp.lisp \
# txn_data/lookups/from_hub.lisp txn_data/lookups/into_btc.lisp

ZKEVM_MODULES := ${LIBRARY} \
${ALU} \
${BIN} \
Expand Down
9 changes: 0 additions & 9 deletions logInfo/lookups/loginfo-to-rlprcpt.lisp
Original file line number Diff line number Diff line change
@@ -1,12 +1,3 @@
(defpurefun (subphaseId-rlp-txrcpt)
(+ (reduce +
(for i [1 : 5] (* i [rlpTxRcpt.PHASE i])))
(* 6 rlpTxRcpt.IS_PREFIX)
(* 12 rlpTxRcpt.IS_TOPIC)
(* 24 rlpTxRcpt.IS_DATA)
(* 48 rlpTxRcpt.DEPTH_1)
(* 96 rlpTxRcpt.IS_TOPIC rlpTxRcpt.INDEX_LOCAL))) ;;TODO, doublon, already define in txnData->rlpRcpt lookup

(deflookup
logInfo-into-rlpTxnRcpt
;reference columns
Expand Down
12 changes: 8 additions & 4 deletions txn_data/constraints.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,11 @@
(if-zero TYPE2
(vanishes! (shift OUTGOING_HI 6)))))

(defconstraint verticalization (:guard (remained-constant! ABS))
;; is non-zero for the first row of each tx
(defun (first-row-trigger)
(- ABS (prev ABS)))

(defconstraint verticalization (:guard (first-row-trigger))
(begin (setting_phase_numbers)
(data_transfer)
(vanishing_data_cells)))
Expand Down Expand Up @@ -346,7 +350,7 @@
;; (= (shift WCP_RES_LO 6) ???) ;; unknown
))

(defconstraint comparisons (:guard (remained-constant! ABS))
(defconstraint comparisons (:guard (first-row-trigger))
(begin (sufficient_balance)
(sufficient_gas_limit)
(upper_limit_for_refunds)
Expand All @@ -361,7 +365,7 @@
;; 2.11 Gas and gas price constraints ;;
;; ;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(defconstraint gas_and_gas_price (:guard (remained-constant! ABS))
(defconstraint gas_and_gas_price (:guard (first-row-trigger))
(begin ;; constraining INIT_GAS
(= IGAS
(- (gas_limit) (shift WCP_ARG_TWO_LO 1)))
Expand All @@ -382,7 +386,7 @@
;; 2.11 Verticalisation for RlpTxnRcpt ;;
;; ;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(defconstraint verticalisation-rlp-txn-rcpt (:guard (remained-constant! ABS))
(defconstraint verticalisation-rlp-txn-rcpt (:guard (first-row-trigger))
(begin (eq! PHASE_RLP_TXNRCPT RLPRECEIPT_SUBPHASE_ID_TYPE)
(eq! OUTGOING_RLP_TXNRCPT (tx_type))
(eq! (next PHASE_RLP_TXNRCPT) RLPRECEIPT_SUBPHASE_ID_STATUS_CODE)
Expand Down

0 comments on commit 7413d7f

Please sign in to comment.