Merge pull request #385 from ConsenSys/python-3.5-intermittent

Force determinism in iterating over dictionary keys...
pull/384/merge
R. Bernstein 6 years ago committed by GitHub
commit b6beed98d4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  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