Use Action in single_block_component_processed#5564
Merged
mergify[bot] merged 4 commits intosigp:unstablefrom Apr 16, 2024
Merged
Use Action in single_block_component_processed#5564mergify[bot] merged 4 commits intosigp:unstablefrom
mergify[bot] merged 4 commits intosigp:unstablefrom
Conversation
…ngle_block_component_processed-action
realbigsean
approved these changes
Apr 15, 2024
Member
|
@Mergifyio queue |
✅ The pull request has been merged automaticallyDetailsThe pull request has been merged automatically at e5b8d12 |
5 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Issue Addressed
Part of:
The job of
single_block_component_processedis to decide what action to do in response to a block components processing result. The current code is correct, but IMO it is hard to audit to ensure that:Proposed Changes
This PR changes the current match into returning a single
ActionvalueThis style achieves the goals:
lookupto a mutable reference as the match does not call into someself.method (not impl in this PR). We can switch from the current pattern of remove -> insert to retry / noop to drop, to get_mut -> noop to retry / remove to drop.I'd recommend looking at the final file for a better read
https://github.com/dapplion/lighthouse/blob/540f87325f132b5065379117d92fba1e308c8a02/beacon_node/network/src/sync/block_lookups/mod.rs#L798
Next steps
There are 3 other functions that could adopt this pattern:
single_lookup_responseparent_block_processedparent_chain_processedBut if this PR is well received I would prefer to tackle each latter and separately