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 unexpected UnrequestedBlobId and ExtraBlocksReturned errors due to race conditions. #5477

Closed
wants to merge 2 commits into from

Conversation

jimmygchen
Copy link
Member

@jimmygchen jimmygchen commented Mar 25, 2024

Issue Addressed

Fix unexpected UnrequestedBlobId and ExtraBlocksReturned errors due to race conditions.

Scenario

  1. Node receives a blob with unknown parent hash via gossip, this triggers a current lookup + parent lookup
  2. Some blobs for the current lookup are received via gossip before we get RPC responses
  3. RPC blob returned, this triggers UnrequestedBlobId as we already have the blob. This updates the lookup state to State::AwaitingDownload, which causes subsequent blobs received to trigger error ExtraBlocksReturned
  4. This causes peers to be disconnected.

@jimmygchen jimmygchen added the ready-for-review The code is ready for review label Mar 25, 2024
Copy link
Member

@realbigsean realbigsean left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should take out the block root check, and revert the deleted tests, but I'm on board with adding the BlockIsAlreadyKnown change and the error information improvement

Comment on lines +382 to +386
if expected_block_root == received_id.block_root {
// We may have already received this blob via gossip since the lookup,
// so don't return an error here.
return Ok(None);
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if expected_block_root == received_id.block_root {
// We may have already received this blob via gossip since the lookup,
// so don't return an error here.
return Ok(None);
}

I think the issue is really that we update requested_ids mid-response which keeps us from tracking what we should receive. If this is the case, this is more treating a symptom than the cause. This is an alternative:

77c4ffe#diff-af9c70c212795da7557f17c24d6fc12fa4aa6833d06db6eb2d807c277ee2aadbR260

@realbigsean realbigsean added waiting-on-author The reviewer has suggested changes and awaits thier implementation. and removed ready-for-review The code is ready for review labels Mar 26, 2024
@realbigsean
Copy link
Member

closing in favor of #5488

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
waiting-on-author The reviewer has suggested changes and awaits thier implementation.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants