From 9f7d21edb76f8fec365758894c336adec2c325ac Mon Sep 17 00:00:00 2001 From: yann300 Date: Wed, 21 Dec 2022 20:35:38 +0100 Subject: [PATCH] fix dumping the storage --- libs/remix-simulator/src/VmProxy.ts | 13 ++++++------- libs/remix-simulator/src/vm-context.ts | 4 +++- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/libs/remix-simulator/src/VmProxy.ts b/libs/remix-simulator/src/VmProxy.ts index e30357510e..858e172e6c 100644 --- a/libs/remix-simulator/src/VmProxy.ts +++ b/libs/remix-simulator/src/VmProxy.ts @@ -135,12 +135,11 @@ export class VmProxy { this.storageCache[this.processingHash] = {} this.storageCache['after_' + this.processingHash] = {} if (data.to) { - try { - const storage = await this.stateCopy.dumpStorage(data.to) - this.storageCache[this.processingHash][tx['to']] = storage - } catch (e) { - console.log(e) - } + ((processingHash, processingAccount, processingAddress, self) => { + self.stateCopy.dumpStorage(processingAccount).then((storage) => { + self.storageCache[processingHash][processingAddress] = storage + }).catch(console.log) + })(this.processingHash, data.to, tx['to'], this) } this.processingIndex = 0 } @@ -265,7 +264,7 @@ export class VmProxy { self.stateCopy.dumpStorage(account).then((storage) => { self.storageCache[processingHash][processingAddress] = storage }).catch(console.log) - })(this.processingHash, this.processingAddress, this) + })(this.processingHash, this.processingAddress, this) } } } diff --git a/libs/remix-simulator/src/vm-context.ts b/libs/remix-simulator/src/vm-context.ts index 0aa055f83f..0928212d40 100644 --- a/libs/remix-simulator/src/vm-context.ts +++ b/libs/remix-simulator/src/vm-context.ts @@ -46,9 +46,11 @@ class StateManagerCommonStorageDump extends DefaultStateManager { } copy(): StateManagerCommonStorageDump { - return new StateManagerCommonStorageDump({ + const copyState = new StateManagerCommonStorageDump({ trie: this._trie.copy(false), }) + copyState.keyHashes = this.keyHashes + return copyState } async dumpStorage (address): Promise {