Unverified Commit a7780b8e authored by yann300's avatar yann300 Committed by GitHub

Merge pull request #1289 from ethereum/fixGettingCompilationResult-Debugger

Fix getting compilation result
parents fb8b4c20 ae5c5c38
...@@ -74,7 +74,10 @@ export const DebuggerApiMixin = (Base) => class extends Base { ...@@ -74,7 +74,10 @@ export const DebuggerApiMixin = (Base) => class extends Base {
const targetAddress = target || receipt.contractAddress || receipt.to const targetAddress = target || receipt.contractAddress || receipt.to
const codeAtAddress = await this._web3.eth.getCode(targetAddress) const codeAtAddress = await this._web3.eth.getCode(targetAddress)
const output = await this.call('fetchAndCompile', 'resolve', targetAddress, codeAtAddress, 'browser/.debug') const output = await this.call('fetchAndCompile', 'resolve', targetAddress, codeAtAddress, 'browser/.debug')
return new CompilerAbstract(output.languageversion, output.data, output.source) if (output) {
return new CompilerAbstract(output.languageversion, output.data, output.source)
}
return null
} }
async getDebugWeb3 () { async getDebugWeb3 () {
......
...@@ -189,7 +189,7 @@ export class VmDebuggerLogic { ...@@ -189,7 +189,7 @@ export class VmDebuggerLogic {
}) })
}) })
this.debugger.event.register('indexChanged', this, (index) => { this.debugger.event.register('indexChanged', this, async (index) => {
if (index < 0) return if (index < 0) return
if (this.stepManager.currentStepIndex !== index) return if (this.stepManager.currentStepIndex !== index) return
if (!this.storageResolver) return if (!this.storageResolver) return
...@@ -201,11 +201,13 @@ export class VmDebuggerLogic { ...@@ -201,11 +201,13 @@ export class VmDebuggerLogic {
for (var k in this.addresses) { for (var k in this.addresses) {
var address = this.addresses[k] var address = this.addresses[k]
var storageViewer = new StorageViewer({ stepIndex: this.stepManager.currentStepIndex, tx: this.tx, address: address }, this.storageResolver, this._traceManager) var storageViewer = new StorageViewer({ stepIndex: this.stepManager.currentStepIndex, tx: this.tx, address: address }, this.storageResolver, this._traceManager)
storageViewer.storageRange().then((result) => { try {
storageJSON[address] = result storageJSON[address] = await storageViewer.storageRange()
this.event.trigger('traceStorageUpdate', [storageJSON]) } catch (e) {
}) console.error(e)
}
} }
this.event.trigger('traceStorageUpdate', [storageJSON])
}) })
} }
......
...@@ -15,11 +15,11 @@ export function resolveCalledAddress (vmTraceIndex, trace) { ...@@ -15,11 +15,11 @@ export function resolveCalledAddress (vmTraceIndex, trace) {
} }
export function isCallInstruction (step) { export function isCallInstruction (step) {
return ['CALL', 'STATICCALL', 'CALLCODE', 'CREATE', 'DELEGATECALL'].includes(step.op) return ['CALL', 'STATICCALL', 'CALLCODE', 'CREATE', 'DELEGATECALL', 'CREATE2'].includes(step.op)
} }
export function isCreateInstruction (step) { export function isCreateInstruction (step) {
return step.op === 'CREATE' return step.op === 'CREATE' || step.op === 'CREATE2'
} }
export function isReturnInstruction (step) { export function isReturnInstruction (step) {
...@@ -47,7 +47,7 @@ export function isSHA3Instruction (step) { ...@@ -47,7 +47,7 @@ export function isSHA3Instruction (step) {
} }
export function newContextStorage (step) { export function newContextStorage (step) {
return step.op === 'CREATE' || step.op === 'CALL' return step.op === 'CREATE' || step.op === 'CALL' || step.op === 'CREATE2'
} }
export function isCallToPrecompiledContract (index, trace) { export function isCallToPrecompiledContract (index, trace) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment