From 4684d972e0b9fe4c574b885de765ee97bab82246 Mon Sep 17 00:00:00 2001 From: Michael Sproul Date: Wed, 1 Apr 2026 11:31:51 +1100 Subject: [PATCH] Remove TOCTOU early return --- consensus/fork_choice/src/fork_choice.rs | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) diff --git a/consensus/fork_choice/src/fork_choice.rs b/consensus/fork_choice/src/fork_choice.rs index a80ec99a25..630de11281 100644 --- a/consensus/fork_choice/src/fork_choice.rs +++ b/consensus/fork_choice/src/fork_choice.rs @@ -1305,17 +1305,10 @@ where return Ok(()); } - match self.validate_on_payload_attestation(attestation, is_from_block) { - Ok(()) => (), - Err(InvalidAttestation::PayloadAttestationNotCurrentSlot { .. }) => { - // Just ignore wrong-slot payload attestations, they could have been processed at - // the correct slot when received on gossip, but then have the wrong-slot by the - // time they make it to here (TOCTOU). - // TODO(gloas): consider moving this to the call site for gossip processing - return Ok(()); - } - Err(e) => return Err(e.into()), - } + // TODO(gloas): Should ignore wrong-slot payload attestations at the caller, they could + // have been processed at the correct slot when received on gossip, but then have the + // wrong-slot by the time they make it to here (TOCTOU). + self.validate_on_payload_attestation(attestation, is_from_block)?; // Resolve validator indices to PTC committee positions. let ptc_indices: Vec = attestation