Update Create (evm exception) arguments (#805)

* Update Create arguments

* Add integration test

* Dial back the procs
This commit is contained in:
Yan Ivnitskiy 2018-03-12 12:19:38 -04:00 committed by GitHub
parent fbf0823cb6
commit fceb48ce0c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 16 additions and 3 deletions

View File

@ -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)

View File

@ -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])