Skip to content
This repository has been archived by the owner on Jan 25, 2022. It is now read-only.

Separate mythx artifacts #84

Merged
merged 39 commits into from Mar 6, 2019
Merged

Separate mythx artifacts #84

merged 39 commits into from Mar 6, 2019

Conversation

rocky
Copy link
Contributor

@rocky rocky commented Feb 24, 2019

This is not finished, but it seems to be a first step and (mostly?) works. It is important to get this out for people to get a sense of what's up.

We have modified truffle artifact directory build/contracts to save additional information per contract to assist MythX analysis.

This puts artifacts in build/mythx/contracts which is like build/contracts but each contract has:

  • sourceList[] - a list of the sources that can be used in a sourceMap.
  • sources - a dict whose key is an entry of sourceList and whose value contains
    • source: string
    • ast: ast
    • legacyAst: ast

@rocky rocky changed the title Separate mythx artifacts WIP - Separate mythx artifacts Feb 25, 2019
@rocky rocky force-pushed the separate-mythx-artifacts branch 2 times, most recently from ad0c936 to 4c58f40 Compare March 2, 2019 22:28
rocky and others added 16 commits March 3, 2019 16:20
even though MythX doesn't support it right now
* Rename contracts to basenames
* change config.build_mythx_snapshots to config.build_mythx_contracts
- reduce solc output selection
- Handle imports by returning multiple sources and contracts in a file
* move normalizeJsonObject to truffle-compile
* move bytecode cleaning to truffle-compile
Now it stores details of imported files as well
rocky and others added 9 commits March 3, 2019 18:36
Output "Writing artifacts" message only once
See:  console.log("FIXME: danyiar");
for what remains.
sourceMap fixup: adjust non-zero file entries when sending only a single source.
Note: this is temporary until we have something better worked out.

Don't recompile where we don't ahve to. Don't print writing artifacts
when we haven't recompiled. To do this we pass back the stale status.
Addresses this error when run on AragonOS:
MythX Logs:
TypeError: Cannot read property 'level' of undefined
    at logs.forEach.log (/src/external-vcs/github/consensys/truffle-security/helpers.js:361:38)
    at Array.forEach (<anonymous>)
    at doReport (/src/external-vcs/github/consensys/truffle-security/helpers.js:360:14)
    at Object.analyze (/src/external-vcs/github/consensys/truffle-security/helpers.js:492:5)
    at process._tickCallback (internal/process/next_tick.js:68:7)

There is probably some fancier way to address this in the reduce above, but I like simple and stupid.
@tagomaru tagomaru mentioned this pull request Mar 5, 2019
rocky and others added 11 commits March 5, 2019 11:44
* Adjust test_mythx.js test.
* turn a commented-out test into a pending test
* add tests for zeroedSourceMap
* add tests for newTruffleObjToOldTruffleByContracts
Wrong variable name is a remnant from older code.
@daniyarchambylov daniyarchambylov changed the title WIP - Separate mythx artifacts Separate mythx artifacts Mar 6, 2019
@rocky rocky merged commit dcd862b into master Mar 6, 2019
@rocky rocky deleted the separate-mythx-artifacts branch March 11, 2019 16:23
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants