Skip to content

Commit c483d9e

Browse files
authored
EIP-7823: Set upper bounds for MODEXP --- MMU side (#814)
1 parent 40959eb commit c483d9e

File tree

3 files changed

+12
-10
lines changed

3 files changed

+12
-10
lines changed

mmu/osaka/constants.lisp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,8 @@
5353
;;NB_MICRO_ROWS_TOT_RAM_TO_RAM_SANS_PADDING variable
5454
;;NB_MICRO_ROWS_TOT_ANY_TO_RAM_WITH_PADDING_PURE_PADDING variable
5555
;;NB_MICRO_ROWS_TOT_ANY_TO_RAM_WITH_PADDING_SOME_DATA variable
56-
NB_MICRO_ROWS_TOT_MODEXP_ZERO 32
57-
NB_MICRO_ROWS_TOT_MODEXP_DATA 32
56+
NB_MICRO_ROWS_TOT_MODEXP_ZERO 64
57+
NB_MICRO_ROWS_TOT_MODEXP_DATA 64
5858
NB_MICRO_ROWS_TOT_BLAKE 2)
5959

6060

mmu/osaka/instructions/modexp_data.lisp

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -30,19 +30,20 @@
3030
(defun (modexp-data---exo-sum) macro/EXO_SUM)
3131
(defun (modexp-data---phase) macro/PHASE)
3232
(defun (modexp-data---param-byte-size) (modexp-data---size))
33-
(defun (modexp-data---param-offset) (+ (modexp-data---cdo) (modexp-data---src-offset)))
34-
(defun (modexp-data---leftover-data-size) (- (modexp-data---cds) (modexp-data---src-offset)))
35-
(defun (modexp-data---num-left-padding-bytes) (- 512 (modexp-data---param-byte-size)))
33+
(defun (modexp-data---param-offset) (+ (modexp-data---cdo) (modexp-data---src-offset)))
34+
(defun (modexp-data---leftover-data-size) (- (modexp-data---cds) (modexp-data---src-offset)))
35+
(defun (modexp-data---num-left-padding-bytes) (- EIP_7823_MODEXP_UPPER_BYTE_SIZE_BOUND (modexp-data---param-byte-size)))
3636
(defun (modexp-data---data-runs-out) (shift prprc/WCP_RES 2))
3737
(defun (modexp-data---num-right-padding-bytes) (* (- (modexp-data---param-byte-size) (modexp-data---leftover-data-size)) (modexp-data---data-runs-out)))
3838
(defun (modexp-data---right-padding-remainder) (shift prprc/EUC_REM 2))
3939
(defun (modexp-data---totnt-is-one) (shift prprc/WCP_RES 3))
4040
(defun (modexp-data---middle-sbo) (shift prprc/EUC_REM 6)) ;; ""
4141

4242

43-
(defconstraint modexp-data---setting-TOT (:guard (* MACRO IS_MODEXP_DATA))
44-
;; Setting total number of mmio inst
45-
(eq! TOT NB_MICRO_ROWS_TOT_MODEXP_DATA))
43+
(defconstraint modexp-data---number-of-preprocessing-rows-ie-setting-TOT (:guard (* MACRO IS_MODEXP_DATA))
44+
;; Setting total number of mmio inst
45+
(eq! TOT
46+
NB_MICRO_ROWS_TOT_MODEXP_DATA))
4647

4748
(defconstraint modexp-data---1st-preprocessing-row (:guard (* MACRO IS_MODEXP_DATA))
4849
(begin
@@ -64,7 +65,8 @@
6465
(modexp-data---num-right-padding-bytes)
6566
LLARGE)
6667
(eq! TOTRZ (shift prprc/EUC_QUOT 2))
67-
(debug (eq! TOTNT (- 32 (+ TOTLZ TOTRZ))))))
68+
(debug (eq! TOTNT (- NB_MICRO_ROWS_TOT_MODEXP_DATA
69+
(+ TOTLZ TOTRZ))))))
6870

6971
(defconstraint modexp-data---3rd-preprocessing-row (:guard (* MACRO IS_MODEXP_DATA))
7072
(begin

mmu/osaka/instructions/modexp_zero.lisp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
(defconstraint modexp-zero---setting-the-TOTs (:guard (* MACRO IS_MODEXP_ZERO))
1717
(begin
1818
(vanishes! TOTLZ)
19-
(eq! TOTNT NB_MICRO_ROWS_TOT_MODEXP_ZERO)
19+
(eq! TOTNT NB_MICRO_ROWS_TOT_MODEXP_ZERO)
2020
(vanishes! TOTRZ)))
2121

2222
(defconstraint modexp-zero---setting-micro-instruction-constant-values (:guard (* MACRO IS_MODEXP_ZERO))

0 commit comments

Comments
 (0)