diff --git a/libs/remix-debug/src/storage/mappingPreimages.js b/libs/remix-debug/src/storage/mappingPreimages.js index 513bdbf58f..94f95ae973 100644 --- a/libs/remix-debug/src/storage/mappingPreimages.js +++ b/libs/remix-debug/src/storage/mappingPreimages.js @@ -13,7 +13,7 @@ module.exports = { * @param {Function} callback - calback * @return {Map} - solidity mapping location (e.g { "" : { "": preimageOf1 }, { "": preimageOf2 }, ... }) */ -async function decodeMappingsKeys (web3, storage, corrections, callback) { +async function decodeMappingsKeys (web3, storage, corrections) { const ret = {} if (!corrections.length) corrections.push({offset: 0, slot: 0}) for (let hashedLoc in storage) { @@ -38,7 +38,7 @@ async function decodeMappingsKeys (web3, storage, corrections, callback) { ret[mappingSlot][mappingKey] = preimage } } - callback(null, ret) + return ret } /** diff --git a/libs/remix-debug/src/storage/storageResolver.js b/libs/remix-debug/src/storage/storageResolver.js index 4cedf4fa69..8e8afaeea6 100644 --- a/libs/remix-debug/src/storage/storageResolver.js +++ b/libs/remix-debug/src/storage/storageResolver.js @@ -47,14 +47,9 @@ class StorageResolver { if (error) { return callback(error) } - mappingPreimages.decodeMappingsKeys(this.web3, storage, corrections, (error, mappings) => { - if (error) { - callback(error) - } else { - this.preimagesMappingByAddress[address] = mappings - callback(null, mappings) - } - }) + const mappings = mappingPreimages.decodeMappingsKeys(this.web3, storage, corrections) + this.preimagesMappingByAddress[address] = mappings + callback(null, mappings) }) } diff --git a/libs/remix-debug/src/storage/storageViewer.js b/libs/remix-debug/src/storage/storageViewer.js index 3f7aaec6b9..d46b0cfc3b 100644 --- a/libs/remix-debug/src/storage/storageViewer.js +++ b/libs/remix-debug/src/storage/storageViewer.js @@ -118,14 +118,9 @@ class StorageViewer { if (this.mappingsLocationChanges) { return callback(null, this.mappingsLocationChanges) } - mappingPreimages.decodeMappingsKeys(this.web3, storageChanges, corrections, (error, mappings) => { - if (!error) { - this.mappingsLocationChanges = mappings - return callback(null, this.mappingsLocationChanges) - } else { - callback(error) - } - }) + const mappings = mappingPreimages.decodeMappingsKeys(this.web3, storageChanges, corrections) + this.mappingsLocationChanges = mappings + return callback(null, this.mappingsLocationChanges) } }