Refactor getLocalPayloadAndBlobs with New Helper getParentBlockHash#12951
Merged
prylabs-bulldozer[bot] merged 2 commits intodevelopfrom Sep 27, 2023
Merged
Refactor getLocalPayloadAndBlobs with New Helper getParentBlockHash#12951prylabs-bulldozer[bot] merged 2 commits intodevelopfrom
getLocalPayloadAndBlobs with New Helper getParentBlockHash#12951prylabs-bulldozer[bot] merged 2 commits intodevelopfrom
Conversation
1b7f0ed to
f0077cc
Compare
saolyn
reviewed
Sep 25, 2023
| func getParentBlockHashPostCapella(st state.BeaconState) ([]byte, error) { | ||
| header, err := st.LatestExecutionPayloadHeader() | ||
| if err != nil { | ||
| return nil, err |
Contributor
There was a problem hiding this comment.
The only errors that can ever be returned by LatestExecutionPayloadHeader() is either errNotSupported+funcname or ErrNilObjectWrapped as there are two instances of the same call it may be better to add some additional information as to whether the failure is when retrieving the hash post Capella or below post merge.
saolyn
approved these changes
Sep 25, 2023
| } | ||
| var attr payloadattribute.Attributer | ||
| switch st.Version() { | ||
| case version.Deneb: |
Contributor
There was a problem hiding this comment.
As a side note, there don't appear to be any tests covering this case here.
807f063 to
5a25e9f
Compare
5a25e9f to
fbb9680
Compare
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.
Description
This pull request aims to improve the maintainability and readability of the
getLocalPayloadAndBlobsfunction. The refactor introduces a new helper function,getParentBlockHash, which streamlines the logic for fetching the parent block hash based on various conditions. This change aligns with the consensus spec as outlined in PR #3350.Key Changes
getParentBlockHashto encapsulate the logic for obtaining the parent block hash.IsMergeTransitionCompletecheck and fetches the parent block hash directly fromst.LatestExecutionPayloadHeader().activationEpochNotReachedandgetTerminalBlockHashIfExistswhen necessary.