|
|
@ -91,10 +91,8 @@ class StorageResolver { |
|
|
|
if (cached && cached.storage[slotKey]) { // we have the current slot in the cache and maybe the next 1000...
|
|
|
|
if (cached && cached.storage[slotKey]) { // we have the current slot in the cache and maybe the next 1000...
|
|
|
|
return resolve(cached.storage) |
|
|
|
return resolve(cached.storage) |
|
|
|
} |
|
|
|
} |
|
|
|
this.storageRangeWeb3Call(tx, address, slotKey, self.maxSize, (error, storage, nextKey) => { |
|
|
|
this.storageRangeWeb3Call(tx, address, slotKey, self.maxSize).then((result) => { |
|
|
|
if (error) { |
|
|
|
const [storage, nextKey] = result |
|
|
|
return reject(error) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
if (!storage[slotKey] && slotKey !== self.zeroSlot) { // we don't cache the zero slot (could lead to inconsistency)
|
|
|
|
if (!storage[slotKey] && slotKey !== self.zeroSlot) { // we don't cache the zero slot (could lead to inconsistency)
|
|
|
|
storage[slotKey] = { |
|
|
|
storage[slotKey] = { |
|
|
|
key: slotKey, |
|
|
|
key: slotKey, |
|
|
@ -106,7 +104,7 @@ class StorageResolver { |
|
|
|
self.storageByAddress[address].complete = true |
|
|
|
self.storageByAddress[address].complete = true |
|
|
|
} |
|
|
|
} |
|
|
|
return resolve(storage) |
|
|
|
return resolve(storage) |
|
|
|
}) |
|
|
|
}).catch(reject) |
|
|
|
}) |
|
|
|
}) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -136,25 +134,27 @@ class StorageResolver { |
|
|
|
self.storageByAddress[address].storage = Object.assign(self.storageByAddress[address].storage || {}, storage) |
|
|
|
self.storageByAddress[address].storage = Object.assign(self.storageByAddress[address].storage || {}, storage) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
storageRangeWeb3Call (tx, address, start, maxSize, callback) { |
|
|
|
storageRangeWeb3Call (tx, address, start, maxSize) { |
|
|
|
if (traceHelper.isContractCreation(address)) { |
|
|
|
return new Promise((resolve, reject) => { |
|
|
|
callback(null, {}, null) |
|
|
|
if (traceHelper.isContractCreation(address)) { |
|
|
|
} else { |
|
|
|
resolve([{}, null]) |
|
|
|
this.web3.debug.storageRangeAt( |
|
|
|
} else { |
|
|
|
tx.blockHash, tx.transactionIndex === undefined ? tx.hash : tx.transactionIndex, |
|
|
|
this.web3.debug.storageRangeAt( |
|
|
|
address, |
|
|
|
tx.blockHash, tx.transactionIndex === undefined ? tx.hash : tx.transactionIndex, |
|
|
|
start, |
|
|
|
address, |
|
|
|
maxSize, |
|
|
|
start, |
|
|
|
(error, result) => { |
|
|
|
maxSize, |
|
|
|
if (error) { |
|
|
|
(error, result) => { |
|
|
|
callback(error) |
|
|
|
if (error) { |
|
|
|
} else if (result.storage) { |
|
|
|
reject(error) |
|
|
|
callback(null, result.storage, result.nextKey) |
|
|
|
} else if (result.storage) { |
|
|
|
} else { |
|
|
|
resolve([result.storage, result.nextKey]) |
|
|
|
callback('the storage has not been provided') |
|
|
|
} else { |
|
|
|
} |
|
|
|
reject('the storage has not been provided') |
|
|
|
}) |
|
|
|
} |
|
|
|
} |
|
|
|
}) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}) |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|