Skip to content

Commit

Permalink
fix: proof fetching error ignored (#28)
Browse files Browse the repository at this point in the history
  • Loading branch information
xJonathanLEI authored Aug 23, 2024
1 parent 6807a71 commit 9a5d46f
Showing 1 changed file with 18 additions and 9 deletions.
27 changes: 18 additions & 9 deletions crates/storage/rpc-db/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -182,14 +182,23 @@ impl<T: Transport + Clone, P: Provider<T> + Clone> RpcDb<T, P> {

// 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
}
}
}
}
})
Expand All @@ -198,7 +207,7 @@ impl<T: Transport + Clone, P: Provider<T> + Clone> RpcDb<T, P> {

// 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();
Expand Down

0 comments on commit 9a5d46f

Please sign in to comment.