-
-
Notifications
You must be signed in to change notification settings - Fork 478
fix: payload status on fork chocie init #8987
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鈥檒l occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -4,7 +4,6 @@ import { | |
| ForkChoice, | ||
| ForkChoiceStore, | ||
| JustifiedBalancesGetter, | ||
| PayloadStatus, | ||
| ProtoArray, | ||
| ProtoBlock, | ||
| ForkChoiceOpts as RawForkChoiceOpts, | ||
|
|
@@ -157,7 +156,7 @@ export function initializeForkChoiceFromFinalizedState( | |
| : {executionPayloadBlockHash: null, executionStatus: ExecutionStatus.PreMerge}), | ||
|
|
||
| dataAvailabilityStatus: DataAvailabilityStatus.PreData, | ||
| payloadStatus: isForkPostGloas ? PayloadStatus.PENDING : PayloadStatus.FULL, // TODO GLOAS: Post-gloas how do we know if the checkpoint payload is FULL or EMPTY? | ||
| payloadStatus: getCheckpointPayloadStatus(state, checkpoint.epoch), | ||
| builderIndex: isForkPostGloas ? (state as CachedBeaconStateGloas).latestExecutionPayloadBid.builderIndex : null, | ||
| blockHashFromBid: isForkPostGloas | ||
| ? toRootHex((state as CachedBeaconStateGloas).latestExecutionPayloadBid.blockHash) | ||
|
|
@@ -254,7 +253,7 @@ export function initializeForkChoiceFromUnfinalizedState( | |
| : {executionPayloadBlockHash: null, executionStatus: ExecutionStatus.PreMerge}), | ||
|
|
||
| dataAvailabilityStatus: DataAvailabilityStatus.PreData, | ||
| payloadStatus: isForkPostGloas ? PayloadStatus.PENDING : PayloadStatus.FULL, // TODO GLOAS: Post-gloas how do we know if the checkpoint payload is FULL or EMPTY? | ||
| payloadStatus: getCheckpointPayloadStatus(unfinalizedState, computeEpochAtSlot(blockHeader.slot)), | ||
| builderIndex: isForkPostGloas | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Initializing
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Agreed on this risk. I reviewed it and confirmed this is actionable: using |
||
| ? (unfinalizedState as CachedBeaconStateGloas).latestExecutionPayloadBid.builderIndex | ||
| : null, | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The pull request modifies the initialization of
payloadStatusininitializeForkChoiceFromFinalizedStateandinitializeForkChoiceFromUnfinalizedStateto usegetCheckpointPayloadStatus(state, checkpoint.epoch). For Gloas (ePBS) forks,getCheckpointPayloadStatuscan returnPayloadStatus.FULLif the execution payload is marked as available in the state.However,
ProtoArray.onBlock, which is called during fork choice initialization (lines 134 and 305-308), only createsPENDINGandEMPTYvariants for Gloas blocks. It does not create theFULLvariant. TheFULLvariant is only created later viaonExecutionPayloadwhen the payload actually arrives.By initializing the
ForkChoiceStorewithpayloadStatus = FULLfor the finalized or justified checkpoints whileProtoArraylacks the correspondingFULLvariant, several critical operations will fail:getJustifiedBlock()andgetFinalizedBlock()will throw aMISSING_PROTO_ARRAY_BLOCKerror.isFinalizedRootOrDescendant()will fail to walk back to the finalized block if it attempts to match theFULLvariant (e.g., when a child block'sparentBlockHashrefers to the execution payload hash).findHead()will throwINVALID_BEST_NODEif it cannot verify the finalized root relationship.This mismatch results in a complete denial of service for the node's fork choice processing and breaks related API endpoints.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+1 from my side as reviewer. This should not initialize anchor/head payload status from checkpoint-epoch availability for the reasons above (can incorrectly choose
FULLand mismatch proto-array variants).\n\nAuthor guidance is captured here: https://github.com/ChainSafe/lodestar/pull/8987#issuecomment-4003698056\n\nOnce this is wired to the correct head-slot semantics, the concern should be resolved.