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

Add peers to parent lookups #5858

Merged
merged 5 commits into from
May 30, 2024
Merged

Conversation

dapplion
Copy link
Collaborator

Issue Addressed

Previous PR

Dropped the following feature: If a peers claims to have imported a block, we assume that it must have imported all its parents and will be considered to fetch data from any parent lookup

Having this feature is important to ensure that parent lookups don't "thin-out". Also, malicious peers can strategically send unknown data first to create lookups with a single peer.

Proposed Changes

Add peers that claim to have imported a block to all lookups that are an ancestor of that block

Closes #5708

@dapplion dapplion requested a review from realbigsean May 28, 2024 22:03
@jimmygchen jimmygchen added the v5.2.0 Q2 2024 label May 29, 2024
Comment on lines 857 to 859
let awaiting_parent = lookup.awaiting_parent();
// After adding new peers a lookup may be able to make progress.
let result = lookup.continue_requests(cx);
Copy link
Member

Choose a reason for hiding this comment

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

It's not clear to me why we try to progress to the lookup here, before we progress the parent. Wouldn't it make more sense to do it in reverse? Also this action feels quite out of place in this function although I'm not sure what's a better place for this.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

After #5839 lookups may have zero peers. I agree it won't be a common case that the ancestor lookup in a parent chain ends up with zero peers, pauses and then needs continuation from the code of this PR. I would be okay with dropping this new continue_requests statement, it's really an optimization and not strictly required

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

@jimmygchen jimmygchen left a comment

Choose a reason for hiding this comment

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

Just a minor question & comment above.
I did a round of quick testing locally to trigger parent lookups and it works fine 👍

@jimmygchen jimmygchen 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 May 29, 2024
michaelsproul added a commit that referenced this pull request May 30, 2024
Squashed commit of the following:

commit 08505cb
Author: dapplion <35266934+dapplion@users.noreply.github.com>
Date:   Wed May 29 01:53:40 2024 +0300

    lint

commit 7ad3be6
Author: dapplion <35266934+dapplion@users.noreply.github.com>
Date:   Wed May 29 00:58:03 2024 +0300

    Add test

commit 52c8034
Author: dapplion <35266934+dapplion@users.noreply.github.com>
Date:   Wed May 29 00:19:13 2024 +0300

    Add peers to parent lookups
@michaelsproul michaelsproul mentioned this pull request May 30, 2024
@dapplion dapplion added ready-for-review The code is ready for review and removed waiting-on-author The reviewer has suggested changes and awaits thier implementation. labels May 30, 2024
@realbigsean
Copy link
Member

@mergify queue

@realbigsean realbigsean added ready-for-merge This PR is ready to merge. and removed ready-for-review The code is ready for review labels May 30, 2024
Copy link

mergify bot commented May 30, 2024

queue

✅ The pull request has been merged automatically

The pull request has been merged automatically at 17dc978

mergify bot added a commit that referenced this pull request May 30, 2024
@mergify mergify bot merged commit 17dc978 into sigp:unstable May 30, 2024
28 checks passed
@dapplion dapplion deleted the lookup-parent-peers branch June 2, 2024 11:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ready-for-merge This PR is ready to merge. v5.2.0 Q2 2024
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants