Commit 5d818814 authored by aniket-engg's avatar aniket-engg Committed by Aniket

storage imports updated

parent 2984cc21
const util = require('../solidity-decoder/types/util') import { sub } from '../solidity-decoder/types/util'
/** /**
* extract the mappings location from the storage * extract the mappings location from the storage
...@@ -17,7 +17,7 @@ export async function decodeMappingsKeys (web3, storage, corrections) { ...@@ -17,7 +17,7 @@ export async function decodeMappingsKeys (web3, storage, corrections) {
try { try {
const key = storage[hashedLoc].key const key = storage[hashedLoc].key
for (let k in corrections) { 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) preimage = await getPreimage(web3, '0x' + corrected)
if (preimage) break if (preimage) break
} }
......
'use strict' 'use strict'
const traceHelper = require('../trace/traceHelper') import { isContractCreation } from '../trace/traceHelper'
const mappingPreimages = require('./mappingPreimages') import { decodeMappingsKeys } from './mappingPreimages'
/** /**
* Basically one instance is created for one debugging session. * Basically one instance is created for one debugging session.
...@@ -50,7 +50,7 @@ export class StorageResolver { ...@@ -50,7 +50,7 @@ export class StorageResolver {
return this.preimagesMappingByAddress[address] return this.preimagesMappingByAddress[address]
} }
const storage = await this.storageRange(tx, stepIndex, 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 this.preimagesMappingByAddress[address] = mappings
return mappings return mappings
} }
...@@ -130,7 +130,7 @@ export class StorageResolver { ...@@ -130,7 +130,7 @@ export class StorageResolver {
storageRangeWeb3Call (tx, address, start, maxSize): Promise<Array<unknown>> { storageRangeWeb3Call (tx, address, start, maxSize): Promise<Array<unknown>> {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
if (traceHelper.isContractCreation(address)) { if (isContractCreation(address)) {
resolve([{}, null]) resolve([{}, null])
} else { } else {
this.web3.debug.storageRangeAt( this.web3.debug.storageRangeAt(
......
'use strict' 'use strict'
const remixLib = require('@remix-project/remix-lib') import { util } from '@remix-project/remix-lib'
const util = remixLib.util import { decodeMappingsKeys } from './mappingPreimages'
const mappingPreimages = require('./mappingPreimages')
/** /**
* easier access to the storage resolver * easier access to the storage resolver
...@@ -102,7 +101,7 @@ export class StorageViewer { ...@@ -102,7 +101,7 @@ export class StorageViewer {
if (this.mappingsLocationChanges) { if (this.mappingsLocationChanges) {
return this.mappingsLocationChanges return this.mappingsLocationChanges
} }
const mappings = mappingPreimages.decodeMappingsKeys(this.web3, storageChanges, corrections) const mappings = decodeMappingsKeys(this.web3, storageChanges, corrections)
this.mappingsLocationChanges = mappings this.mappingsLocationChanges = mappings
return this.mappingsLocationChanges return this.mappingsLocationChanges
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment