From 2dc76f9abe0d0386ff6e33af6543e79a70c028c1 Mon Sep 17 00:00:00 2001 From: DaniPopes <57450786+DaniPopes@users.noreply.github.com> Date: Tue, 3 Feb 2026 13:47:15 +0100 Subject: [PATCH] chore: match statement order in ExecutionCache::new (#21712) Co-authored-by: Matthias Seitz Co-authored-by: github-actions[bot] --- .changelog/gentle-moons-cry.md | 5 +++++ crates/engine/tree/src/tree/cached_state.rs | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) create mode 100644 .changelog/gentle-moons-cry.md diff --git a/.changelog/gentle-moons-cry.md b/.changelog/gentle-moons-cry.md new file mode 100644 index 0000000000..01b1ee18d7 --- /dev/null +++ b/.changelog/gentle-moons-cry.md @@ -0,0 +1,5 @@ +--- +reth-engine-tree: patch +--- + +Reordered cache size calculations in `ExecutionCache::new` to group related operations together. diff --git a/crates/engine/tree/src/tree/cached_state.rs b/crates/engine/tree/src/tree/cached_state.rs index fdd3ea4c68..7e738699b6 100644 --- a/crates/engine/tree/src/tree/cached_state.rs +++ b/crates/engine/tree/src/tree/cached_state.rs @@ -534,9 +534,9 @@ impl ExecutionCache { /// Build an [`ExecutionCache`] struct, so that execution caches can be easily cloned. pub fn new(total_cache_size: usize) -> Self { + let code_cache_size = (total_cache_size * 556) / 10000; // 5.56% of total let storage_cache_size = (total_cache_size * 8888) / 10000; // 88.88% of total let account_cache_size = (total_cache_size * 556) / 10000; // 5.56% of total - let code_cache_size = (total_cache_size * 556) / 10000; // 5.56% of total let code_capacity = Self::bytes_to_entries(code_cache_size, CODE_CACHE_ENTRY_SIZE); let storage_capacity = Self::bytes_to_entries(storage_cache_size, STORAGE_CACHE_ENTRY_SIZE);