enzymefinance / oyente

An Analysis Tool for Smart Contracts
GNU General Public License v3.0
1.32k stars 311 forks source link

Add support for standard-json. #200

Open MicahZoltu opened 7 years ago

MicahZoltu commented 7 years ago

In a complex project like Augur, the contracts don't compile by just passing them to solc because the system is made up of dozens of contracts that have intertwining references and a non-trivial build system. "Standard JSON" seems to be the recommended mechanism for defining complex builds for solc, so it would be nice if Oyente supported building from a "Standard JSON" file as well so large projects can leverage Oyente (arguably, large projects need Oyente more than small projects).

joeykrug commented 7 years ago

Yes please +1

luongnt95 commented 7 years ago

Thanks @MicahZoltu Will consider this

beaugunderson commented 6 years ago

@luongnt95 looks like support was added here--does it work? :)

luongnt95 commented 6 years ago

@beaugunderson it's not fully supported. Could you help me test this feature? Just report any problems you have with this feature. Thanks

joeykrug commented 6 years ago

Below is a standard JSON output file for solidity, trying it with:

oyente/oyente.py --standard-json --source contracts.json

Traceback (most recent call last):
  File "oyente/oyente.py", line 209, in <module>
    main()
  File "oyente/oyente.py", line 202, in main
    exit_code = analyze_solidity(input_type='standard_json')
  File "oyente/oyente.py", line 105, in analyze_solidity
    helper = InputHelper(InputHelper.STANDARD_JSON, source=args.source, allow_paths=args.allow_paths)
  File "/home/ubuntu/workspace/oyente/input_helper.py", line 44, in __init__
    raise Exception("'%s' attribute can't be None" % attr)
Exception: 'allow_paths' attribute can't be None

contracts.json.zip

It'd be simplest if we could use the solidity json output as then we'd never run into path or build issues w/ oyente.

From above, perhaps it takes the solidity json input instead? I tried that and got the same error though

luongnt95 commented 6 years ago

@joeykrug Currently, Oyente only gets json input as the input. In order to run json input with Oyente, you also have to use --alow-paths parameter as in solc oyente/oyente.py --standard-json --source input_json.json --allow-paths <absolute paht>