Skip to content

Simplify exponentiation over conditional constants - #1250

Open
gustavo-grieco wants to merge 1 commit into
mainfrom
fix/constant-ite-exponent
Open

gustavo-grieco wants to merge 1 commit into
mainfrom
fix/constant-ite-exponent

Conversation

@gustavo-grieco

Copy link
Copy Markdown
Collaborator

Description

Packed-array writes can produce 256 ** ITE(condition, 28, 4) after branch merging, causing SMT encoding to fail with Cannot encode symbolic exponent. Extend the existing literal-branch ITE helper to exponentiation so these powers fold to constants. The production change is two lines.

The Solidity regression selects index 1 or 7 in a uint32[8] storage array, writes that element, and asserts that element 0 is unchanged. It reproduces the encoding error on main and verifies with this change. Unit tests also cover wrapping at 256 bits, conditional bases, and operands sharing a condition; the rewrite fuzzer now generates conditional exponentiation.

Validation using Stack (GHC 9.10.3), Bitwuzla, and solc 0.8.25:

  • 62 simplification and rewrite tests passed.
  • 21 symbolic-execution tests passed, including the Solidity regression.
  • 10,000 word rewrite fuzz cases and 10,000 proposition rewrite fuzz cases passed.

Checklist

  • tested locally
  • added automated tests
  • updated the docs (not applicable: internal simplification)
  • updated the changelog

This branch has not been deployed

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant