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

reverse MemoryOverlayStateProvider block order #9825

Closed
Tracked by #8742
mattsse opened this issue Jul 26, 2024 · 0 comments · Fixed by #9826
Closed
Tracked by #8742

reverse MemoryOverlayStateProvider block order #9825

mattsse opened this issue Jul 26, 2024 · 0 comments · Fixed by #9826
Assignees

Comments

@mattsse
Copy link
Collaborator

mattsse commented Jul 26, 2024

Currently the MemoryOverlayStateProvider expects the list of blocks to be [old -> new]

/// The collection of executed parent blocks.
in_memory: Vec<ExecutedBlock>,

for block in self.in_memory.iter().rev() {

but this is usually populated by walking backwards:

while let Some(executed) = self.state.tree_state.blocks_by_hash.get(&parent_hash) {
parent_hash = executed.block.parent_hash;
in_memory.insert(0, executed.clone());
}

so it would be more efficient if we'd do [new -> old] so appending a parent block is a simple push

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

2 participants