From 698b1d423f9ea3867a92087de8c0e49a01e4730f Mon Sep 17 00:00:00 2001 From: Nikhil Parasaram Date: Wed, 6 May 2020 16:51:25 +0100 Subject: [PATCH] Fix create tests --- tests/instructions/create2_test.py | 5 +++-- tests/instructions/create_test.py | 6 ++++-- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/tests/instructions/create2_test.py b/tests/instructions/create2_test.py index d98de529..ffe72917 100644 --- a/tests/instructions/create2_test.py +++ b/tests/instructions/create2_test.py @@ -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] diff --git a/tests/instructions/create_test.py b/tests/instructions/create_test.py index d68dc681..8abab624 100644 --- a/tests/instructions/create_test.py +++ b/tests/instructions/create_test.py @@ -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: