-
Notifications
You must be signed in to change notification settings - Fork 2k
Open
Labels
A-internalsArea: internalsArea: internalsA-reth-anvilArea: reth-anvilArea: reth-anvilC-anvilCommand: anvilCommand: anvilT-featureType: featureType: feature
Milestone
Description
Component
Anvil
Describe the feature you would like
for historic blocks we currently need to acquire a write lock
foundry/crates/anvil/src/eth/backend/mem/mod.rs
Line 1729 in 88c9b7f
if let Some((state, block)) = self |
in case we need to fetch the state from disk:
if let Some(state) = self.on_disk_states.get_mut(hash) { |
this is very inefficient because it bottlenecks concurrent requests < current.height.
this can be improved in various ways,
- easiest solution would be two step locking
- write lock and ensure state is initialized if missing:
foundry/crates/anvil/src/eth/backend/mem/storage.rs
Lines 164 to 166 in 88c9b7f
if let Some(state) = self.on_disk_states.get_mut(hash) { if let Some(cached) = self.disk_cache.read(*hash) { state.init_from_snapshot(cached); - read lock to fetch it
Additional context
No response
Metadata
Metadata
Assignees
Labels
A-internalsArea: internalsArea: internalsA-reth-anvilArea: reth-anvilArea: reth-anvilC-anvilCommand: anvilCommand: anvilT-featureType: featureType: feature
Type
Projects
Status
Todo