Skip to content

fix: skip casting payload attestation when there is no block at slot#9406

Merged
nflaig merged 6 commits into
ChainSafe:unstablefrom
ensi321:nc/ptc-skip-when-no-block
May 30, 2026
Merged

fix: skip casting payload attestation when there is no block at slot#9406
nflaig merged 6 commits into
ChainSafe:unstablefrom
ensi321:nc/ptc-skip-when-no-block

Conversation

@ensi321
Copy link
Copy Markdown
Contributor

@ensi321 ensi321 commented May 26, 2026

No description provided.

ensi321 and others added 2 commits May 25, 2026 19:46
Per the gloas honest validator spec, a PTC member must not submit a
payload attestation when no beacon block has been seen for the assigned
slot. Previously, producePayloadAttestationData fell back to the most
recent canonical block at or before the assigned slot, causing the
validator to attest with a stale beaconBlockRoot that peers ignore.

Change the beacon node endpoint to look up the canonical block at the
exact slot and return 404 when none is found, matching the 404 behavior
of /eth/v2/beacon/blocks/{block_id} for empty slots. The validator
client treats 404 as a skip signal and logs at debug rather than error,
since empty slots are an expected condition.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Restructure the payloadInput branch so payloadPresent / blobDataAvailable
are computed inside a single null-check rather than separate guards.
Resolves the lint/complexity/useOptionalChain warning surfaced by biome
after removing the now-redundant blockIsForSlot gate.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@ensi321 ensi321 requested a review from a team as a code owner May 26, 2026 03:18
Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request updates the validator API and PTC service to handle cases where no beacon block is seen at a specific slot. It switches from retrieving the closest block less than or equal to the slot to retrieving the block exactly at the slot. If no block is found, a 404 error is thrown, allowing the validator client to skip submitting payload attestations for that slot. Unit tests and API mocking helpers have been updated and added to cover this scenario. No review comments were provided, so there is no additional feedback to address.

Comment thread packages/validator/src/services/ptc.ts
Comment thread packages/beacon-node/src/api/impl/validator/index.ts Outdated
ensi321 and others added 2 commits May 28, 2026 14:25
Collapse let/if guard into single optional-chain expression with `?? false`
fallback so payloadPresent and blobDataAvailable stay boolean (SSZ Boolean
field). Addresses review feedback on ChainSafe#9406.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Comment thread packages/beacon-node/src/api/impl/validator/index.ts Outdated
Copy link
Copy Markdown
Member

@nflaig nflaig left a comment

Choose a reason for hiding this comment

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

LGTM

@nflaig nflaig merged commit c8732e0 into ChainSafe:unstable May 30, 2026
23 of 24 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants