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

Avoid checking illegal blocks. #230

Merged
merged 1 commit into from
Oct 28, 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
11 changes: 4 additions & 7 deletions crates/rbuilder/src/utils/provider_factory_reopen.rs
Original file line number Diff line number Diff line change
Expand Up @@ -133,21 +133,18 @@ pub fn check_provider_factory_health<DB: Database>(
current_block_number: u64,
provider_factory: &ProviderFactory<DB>,
) -> eyre::Result<()> {
// evm must have access to block hashed of 256 of the previous blocks
for i in 1u64..=256 {
// evm must have access to block hashes of 256 of the previous blocks
let blocks_to_check = current_block_number.min(256);
for i in 1..=blocks_to_check {
let num = current_block_number - i;
let hash = provider_factory.block_hash(num)?;
if hash.is_none() {
eyre::bail!(
"Missing historical block hash for block {}, current block: {}",
current_block_number - i,
num,
current_block_number
);
}

if num == 0 {
break;
}
}

Ok(())
Expand Down
Loading