Skip to content

Commit

Permalink
statemanager: remove redundant checks
Browse files Browse the repository at this point in the history
  • Loading branch information
gabrocheleau committed Aug 9, 2024
1 parent 888b20e commit 905a52e
Showing 1 changed file with 4 additions and 12 deletions.
16 changes: 4 additions & 12 deletions packages/statemanager/src/stateManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -922,23 +922,15 @@ export class DefaultStateManager implements StateManagerInterface {
const prefixCodeHashes = this._prefixCodeHashes
const prefixStorageTrieKeys = this._prefixStorageTrieKeys
let accountCacheOpts = { ...this._caches?.settings.account }
if (
downlevelCaches &&
this._caches !== undefined &&
!this._caches.settings.account.deactivate
) {
if (downlevelCaches && this._caches?.settings.account.deactivate === false) {
accountCacheOpts = { ...accountCacheOpts, type: CacheType.ORDERED_MAP }
}
let storageCacheOpts = { ...this._caches?.settings.storage }
if (
downlevelCaches &&
this._caches !== undefined &&
!this._caches.settings.storage.deactivate
) {
if (downlevelCaches && this._caches?.settings.storage.deactivate === false) {
storageCacheOpts = { ...storageCacheOpts, type: CacheType.ORDERED_MAP }
}
let codeCacheOpts = { ...this._caches?.settings.code }
if (this._caches !== undefined && !this._caches.settings.code.deactivate) {
if (this._caches?.settings.code.deactivate === false) {
codeCacheOpts = { ...codeCacheOpts, type: CacheType.ORDERED_MAP }
}

Expand All @@ -947,7 +939,7 @@ export class DefaultStateManager implements StateManagerInterface {
trie,
prefixStorageTrieKeys,
prefixCodeHashes,
caches: new Caches({ accountCacheOpts, storageCacheOpts, codeCacheOpts }),
caches: new Caches({ accountCacheOpts, codeCacheOpts, storageCacheOpts }),
})
}

Expand Down

0 comments on commit 905a52e

Please sign in to comment.