-
Notifications
You must be signed in to change notification settings - Fork 784
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
Make SingleLookupRequestState fields private #5563
Conversation
fa6c8f1
to
22dba0c
Compare
definitely support consolidating where these state changes are made. Not tracking this led to one of our recent bugs in duplicate parent lookups
Agreed |
@Mergifyio queue |
✅ The pull request has been merged automaticallyThe pull request has been merged automatically at fee2ee9 |
@realbigsean about this todo lighthouse/beacon_node/network/src/sync/block_lookups/common.rs Lines 169 to 171 in 6cc98a7
not sure if this was just overlooked in the original design. The peer returned from the network is decided by internal logic. If there are not bugs in routing the correct request_id the peer_id should always match. Then, should we even track the downloading peer? |
Issue Addressed
SingleLookupRequestState
fields are public and mutated all over the place. This makes the code unnecessarily difficult to follow. Instead, its fields should be private and mutated through setters such that looking the the implementation ofSingleLookupRequestState
is sufficient to view and understand all possible state transitions.Part of:
Proposed Changes
verify_response_inner
(specific per request) toverify_response
(generic for the trait)verify_response
use the actual response sending peer instead of the one being tracked in the state. See code comment about potential inconsistencies.A future PR should add more checks in setters like
on_download_success
such that a state transition fromProcessed
->Downloading
is not possible