storage imports updated

pull/5370/head
aniket-engg 4 years ago committed by Aniket
parent a9541d8218
commit daa84c6e69
  1. 4
      libs/remix-debug/src/storage/mappingPreimages.ts
  2. 8
      libs/remix-debug/src/storage/storageResolver.ts
  3. 7
      libs/remix-debug/src/storage/storageViewer.ts

@ -1,4 +1,4 @@
const util = require('../solidity-decoder/types/util')
import { sub } from '../solidity-decoder/types/util'
/**
* extract the mappings location from the storage
@ -17,7 +17,7 @@ export async function decodeMappingsKeys (web3, storage, corrections) {
try {
const key = storage[hashedLoc].key
for (let k in corrections) {
const corrected = util.sub(key, corrections[k].slot).toString(16)
const corrected = sub(key, corrections[k].slot).toString(16)
preimage = await getPreimage(web3, '0x' + corrected)
if (preimage) break
}

@ -1,6 +1,6 @@
'use strict'
const traceHelper = require('../trace/traceHelper')
const mappingPreimages = require('./mappingPreimages')
import { isContractCreation } from '../trace/traceHelper'
import { decodeMappingsKeys } from './mappingPreimages'
/**
* Basically one instance is created for one debugging session.
@ -50,7 +50,7 @@ export class StorageResolver {
return this.preimagesMappingByAddress[address]
}
const storage = await this.storageRange(tx, stepIndex, address)
const mappings = mappingPreimages.decodeMappingsKeys(this.web3, storage, corrections)
const mappings = decodeMappingsKeys(this.web3, storage, corrections)
this.preimagesMappingByAddress[address] = mappings
return mappings
}
@ -130,7 +130,7 @@ export class StorageResolver {
storageRangeWeb3Call (tx, address, start, maxSize): Promise<Array<unknown>> {
return new Promise((resolve, reject) => {
if (traceHelper.isContractCreation(address)) {
if (isContractCreation(address)) {
resolve([{}, null])
} else {
this.web3.debug.storageRangeAt(

@ -1,7 +1,6 @@
'use strict'
const remixLib = require('@remix-project/remix-lib')
const util = remixLib.util
const mappingPreimages = require('./mappingPreimages')
import { util } from '@remix-project/remix-lib'
import { decodeMappingsKeys } from './mappingPreimages'
/**
* easier access to the storage resolver
@ -102,7 +101,7 @@ export class StorageViewer {
if (this.mappingsLocationChanges) {
return this.mappingsLocationChanges
}
const mappings = mappingPreimages.decodeMappingsKeys(this.web3, storageChanges, corrections)
const mappings = decodeMappingsKeys(this.web3, storageChanges, corrections)
this.mappingsLocationChanges = mappings
return this.mappingsLocationChanges
}

Loading…
Cancel
Save