Convert RpcBlock to an enum that indicates availability #8424
+273
−115
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
In block lookup an
RpcBlockis maybe available. In Range sync and backfill sync theRpcBlockis guaranteed to be available because consistency checks are made before theRpcBlockis constructed. In downstream code when we process blocks from lookup and sync, we are treating theRpcBlockas maybe available which adds match statements and edge cases that are mostly irrelevant for sync.Proposed Changes
This PR is a first step towards cleaning up block processing.
RpcBlockis now an enum withAvailableandMaybeAvailablevariants. These variants are constructed when appropriate.Additionally the
RpcBlockInneris created based on the blocks fork variant. i.e.DeneborElectrablocks will always use theRpcInnerBlock::BlockAndBlobsvariant, even if blobs for that block don't exist (or may not be available yet)In a subsequent PR, I'll be updating the block processing code paths to remove availability checks for the
RpcBlock::Availablevariant. In the interest of keeping these PR reviews manageable this PR sticks to just converting theRpcBlockto an enum