From 4280ccf4701445173419b7a9f9f02ae686e03cd1 Mon Sep 17 00:00:00 2001 From: Arsenii Kulikov Date: Mon, 2 Feb 2026 16:18:45 +0400 Subject: [PATCH] fix: short-circuit in reveal_account_v2_proof_nodes on empty nodes (#21701) --- crates/trie/sparse/src/state.rs | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/crates/trie/sparse/src/state.rs b/crates/trie/sparse/src/state.rs index 29ae813b4e..f4cd5a998e 100644 --- a/crates/trie/sparse/src/state.rs +++ b/crates/trie/sparse/src/state.rs @@ -355,8 +355,16 @@ where &mut self, multiproof: reth_trie_common::DecodedMultiProofV2, ) -> SparseStateTrieResult<()> { - // Reveal the account proof nodes - self.reveal_account_v2_proof_nodes(multiproof.account_proofs)?; + // Reveal the account proof nodes. + // + // Skip revealing account nodes if this result only contains storage proofs. + // `reveal_account_v2_proof_nodes` will return an error if empty `nodes` are passed into it + // before the accounts trie root was revealed. This might happen in cases when first account + // trie proof arrives later than first storage trie proof even though the account trie proof + // was requested first. + if !multiproof.account_proofs.is_empty() { + self.reveal_account_v2_proof_nodes(multiproof.account_proofs)?; + } #[cfg(not(feature = "std"))] // If nostd then serially reveal storage proof nodes for each storage trie