Merge pull request #1377 from ConsenSys/bugfix/multicontract1

Fix a multicontract bug
pull/1380/head
Bernhard Mueller 5 years ago committed by GitHub
commit 2ba2d3e5bd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      mythril/interfaces/cli.py
  2. 8
      mythril/laser/ethereum/call.py
  3. 5
      tests/instructions/create2_test.py
  4. 6
      tests/instructions/create_test.py

@ -563,7 +563,7 @@ def set_config(args: Namespace):
):
config.set_api_from_config_path()
if args.__dict__.get("address", None):
if args.__dict__.get("rpc", None):
# Establish RPC connection if necessary
config.set_api_rpc(rpc=args.rpc, rpctls=args.rpctls)
if args.command in ("hash-to-address", "leveldb-search"):

@ -178,14 +178,6 @@ def get_call_data(
else memory_size
),
)
uses_entire_calldata = simplify(
memory_size == global_state.environment.calldata.calldatasize
)
if is_true(uses_entire_calldata):
return global_state.environment.calldata
try:
calldata_from_mem = state.memory[
util.get_concrete_int(memory_start) : util.get_concrete_int(

@ -39,7 +39,7 @@ def test_create2():
world_state, environment, None, MachineState(gas_limit=8000000)
)
code_raw = []
code = "606060406060"
code = "606060606060"
for i in range(len(code) // 2):
code_raw.append(int(code[2 * i : 2 * (i + 1)], 16))
calldata = ConcreteCalldata("1", code_raw)
@ -55,8 +55,9 @@ def test_create2():
symbol_factory.BitVecVal(0, 256),
value,
]
og_state.mstate.memory.extend(100)
og_state.mstate.memory[0:6] = [96] * 6
instruction = Instruction("create2", dynamic_loader=None)
# Act + Assert
with pytest.raises(TransactionStartSignal) as t:
_ = instruction.evaluate(og_state)[0]

@ -20,13 +20,13 @@ created_contract_account = None
def test_create():
world_state = WorldState()
account = world_state.create_account(balance=10, address=101)
account.code = Disassembly("60606040")
account.code = Disassembly("60606060")
environment = Environment(account, None, None, None, None, None)
og_state = GlobalState(
world_state, environment, None, MachineState(gas_limit=8000000)
)
code_raw = []
code = "606060406060"
code = "606060606060"
for i in range(len(code) // 2):
code_raw.append(int(code[2 * i : 2 * (i + 1)], 16))
calldata = ConcreteCalldata("1", code_raw)
@ -37,6 +37,8 @@ def test_create():
value = 3
og_state.mstate.stack = [6, 0, value]
instruction = Instruction("create", dynamic_loader=None)
og_state.mstate.memory.extend(100)
og_state.mstate.memory[0:6] = [96] * 6
# Act + Assert
with pytest.raises(TransactionStartSignal) as t:

Loading…
Cancel
Save