perf(trie): defer consuming remaining storage proof receivers (#20915)

This commit is contained in:
Matthias Seitz
2026-01-10 16:17:20 +01:00
committed by GitHub
parent 0f3d3695f5
commit a4921119e4

View File

@@ -1505,17 +1505,6 @@ where
}
}
// Consume remaining storage proof receivers for accounts not encountered during trie walk.
for (hashed_address, receiver) in storage_proof_receivers {
if let Ok(proof_msg) = receiver.recv() {
// Extract storage proof from the result
let proof_result = proof_msg.result?;
let proof = Into::<Option<DecodedStorageMultiProof>>::into(proof_result)
.expect("Partial proofs are not yet supported");
collected_decoded_storages.insert(hashed_address, proof);
}
}
let _ = hash_builder.root();
let account_subtree_raw_nodes = hash_builder.take_proof_nodes();
@@ -1537,6 +1526,17 @@ where
tracker.cursor_metrics.account_trie_cursor.extend(&account_trie_cursor_metrics);
tracker.cursor_metrics.account_hashed_cursor.extend(&account_hashed_cursor_metrics);
// Consume remaining storage proof receivers for accounts not encountered during trie walk.
// Done last to allow storage workers more time to complete while we finalized the account trie.
for (hashed_address, receiver) in storage_proof_receivers {
if let Ok(proof_msg) = receiver.recv() {
let proof_result = proof_msg.result?;
let proof = Into::<Option<DecodedStorageMultiProof>>::into(proof_result)
.expect("Partial proofs are not yet supported");
collected_decoded_storages.insert(hashed_address, proof);
}
}
Ok(DecodedMultiProof {
account_subtree: decoded_account_subtree,
branch_node_masks,