Refactor code (#1831)

* Refactor code

* Edit tox

* Modify tox

* Modify tests

* Reduce processes
z3
Nikhil Parasaram 10 months ago committed by GitHub
parent b8ad3a9603
commit 828b54f1b6
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 5
      mythril/laser/ethereum/svm.py
  2. 2
      mythril/support/opcodes.py
  3. 2
      tests/integration_tests/parallel_test.py

@ -592,11 +592,6 @@ class LaserEVM:
self._new_node_state( self._new_node_state(
state, JumpType.CONDITIONAL, state.world_state.constraints[-1] state, JumpType.CONDITIONAL, state.world_state.constraints[-1]
) )
elif opcode in ("SLOAD", "SSTORE") and len(new_states) > 1:
for state in new_states:
self._new_node_state(
state, JumpType.CONDITIONAL, state.world_state.constraints[-1]
)
elif opcode == "RETURN": elif opcode == "RETURN":
for state in new_states: for state in new_states:
self._new_node_state(state, JumpType.RETURN) self._new_node_state(state, JumpType.RETURN)

@ -96,7 +96,7 @@ OPCODES: Dict = {
"MSTORE8": {GAS: (3, 98), STACK: (2, 0), ADDRESS: 0x53}, "MSTORE8": {GAS: (3, 98), STACK: (2, 0), ADDRESS: 0x53},
# assume 64 byte r/w cost as upper bound # assume 64 byte r/w cost as upper bound
"SLOAD": {GAS: (800, 800), STACK: UN_OPERATOR_TUPLE, ADDRESS: 0x54}, "SLOAD": {GAS: (800, 800), STACK: UN_OPERATOR_TUPLE, ADDRESS: 0x54},
"SSTORE": {GAS: (5000, 25000), STACK: (1, 0), ADDRESS: 0x55}, "SSTORE": {GAS: (5000, 25000), STACK: (2, 0), ADDRESS: 0x55},
"JUMP": {GAS: (8, 8), STACK: (1, 0), ADDRESS: 0x56}, "JUMP": {GAS: (8, 8), STACK: (1, 0), ADDRESS: 0x56},
"JUMPI": {GAS: (10, 10), STACK: (2, 0), ADDRESS: 0x57}, "JUMPI": {GAS: (10, 10), STACK: (2, 0), ADDRESS: 0x57},
"PC": {GAS: (2, 2), STACK: Z_OPERATOR_TUPLE, ADDRESS: 0x58}, "PC": {GAS: (2, 2), STACK: Z_OPERATOR_TUPLE, ADDRESS: 0x58},

@ -9,7 +9,7 @@ def test_parallel():
test_file = str(TESTDATA / "input_contracts" / "origin.sol") test_file = str(TESTDATA / "input_contracts" / "origin.sol")
program = f"python3 {MYTH} a {test_file} --solv 0.5.0 -o json" program = f"python3 {MYTH} a {test_file} --solv 0.5.0 -o json"
processes = [Popen(program, stdout=PIPE, shell=True) for i in range(30)] processes = [Popen(program, stdout=PIPE, shell=True) for i in range(8)]
for p in processes: for p in processes:
out, err = p.communicate() out, err = p.communicate()
json_output = json.loads(out.decode("utf-8")) json_output = json.loads(out.decode("utf-8"))

Loading…
Cancel
Save