Skip to content

Conversation

@shekhirin
Copy link
Collaborator

@shekhirin shekhirin commented Jan 5, 2026

Problem

Every time cache_for is called, we check that it's going to be the only cache in use:

// Check `is_available()` to ensure no other tasks (e.g., prewarming) currently hold
// a reference to this cache. We can only reuse it when we have exclusive access.
.filter(|c| c.executed_block_hash() == parent_hash && c.is_available())

First cache_for call is happening here

Second is here

let saved_cache = self.cache_for(parent_hash);

Which leads to always creating a new cache on the second call

Solution

Get cache once with cache_for and pass to all consumers.

@shekhirin shekhirin force-pushed the alexey/engine-reuse-one-cache branch from c292119 to 86f6e8a Compare January 5, 2026 17:41
@shekhirin shekhirin force-pushed the alexey/engine-reuse-one-cache branch from a37ab47 to d58179c Compare January 5, 2026 17:47
@shekhirin shekhirin force-pushed the alexey/engine-reuse-one-cache branch from a3f5aba to c7a5203 Compare January 5, 2026 18:40
@shekhirin shekhirin marked this pull request as ready for review January 6, 2026 16:12
@github-project-automation github-project-automation bot moved this from Backlog to In Progress in Reth Tracker Jan 6, 2026
@shekhirin shekhirin added this pull request to the merge queue Jan 6, 2026
Merged via the queue into main with commit d52b337 Jan 6, 2026
44 checks passed
@shekhirin shekhirin deleted the alexey/engine-reuse-one-cache branch January 6, 2026 21:01
@github-project-automation github-project-automation bot moved this from In Progress to Done in Reth Tracker Jan 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

4 participants