From 905a52e0cf03ac86d1a51fadeca756430a0bac0b Mon Sep 17 00:00:00 2001 From: Gabriel Rocheleau Date: Fri, 9 Aug 2024 17:26:13 -0400 Subject: [PATCH] statemanager: remove redundant checks --- packages/statemanager/src/stateManager.ts | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) diff --git a/packages/statemanager/src/stateManager.ts b/packages/statemanager/src/stateManager.ts index 12f5b89de0..0115c69199 100644 --- a/packages/statemanager/src/stateManager.ts +++ b/packages/statemanager/src/stateManager.ts @@ -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 } } @@ -947,7 +939,7 @@ export class DefaultStateManager implements StateManagerInterface { trie, prefixStorageTrieKeys, prefixCodeHashes, - caches: new Caches({ accountCacheOpts, storageCacheOpts, codeCacheOpts }), + caches: new Caches({ accountCacheOpts, codeCacheOpts, storageCacheOpts }), }) }