Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: proof fetching error ignored #28

Merged
merged 1 commit into from
Aug 23, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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