vyperlang / vyper

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

incorrectly reported overflow exception #4383

Open AlbertoCentonze opened 2 days ago

AlbertoCentonze commented 2 days ago

Version Information

What's your issue about?

@external
def foo() -> uint256:
    return (10**18)**2

panics at compilation with the following error, which is clearly wrong given that 10**36 clearly fits in a uint256:

vyper.exceptions.OverflowException: Base is too large, calculation will always overflow

  contract "contracts/token.vy:3", function "foo", line 3:12 
       2 def foo() -> uint256:
  ---> 3     return (10**18)**2
  -------------------^