diff --git a/manticore/platforms/evm.py b/manticore/platforms/evm.py index c239dc1..eb77a3e 100644 --- a/manticore/platforms/evm.py +++ b/manticore/platforms/evm.py @@ -1008,8 +1008,8 @@ class Call(EVMInstructionException): return (self.__class__, (self.gas, self.to, self.value, self.data, self.out_offset, self.out_size) ) class Create(Call): - def __init__(self, value, offset, size): - super(Create, self).__init__(gas=None, to=None, value=value, data='') + def __init__(self, value, bytecode): + super(Create, self).__init__(gas=None, to=None, value=value, data=bytecode) class DelegateCall(Call): pass @@ -2366,7 +2366,7 @@ class EVMWorld(Platform): if is_human_tx: #handle human transactions if ty == 'Create': - self.current.last_exception = Create(None, None, None) + self.current.last_exception = Create(None, None) elif ty == 'Call': self.current.last_exception = Call(None, None, None, None) diff --git a/tests/test_eth.py b/tests/test_eth.py index fe7044f..bbdf612 100644 --- a/tests/test_eth.py +++ b/tests/test_eth.py @@ -89,3 +89,16 @@ class EthTests(unittest.TestCase): context = p.context['insns'] self.assertIn('STOP', context) self.assertIn('REVERT', context) + + def test_can_create(self): + mevm = ManticoreEVM() + source_code = """ + contract X { function X(address x) {} } + contract C { function C(address x) { new X(x); } + } + """ + # Make sure that we can can call CREATE without raising an exception + owner = mevm.create_account(balance=1000) + x = mevm.create_account(balance=0) + contract_account = mevm.solidity_create_contract(source_code, + contract_name="C", owner=owner, args=[x])