-
Notifications
You must be signed in to change notification settings - Fork 21
EIP-7823: Set upper bounds for MODEXP --- HUB side
#815
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
EIP-7823: Set upper bounds for MODEXP --- HUB side
#815
Conversation
hub/osaka/constraints/instruction-handling/call/precompiles/modexp/common/zzz_old.lispX
Show resolved
Hide resolved
|
|
||
| (defun (precompile-processing---MODEXP---call-EXP-to-analyze-leading-word) (shift misc/EXP_FLAG precompile-processing---MODEXP---misc-row-offset---leading-word-analysis)) | ||
| (defun (precompile-processing---MODEXP---call-MMU-to-extract-leading-word) (shift misc/MMU_FLAG precompile-processing---MODEXP---misc-row-offset---leading-word-analysis)) | ||
| (defun (precompile-processing---MODEXP---call-OOB-on-leading-word-row) (shift misc/MMU_FLAG precompile-processing---MODEXP---misc-row-offset---leading-word-analysis)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Bug: OOB Flag Check Misplaced in Precompile Step
The function precompile-processing---MODEXP---call-OOB-on-leading-word-row incorrectly checks misc/MMU_FLAG instead of misc/OOB_FLAG. This is a copy-paste error from the line above. The function name indicates it should check if the OOB module is being called, and it's used in a constraint (line 37) that requires it to equal 1, meaning OOB should always be called on this row. However, it's actually checking the MMU flag, which will cause incorrect behavior when the MMU flag and OOB flag have different values.
| (:guard (* (assumption---fresh-new-stamp) (prc-modexp-xbs---standard-precondition))) | ||
| ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | ||
| (begin (or! (eq! 0 (prc-modexp-xbs---compute-max)) (eq! 1 (prc-modexp-xbs---compute-max))) | ||
| (eq! (prc-modexp-xbs---xbs-is-LEQ-the-MODEXP-upper-bound) 1))) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Bug: Broken bounds check for MODEXP parameters
The constraint forces prc-modexp-xbs---xbs-is-LEQ-the-MODEXP-upper-bound to always equal 1, preventing the system from detecting out-of-bounds byte sizes. This makes xbs-out-of-bounds always 0 and breaks the bounds checking mechanism for MODEXP parameters, allowing invalid calls that exceed EIP_7823_MODEXP_UPPER_BYTE_SIZE_BOUND to pass validation.
Note
Implements MODEXP common rows (byte-size extraction, leading-word, pricing) with EIP‑7823 upper-bound checks, updates success flow to use normalized sizes, and refactors OOB lead/xbs logic.
common/:__01__call_data_size_analysis_row.lisp: OOBmodexp-cds; exposesextract-{b,e,m}bs.__02__bbs_extraction_row.lisp,__03__ebs_extraction_row.lisp,__04__mbs_extraction_row.lisp:modexp-xbs.{b,e,m}bs-(hi|lo), within/out‑of‑bounds bits, and normalized sizes; computemax-mbs-bbsandall-byte-sizes-are-in-bounds.__05__exponent_leading_word_extraction_and_analysis_row.lisp:mload; OOBmodexp-lead; expose cutoffs andmodexp-full-log.__06__pricing_row.lisp: OOBmodexp-pricing; expose RAM success/return gas.generalities.lisp: standard precondition; exclude hub-known failure.justifying_hub_predictions.lisp: tie success and return gas to pricing outputs gated by bounds.*-extraction-and-analysis.success.lisp):{b,e,m}bsacross base/exponent/modulus extraction.512withEIP_7823_MODEXP_UPPER_BYTE_SIZE_BOUNDfor result copy; adjust offsets and return-data sizes.modexp/lead.lisp: renameload-lead→extract-leading-word; update justification accordingly.modexp/xbs.lisp: refactor comparison helpers and prediction bits; adjust max(xbs,ybs) setting logic and bounds bits.Written by Cursor Bugbot for commit 6bcb9fc. This will update automatically on new commits. Configure here.