Skip to content

Count PTC votes from duplicated validators + apply attestations from blocks - #10732

Merged
tbenr merged 3 commits into
Consensys:masterfrom
zilm13:ptc-votes-duplicated-validators
May 22, 2026
Merged

Count PTC votes from duplicated validators + apply attestations from blocks#10732
tbenr merged 3 commits into
Consensys:masterfrom
zilm13:ptc-votes-duplicated-validators

Conversation

@zilm13

@zilm13 zilm13 commented May 19, 2026

Copy link
Copy Markdown
Contributor

PR Description

ethereum/consensus-specs#5222) -
It also includes applying attestations from block which we missed

Fixed Issue(s)

Documentation

  • I thought about documentation and added the doc-change-required label to this PR if updates are required.

Changelog

  • I thought about adding a changelog entry, and added one if I deemed necessary.

Note

High Risk
Changes fork-choice vote accounting and block-import processing for Gloas payload attestations; mistakes could alter head selection or payload-timeliness decisions in consensus-critical logic.

Overview
Fixes Gloas payload-attestation vote accounting by tracking votes per PTC position (not per validator index), so duplicated validators in the committee contribute correctly to is_payload_timely / is_payload_data_available thresholds.

Introduces ValidatablePayloadAttestationMessage to precompute/cache PTC positions during gossip validation and before updating fork choice, adds a validated-subscriber path in the payload attestation pool, and updates ForkChoice/ForkChoiceStrategy/PtcVoteTracker APIs accordingly.

Applies payload attestations included in imported blocks by expanding aggregated attestations into per-position messages and recording their votes during onBlock processing; reference tests and unit tests are updated to cover duplicate-PTC and block-sourced attestations.

Reviewed by Cursor Bugbot for commit 0748348. Bugbot is set up for automated code reviews on this repo. Configure here.

@zilm13 zilm13 mentioned this pull request May 19, 2026
17 tasks
rolfyone
rolfyone previously approved these changes May 21, 2026
tbenr
tbenr previously approved these changes May 21, 2026

@tbenr tbenr left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. just a consideration

// Note: not using thenRun here because we want to ensure each step is on the event thread
transaction.commit().join();
blockImportPerformance.ifPresent(BlockImportPerformance::transactionCommitted);
applyPayloadAttestationsFromBlock(block);

@tbenr tbenr May 21, 2026

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i'd move this closer to the block in which we call apply*FromBlock

the reason why it was not implemented in the first place is because it is not a big deal:
1- PTC votes influence only the FULL\EMPTY selection (no "long term" weight applied to FC)
2- in terms of PTC packing and block inclusion during block production, the PTC are included only if they are from the previous slot. So the attestationPool complication is not needed.

so, missing those messages is not really a big deal.

Due to that, even if not super-aligned with the spec, we could move this inside

    if (spec.computeEpochAtSlot(block.getSlot())
        .isGreaterThanOrEqualTo(currentEpoch.minusMinZero(1))) {
....
}

together with the others, so while syncing far from head we won't do useless work (if spec will change around it we may need to reevaluate) and it will be nicely together with the others.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good clarification! I've updated the code

@zilm13
zilm13 dismissed stale reviews from tbenr and rolfyone via 0748348 May 21, 2026 19:58

@tbenr tbenr left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@tbenr
tbenr merged commit 7abc081 into Consensys:master May 22, 2026
157 of 159 checks passed
@github-actions github-actions Bot locked and limited conversation to collaborators May 22, 2026
@zilm13
zilm13 deleted the ptc-votes-duplicated-validators branch May 25, 2026 14:10
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants