Skip to content

Commit

Permalink
Use shallowCopy() Caches copy() optimization also for VerkleSM to avo…
Browse files Browse the repository at this point in the history
…id Caches bundling on non-Caches default
  • Loading branch information
holgerd77 committed Aug 17, 2024
1 parent 0aa7445 commit 57d382f
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions packages/statemanager/src/statelessVerkleStateManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,11 @@ import debugDefault from 'debug'
import { keccak256 } from 'ethereum-cryptography/keccak.js'

import { AccessWitness, AccessedStateType, decodeValue } from './accessWitness.js'
import { Caches, OriginalStorageCache } from './cache/index.js'
import { OriginalStorageCache } from './cache/index.js'
import { modifyAccountFields } from './util.js'

import type { AccessedStateWithAddress } from './accessWitness.js'
import type { Caches } from './cache/index.js'
import type { StatelessVerkleStateManagerOpts, VerkleState } from './index.js'
import type { DefaultStateManager } from './stateManager.js'
import type { AccountFields, Proof, StateManagerInterface } from '@ethereumjs/common'
Expand Down Expand Up @@ -206,9 +207,9 @@ export class StatelessVerkleStateManager implements StateManagerInterface {
* at the last fully committed point, i.e. as if all current
* checkpoints were reverted.
*/
shallowCopy(): StatelessVerkleStateManager {
shallowCopy(downlevelCaches = true): StatelessVerkleStateManager {
const stateManager = new StatelessVerkleStateManager({
caches: this._caches !== undefined ? new Caches() : undefined,
caches: this._caches?.shallowCopy(downlevelCaches),
verkleCrypto: this.verkleCrypto,
})
return stateManager
Expand Down

0 comments on commit 57d382f

Please sign in to comment.