vyperlang / vyper

Pythonic Smart Contract Language for the EVM
https://vyperlang.org
Other
4.83k stars 789 forks source link

Incorrect OverflowException for nested computation #4076

Open ritzdorf opened 3 months ago

ritzdorf commented 3 months ago

Version Information

Issue description

In case of nested computation the compiler can incorrectly emit an OverflowException.

This was not an issue in 0.3.10.

POC

@external
def foo():
        x: uint256 = (10**3)**2

fails to compile with:

OverflowException: Base is too large, calculation will always overflow

It is not limited to nested exponentiation, this also fails:

@external
def foo():
        x: uint256 = (100*2)**3