diff --git a/packages/client/src/execution/vmexecution.ts b/packages/client/src/execution/vmexecution.ts index 8b45786f67..0ddbe76e6c 100644 --- a/packages/client/src/execution/vmexecution.ts +++ b/packages/client/src/execution/vmexecution.ts @@ -4,10 +4,14 @@ import { DBSetHashToNumber, DBSetTD, } from '@ethereumjs/blockchain' -import { CacheType, ConsensusType, Hardfork } from '@ethereumjs/common' +import { ConsensusType, Hardfork } from '@ethereumjs/common' import { MCLBLS } from '@ethereumjs/evm' import { getGenesis } from '@ethereumjs/genesis' -import { DefaultStateManager, StatelessVerkleStateManager } from '@ethereumjs/statemanager' +import { + CacheType, + DefaultStateManager, + StatelessVerkleStateManager, +} from '@ethereumjs/statemanager' import { createTrie } from '@ethereumjs/trie' import { BIGINT_0, diff --git a/packages/client/src/rpc/modules/eth.ts b/packages/client/src/rpc/modules/eth.ts index 6cdb852b77..36da556bd4 100644 --- a/packages/client/src/rpc/modules/eth.ts +++ b/packages/client/src/rpc/modules/eth.ts @@ -45,8 +45,8 @@ import type { EthProtocol } from '../../net/protocol/index.js' import type { FullEthereumService, Service } from '../../service/index.js' import type { RpcTx } from '../types.js' import type { Block, JsonRpcBlock } from '@ethereumjs/block' -import type { Proof } from '@ethereumjs/common' import type { Log } from '@ethereumjs/evm' +import type { Proof } from '@ethereumjs/statemanager' import type { FeeMarketEIP1559Transaction, LegacyTransaction, diff --git a/packages/common/src/interfaces.ts b/packages/common/src/interfaces.ts index 29c7b259df..1768e417b1 100644 --- a/packages/common/src/interfaces.ts +++ b/packages/common/src/interfaces.ts @@ -209,35 +209,4 @@ export interface StateManagerInterface { */ clearCaches(): void shallowCopy(downlevelCaches?: boolean): StateManagerInterface - - /* - * Cache properties - */ - _accountCache?: Cache - _storageCache?: Cache - _codeCache?: Cache - - _accountCacheSettings?: CacheSettings - _storageCacheSettings?: CacheSettings - _codeCacheSettings?: CacheSettings -} - -/** - * Cache related - */ -export enum CacheType { - LRU = 'lru', - ORDERED_MAP = 'ordered_map', -} - -export type CacheSettings = { - deactivate: boolean - type: CacheType - size: number -} - -interface Cache { - checkpoint(): void - commit(): void - revert(): void } diff --git a/packages/statemanager/src/cache/account.ts b/packages/statemanager/src/cache/account.ts index eedb7ef5c5..216abeb54d 100644 --- a/packages/statemanager/src/cache/account.ts +++ b/packages/statemanager/src/cache/account.ts @@ -1,10 +1,10 @@ -import { CacheType } from '@ethereumjs/common' import { bytesToUnprefixedHex } from '@ethereumjs/util' import { OrderedMap } from '@js-sdsl/ordered-map' import debugDefault from 'debug' import { LRUCache } from 'lru-cache' import { Cache } from './cache.js' +import { CacheType } from './types.js' import type { CacheOpts } from './types.js' import type { Account, Address } from '@ethereumjs/util' diff --git a/packages/statemanager/src/cache/code.ts b/packages/statemanager/src/cache/code.ts index 61a957de62..3aaeb25db8 100644 --- a/packages/statemanager/src/cache/code.ts +++ b/packages/statemanager/src/cache/code.ts @@ -1,10 +1,10 @@ -import { CacheType } from '@ethereumjs/common' import { bytesToUnprefixedHex } from '@ethereumjs/util' import { OrderedMap } from '@js-sdsl/ordered-map' import debugDefault from 'debug' import { LRUCache } from 'lru-cache' import { Cache } from './cache.js' +import { CacheType } from './types.js' import type { CacheOpts } from './types.js' import type { Address } from '@ethereumjs/util' diff --git a/packages/statemanager/src/cache/storage.ts b/packages/statemanager/src/cache/storage.ts index 6c9c153e14..345e74ad3b 100644 --- a/packages/statemanager/src/cache/storage.ts +++ b/packages/statemanager/src/cache/storage.ts @@ -1,10 +1,10 @@ -import { CacheType } from '@ethereumjs/common' import { bytesToUnprefixedHex, hexToBytes } from '@ethereumjs/util' import { OrderedMap } from '@js-sdsl/ordered-map' import debugDefault from 'debug' import { LRUCache } from 'lru-cache' import { Cache } from './cache.js' +import { CacheType } from './types.js' import type { CacheOpts } from './types.js' import type { Address } from '@ethereumjs/util' diff --git a/packages/statemanager/src/cache/types.ts b/packages/statemanager/src/cache/types.ts index 7f283d7c65..0e5b3d40f6 100644 --- a/packages/statemanager/src/cache/types.ts +++ b/packages/statemanager/src/cache/types.ts @@ -1,4 +1,7 @@ -import type { CacheType } from '@ethereumjs/common' +export enum CacheType { + LRU = 'lru', + ORDERED_MAP = 'ordered_map', +} export interface CacheOpts { size: number diff --git a/packages/statemanager/src/capabilities.ts b/packages/statemanager/src/capabilities.ts deleted file mode 100644 index 9b48cd0468..0000000000 --- a/packages/statemanager/src/capabilities.ts +++ /dev/null @@ -1,88 +0,0 @@ -import { type AccountFields, CacheType, type StateManagerInterface } from '@ethereumjs/common' -import { Account } from '@ethereumjs/util' - -import { AccountCache, CodeCache, OriginalStorageCache, StorageCache } from './cache/index.js' - -import type { CacheStateManagerOpts } from './types.js' -import type { Address } from '@ethereumjs/util' - -export function checkpointCaches(stateManager: StateManagerInterface): void { - stateManager._accountCache?.checkpoint() - stateManager._storageCache?.checkpoint() - stateManager._codeCache?.checkpoint() -} - -export function commitCaches(stateManager: StateManagerInterface): void { - stateManager._accountCache?.commit() - stateManager._storageCache?.commit() - stateManager._codeCache?.commit() -} - -export function initializeCaches( - stateManager: StateManagerInterface, - options: CacheStateManagerOpts, -): void { - stateManager.originalStorageCache = new OriginalStorageCache( - stateManager.getStorage.bind(stateManager), - ) - - stateManager._accountCacheSettings = { - deactivate: options.accountCacheOpts?.deactivate ?? false, - type: options.accountCacheOpts?.type ?? CacheType.ORDERED_MAP, - size: options.accountCacheOpts?.size ?? 100000, - } - - if (stateManager._accountCacheSettings.deactivate === false) { - stateManager._accountCache = new AccountCache({ - size: stateManager._accountCacheSettings.size, - type: stateManager._accountCacheSettings.type, - }) - } - - stateManager._storageCacheSettings = { - deactivate: options.storageCacheOpts?.deactivate ?? false, - type: options.storageCacheOpts?.type ?? CacheType.ORDERED_MAP, - size: options.storageCacheOpts?.size ?? 20000, - } - - if (stateManager._storageCacheSettings.deactivate === false) { - stateManager._storageCache = new StorageCache({ - size: stateManager._storageCacheSettings.size, - type: stateManager._storageCacheSettings.type, - }) - } - - stateManager._codeCacheSettings = { - deactivate: - (options.codeCacheOpts?.deactivate === true || options.codeCacheOpts?.size === 0) ?? false, - type: options.codeCacheOpts?.type ?? CacheType.ORDERED_MAP, - size: options.codeCacheOpts?.size ?? 20000, - } - - if (stateManager._codeCacheSettings.deactivate === false) { - stateManager._codeCache = new CodeCache({ - size: stateManager._codeCacheSettings.size, - type: stateManager._codeCacheSettings.type, - }) - } -} - -export async function modifyAccountFields( - stateManager: StateManagerInterface, - address: Address, - accountFields: AccountFields, -): Promise { - const account = (await stateManager.getAccount(address)) ?? new Account() - - account.nonce = accountFields.nonce ?? account.nonce - account.balance = accountFields.balance ?? account.balance - account.storageRoot = accountFields.storageRoot ?? account.storageRoot - account.codeHash = accountFields.codeHash ?? account.codeHash - await stateManager.putAccount(address, account) -} - -export function revertCaches(stateManager: StateManagerInterface): void { - stateManager._accountCache?.revert() - stateManager._storageCache?.revert() - stateManager._codeCache?.revert() -} diff --git a/packages/statemanager/src/rpcStateManager.ts b/packages/statemanager/src/rpcStateManager.ts index 2c6016aac4..198dd25a94 100644 --- a/packages/statemanager/src/rpcStateManager.ts +++ b/packages/statemanager/src/rpcStateManager.ts @@ -1,4 +1,4 @@ -import { CacheType, Common, Mainnet } from '@ethereumjs/common' +import { Common, Mainnet } from '@ethereumjs/common' import { RLP } from '@ethereumjs/rlp' import { verifyTrieProof } from '@ethereumjs/trie' import { @@ -16,11 +16,10 @@ import { import debugDefault from 'debug' import { keccak256 } from 'ethereum-cryptography/keccak.js' -import { AccountCache, OriginalStorageCache, StorageCache } from './cache/index.js' -import * as Capabilities from './capabilities.js' +import { AccountCache, CacheType, OriginalStorageCache, StorageCache } from './cache/index.js' -import type { RPCStateManagerOpts } from './index.js' -import type { AccountFields, Proof, StateManagerInterface, StorageDump } from '@ethereumjs/common' +import type { Proof, RPCStateManagerOpts } from './index.js' +import type { AccountFields, StateManagerInterface, StorageDump } from '@ethereumjs/common' import type { Address, PrefixedHexString } from '@ethereumjs/util' import type { Debugger } from 'debug' @@ -28,14 +27,12 @@ const KECCAK256_RLP_EMPTY_ACCOUNT = RLP.encode(new Account().serialize()).slice( export class RPCStateManager implements StateManagerInterface { protected _provider: string + protected _contractCache: Map + protected _storageCache: StorageCache protected _blockTag: string - - _accountCache: AccountCache - _storageCache: StorageCache - _contractCache: Map - + protected _accountCache: AccountCache originalStorageCache: OriginalStorageCache - _debug: Debugger + protected _debug: Debugger protected DEBUG: boolean private keccakFunction: Function public readonly common: Common @@ -320,7 +317,15 @@ export class RPCStateManager implements StateManagerInterface { ), ) } - await Capabilities.modifyAccountFields(this, address, accountFields) + let account = await this.getAccount(address) + if (!account) { + account = new Account() + } + account.nonce = accountFields.nonce ?? account.nonce + account.balance = accountFields.balance ?? account.balance + account.storageRoot = accountFields.storageRoot ?? account.storageRoot + account.codeHash = accountFields.codeHash ?? account.codeHash + await this.putAccount(address, account) } /** diff --git a/packages/statemanager/src/simpleStateManager.ts b/packages/statemanager/src/simpleStateManager.ts index 58d6977a96..8c58c616ba 100644 --- a/packages/statemanager/src/simpleStateManager.ts +++ b/packages/statemanager/src/simpleStateManager.ts @@ -2,7 +2,6 @@ import { Account, bytesToHex } from '@ethereumjs/util' import { keccak256 } from 'ethereum-cryptography/keccak.js' import { OriginalStorageCache } from './cache/originalStorageCache.js' -import * as Capabilities from './capabilities.js' import type { SimpleStateManagerOpts } from './index.js' import type { AccountFields, Common, StateManagerInterface } from '@ethereumjs/common' @@ -79,7 +78,15 @@ export class SimpleStateManager implements StateManagerInterface { } async modifyAccountFields(address: Address, accountFields: AccountFields): Promise { - await Capabilities.modifyAccountFields(this, address, accountFields) + let account = await this.getAccount(address) + if (!account) { + account = new Account() + } + account.nonce = accountFields.nonce ?? account.nonce + account.balance = accountFields.balance ?? account.balance + account.storageRoot = accountFields.storageRoot ?? account.storageRoot + account.codeHash = accountFields.codeHash ?? account.codeHash + await this.putAccount(address, account) } async getCode(address: Address): Promise { diff --git a/packages/statemanager/src/stateManager.ts b/packages/statemanager/src/stateManager.ts index d7b5829891..9e05681adb 100644 --- a/packages/statemanager/src/stateManager.ts +++ b/packages/statemanager/src/stateManager.ts @@ -1,4 +1,4 @@ -import { CacheType, Common, Mainnet } from '@ethereumjs/common' +import { Common, Mainnet } from '@ethereumjs/common' import { RLP } from '@ethereumjs/rlp' import { Trie, @@ -31,17 +31,22 @@ import { import debugDefault from 'debug' import { keccak256 } from 'ethereum-cryptography/keccak.js' -import * as Capabilities from './capabilities.js' +import { + AccountCache, + CacheType, + CodeCache, + OriginalStorageCache, + StorageCache, +} from './cache/index.js' import { CODEHASH_PREFIX, type CacheSettings, type DefaultStateManagerOpts } from './index.js' -import type { AccountCache, CodeCache, OriginalStorageCache, StorageCache } from './cache/index.js' +import type { StorageProof } from './index.js' import type { AccountFields, Proof, StateManagerInterface, StorageDump, - StorageProof, StorageRange, } from '@ethereumjs/common' import type { Address, DB, PrefixedHexString } from '@ethereumjs/util' @@ -64,21 +69,20 @@ import type { Debugger } from 'debug' */ export class DefaultStateManager implements StateManagerInterface { protected _debug: Debugger - _accountCache?: AccountCache - _storageCache?: StorageCache - _codeCache?: CodeCache + protected _accountCache?: AccountCache + protected _storageCache?: StorageCache + protected _codeCache?: CodeCache + + originalStorageCache: OriginalStorageCache protected _trie: Trie protected _storageTries: { [key: string]: Trie } protected readonly _prefixCodeHashes: boolean protected readonly _prefixStorageTrieKeys: boolean - - // Non-null assertion necessary to inform TypeScript that these properties are set in the constructor through a helper function - originalStorageCache!: OriginalStorageCache - readonly _accountCacheSettings!: CacheSettings - readonly _storageCacheSettings!: CacheSettings - readonly _codeCacheSettings!: CacheSettings + protected readonly _accountCacheSettings: CacheSettings + protected readonly _storageCacheSettings: CacheSettings + protected readonly _codeCacheSettings: CacheSettings public readonly common: Common @@ -116,10 +120,48 @@ export class DefaultStateManager implements StateManagerInterface { this.keccakFunction = opts.common?.customCrypto.keccak256 ?? keccak256 + this.originalStorageCache = new OriginalStorageCache(this.getStorage.bind(this)) + this._prefixCodeHashes = opts.prefixCodeHashes ?? true this._prefixStorageTrieKeys = opts.prefixStorageTrieKeys ?? false + this._accountCacheSettings = { + deactivate: + (opts.accountCacheOpts?.deactivate === true || opts.accountCacheOpts?.size === 0) ?? false, + type: opts.accountCacheOpts?.type ?? CacheType.ORDERED_MAP, + size: opts.accountCacheOpts?.size ?? 100000, + } + if (!this._accountCacheSettings.deactivate) { + this._accountCache = new AccountCache({ + size: this._accountCacheSettings.size, + type: this._accountCacheSettings.type, + }) + } - Capabilities.initializeCaches(this, opts) + this._storageCacheSettings = { + deactivate: + (opts.storageCacheOpts?.deactivate === true || opts.storageCacheOpts?.size === 0) ?? false, + type: opts.storageCacheOpts?.type ?? CacheType.ORDERED_MAP, + size: opts.storageCacheOpts?.size ?? 20000, + } + if (!this._storageCacheSettings.deactivate) { + this._storageCache = new StorageCache({ + size: this._storageCacheSettings.size, + type: this._storageCacheSettings.type, + }) + } + + this._codeCacheSettings = { + deactivate: + (opts.codeCacheOpts?.deactivate === true || opts.codeCacheOpts?.size === 0) ?? false, + type: opts.codeCacheOpts?.type ?? CacheType.ORDERED_MAP, + size: opts.codeCacheOpts?.size ?? 20000, + } + if (!this._codeCacheSettings.deactivate) { + this._codeCache = new CodeCache({ + size: this._codeCacheSettings.size, + type: this._codeCacheSettings.type, + }) + } } /** @@ -182,7 +224,15 @@ export class DefaultStateManager implements StateManagerInterface { * @param accountFields - Object containing account fields and values to modify */ async modifyAccountFields(address: Address, accountFields: AccountFields): Promise { - await Capabilities.modifyAccountFields(this, address, accountFields) + let account = await this.getAccount(address) + if (!account) { + account = new Account() + } + account.nonce = accountFields.nonce ?? account.nonce + account.balance = accountFields.balance ?? account.balance + account.storageRoot = accountFields.storageRoot ?? account.storageRoot + account.codeHash = accountFields.codeHash ?? account.codeHash + await this.putAccount(address, account) } /** @@ -462,7 +512,9 @@ export class DefaultStateManager implements StateManagerInterface { */ async checkpoint(): Promise { this._trie.checkpoint() - Capabilities.checkpointCaches(this) + this._storageCache?.checkpoint() + this._accountCache?.checkpoint() + this._codeCache?.checkpoint() this._checkpointCount++ } @@ -473,7 +525,9 @@ export class DefaultStateManager implements StateManagerInterface { async commit(): Promise { // setup trie checkpointing await this._trie.commit() - Capabilities.commitCaches(this) + this._storageCache?.commit() + this._accountCache?.commit() + this._codeCache?.commit() this._checkpointCount-- if (this._checkpointCount === 0) { @@ -493,7 +547,9 @@ export class DefaultStateManager implements StateManagerInterface { async revert(): Promise { // setup trie checkpointing await this._trie.revert() - Capabilities.revertCaches(this) + this._storageCache?.revert() + this._accountCache?.revert() + this._codeCache?.revert() this._storageTries = {} diff --git a/packages/statemanager/src/statelessVerkleStateManager.ts b/packages/statemanager/src/statelessVerkleStateManager.ts index cc9b93d15f..4fc1d33211 100644 --- a/packages/statemanager/src/statelessVerkleStateManager.ts +++ b/packages/statemanager/src/statelessVerkleStateManager.ts @@ -25,16 +25,16 @@ import debugDefault from 'debug' import { keccak256 } from 'ethereum-cryptography/keccak.js' import { AccessWitness, AccessedStateType, decodeValue } from './accessWitness.js' -import * as Capabilities from './capabilities.js' - import { - type CacheSettings, - type StatelessVerkleStateManagerOpts, - type VerkleState, -} from './index.js' + AccountCache, + CacheType, + CodeCache, + OriginalStorageCache, + StorageCache, +} from './cache/index.js' import type { AccessedStateWithAddress } from './accessWitness.js' -import type { AccountCache, CodeCache, OriginalStorageCache, StorageCache } from './cache/index.js' +import type { CacheSettings, StatelessVerkleStateManagerOpts, VerkleState } from './index.js' import type { DefaultStateManager } from './stateManager.js' import type { AccountFields, Proof, StateManagerInterface } from '@ethereumjs/common' import type { @@ -72,13 +72,12 @@ export class StatelessVerkleStateManager implements StateManagerInterface { _codeCache?: CodeCache _cachedStateRoot?: Uint8Array - verkleCrypto: VerkleCrypto + originalStorageCache: OriginalStorageCache - // Non-null assertion necessary to inform TypeScript that these properties are set in the constructor through a helper function - originalStorageCache!: OriginalStorageCache - readonly _accountCacheSettings!: CacheSettings - readonly _storageCacheSettings!: CacheSettings - readonly _codeCacheSettings!: CacheSettings + verkleCrypto: VerkleCrypto + protected readonly _accountCacheSettings: CacheSettings + protected readonly _storageCacheSettings: CacheSettings + protected readonly _codeCacheSettings: CacheSettings /** * StateManager is run in DEBUG mode (default: false) @@ -113,7 +112,47 @@ export class StatelessVerkleStateManager implements StateManagerInterface { * Instantiate the StateManager interface. */ constructor(opts: StatelessVerkleStateManagerOpts) { - Capabilities.initializeCaches(this, opts) + this.originalStorageCache = new OriginalStorageCache(this.getStorage.bind(this)) + + this._accountCacheSettings = { + deactivate: opts.accountCacheOpts?.deactivate ?? false, + type: opts.accountCacheOpts?.type ?? CacheType.ORDERED_MAP, + size: opts.accountCacheOpts?.size ?? 100000, + } + + if (!this._accountCacheSettings.deactivate) { + this._accountCache = new AccountCache({ + size: this._accountCacheSettings.size, + type: this._accountCacheSettings.type, + }) + } + + this._storageCacheSettings = { + deactivate: opts.storageCacheOpts?.deactivate ?? false, + type: opts.storageCacheOpts?.type ?? CacheType.ORDERED_MAP, + size: opts.storageCacheOpts?.size ?? 20000, + } + + if (!this._storageCacheSettings.deactivate) { + this._storageCache = new StorageCache({ + size: this._storageCacheSettings.size, + type: this._storageCacheSettings.type, + }) + } + + this._codeCacheSettings = { + deactivate: + (opts.codeCacheOpts?.deactivate === true || opts.codeCacheOpts?.size === 0) ?? false, + type: opts.codeCacheOpts?.type ?? CacheType.ORDERED_MAP, + size: opts.codeCacheOpts?.size ?? 20000, + } + + if (!this._codeCacheSettings.deactivate) { + this._codeCache = new CodeCache({ + size: this._codeCacheSettings.size, + type: this._codeCacheSettings.type, + }) + } this._cachedStateRoot = opts.initialStateRoot @@ -532,7 +571,16 @@ export class StatelessVerkleStateManager implements StateManagerInterface { } async modifyAccountFields(address: Address, accountFields: AccountFields): Promise { - await Capabilities.modifyAccountFields(this, address, accountFields) + let account = await this.getAccount(address) + if (!account) { + account = new Account() + } + + account._nonce = accountFields.nonce ?? account._nonce + account._balance = accountFields.balance ?? account._balance + account._storageRoot = accountFields.storageRoot ?? account._storageRoot + account._codeHash = accountFields.codeHash ?? account._codeHash + await this.putAccount(address, account) } getProof(_: Address, __: Uint8Array[] = []): Promise { @@ -733,7 +781,9 @@ export class StatelessVerkleStateManager implements StateManagerInterface { */ async checkpoint(): Promise { this._checkpoints.push(this._state) - Capabilities.checkpointCaches(this) + this._accountCache?.checkpoint() + this._storageCache?.checkpoint() + this._codeCache?.checkpoint() } /** @@ -742,7 +792,9 @@ export class StatelessVerkleStateManager implements StateManagerInterface { */ async commit(): Promise { this._checkpoints.pop() - Capabilities.commitCaches(this) + this._accountCache!.commit() + this._storageCache?.commit() + this._codeCache?.commit() } // TODO @@ -757,7 +809,9 @@ export class StatelessVerkleStateManager implements StateManagerInterface { async revert(): Promise { // setup trie checkpointing this._checkpoints.pop() - Capabilities.revertCaches(this) + this._accountCache?.revert() + this._storageCache?.revert() + this._codeCache?.revert() } /** diff --git a/packages/statemanager/src/types.ts b/packages/statemanager/src/types.ts index 340a21eb3c..da35fe4a85 100644 --- a/packages/statemanager/src/types.ts +++ b/packages/statemanager/src/types.ts @@ -1,7 +1,8 @@ import { type PrefixedHexString, utf8ToBytes } from '@ethereumjs/util' +import type { CacheType } from './cache/index.js' import type { AccessWitness } from './index.js' -import type { CacheType, Common } from '@ethereumjs/common' +import type { Common } from '@ethereumjs/common' import type { Trie } from '@ethereumjs/trie' import type { VerkleCrypto } from '@ethereumjs/util' @@ -61,7 +62,7 @@ interface BaseStateManagerOpts { /** * Cache state manager options (not to be used directly) */ -export interface CacheStateManagerOpts { +interface CacheStateManagerOpts { accountCacheOpts?: CacheOptions storageCacheOpts?: CacheOptions codeCacheOpts?: CacheOptions @@ -136,3 +137,19 @@ export interface EncodedVerkleProof { * misbehaviour in the underlying trie library. */ export const CODEHASH_PREFIX = utf8ToBytes('c') + +export type StorageProof = { + key: PrefixedHexString + proof: PrefixedHexString[] + value: PrefixedHexString +} + +export type Proof = { + address: PrefixedHexString + balance: PrefixedHexString + codeHash: PrefixedHexString + nonce: PrefixedHexString + storageHash: PrefixedHexString + accountProof: PrefixedHexString[] + storageProof: StorageProof[] +} diff --git a/packages/statemanager/test/cache/account.spec.ts b/packages/statemanager/test/cache/account.spec.ts index 4c69073eb8..533f62d095 100644 --- a/packages/statemanager/test/cache/account.spec.ts +++ b/packages/statemanager/test/cache/account.spec.ts @@ -1,8 +1,7 @@ -import { CacheType } from '@ethereumjs/common' import { Account, Address, equalsBytes, hexToBytes } from '@ethereumjs/util' import { assert, describe, it } from 'vitest' -import { AccountCache } from '../../src/cache/index.js' +import { AccountCache, CacheType } from '../../src/cache/index.js' import { createAccountWithDefaults } from '../util.js' describe('Account Cache: initialization', () => { diff --git a/packages/statemanager/test/cache/code.spec.ts b/packages/statemanager/test/cache/code.spec.ts index cc1aac0b40..2bbe3eaea7 100644 --- a/packages/statemanager/test/cache/code.spec.ts +++ b/packages/statemanager/test/cache/code.spec.ts @@ -1,8 +1,7 @@ -import { CacheType } from '@ethereumjs/common' import { Address, equalsBytes, hexToBytes } from '@ethereumjs/util' import { assert, describe, it } from 'vitest' -import { CodeCache } from '../../src/cache/index.js' +import { CacheType, CodeCache } from '../../src/cache/index.js' describe('Code Cache: initialization', () => { for (const type of [CacheType.LRU, CacheType.ORDERED_MAP]) { diff --git a/packages/statemanager/test/cache/storage.spec.ts b/packages/statemanager/test/cache/storage.spec.ts index dbd9914767..3fcb30d5f6 100644 --- a/packages/statemanager/test/cache/storage.spec.ts +++ b/packages/statemanager/test/cache/storage.spec.ts @@ -1,8 +1,7 @@ -import { CacheType } from '@ethereumjs/common' import { Address, equalsBytes, hexToBytes } from '@ethereumjs/util' import { assert, describe, it } from 'vitest' -import { StorageCache } from '../../src/cache/index.js' +import { CacheType, StorageCache } from '../../src/cache/index.js' describe('Storage Cache: initialization', () => { for (const type of [CacheType.LRU, CacheType.ORDERED_MAP]) { diff --git a/packages/statemanager/test/stateManager.spec.ts b/packages/statemanager/test/stateManager.spec.ts index 6aca9047bb..1744973e3b 100644 --- a/packages/statemanager/test/stateManager.spec.ts +++ b/packages/statemanager/test/stateManager.spec.ts @@ -1,4 +1,3 @@ -import { CacheType } from '@ethereumjs/common' import { Trie, createTrie, createTrieFromProof } from '@ethereumjs/trie' import { Account, @@ -15,7 +14,7 @@ import { } from '@ethereumjs/util' import { assert, describe, it } from 'vitest' -import { DefaultStateManager } from '../src/index.js' +import { CacheType, DefaultStateManager } from '../src/index.js' import type { PrefixedHexString } from '@ethereumjs/util' diff --git a/packages/statemanager/test/statelessVerkleStateManager.spec.ts b/packages/statemanager/test/statelessVerkleStateManager.spec.ts index 310fcebd7b..489d594616 100644 --- a/packages/statemanager/test/statelessVerkleStateManager.spec.ts +++ b/packages/statemanager/test/statelessVerkleStateManager.spec.ts @@ -1,5 +1,5 @@ import { createBlock } from '@ethereumjs/block' -import { CacheType, createCommonFromGethGenesis } from '@ethereumjs/common' +import { createCommonFromGethGenesis } from '@ethereumjs/common' import { createTxFromSerializedData } from '@ethereumjs/tx' import { Address, @@ -16,7 +16,7 @@ import { import { loadVerkleCrypto } from 'verkle-cryptography-wasm' import { assert, beforeAll, describe, it, test } from 'vitest' -import { StatelessVerkleStateManager } from '../src/index.js' +import { CacheType, StatelessVerkleStateManager } from '../src/index.js' import * as testnetVerkleKaustinen from './testdata/testnetVerkleKaustinen.json' import * as verkleBlockJSON from './testdata/verkleKaustinen6Block72.json'