fix eth_getStorageAt

pull/2893/head
yann300 2 years ago committed by Aniket
parent ed7ce0c74b
commit c4a5e4b7ff
  1. 11
      libs/remix-simulator/src/VmProxy.ts
  2. 2
      libs/remix-simulator/src/methods/blocks.ts

@ -310,15 +310,8 @@ export class VmProxy {
// we don't use the range params here
address = toChecksumAddress(address)
let txHash
if (txIndex === 'latest') {
txHash = this.lastProcessedStorageTxHash[address]
} else {
const block = this.vmContext.blocks[blockNumber]
txHash = '0x' + block.transactions[txIndex].hash().toString('hex')
}
const block = this.vmContext.blocks[blockNumber]
const txHash = '0x' + block.transactions[txIndex].hash().toString('hex')
if (this.storageCache['after_' + txHash] && this.storageCache['after_' + txHash][address]) {
const storage = this.storageCache['after_' + txHash][address]

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

Loading…
Cancel
Save