vyperlang / vyper

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

possibly confusing semantics for `self.codesize` in constructor #2750

Open charles-cooper opened 2 years ago

charles-cooper commented 2 years ago

Version Information

What's your issue about?

self.codesize issues a CODESIZE instruction but you can convince vyper to issue an EXTCODESIZE instruction with the below code. these have differing semantics in deploy code (h/t https://twitter.com/sw0nt/status/1510720576054251520).

x: address = convert(convert(self, bytes32), address)  # confuse the constant folder
return x.codesize  # issues EXTCODESIZE instruction

How can it be fixed?

not sure if we need to change the behavior but we should at least note it in the docs because the behavior is not obvious.

charles-cooper commented 2 years ago

meeting notes: document this.