Make SingleLookupRequestState fields private#5563
Make SingleLookupRequestState fields private#5563mergify[bot] merged 2 commits intosigp:unstablefrom
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 automaticallyDetailsThe 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
SingleLookupRequestStatefields 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 ofSingleLookupRequestStateis 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_responseuse 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_successsuch that a state transition fromProcessed->Downloadingis not possible