From f96876b4791e370e1065d7fb265e7b5eee859945 Mon Sep 17 00:00:00 2001 From: yann300 Date: Tue, 11 Apr 2017 21:02:50 +0200 Subject: [PATCH] typo --- src/storage/storageResolver.js | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/src/storage/storageResolver.js b/src/storage/storageResolver.js index 8fd2ae5d5d..e072e71db0 100644 --- a/src/storage/storageResolver.js +++ b/src/storage/storageResolver.js @@ -11,8 +11,8 @@ class StorageResolver { } /** - * return the storage for the given context (address and vm trace index) - * returns the range 0 => this.maxSize + * returns the storage for the given context (address and vm trace index) + * returns the range 0x0 => this.maxSize * * @param {Object} - tx - transaction * @param {Int} - stepIndex - Index of the stop in the vm trace @@ -31,11 +31,11 @@ class StorageResolver { * @param {Function} - callback - {key, hashedKey, value} - */ storageSlot (slot, tx, stepIndex, callback) { - storageRangeInternal(this, slot, tx, stepIndex, false, function (error, storage) { + var hashed = helper.sha3_32(slot) + storageRangeInternal(this, hashed, tx, stepIndex, false, function (error, storage) { if (error) { callback(error) } else { - var hashed = helper.sha3_32(slot) callback(null, storage[hashed] !== undefined ? storage[hashed] : null) } }) @@ -58,7 +58,7 @@ class StorageResolver { * even if the next 1000 items are not in the cache. * - If @arg slot is not cached, the corresponding value will be resolved and the next 1000 slots. */ -function storageRangeInternal (self, slot, tx, stepIndex, fullStorage, callback) { +function storageRangeInternal (self, slotKey, tx, stepIndex, fullStorage, callback) { resolveAddress(self, stepIndex, (error, address) => { if (error) { return callback(error) @@ -67,19 +67,19 @@ function storageRangeInternal (self, slot, tx, stepIndex, fullStorage, callback) if (error) { return callback(error) } - if (!fullStorage && storageChanges[slot]) { + if (!fullStorage && storageChanges[slotKey]) { return callback(null, storageChanges) } - var cached = fromCache(self, address, slot) - if (cached && cached[slot]) { // we have the current slot in the cache and maybe the next 1000 ... + var cached = fromCache(self, address, slotKey) + if (cached && cached[slotKey]) { // we have the current slot in the cache and maybe the next 1000 ... return callback(null, Object.assign(cached, storageChanges)) } - storageRangeWeb3Call(tx, address, slot, self.maxSize, (error, storage, complete) => { + storageRangeWeb3Call(tx, address, slotKey, self.maxSize, (error, storage, complete) => { if (error) { return callback(error) } toCache(self, address, storage) - if (slot === '0x0' && Object.keys(storage).length < self.maxSize) { + if (slotKey === '0x0' && Object.keys(storage).length < self.maxSize) { self.storageByAddress[address].complete = true } callback(null, Object.assign(storage, storageChanges))