Fixed JSON data issue
This commit is contained in:
parent
2991e5f5d1
commit
21ea71d9a1
|
@ -54,8 +54,9 @@ class MythXIssues {
|
|||
this.offset2InstNum = srcmap.makeOffset2InstNum(this.buildObj.deployedBytecode);
|
||||
this.contractName = buildObj.contractName;
|
||||
this.sourceMappingDecoder = new SourceMappingDecoder();
|
||||
//this.asts = this.mapAsts(this.buildObj.sources);
|
||||
//this.lineBreakPositions = this.mapLineBreakPositions(this.sourceMappingDecoder, this.buildObj.sources);
|
||||
console.log("buildObj", buildObj)
|
||||
this.asts = this.mapAsts(this.buildObj.sources);
|
||||
this.lineBreakPositions = this.mapLineBreakPositions(this.sourceMappingDecoder, this.buildObj.sources);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -4,6 +4,7 @@ const armlet = require('armlet')
|
|||
const fs = require('fs')
|
||||
const util = require('util');
|
||||
const eslintHelpers = require('./eslint');
|
||||
const srcmap = require('./srcmap');
|
||||
|
||||
const getContractFiles = directory => {
|
||||
let files = fs.readdirSync(directory)
|
||||
|
@ -46,14 +47,13 @@ const buildRequestData = contractObjects => {
|
|||
//console.log("goes in", [sourcePath, data])
|
||||
const contract = {
|
||||
contractName: contractKey,
|
||||
bytecode: contractJSON.evm.bytecode,
|
||||
bytecode: contractJSON.evm.bytecode.object,
|
||||
deployedBytecode: contractJSON.evm.deployedBytecode.object,
|
||||
sourceMap: contractJSON.evm.bytecode.sourceMap,
|
||||
deployedSourceMap: contractJSON.evm.deployedBytecode.sourceMap,
|
||||
ast: source.ast,
|
||||
legacyAST: source.legacyAST,
|
||||
sourcePath: fileKey
|
||||
//source: source
|
||||
};
|
||||
|
||||
console.log("comes out", contract)
|
||||
|
@ -105,15 +105,19 @@ const buildRequestData = contractObjects => {
|
|||
return allContracts;
|
||||
};
|
||||
|
||||
// Take truffle's build/contracts/xxx.json JSON and make it
|
||||
// compatible with the Mythril Platform API
|
||||
const truffle2MythXJSON = function(truffleJSON, toolId = 'truffle-security') {
|
||||
let {
|
||||
contractName,
|
||||
bytecode,
|
||||
deployedBytecode,
|
||||
sourceMap,
|
||||
deployedSourceMap,
|
||||
sourcePath,
|
||||
source,
|
||||
legacyAST,
|
||||
ast,
|
||||
ast
|
||||
} = truffleJSON;
|
||||
|
||||
const sourcesKey = path.basename(sourcePath);
|
||||
|
@ -121,15 +125,15 @@ const truffle2MythXJSON = function(truffleJSON, toolId = 'truffle-security') {
|
|||
// FIXME: why do we only one sourcePath in sourceList?
|
||||
// We shouldn't be zeroing this but instead correcting sourceList to
|
||||
// have the multiple entries.
|
||||
//sourceMap = srcmap.zeroedSourceMap(sourceMap);
|
||||
//deployedSourceMap = srcmap.zeroedSourceMap(deployedSourceMap);
|
||||
sourceMap = srcmap.zeroedSourceMap(sourceMap);
|
||||
deployedSourceMap = srcmap.zeroedSourceMap(deployedSourceMap);
|
||||
|
||||
return {
|
||||
contractName,
|
||||
bytecode,
|
||||
deployedBytecode,
|
||||
//sourceMap,
|
||||
//deployedSourceMap,
|
||||
sourceMap,
|
||||
deployedSourceMap,
|
||||
sourceList: [ sourcePath ],
|
||||
sources: {
|
||||
[sourcesKey]: {
|
||||
|
|
Loading…
Reference in New Issue