-
Notifications
You must be signed in to change notification settings - Fork 795
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Make ethersStateManager
more awesome
#2720
Conversation
Codecov Report
Additional details and impacted files
Flags with carried forward coverage won't be shown. Click here to find out more. |
@@ -52,7 +55,7 @@ export class EthersStateManager implements EVMStateManagerInterface { | |||
}) | |||
;(newState as any).contractCache = new Map(this.contractCache) | |||
;(newState as any).storageCache = new StorageCache({ size: 10000, type: CacheType.LRU }) | |||
;(newState as any)._accountCache = this._accountCache | |||
;(newState as any)._accountCache = new AccountCache({ size: 10000, type: CacheType.LRU }) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We shouldn't use an LRU cache for EthersStateManager since this is such an ad-hoc usage, also just a general reminder that something like 10000 for LRU is still "unsafe" since too low, so this would e.g. break on mainnet genesis since genesis state accounts are > 10.000 (admittedly an obscure use case for ESM, but just as an example). Maybe we still need to point this out more clearly in the docs adding some "real" number advices ("only use LRU with size >= 50000"). Or maybe also an option: we just plainly throw below a certain threshold, might be too harsh though. 🤔
Anyhow: generally this looks great, I will directly push and change to ORDERED_MAP cache and fix another thing, then we can merge.
I would generally be a fan if we can also harmonize the options over time (so: before the releases), it would definitely make sense and be useful if people have the option here as well to customize the caches, also from a general design PoV it would be good to have this harmonized.
Just wouldn't want to do now because this might interfere too much with the work from @jochem-brouwer on EEI/StateManager, so likely something for a PR beyond that (or Jochem does this directly when integrating these changes here).
Some side remarks on this task: so we should definitely also create a normal types.ts
file for SM and put the options there, just realized that we haven't yet. Also wonder if this prefixCodeHashes
option is still necessary? Rather a question for Jochem though.
…move console.log() from tests
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
ethers
dependency to v6mockProvider
to reflectethers
v6 provider API#
operator syntax thatethers
uses to specify private class membersethersStateManager
lockfile-lint
CI run to allow for newethers
subdependency that installs from github