vyperlang / vyper

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

External Call Kwargs Allowed for Call to __init__ #3992

Open cyberthirst opened 3 months ago

cyberthirst commented 3 months ago

Version Information

ContractFunctionT.fetch_call_return depends on self.is_internal to prevent or not the call from being passed some external call reserved kwargs such as gas or value. However, an __init__ function has self.is_internal = False so it is possible to pass kwags when calling it although it should not be allowed.

POC

For example, the contract below compiles:

# main.vy
import bar

initializes: bar

@deploy
@payable
def __init__():
    bar.__init__(12, gas=14, value = 12, skip_contract_check= True)     
# bar.vy
a:uint256

@deploy
@payable
def __init__(x: uint256):
    self.a = x

credits: @trocher