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

Generalize sync ActiveRequests #6398

Merged
merged 13 commits into from
Oct 17, 2024
Merged

Conversation

dapplion
Copy link
Collaborator

Part of

To address PeerDAS sync issues we need to make individual by_range requests within a batch retriable. We should adopt the same pattern for lookup sync where each request (block/blobs/columns) is tracked individually within a "meta" request that group them all and handles retry logic.

The first step is to add ActiveBlocksByRangeRequest, ActiveBlobsByRangeRequest and ActiveDataColumnsByRangeRequest. I'm in the progress of doing that in this branch https://github.com/sigp/lighthouse/compare/unstable...dapplion:lighthouse:sync-active-requests?expand=1 but I noted a lot of sensitive code repetition.

This PR is pre-step to add ActiveRequest to our existing ActiveRequest*ByRoot (the ones for by_root). Next PR will add the ActiveRequest*ByRange goodies :)

@dapplion dapplion added ready-for-review The code is ready for review syncing and removed ready-for-review The code is ready for review labels Sep 16, 2024
@dapplion dapplion marked this pull request as draft September 16, 2024 11:42
@dapplion dapplion added the ready-for-review The code is ready for review label Sep 17, 2024
@dapplion dapplion marked this pull request as ready for review September 17, 2024 12:19
@dapplion dapplion force-pushed the sync-active-request-generalize branch from 2e502a9 to 043d52b Compare September 17, 2024 12:21
@@ -42,11 +37,19 @@ pub enum SyncRequestId {
/// Request searching for a set of blobs given a hash.
SingleBlob { id: SingleLookupReqId },
/// Request searching for a set of data columns given a hash and list of column indices.
DataColumnsByRoot(DataColumnsByRootRequestId, DataColumnsByRootRequester),
DataColumnsByRoot(DataColumnsByRootRequestId),
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Having the requester inside the ID just simplifies downstream code and makes it symmetrical with the other variants

// Network context returns "download success" because the request has enough blobs + it
// downscores the peer for returning too many.
.expect_no_block_request();
}
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This test needs a scenario where sync receives more blob chunks than originally requested. This can never happen in practice so I choose to not handle this scenario to reduce complexity

// Should never happen, ReqResp network behaviour enforces a max count of chunks
// When `max_remaining_chunks <= 1` a the inbound stream in terminated in
// `rpc/handler.rs`. Handling this case adds complexity for no gain. Even if an
// attacker could abuse this, there's no gain in sending garbage chunks that
// will be ignored anyway.
State::CompletedEarly => None,

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.

Just had some nits, but looks good, overall like the direction 👌

beacon_node/lighthouse_network/src/service/api_types.rs Outdated Show resolved Hide resolved
beacon_node/lighthouse_network/src/service/api_types.rs Outdated Show resolved Hide resolved
beacon_node/network/src/sync/network_context.rs Outdated Show resolved Hide resolved
beacon_node/network/src/sync/network_context.rs Outdated Show resolved Hide resolved
beacon_node/network/src/sync/network_context.rs Outdated Show resolved Hide resolved
beacon_node/network/src/sync/network_context.rs Outdated Show resolved Hide resolved
beacon_node/network/src/sync/network_context.rs Outdated Show resolved Hide resolved
@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 Sep 27, 2024
@dapplion
Copy link
Collaborator Author

dapplion commented Oct 5, 2024

@realbigsean sir I fix the test sir

@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 Oct 6, 2024
@realbigsean
Copy link
Member

looks like there's another test broken, sorry @dapplion !

@realbigsean
Copy link
Member

@mergify queue

Copy link

mergify bot commented Oct 16, 2024

queue

🛑 The pull request has been removed from the queue default

Pull request #6398 has been dequeued by a dequeue command.

You can take a look at Queue: Embarked in merge queue check runs for more details.

In case of a failure due to a flaky test, you should first retrigger the CI.
Then, re-embark the pull request into the merge queue by posting the comment
@mergifyio refresh on the pull request.

mergify bot added a commit that referenced this pull request Oct 17, 2024
@michaelsproul michaelsproul added ready-for-merge This PR is ready to merge. and removed ready-for-review The code is ready for review labels Oct 17, 2024
@michaelsproul
Copy link
Member

@mergify dequeue

Copy link

mergify bot commented Oct 17, 2024

dequeue

✅ The pull request has been removed from the queue default

@michaelsproul
Copy link
Member

@mergify queue

Copy link

mergify bot commented Oct 17, 2024

queue

🛑 The pull request has been removed from the queue default

Pull request #6398 has been dequeued by a dequeue command.

You can take a look at Queue: Embarked in merge queue check runs for more details.

In case of a failure due to a flaky test, you should first retrigger the CI.
Then, re-embark the pull request into the merge queue by posting the comment
@mergifyio refresh on the pull request.

@realbigsean
Copy link
Member

@mergify queue

Copy link

mergify bot commented Oct 17, 2024

queue

🛑 The pull request has been removed from the queue default

The pull request #6398 has been manually updated.

You can take a look at Queue: Embarked in merge queue check runs for more details.

In case of a failure due to a flaky test, you should first retrigger the CI.
Then, re-embark the pull request into the merge queue by posting the comment
@mergifyio refresh on the pull request.

@realbigsean
Copy link
Member

looks like CI here is hung on b9cd5ad ?
Screenshot 2024-10-17 at 10 08 27 AM

@realbigsean
Copy link
Member

@mergify cancel

Copy link

mergify bot commented Oct 17, 2024

cancel

❌ Sorry but I didn't understand the command. Please consult the commands documentation 📚.

@realbigsean
Copy link
Member

@mergify queue

Copy link

mergify bot commented Oct 17, 2024

queue

✅ The pull request has been merged automatically

The pull request has been merged automatically at a074e9e

@mergify mergify bot merged commit a074e9e into unstable Oct 17, 2024
29 checks passed
@mergify mergify bot deleted the sync-active-request-generalize branch October 17, 2024 18:14
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. syncing
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants