@@ -126,28 +126,55 @@ type
126126 current_root* : Eth2Digest
127127 next_root* : Eth2Digest
128128 next_epoch* : Epoch
129+ next_slot* : Slot
130+ payload_present* : bool
129131
130132 ForkChoiceBackend * = object
131133 proto_array* : ProtoArray
132134 votes* : seq [VoteTracker ]
133135 balances* : seq [Gwei ]
136+ # Additional state tracking for Gloas
137+ execution_payload_states* : Table [Eth2Digest , Eth2Digest ] # root -> state_root
138+ ptc_vote* : Table [Eth2Digest , seq [bool ]]
134139
135140 QueuedAttestation * = object
136141 slot* : Slot
137142 attesting_indices* : seq [ValidatorIndex ]
138143 block_root* : Eth2Digest
139144 target_epoch* : Epoch
145+ # Gloas - track committee index for payload preference
146+ committee_index* : CommitteeIndex
140147
141148 ForkChoice * = object
142149 backend* : ForkChoiceBackend
143150 checkpoints* : Checkpoints
144151 queuedAttestations* : seq [QueuedAttestation ]
145152
153+ # New Fork choice types for Gloas
154+ # ----------------------------------------------------------------------
155+
156+ type
157+ # https://github.com/ethereum/consensus-specs/blob/v1.6.1/specs/gloas/fork-choice.md#custom-types
158+ PayloadStatus * = uint8
159+
160+ ForkChoiceNode * = object
161+ root* : Eth2Digest
162+ payloadStatus* : PayloadStatus
163+
164+ const
165+ # https://github.com/ethereum/consensus-specs/blob/v1.6.1/specs/gloas/fork-choice.md#constants
166+ PAYLOAD_TIMELY_THRESHOLD * : uint64 = PTC_SIZE div 2
167+ PAYLOAD_STATUS_PENDING * = PayloadStatus (0 )
168+ PAYLOAD_STATUS_EMPTY * = PayloadStatus (1 )
169+ PAYLOAD_STATUS_FULL * = PayloadStatus (2 )
170+
146171func shortLog * (vote: VoteTracker ): auto =
147172 (
148173 current_root: shortLog (vote.current_root),
149174 next_root: shortLog (vote.next_root),
150- next_epoch: vote.next_epoch
175+ next_epoch: vote.next_epoch,
176+ next_slot: vote.next_slot,
177+ payload_present: vote.payload_present
151178 )
152179
153180chronicles.formatIt VoteTracker : it.shortLog
0 commit comments