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

network: Investigate importing block with unknown parent #4984

Open
lexnv opened this issue Jul 9, 2024 · 1 comment
Open

network: Investigate importing block with unknown parent #4984

lexnv opened this issue Jul 9, 2024 · 1 comment

Comments

@lexnv
Copy link
Contributor

lexnv commented Jul 9, 2024

Long running litep2p and libp2p nodes produced a high number of warnings wrt:

litep2p
| 516        | warn       | 💔 Error importing block .*: .* ( block has an unknown parent    ) |

libp2p
| 506        | warn       | 💔 Error importing block .*: .* ( block has an unknown parent    ) |

The warning is coming from:

e @ Err(BlockImportError::UnknownParent) | e @ Err(BlockImportError::Other(_)) => {
warn!(target: LOG_TARGET, "💔 Error importing block {hash:?}: {}", e.unwrap_err());
self.state_sync = None;
self.restart();
},

And this is causing the sync process to restart, which may affect other issues like:

/// Restart the sync process. This will reset all pending block requests and return an iterator
/// of new block requests to make to peers. Peers that were downloading finality data (i.e.
/// their state was `DownloadingJustification`) are unaffected and will stay in the same state.
fn restart(&mut self) {

@lexnv lexnv added this to Networking Jul 9, 2024
@lexnv
Copy link
Contributor Author

lexnv commented Jul 9, 2024

Might be coming from:

  • loosing queue_blocks status information

/// What is the status of the block corresponding to the given hash?
fn block_status(&self, hash: &B::Hash) -> Result<BlockStatus, ClientError> {
if self.queue_blocks.contains(hash) {
return Ok(BlockStatus::Queued)
}
self.client.block_status(*hash)
}

  • Note: we might not track the queued_blocks properly (ie if self.queue_blocks.len() > MAX_IMPORTING_BLOCKS > 2k blocks)

  • lower level

if number == front_block_number {
if !self
.last_canonicalized
.as_ref()
.map_or(false, |&(ref h, n)| h == parent_hash && n == number - 1)
{
return Err(StateDbError::InvalidParent)
}
} else if !self.parents.contains_key(parent_hash) {
return Err(StateDbError::InvalidParent)
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: No status
Development

No branches or pull requests

1 participant