|
|
|
@ -103,38 +103,64 @@ class DebuggerUI { |
|
|
|
|
return this.isActive |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
startDebugging (blockNumber, txNumber, tx) { |
|
|
|
|
const self = this |
|
|
|
|
getDebugWeb3 () { |
|
|
|
|
return new Promise((resolve, reject) => { |
|
|
|
|
executionContext.detectNetwork((error, network) => { |
|
|
|
|
let web3 |
|
|
|
|
if (error || !network) { |
|
|
|
|
web3 = init.web3DebugNode(executionContext.web3()) |
|
|
|
|
} else { |
|
|
|
|
const webDebugNode = init.web3DebugNode(network.name) |
|
|
|
|
web3 = !webDebugNode ? executionContext.web3() : webDebugNode |
|
|
|
|
} |
|
|
|
|
init.extendWeb3(web3) |
|
|
|
|
resolve(web3) |
|
|
|
|
}) |
|
|
|
|
}) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
async startDebugging (blockNumber, txNumber, tx) { |
|
|
|
|
if (this.debugger) this.unLoad() |
|
|
|
|
|
|
|
|
|
let compilers = this.registry.get('compilersartefacts').api |
|
|
|
|
let lastCompilationResult |
|
|
|
|
if (compilers['__last']) lastCompilationResult = compilers['__last'] |
|
|
|
|
|
|
|
|
|
executionContext.detectNetwork((error, network) => { |
|
|
|
|
let web3 |
|
|
|
|
if (error || !network) { |
|
|
|
|
web3 = init.web3DebugNode(executionContext.web3()) |
|
|
|
|
} else { |
|
|
|
|
var webDebugNode = init.web3DebugNode(network.name) |
|
|
|
|
web3 = (!webDebugNode ? executionContext.web3() : webDebugNode) |
|
|
|
|
} |
|
|
|
|
init.extendWeb3(web3) |
|
|
|
|
this.debugger = new Debugger({ |
|
|
|
|
let web3 = await this.getDebugWeb3() |
|
|
|
|
this.debugger = new Debugger({ |
|
|
|
|
web3, |
|
|
|
|
offsetToLineColumnConverter: this.registry.get('offsettolinecolumnconverter').api, |
|
|
|
|
compiler: { lastCompilationResult } |
|
|
|
|
}) |
|
|
|
|
|
|
|
|
|
this.listenToEvents() |
|
|
|
|
this.debugger.debug(blockNumber, txNumber, tx, () => { |
|
|
|
|
this.stepManager = new StepManagerUI(this.debugger.step_manager) |
|
|
|
|
this.vmDebugger = new VmDebugger(this.debugger.vmDebuggerLogic) |
|
|
|
|
this.txBrowser.setState({ blockNumber, txNumber, debugging: true }) |
|
|
|
|
this.renderDebugger() |
|
|
|
|
}).catch((error) => { |
|
|
|
|
toaster(error) |
|
|
|
|
this.unLoad() |
|
|
|
|
}) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
getTrace (hash) { |
|
|
|
|
return new Promise(async (resolve, reject) => { |
|
|
|
|
const compilers = this.registry.get('compilersartefacts').api |
|
|
|
|
let lastCompilationResult |
|
|
|
|
if (compilers['__last']) lastCompilationResult = compilers['__last'] |
|
|
|
|
|
|
|
|
|
const web3 = await this.getDebugWeb3() |
|
|
|
|
|
|
|
|
|
const debug = new Debugger({ |
|
|
|
|
web3, |
|
|
|
|
offsetToLineColumnConverter: this.registry.get('offsettolinecolumnconverter').api, |
|
|
|
|
compiler: { lastCompilationResult } |
|
|
|
|
}) |
|
|
|
|
|
|
|
|
|
this.listenToEvents() |
|
|
|
|
this.debugger.debug(blockNumber, txNumber, tx, () => { |
|
|
|
|
self.stepManager = new StepManagerUI(this.debugger.step_manager) |
|
|
|
|
self.vmDebugger = new VmDebugger(this.debugger.vmDebuggerLogic) |
|
|
|
|
self.txBrowser.setState({ blockNumber, txNumber, debugging: true }) |
|
|
|
|
self.renderDebugger() |
|
|
|
|
}).catch((error) => { |
|
|
|
|
toaster(error) |
|
|
|
|
this.unLoad() |
|
|
|
|
debug.debugger.traceManager.traceRetriever.getTrace(hash, (error, trace) => { |
|
|
|
|
if (error) return reject(error) |
|
|
|
|
resolve(trace) |
|
|
|
|
}) |
|
|
|
|
}) |
|
|
|
|
} |
|
|
|
|