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

Feat/issue 189/add result keccak selector #196

Merged
Merged
Show file tree
Hide file tree
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
37 changes: 19 additions & 18 deletions constants/constants.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -205,8 +205,9 @@
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
EIP_3541_MARKER 0xEF
BLOCKHASH_MAX_HISTORY 256
BLOCKHASH_MAX_HISTORY 256
MAX_REFUND_QUOTIENT 5
CREATE2_SHIFT 0xff ;; create2 first byte
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; LINEA MISC ;;
Expand Down Expand Up @@ -283,14 +284,14 @@
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; EC DATA MODULE ;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
PHASE_ECRECOVER_DATA 0x010A
PHASE_ECRECOVER_RESULT 0x010B
PHASE_ECADD_DATA 0x060A
PHASE_ECADD_RESULT 0x060B
PHASE_ECMUL_DATA 0x070A
PHASE_ECMUL_RESULT 0x070B
PHASE_ECPAIRING_DATA 0x080A
PHASE_ECPAIRING_RESULT 0x080B
PHASE_ECRECOVER_DATA 0x010A
PHASE_ECRECOVER_RESULT 0x010B
PHASE_ECADD_DATA 0x060A
PHASE_ECADD_RESULT 0x060B
PHASE_ECMUL_DATA 0x070A
PHASE_ECMUL_RESULT 0x070B
PHASE_ECPAIRING_DATA 0x080A
PHASE_ECPAIRING_RESULT 0x080B
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; EXP MODULE ;;
Expand All @@ -306,15 +307,15 @@
;;
;;MMU Instructions
;;
MMU_INST_MLOAD 0xfe01
MMU_INST_MSTORE 0xfe02
MMU_INST_MSTORE8 0xfe03
MMU_INST_INVALID_CODE_PREFIX 0xfe00
MMU_INST_RIGHT_PADDED_WORD_EXTRACTION 0xfe10
MMU_INST_RAM_TO_EXO_WITH_PADDING 0xfe20
MMU_INST_EXO_TO_RAM_TRANSPLANTS 0xfe30
MMU_INST_RAM_TO_RAM_SANS_PADDING 0xfe40
MMU_INST_ANY_TO_RAM_WITH_PADDING 0xfe50
MMU_INST_MLOAD 0xfe01
MMU_INST_MSTORE 0xfe02
MMU_INST_MSTORE8 0xfe03
MMU_INST_INVALID_CODE_PREFIX 0xfe00
MMU_INST_RIGHT_PADDED_WORD_EXTRACTION 0xfe10
MMU_INST_RAM_TO_EXO_WITH_PADDING 0xfe20
MMU_INST_EXO_TO_RAM_TRANSPLANTS 0xfe30
MMU_INST_RAM_TO_RAM_SANS_PADDING 0xfe40
MMU_INST_ANY_TO_RAM_WITH_PADDING 0xfe50
;;MMU_INST_ANY_TO_RAM_WITH_PADDING_SOME_DATA 0xfe51
;;MMU_INST_ANY_TO_RAM_WITH_PADDING_PURE_PADDING 0xfe52
MMU_INST_MODEXP_ZERO 0xfe60
Expand Down
5 changes: 3 additions & 2 deletions rlpaddr/columns.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,11 @@
(BYTE1 :byte@prove)
(ACC :i64)
(ACC_BYTESIZE :byte)
POWER
(POWER :i128)
(BIT1 :binary@prove)
(BIT_ACC :byte)
(TINY_NON_ZERO_NONCE :binary@prove))
(TINY_NON_ZERO_NONCE :binary@prove)
(SELECTOR_KECCAK_RES :binary))

;; aliases
(defalias
Expand Down
1 change: 0 additions & 1 deletion rlpaddr/constants.lisp
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
(module rlpaddr)

(defconst
CREATE2_SHIFT 0xff ;; create2 first byte
MAX_CT_CREATE 7
MAX_CT_CREATE2 5)

Expand Down
30 changes: 20 additions & 10 deletions rlpaddr/constraints.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,11 @@
(begin (if-eq RECIPE_1 1 (eq! ct MAX_CT_CREATE))
(if-eq RECIPE_2 1 (eq! ct MAX_CT_CREATE2))))

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; ;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; ;;
;; 3.2 Constancies ;;
;; ;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; ;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;
(defconstraint stamp-constancies ()
(begin (stamp-constancy STAMP ADDR_HI)
(stamp-constancy STAMP ADDR_LO)
Expand All @@ -69,11 +69,11 @@
(begin (ct-incrementing ct INDEX)
(ct-incrementing ct LC)))

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; ;;
;; 3.4 Byte and Bit decomposition ;;
;; ;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; ;;
;; 3.4 Byte and Bit decomposition ;;
;; ;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(defconstraint byte-bit-decomposition ()
(if-zero ct
(begin (eq! ACC BYTE1)
Expand All @@ -99,6 +99,16 @@
(eq! RECIPE
(+ (* RLP_ADDR_RECIPE_1 RECIPE_1) (* RLP_ADDR_RECIPE_2 RECIPE_2))))

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; ;;
;; 3.6 SELECTOR_KECCAK_RES ;;
;; ;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(defconstraint set-kec-res-selector ()
(eq! SELECTOR_KECCAK_RES
(* (~ STAMP)
(- STAMP (prev STAMP)))))

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; ;;
;; 4.1 RECIPE_1 constraints ;;
Expand Down Expand Up @@ -155,7 +165,7 @@

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; ;;
;; 6 RECIPIE2 constraints ;;
;; 6 RECIPIE2 constraints ;;
;; ;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(defconstraint index-create2 (:guard RECIPE_2)
Expand Down
4 changes: 3 additions & 1 deletion shakiradata/columns.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@
(IS_SHA2_RESULT :binary@prove)
(IS_RIPEMD_DATA :binary@prove)
(IS_RIPEMD_RESULT :binary@prove)
(IS_EXTRA :binary@prove))
(IS_EXTRA :binary@prove)
(SELECTOR_KECCAK_RES_HI :binary)
(SELECTOR_KECCAK_RES_LO :binary))


13 changes: 13 additions & 0 deletions shakiradata/constraints.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -215,3 +215,16 @@
(if-eq (is-result) 1
(prev (eq! nBYTES_ACC TOTAL_SIZE)))))

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; ;;
;; 1.3.8 SELECTOR_KECCAK_RES ;;
;; ;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(defconstraint set-selector_kec_res-hi ()
(eq! SELECTOR_KECCAK_RES_HI
(* IS_KECCAK_RESULT (- 1 INDEX))))

(defconstraint set-selector_kec_res-lo ()
(eq! SELECTOR_KECCAK_RES_LO (* IS_KECCAK_RESULT INDEX)))


Loading