fix copying the state

pull/3358/head
yann300 2 years ago committed by Aniket
parent 5234873953
commit 8066ac1227
  1. 18
      libs/remix-simulator/src/vm-context.ts

@ -50,8 +50,14 @@ class CustomEthersStateManager extends EthersStateManager {
} }
copy(): CustomEthersStateManager { copy(): CustomEthersStateManager {
const newState = super.copy() as CustomEthersStateManager const newState = new CustomEthersStateManager({
newState.keyHashes = this.keyHashes provider: (this as any).provider,
blockTag: BigInt((this as any).blockTag),
})
;(newState as any).contractCache = new Map((this as any).contractCache)
;(newState as any).storageCache = new Map((this as any).storageCache)
;(newState as any)._cache = this._cache
;(newState as any).keyHashes = this.keyHashes
return newState return newState
} }
@ -85,9 +91,11 @@ class StateManagerCommonStorageDump extends DefaultStateManager {
} }
copy(): StateManagerCommonStorageDump { copy(): StateManagerCommonStorageDump {
const newState = super.copy() as StateManagerCommonStorageDump const copyState = new StateManagerCommonStorageDump({
newState.keyHashes = this.keyHashes trie: this._trie.copy(false),
return newState })
copyState.keyHashes = this.keyHashes
return copyState
} }
async dumpStorage (address): Promise<StorageDump> { async dumpStorage (address): Promise<StorageDump> {

Loading…
Cancel
Save