Skip to content
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

Merged
merged 15 commits into from
May 24, 2023
Merged

Make ethersStateManager more awesome #2720

merged 15 commits into from
May 24, 2023

Conversation

acolytec3
Copy link
Contributor

@acolytec3 acolytec3 commented May 23, 2023

  • Upgrades ethers dependency to v6
  • Updates mockProvider to reflect ethers v6 provider API
  • Updates karma to use ES2022 for parsing to allow for # operator syntax that ethers uses to specify private class members
  • Adds debug logging to ethersStateManager
  • Revise lockfile-lint CI run to allow for new ethers subdependency that installs from github

@acolytec3 acolytec3 added dependencies Pull requests that update a dependency file package: statemanager labels May 23, 2023
@codecov
Copy link

codecov bot commented May 23, 2023

Codecov Report

Merging #2720 (f3b860a) into master (453b60e) will increase coverage by 0.86%.
The diff coverage is 51.02%.

Additional details and impacted files

Impacted file tree graph

Flag Coverage Δ
block 90.82% <ø> (ø)
blockchain 90.72% <ø> (ø)
client 86.83% <ø> (?)
common 97.05% <ø> (ø)
devp2p 89.47% <ø> (?)
ethash ∅ <ø> (∅)
evm 79.58% <ø> (ø)
rlp ?
statemanager 80.53% <47.82%> (-0.40%) ⬇️
trie 90.54% <ø> (+0.61%) ⬆️
tx 95.76% <ø> (ø)
util 81.13% <100.00%> (ø)
vm 81.36% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

@acolytec3 acolytec3 marked this pull request as ready for review May 23, 2023 18:49
@@ -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 })
Copy link
Member

@holgerd77 holgerd77 May 24, 2023

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.

Copy link
Member

@holgerd77 holgerd77 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@holgerd77 holgerd77 merged commit fb6b221 into master May 24, 2023
@holgerd77 holgerd77 deleted the update-ethers-to-v6 branch May 24, 2023 07:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
dependencies Pull requests that update a dependency file package: statemanager type: CI
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants