From f215ea04d2edcd658939aed0cf36bebe45bd7700 Mon Sep 17 00:00:00 2001 From: Jonathan LEI Date: Sat, 24 Aug 2024 03:40:05 +0800 Subject: [PATCH] fix: proof fetching error ignored --- crates/storage/rpc-db/src/lib.rs | 27 ++++++++++++++++++--------- 1 file changed, 18 insertions(+), 9 deletions(-) diff --git a/crates/storage/rpc-db/src/lib.rs b/crates/storage/rpc-db/src/lib.rs index 1deec24..7c2f795 100644 --- a/crates/storage/rpc-db/src/lib.rs +++ b/crates/storage/rpc-db/src/lib.rs @@ -182,14 +182,23 @@ impl + Clone> RpcDb { // Fetch the proof for the address + storage keys. async move { - match self - .provider - .get_proof(address, storage_keys_for_address) - .block_id(self.block) - .await - { - Ok(proof) => Some((address, proof)), - Err(_) => None, + loop { + match self + .provider + .get_proof(address, storage_keys_for_address.clone()) + .block_id(self.block) + .await + { + Ok(proof) => break (address, proof), + Err(err) => { + tracing::info!( + "error fetching account proof for {}: {}. Retrying in 1s", + address, + err + ); + tokio::time::sleep(std::time::Duration::from_secs(1)).await + } + } } } }) @@ -198,7 +207,7 @@ impl + Clone> RpcDb { // Get the EIP-1186 proofs for the accounts that were touched. let results = join_all(futures).await; - let eip1186_proofs: Vec<_> = results.into_iter().flatten().collect(); + let eip1186_proofs: Vec<_> = results.into_iter().collect(); // Convert the EIP-1186 proofs to [AccountProofWithBytecode]. let accounts = self.accounts.borrow();