From aa9bda271feb8cb9d80cc2ac647e1e510b94b55b Mon Sep 17 00:00:00 2001 From: Danny Ryan Date: Fri, 28 Dec 2018 11:10:12 -0600 Subject: [PATCH] fix slashing conditons to be based upon epochs rather than slots --- specs/core/0_beacon-chain.md | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/specs/core/0_beacon-chain.md b/specs/core/0_beacon-chain.md index 045a914b0..8501a1a40 100644 --- a/specs/core/0_beacon-chain.md +++ b/specs/core/0_beacon-chain.md @@ -1080,7 +1080,9 @@ def is_double_vote(attestation_data_1: AttestationData, Returns True if the provided ``AttestationData`` are slashable due to a 'double vote'. """ - return attestation_data_1.slot == attestation_data_2.slot + target_epoch_1 = attestation_data_1.slot // EPOCH_LENGTH + target_epoch_2 = attestation_data_2.slot // EPOCH_LENGTH + return target_epoch_1 == target_epoch_2 ``` #### `is_surround_vote` @@ -1095,10 +1097,14 @@ def is_surround_vote(attestation_data_1: AttestationData, Note: parameter order matters as this function only checks that ``attestation_data_1`` surrounds ``attestation_data_2``. """ + source_epoch_1 = attestation_data_1.justified_slot // EPOCH_LENGTH + source_epoch_2 = attestation_data_2.justified_slot // EPOCH_LENGTH + target_epoch_1 = attestation_data_1.slot // EPOCH_LENGTH + target_epoch_2 = attestation_data_2.slot // EPOCH_LENGTH return ( - (attestation_data_1.justified_slot < attestation_data_2.justified_slot) and - (attestation_data_2.justified_slot + 1 == attestation_data_2.slot) and - (attestation_data_2.slot < attestation_data_1.slot) + (source_epoch_1 < source_epoch_2) and + (source_epoch_2 + 1 == target_epoch_2) and + (target_epoch_2 < target_epoch_1) ) ```