parent
cc0028c103
commit
4db645cb91
@ -1,7 +1,7 @@ |
|||||||
'use strict' |
'use strict' |
||||||
var remixLib = require('remix-lib') |
|
||||||
var EventManager = remixLib.EventManager |
var EventManager = require('../eventManager') |
||||||
var helper = remixLib.helpers.trace |
var helper = require('../helpers/traceHelper') |
||||||
|
|
||||||
/** |
/** |
||||||
* allow to manage breakpoint |
* allow to manage breakpoint |
@ -1,8 +1,8 @@ |
|||||||
'use strict' |
'use strict' |
||||||
var remixLib = require('remix-lib') |
|
||||||
var EventManager = remixLib.EventManager |
var EventManager = require('../eventManager') |
||||||
var traceHelper = remixLib.helpers.trace |
var traceHelper = require('../helpers/traceHelper') |
||||||
var SourceMappingDecoder = remixLib.SourceMappingDecoder |
var SourceMappingDecoder = require('../sourceMappingDecoder') |
||||||
var CodeResolver = require('./codeResolver') |
var CodeResolver = require('./codeResolver') |
||||||
|
|
||||||
/* |
/* |
@ -1,8 +1,7 @@ |
|||||||
'use strict' |
'use strict' |
||||||
|
|
||||||
var parseCode = require('./codeUtils').parseCode |
var parseCode = require('./codeUtils').parseCode |
||||||
var remixLib = require('remix-lib') |
var util = require('../util') |
||||||
var util = remixLib.util |
|
||||||
|
|
||||||
var createExpressions = function (instructions) { |
var createExpressions = function (instructions) { |
||||||
var expressions = [] |
var expressions = [] |
@ -1,6 +1,5 @@ |
|||||||
'use strict' |
'use strict' |
||||||
var remixLib = require('remix-lib') |
var traceHelper = require('../helpers/traceHelper') |
||||||
var traceHelper = remixLib.helpers.trace |
|
||||||
|
|
||||||
function TraceAnalyser (_cache) { |
function TraceAnalyser (_cache) { |
||||||
this.traceCache = _cache |
this.traceCache = _cache |
@ -1,6 +1,5 @@ |
|||||||
'use strict' |
'use strict' |
||||||
var remixLib = require('remix-lib') |
var helper = require('../util') |
||||||
var helper = remixLib.util |
|
||||||
|
|
||||||
function TraceCache () { |
function TraceCache () { |
||||||
this.init() |
this.init() |
@ -1,7 +1,7 @@ |
|||||||
'use strict' |
'use strict' |
||||||
var remixLib = require('remix-lib') |
|
||||||
var traceHelper = remixLib.helpers.trace |
var traceHelper = require('../helpers/traceHelper') |
||||||
var util = remixLib.util |
var util = require('../util') |
||||||
|
|
||||||
function TraceStepManager (_traceAnalyser) { |
function TraceStepManager (_traceAnalyser) { |
||||||
this.traceAnalyser = _traceAnalyser |
this.traceAnalyser = _traceAnalyser |
@ -1,7 +1,6 @@ |
|||||||
'use strict' |
'use strict' |
||||||
var tape = require('tape') |
var tape = require('tape') |
||||||
var remixLib = require('remix-lib') |
var Web3Providers = require('../src/web3Provider/web3Providers') |
||||||
var Web3Providers = remixLib.vm.Web3Providers |
|
||||||
var TraceManager = require('../src/trace/traceManager') |
var TraceManager = require('../src/trace/traceManager') |
||||||
var CodeManager = require('../src/code/codeManager') |
var CodeManager = require('../src/code/codeManager') |
||||||
var web3Test = require('./resources/testWeb3') |
var web3Test = require('./resources/testWeb3') |
@ -0,0 +1,31 @@ |
|||||||
|
var init = { |
||||||
|
overrideWeb3: function (web3, web3Override) { |
||||||
|
web3.eth.getCode = web3Override.getCode |
||||||
|
web3.debug.traceTransaction = web3Override.traceTransaction |
||||||
|
web3.debug.storageRangeAt = web3Override.storageRangeAt |
||||||
|
web3.eth.getTransaction = web3Override.getTransaction |
||||||
|
web3.eth.getTransactionFromBlock = web3Override.getTransactionFromBlock |
||||||
|
web3.eth.getBlockNumber = web3Override.getBlockNumber |
||||||
|
}, |
||||||
|
|
||||||
|
readFile: function (filename, callback) { |
||||||
|
var fs = require('fs') |
||||||
|
try { |
||||||
|
console.log('reading ' + filename) |
||||||
|
if (callback) { |
||||||
|
fs.readFile(filename, 'utf8', callback) |
||||||
|
} else { |
||||||
|
return fs.readFileSync(filename, 'utf8') |
||||||
|
} |
||||||
|
} catch (e) { |
||||||
|
console.log(e) |
||||||
|
if (callback) { |
||||||
|
callback(e) |
||||||
|
} else { |
||||||
|
return e |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
module.exports = init |
@ -0,0 +1,51 @@ |
|||||||
|
'use strict' |
||||||
|
var init = require('../init') |
||||||
|
var web3Override = {} |
||||||
|
web3Override.eth = {} |
||||||
|
web3Override.debug = {} |
||||||
|
var data = init.readFile(require('path').resolve(__dirname, 'testWeb3.json')) |
||||||
|
data = JSON.parse(data) |
||||||
|
|
||||||
|
web3Override.eth.getCode = function (address, callback) { |
||||||
|
if (callback) { |
||||||
|
callback(null, data.testCodes[address]) |
||||||
|
} else { |
||||||
|
return data.testCodes[address] |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
web3Override.debug.traceTransaction = function (txHash, options, callback) { |
||||||
|
callback(null, data.testTraces[txHash]) |
||||||
|
} |
||||||
|
|
||||||
|
web3Override.debug.storageRangeAt = function (blockNumber, txIndex, address, start, maxSize, callback) { |
||||||
|
callback(null, { storage: {}, complete: true }) |
||||||
|
} |
||||||
|
|
||||||
|
web3Override.eth.getTransaction = function (txHash, callback) { |
||||||
|
if (callback) { |
||||||
|
callback(null, data.testTxs[txHash]) |
||||||
|
} else { |
||||||
|
return data.testTxs[txHash] |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
web3Override.eth.getTransactionFromBlock = function (blockNumber, txIndex, callback) { |
||||||
|
if (callback) { |
||||||
|
callback(null, data.testTxsByBlock[blockNumber + '-' + txIndex]) |
||||||
|
} else { |
||||||
|
return data.testTxsByBlock[blockNumber + '-' + txIndex] |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
web3Override.eth.getBlockNumber = function (callback) { callback('web3 modified testing purposes :)') } |
||||||
|
|
||||||
|
web3Override.eth.setProvider = function (provider) {} |
||||||
|
|
||||||
|
web3Override.eth.providers = { 'HttpProvider': function (url) {} } |
||||||
|
|
||||||
|
web3Override.eth.currentProvider = {'host': 'test provider'} |
||||||
|
|
||||||
|
if (typeof (module) !== 'undefined' && typeof (module.exports) !== 'undefined') { |
||||||
|
module.exports = web3Override |
||||||
|
} |
File diff suppressed because one or more lines are too long
@ -1,8 +1,7 @@ |
|||||||
'use strict' |
'use strict' |
||||||
var TraceManager = require('../src/trace/traceManager') |
var TraceManager = require('../src/trace/traceManager') |
||||||
var tape = require('tape') |
var tape = require('tape') |
||||||
var remixLib = require('remix-lib') |
var Web3Providers = require('../src/web3Provider/web3Providers') |
||||||
var Web3Providers = remixLib.vm.Web3Providers |
|
||||||
var web3Test = require('./resources/testWeb3') |
var web3Test = require('./resources/testWeb3') |
||||||
|
|
||||||
let web3 = null |
let web3 = null |
Loading…
Reference in new issue