From 6c6025d7d4402b142c4113c34c07d8c0237d2cae Mon Sep 17 00:00:00 2001 From: yann300 Date: Mon, 2 Jan 2023 14:37:24 +0100 Subject: [PATCH] use enclosure to dump the storage && duplicate instantiating --- libs/remix-simulator/src/VmProxy.ts | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/libs/remix-simulator/src/VmProxy.ts b/libs/remix-simulator/src/VmProxy.ts index 9e359ab5af..89896fb2e8 100644 --- a/libs/remix-simulator/src/VmProxy.ts +++ b/libs/remix-simulator/src/VmProxy.ts @@ -148,7 +148,7 @@ export class VmProxy { } catch (e) { console.log(e) } - })(this.processingHash, data.to, tx['to'], this) + })(this.processingHash, data.to, tx['to'], this) } this.processingIndex = 0 } @@ -191,9 +191,15 @@ export class VmProxy { const to = this.txs[this.processingHash].to if (to) { try { - const account = Address.fromString(to) - const storage = await this.vm.stateManager.dumpStorage(account) - this.storageCache['after_' + this.processingHash][to] = storage + (async (processingHash, processingAddress, self) => { + try { + const account = Address.fromString(processingAddress) + const storage = await self.stateCopy.dumpStorage(account) + self.storageCache[processingHash][processingAddress] = storage + } catch (e) { + console.log(e) + } + })(this.processingHash, to, this) } catch (e) { console.log(e) } @@ -201,8 +207,9 @@ export class VmProxy { if (data.createdAddress) { const address = data.createdAddress.toString() - this.vmTraces[this.processingHash].return = toChecksumAddress(address) - this.txsReceipt[this.processingHash].contractAddress = toChecksumAddress(address) + const checksumedAddress = toChecksumAddress(address) + this.vmTraces[this.processingHash].return = checksumedAddress + this.txsReceipt[this.processingHash].contractAddress = checksumedAddress } else if (data.execResult.returnValue) { this.vmTraces[this.processingHash].return = '0x' + data.execResult.returnValue.toString('hex') } else {