fix storage at

pull/2893/head
yann300 2 years ago committed by Aniket
parent 007e73903d
commit cb7eacf42f
  1. 16
      libs/remix-simulator/src/VmProxy.ts

@ -132,6 +132,7 @@ export class VmProxy {
this.txs[this.processingHash] = tx this.txs[this.processingHash] = tx
this.txsReceipt[this.processingHash] = tx this.txsReceipt[this.processingHash] = tx
this.storageCache[this.processingHash] = {} this.storageCache[this.processingHash] = {}
this.storageCache['after_' + this.processingHash] = {}
if (data.to) { if (data.to) {
try { try {
const storage = await this.vm.stateManager.dumpStorage(data.to) const storage = await this.vm.stateManager.dumpStorage(data.to)
@ -175,6 +176,17 @@ export class VmProxy {
const status = data.execResult.exceptionError ? 0 : 1 const status = data.execResult.exceptionError ? 0 : 1
this.txsReceipt[this.processingHash].status = `0x${status}` this.txsReceipt[this.processingHash].status = `0x${status}`
const to = this.txs[this.processingHash].to
if (to) {
try {
const account = Address.fromString(to)
const storage = await this.vm.stateManager.dumpStorage(account)
this.storageCache['after_' + this.processingHash][to] = storage
} catch (e) {
console.log(e)
}
}
if (data.createdAddress) { if (data.createdAddress) {
const address = data.createdAddress.toString() const address = data.createdAddress.toString()
this.vmTraces[this.processingHash].return = toChecksumAddress(address) this.vmTraces[this.processingHash].return = toChecksumAddress(address)
@ -308,8 +320,8 @@ export class VmProxy {
if (this.storageCache[txHash] && this.storageCache[txHash][address]) { if (this.storageCache['after_' + txHash] && this.storageCache['after_' + txHash][address]) {
const storage = this.storageCache[txHash][address] const storage = this.storageCache['after_' + txHash][address]
return cb(null, { return cb(null, {
storage: JSON.parse(JSON.stringify(storage)), storage: JSON.parse(JSON.stringify(storage)),
nextKey: null nextKey: null

Loading…
Cancel
Save