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

race condition during fork detection #11583

Closed
mattsse opened this issue Oct 8, 2024 · 0 comments · Fixed by #11592
Closed

race condition during fork detection #11583

mattsse opened this issue Oct 8, 2024 · 0 comments · Fixed by #11592
Labels
C-bug An unexpected or incorrect behavior

Comments

@mattsse
Copy link
Collaborator

mattsse commented Oct 8, 2024

Describe the feature

fn is_fork(&self, target_hash: B256) -> ProviderResult<bool> {
suffers from a race conditions here

// verify that the given hash is not already part of persisted canonical chain
if self.provider.block_number(target_hash)?.is_some() {
return Ok(false)
}

if we're currently actively reorging on disk but haven't removed the corresponding block yet, then we would incorrectly categorize the block as a non-fork

scenario

a) 1 -> 2 -> 3 -> 4 -> 5
b) reorg to '2: triggers removal of blocks on disk 2
c) another reorg that makes 2 the new head again at which point we wouldn't detect 2 as a fork block (2' is canonical at this point)

Additional context

No response

@mattsse mattsse added the C-bug An unexpected or incorrect behavior label Oct 8, 2024
@github-project-automation github-project-automation bot moved this from Todo to Done in Reth Tracker Oct 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug An unexpected or incorrect behavior
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

1 participant