fix debugger e2e

pull/5370/head
yann300 2 years ago committed by Aniket
parent bb1650ef05
commit 7d1ddbd6f5
  1. 17
      libs/remix-simulator/src/VmProxy.ts

@ -28,7 +28,6 @@ export class VmProxy {
providers providers
currentProvider currentProvider
storageCache storageCache
lastProcessedStorageTxHash
sha3Preimages sha3Preimages
sha3 sha3
toHex toHex
@ -69,7 +68,6 @@ export class VmProxy {
this.providers = { HttpProvider: function (url) {} } this.providers = { HttpProvider: function (url) {} }
this.currentProvider = { host: 'vm provider' } this.currentProvider = { host: 'vm provider' }
this.storageCache = {} this.storageCache = {}
this.lastProcessedStorageTxHash = {}
this.sha3Preimages = {} this.sha3Preimages = {}
// util // util
this.sha3 = (...args) => utils.sha3.apply(this, args) this.sha3 = (...args) => utils.sha3.apply(this, args)
@ -136,7 +134,6 @@ export class VmProxy {
try { try {
const storage = await this.vm.stateManager.dumpStorage(data.to) const storage = await this.vm.stateManager.dumpStorage(data.to)
this.storageCache[this.processingHash][tx['to']] = storage this.storageCache[this.processingHash][tx['to']] = storage
this.lastProcessedStorageTxHash[tx['to']] = this.processingHash
} catch (e) { } catch (e) {
console.log(e) console.log(e)
} }
@ -201,6 +198,7 @@ export class VmProxy {
} }
async pushTrace (data: InterpreterStep) { async pushTrace (data: InterpreterStep) {
try {
const depth = data.depth + 1 // geth starts the depth from 1 const depth = data.depth + 1 // geth starts the depth from 1
if (!this.processingHash) { if (!this.processingHash) {
console.log('no tx processing') console.log('no tx processing')
@ -253,19 +251,14 @@ export class VmProxy {
if (step.op === 'CREATE') { if (step.op === 'CREATE') {
this.processingAddress = '(Contract Creation - Step ' + this.processingIndex + ')' this.processingAddress = '(Contract Creation - Step ' + this.processingIndex + ')'
this.storageCache[this.processingHash][this.processingAddress] = {} this.storageCache[this.processingHash][this.processingAddress] = {}
this.lastProcessedStorageTxHash[this.processingAddress] = this.processingHash
} else { } else {
this.processingAddress = normalizeHexAddress(step.stack[step.stack.length - 2]) this.processingAddress = normalizeHexAddress(step.stack[step.stack.length - 2])
this.processingAddress = toChecksumAddress(this.processingAddress) this.processingAddress = toChecksumAddress(this.processingAddress)
if (!this.storageCache[this.processingHash][this.processingAddress]) { if (!this.storageCache[this.processingHash][this.processingAddress]) {
const account = Address.fromString(this.processingAddress) const account = Address.fromString(this.processingAddress)
try { this.vm.stateManager.dumpStorage(account).then((storage) => {
const storage = await this.vm.stateManager.dumpStorage(account)
this.storageCache[this.processingHash][this.processingAddress] = storage this.storageCache[this.processingHash][this.processingAddress] = storage
this.lastProcessedStorageTxHash[this.processingAddress] = this.processingHash }).catch(console.log)
} catch (e) {
console.log(e)
}
} }
} }
} }
@ -276,9 +269,11 @@ export class VmProxy {
preimage: preimage preimage: preimage
} }
} }
this.processingIndex++ this.processingIndex++
this.previousDepth = depth this.previousDepth = depth
} catch (e) {
console.log(e)
}
} }
getCode (address, cb) { getCode (address, cb) {

Loading…
Cancel
Save