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

Exp (ReadWord (Lit 0x0) (AbstractBuf "txdata")) (Lit 0x0) runs infinitely on exprToSMT #637

Open
msooseth opened this issue Jan 22, 2025 · 3 comments

Comments

@msooseth
Copy link
Collaborator

As reported by @charles-cooper in chat. Thanks!

@msooseth
Copy link
Collaborator Author

Oooops, base case was not handled....

@@ -921,6 +941,7 @@ copySlice _ _ _ _ _ = Left "CopySlice with a symbolically sized region not curre
 -- | Unrolls an exponentiation into a series of multiplications
 expandExp :: Expr EWord -> W256 -> Err Builder
 expandExp base expnt
+  | expnt == 0 = pure one
   | expnt == 1 = exprToSMT base
   | otherwise = do
     b <- exprToSMT base

@msooseth
Copy link
Collaborator Author

Note that in evm.codes:

// Example 1
PUSH1 0
PUSH1 0
EXP

Gives us 1, so 0^0 is 1. Every other value is also 1.

@charles-cooper
Copy link

charles-cooper commented Jan 22, 2025

just for reference, here is where it is defined in execution specs -- https://github.com/ethereum/execution-specs/blob/e4d7b402a7bda2812e1723642b99614fcdd55193/src/ethereum/cancun/vm/instructions/arithmetic.py#L325

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

No branches or pull requests

2 participants