-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Closed
Labels
A-staged-syncRelated to staged sync (pipelines and stages)Related to staged sync (pipelines and stages)A-trieRelated to Merkle Patricia Trie implementationRelated to Merkle Patricia Trie implementationC-enhancementNew feature or requestNew feature or requestC-perfA change motivated by improving speed, memory usage or disk footprintA change motivated by improving speed, memory usage or disk footprintS-staleThis issue/PR is stale and will close with no further activityThis issue/PR is stale and will close with no further activity
Milestone
Description
Describe the feature
Currently the incremental root stage has a low threshold, because it accumulates lots of data in memory and cannot process large ranges at once. When the number of blocks we need to catch up exceeds this threshold, we do a clean merkle root calculation, which is often slower than if we had run the incremental stage.
The incremental stage branch is here
reth/crates/stages/stages/src/stages/merkle.rs
Lines 253 to 266 in 5c64d59
} else { | |
debug!(target: "sync::stages::merkle::exec", current = ?current_block_number, target = ?to_block, "Updating trie"); | |
let (root, updates) = | |
StateRoot::incremental_root_with_updates(provider.tx_ref(), range) | |
.map_err(|e| { | |
error!(target: "sync::stages::merkle", %e, ?current_block_number, ?to_block, "Incremental state root failed! {INVALID_STATE_ROOT_ERROR_MESSAGE}"); | |
StageError::Fatal(Box::new(e)) | |
})?; | |
provider.write_trie_updates(&updates)?; | |
let total_hashed_entries = (provider.count_entries::<tables::HashedAccounts>()? + | |
provider.count_entries::<tables::HashedStorages>()?) | |
as u64; |
We could instead do this in a loop with a fixed range each time, until we catch up. This way we could avoid doing the clean merkle stage
Additional context
No response
Metadata
Metadata
Assignees
Labels
A-staged-syncRelated to staged sync (pipelines and stages)Related to staged sync (pipelines and stages)A-trieRelated to Merkle Patricia Trie implementationRelated to Merkle Patricia Trie implementationC-enhancementNew feature or requestNew feature or requestC-perfA change motivated by improving speed, memory usage or disk footprintA change motivated by improving speed, memory usage or disk footprintS-staleThis issue/PR is stale and will close with no further activityThis issue/PR is stale and will close with no further activity
Type
Projects
Status
Done