Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions specs/gloas/beacon-chain.md
Original file line number Diff line number Diff line change
Expand Up @@ -614,7 +614,7 @@ def compute_balance_weighted_selection(
Return ``size`` indices sampled by effective balance, using ``indices``
as candidates. If ``shuffle_indices`` is ``True``, candidate indices
are themselves sampled from ``indices`` by shuffling it, otherwise
``indices`` is traversed in order.
``indices`` is traversed in order. The returned list can contain duplicates.
"""
MAX_RANDOM_VALUE = 2**16 - 1
total = uint64(len(indices))
Expand Down Expand Up @@ -665,7 +665,7 @@ def compute_proposer_indices(
```python
def compute_ptc(state: BeaconState, slot: Slot) -> Vector[ValidatorIndex, PTC_SIZE]:
"""
Get the payload timeliness committee for the given ``slot``.
Get the payload timeliness committee, with possible duplicates, for the given ``slot``.
Comment thread
brech1 marked this conversation as resolved.
"""
epoch = compute_epoch_at_slot(slot)
seed = hash(get_seed(state, epoch, DOMAIN_PTC_ATTESTER) + uint_to_bytes(slot))
Expand Down
21 changes: 15 additions & 6 deletions specs/gloas/fork-choice.md
Original file line number Diff line number Diff line change
Expand Up @@ -937,17 +937,25 @@ def on_payload_attestation_message(
Run ``on_payload_attestation_message`` upon receiving a new ``ptc_message`` from
either within a block or directly on the wire.
"""
# The beacon block root must be known
data = ptc_message.data

# PTC attestation must be for a known block. If block is unknown, delay consideration until the block is found
assert data.beacon_block_root in store.block_states
state = store.block_states[data.beacon_block_root]
ptc = get_ptc(state, data.slot)

# PTC votes can only change the vote for their assigned beacon block, return early otherwise
if data.slot != state.slot:
return

# Get all positions of the attester in the PTC
ptc_indices = []
ptc = get_ptc(state, data.slot)
for ptc_index, validator_index in enumerate(ptc):
if validator_index == ptc_message.validator_index:
ptc_indices.append(ptc_index)

# Check that the attester is from the PTC
assert ptc_message.validator_index in ptc
assert len(ptc_indices) > 0

# Verify the signature and check that its for the current slot if it is coming from the wire
if not is_from_block:
Expand All @@ -962,10 +970,11 @@ def on_payload_attestation_message(
signature=ptc_message.signature,
),
)

# Update the votes for the block
ptc_index = ptc.index(ptc_message.validator_index)
payload_timeliness_vote = store.payload_timeliness_vote[data.beacon_block_root]
payload_timeliness_vote[ptc_index] = data.payload_present
payload_data_availability_vote = store.payload_data_availability_vote[data.beacon_block_root]
payload_data_availability_vote[ptc_index] = data.blob_data_available
for ptc_index in ptc_indices:
payload_timeliness_vote[ptc_index] = data.payload_present
payload_data_availability_vote[ptc_index] = data.blob_data_available
```