Force determinism in iterating over dictionary keys...

and replace an "import *" with something specific
pull/385/head
rocky 6 years ago
parent 19d2e1b0fd
commit 83fedfaf43
  1. 6
      mythril/ether/soliditycontract.py

@ -1,6 +1,6 @@
import mythril.laser.ethereum.util as helper import mythril.laser.ethereum.util as helper
from mythril.ether.ethcontract import ETHContract from mythril.ether.ethcontract import ETHContract
from mythril.ether.util import * from mythril.ether.util import get_solc_json
from mythril.exceptions import NoContractFoundError from mythril.exceptions import NoContractFoundError
@ -54,7 +54,7 @@ class SolidityContract(ETHContract):
# If a contract name has been specified, find the bytecode of that specific contract # If a contract name has been specified, find the bytecode of that specific contract
if name: if name:
for key, contract in data['contracts'].items(): for key, contract in sorted(data['contracts'].items()):
filename, _name = key.split(":") filename, _name = key.split(":")
if filename == input_file and name == _name and len(contract['bin-runtime']): if filename == input_file and name == _name and len(contract['bin-runtime']):
@ -67,7 +67,7 @@ class SolidityContract(ETHContract):
# If no contract name is specified, get the last bytecode entry for the input file # If no contract name is specified, get the last bytecode entry for the input file
else: else:
for key, contract in data['contracts'].items(): for key, contract in sorted(data['contracts'].items()):
filename, name = key.split(":") filename, name = key.split(":")
if filename == input_file and len(contract['bin-runtime']): if filename == input_file and len(contract['bin-runtime']):

Loading…
Cancel
Save