@@ -54,8 +54,8 @@ func (f *ForkChoiceStore) notifyPtcMessages(
5454// was voted as present by the PTC, and was locally determined to be available.
5555// [New in Gloas:EIP7732]
5656func (f * ForkChoiceStore ) isPayloadTimely (root common.Hash ) bool {
57- // The beacon block root must be known in ptc_vote
58- ptcVoteRaw , ok := f .ptcVote .Load (root )
57+ // The beacon block root must be known in payload_timeliness_vote
58+ voteRaw , ok := f .payloadTimelinessVote .Load (root )
5959 if ! ok {
6060 return false
6161 }
@@ -67,17 +67,45 @@ func (f *ForkChoiceStore) isPayloadTimely(root common.Hash) bool {
6767 }
6868
6969 // Count PTC votes for payload present
70- ptcVotes := ptcVoteRaw .([clparams .PtcSize ]bool )
70+ votes := voteRaw .([clparams .PtcSize ]bool )
7171 presentCount := uint64 (0 )
72- for i := range ptcVotes {
73- if ptcVotes [i ] {
72+ for i := range votes {
73+ if votes [i ] {
7474 presentCount ++
7575 }
7676 }
7777
7878 return presentCount > clparams .PayloadTimelyThreshold
7979}
8080
81+ // isPayloadDataAvailable returns whether the blob data for the beacon block with root
82+ // was voted as present by the PTC, and was locally determined to be available.
83+ // [New in Gloas:EIP7732]
84+ func (f * ForkChoiceStore ) isPayloadDataAvailable (root common.Hash ) bool {
85+ // The beacon block root must be known in payload_data_availability_vote
86+ voteRaw , ok := f .payloadDataAvailabilityVote .Load (root )
87+ if ! ok {
88+ return false
89+ }
90+
91+ // If the payload is not locally available, the blob data
92+ // is not considered available regardless of the PTC vote
93+ if ! f .forkGraph .HasEnvelope (root ) {
94+ return false
95+ }
96+
97+ // Count PTC votes for data available
98+ votes := voteRaw .([clparams .PtcSize ]bool )
99+ availableCount := uint64 (0 )
100+ for i := range votes {
101+ if votes [i ] {
102+ availableCount ++
103+ }
104+ }
105+
106+ return availableCount > clparams .DataAvailabilityTimelyThreshold
107+ }
108+
81109// getParentPayloadStatus returns the payload status of the parent block.
82110// Compares current block's parent_block_hash with parent block's block_hash from their bids.
83111// [New in Gloas:EIP7732]
@@ -148,14 +176,14 @@ func (f *ForkChoiceStore) isSupportingVote(node ForkChoiceNode, message LatestMe
148176
149177// shouldExtendPayload returns whether the payload for the given root should be extended.
150178// Returns true if:
151- // - The payload is timely (received enough PTC votes), OR
179+ // - The payload is timely AND blob data is available (received enough PTC votes for both ), OR
152180// - There's no proposer boost root, OR
153181// - The proposer boost root's parent is not this root, OR
154182// - The proposer boost root's parent node has FULL payload status
155183// [New in Gloas:EIP7732]
156184func (f * ForkChoiceStore ) shouldExtendPayload (root common.Hash ) bool {
157- // Check if payload is timely
158- if f .isPayloadTimely (root ) {
185+ // Check if payload is timely AND blob data is available
186+ if f .isPayloadTimely (root ) && f . isPayloadDataAvailable ( root ) {
159187 return true
160188 }
161189
0 commit comments