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
  2. 2
      libs/remix-simulator/src/methods/blocks.ts

@ -132,6 +132,7 @@ export class VmProxy {
this.txs[this.processingHash] = tx
this.txsReceipt[this.processingHash] = tx
this.storageCache[this.processingHash] = {}
this.storageCache['after_' + this.processingHash] = {}
if (data.to) {
try {
const storage = await this.vm.stateManager.dumpStorage(data.to)
@ -175,6 +176,17 @@ export class VmProxy {
const status = data.execResult.exceptionError ? 0 : 1
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) {
const address = data.createdAddress.toString()
this.vmTraces[this.processingHash].return = toChecksumAddress(address)
@ -308,8 +320,8 @@ export class VmProxy {
if (this.storageCache[txHash] && this.storageCache[txHash][address]) {
const storage = this.storageCache[txHash][address]
if (this.storageCache['after_' + txHash] && this.storageCache['after_' + txHash][address]) {
const storage = this.storageCache['after_' + txHash][address]
return cb(null, {
storage: JSON.parse(JSON.stringify(storage)),
nextKey: null

@ -173,7 +173,7 @@ export class Blocks {
}
eth_getStorageAt (payload, cb) {
const [address, position, blockNumber] = payload.params
const [ address, position, blockNumber ] = payload.params
this.vmContext.web3().debug.storageRangeAt(blockNumber, 'latest', address.toLowerCase(), position, 1, (err, result) => {
if (err || (result.storage && Object.values(result.storage).length === 0)) {

Loading…
Cancel
Save