perf(trie): dispatch V2 storage proofs in lexicographical order (#21684)

This commit is contained in:
Huber
2026-02-02 11:31:47 +02:00
committed by GitHub
parent e7d4a05e36
commit f74e594292

View File

@@ -1828,8 +1828,14 @@ fn dispatch_v2_storage_proofs(
}
}
// Sort storage targets by address for optimal dispatch order.
// Since trie walk processes accounts in lexicographical order, dispatching in the same order
// reduces head-of-line blocking when consuming results.
let mut sorted_storage_targets: Vec<_> = storage_targets.into_iter().collect();
sorted_storage_targets.sort_unstable_by_key(|(addr, _)| *addr);
// Dispatch all proofs for targeted storage slots
for (hashed_address, targets) in storage_targets {
for (hashed_address, targets) in sorted_storage_targets {
// Create channel for receiving StorageProofResultMessage
let (result_tx, result_rx) = crossbeam_channel::unbounded();
let input = StorageProofInput::new(hashed_address, targets);