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