-
Notifications
You must be signed in to change notification settings - Fork 772
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
evm: verkle testing extraction (#3817)
* evm: extract some verkle related improvements to a separate pr * evm: extract more stuff * Update packages/statemanager/src/statefulVerkleStateManager.ts Co-authored-by: acolytec3 <17355484+acolytec3@users.noreply.github.com> * chore: adjust evm params for 2935 * Fix step logging so dynamic gas doesn't include state accesses * Revert unnecessary change --------- Co-authored-by: acolytec3 <17355484+acolytec3@users.noreply.github.com>
- Loading branch information
1 parent
4da1f03
commit cd4afd0
Showing
20 changed files
with
315 additions
and
55 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
import type { ChunkAccessEvent } from './verkleAccessWitness.js' | ||
import type { PrefixedHexString } from '@ethereumjs/util' | ||
export class ChunkCache { | ||
cache: Map<PrefixedHexString, ChunkAccessEvent> | ||
|
||
constructor() { | ||
this.cache = new Map<PrefixedHexString, ChunkAccessEvent>() | ||
} | ||
|
||
set(stemKey: PrefixedHexString, accessedStem: ChunkAccessEvent) { | ||
this.cache.set(stemKey, accessedStem) | ||
} | ||
|
||
get(stemHex: PrefixedHexString): ChunkAccessEvent | undefined { | ||
return this.cache.get(stemHex) | ||
} | ||
|
||
del(stemHex: PrefixedHexString): void { | ||
this.cache.delete(stemHex) | ||
} | ||
|
||
commit(): [PrefixedHexString, ChunkAccessEvent][] { | ||
const items: [PrefixedHexString, ChunkAccessEvent][] = Array.from(this.cache.entries()) | ||
this.clear() | ||
return items | ||
} | ||
|
||
clear(): void { | ||
this.cache.clear() | ||
} | ||
|
||
size() { | ||
return this.cache.size | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
import type { StemAccessEvent, StemMeta } from './verkleAccessWitness.js' | ||
import type { PrefixedHexString } from '@ethereumjs/util' | ||
export class StemCache { | ||
cache: Map<PrefixedHexString, StemAccessEvent & StemMeta> | ||
|
||
constructor() { | ||
this.cache = new Map<PrefixedHexString, StemAccessEvent & StemMeta>() | ||
} | ||
|
||
set(stemKey: PrefixedHexString, accessedStem: StemAccessEvent & StemMeta) { | ||
this.cache.set(stemKey, accessedStem) | ||
} | ||
|
||
get(stemHex: PrefixedHexString): (StemAccessEvent & StemMeta) | undefined { | ||
return this.cache.get(stemHex) | ||
} | ||
|
||
del(stemHex: PrefixedHexString): void { | ||
this.cache.delete(stemHex) | ||
} | ||
|
||
commit(): [PrefixedHexString, StemAccessEvent & StemMeta][] { | ||
const items: [PrefixedHexString, StemAccessEvent & StemMeta][] = Array.from( | ||
this.cache.entries(), | ||
) | ||
this.clear() | ||
return items | ||
} | ||
|
||
/** | ||
* Clear cache | ||
*/ | ||
clear(): void { | ||
this.cache.clear() | ||
} | ||
|
||
/** | ||
* Returns the size of the cache | ||
* @returns | ||
*/ | ||
size() { | ||
return this.cache.size | ||
} | ||
} |
Oops, something went wrong.