Skip to content

Use modular exponentiation for concrete EXP - #587

Open
DicksonWu654 wants to merge 1 commit into
a16z:mainfrom
DicksonWu654:fix/concrete-exp-modular-reduction
Open

Use modular exponentiation for concrete EXP#587
DicksonWu654 wants to merge 1 commit into
a16z:mainfrom
DicksonWu654:fix/concrete-exp-modular-reduction

Conversation

@DicksonWu654

Copy link
Copy Markdown

Summary

  • Replace the concrete lhs ** rhs shortcut with three-argument pow modulo the bit-vector width.
  • Preserve all symbolic exponentiation paths.
  • Add ordinary wrapping/equivalence cases and a maximum-width exponent regression.

Rationale

EVM EXP results are reduced modulo 2^256. Constructing the entire Python power before bit-vector truncation is equivalent but can allocate an enormous intermediate. Modular exponentiation computes the same result while keeping intermediates bounded; using 1 << size also preserves the helper's generic bit width.

Validation

  • Static diff/whitespace validation passed.
  • Added focused direct tests for ordinary, wrapping, and very large exponent cases.
  • Executable tests, builds, package-manager commands, and hooks were not run locally; repository CI is expected to provide executable validation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant