Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 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
2 changes: 2 additions & 0 deletions packages/beacon-node/src/chain/errors/payloadAttestation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ export enum PayloadAttestationErrorCode {
NOT_CURRENT_SLOT = "PAYLOAD_ATTESTATION_ERROR_NOT_CURRENT_SLOT",
PAYLOAD_ATTESTATION_ALREADY_KNOWN = "PAYLOAD_ATTESTATION_ERROR_PAYLOAD_ATTESTATION_ALREADY_KNOWN",
UNKNOWN_BLOCK_ROOT = "PAYLOAD_ATTESTATION_ERROR_UNKNOWN_BLOCK_ROOT",
INVALID_BLOCK_SLOT = "PAYLOAD_ATTESTATION_ERROR_INVALID_BLOCK_SLOT",
INVALID_BLOCK = "PAYLOAD_ATTESTATION_ERROR_INVALID_BLOCK",
INVALID_ATTESTER = "PAYLOAD_ATTESTATION_ERROR_INVALID_ATTESTER",
INVALID_SIGNATURE = "PAYLOAD_ATTESTATION_ERROR_INVALID_SIGNATURE",
Expand All @@ -18,6 +19,7 @@ export type PayloadAttestationErrorType =
blockRoot: RootHex;
}
| {code: PayloadAttestationErrorCode.UNKNOWN_BLOCK_ROOT; blockRoot: RootHex}
| {code: PayloadAttestationErrorCode.INVALID_BLOCK_SLOT; blockRoot: RootHex; blockSlot: Slot; slot: Slot}
| {code: PayloadAttestationErrorCode.INVALID_BLOCK; blockRoot: RootHex}
| {code: PayloadAttestationErrorCode.INVALID_ATTESTER; attesterIndex: ValidatorIndex}
| {code: PayloadAttestationErrorCode.INVALID_SIGNATURE};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,13 +61,25 @@ async function validatePayloadAttestationMessage(
// [IGNORE] The message's block `data.beacon_block_root` has been seen (via
// gossip or non-gossip sources) (a client MAY queue attestation for processing
// once the block is retrieved. Note a client might want to request payload after).
if (!chain.forkChoice.hasBlock(data.beaconBlockRoot)) {
const block = chain.forkChoice.getBlockDefaultStatus(data.beaconBlockRoot);
if (!block) {
throw new PayloadAttestationError(GossipAction.IGNORE, {
code: PayloadAttestationErrorCode.UNKNOWN_BLOCK_ROOT,
blockRoot: toRootHex(data.beaconBlockRoot),
});
}

// [IGNORE] The block referenced by `data.beacon_block_root` is at slot `data.slot`,
// i.e. the block has `block.slot == data.slot`.
if (block.slot !== data.slot) {
throw new PayloadAttestationError(GossipAction.IGNORE, {
code: PayloadAttestationErrorCode.INVALID_BLOCK_SLOT,
blockRoot: toRootHex(data.beaconBlockRoot),
blockSlot: block.slot,
slot: data.slot,
});
}
Copy link
Copy Markdown
Member Author

@nflaig nflaig May 30, 2026

Choose a reason for hiding this comment

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

it's bit strange that this ignore is above the reject on L84 (anyways not relevant) but that's how the spec orders the checks, but pretty sure having "The message's block data.beacon_block_root passes validation." before slot check against that block is correct, @ensi321 is the spec ordering intended?


const state = chain.getHeadState();
if (!isStatePostGloas(state)) {
throw new Error(`Expected gloas+ state for payload attestation validation, got fork=${state.forkName}`);
Expand Down
Loading