From dd0a91de0c880200ffb586700d5f7308a973ccd4 Mon Sep 17 00:00:00 2001 From: tersec Date: Tue, 4 Aug 2020 20:10:29 +0000 Subject: [PATCH] allow a slot's worth of clock disparity in attestation validation (#1442) --- beacon_chain/attestation_aggregation.nim | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/beacon_chain/attestation_aggregation.nim b/beacon_chain/attestation_aggregation.nim index 07e920132..cb25e3840 100644 --- a/beacon_chain/attestation_aggregation.nim +++ b/beacon_chain/attestation_aggregation.nim @@ -100,10 +100,10 @@ proc isValidAttestationSlot( func checkPropagationSlotRange(data: AttestationData, current_slot: Slot): bool = # https://github.com/ethereum/eth2.0-specs/blob/v0.12.2/specs/phase0/p2p-interface.md#beacon_attestation_subnet_id - # TODO clock disparity + # TODO clock disparity of 0.5s instead of whole slot # attestation.data.slot + ATTESTATION_PROPAGATION_SLOT_RANGE >= # current_slot >= attestation.data.slot - (data.slot + ATTESTATION_PROPAGATION_SLOT_RANGE >= current_slot) and + (data.slot + ATTESTATION_PROPAGATION_SLOT_RANGE + 1 >= current_slot) and (current_slot >= data.slot) # https://github.com/ethereum/eth2.0-specs/blob/v0.12.2/specs/phase0/p2p-interface.md#beacon_attestation_subnet_id @@ -120,7 +120,8 @@ proc isValidAttestation*( return false if not checkPropagationSlotRange(attestation.data, current_slot): - debug "attestation.data.slot not within ATTESTATION_PROPAGATION_SLOT_RANGE" + debug "attestation.data.slot not within ATTESTATION_PROPAGATION_SLOT_RANGE", + current_slot return false # The attestation is unaggregated -- that is, it has exactly one