From 697d3c5eb58df26239bea03154db298e171b2ece Mon Sep 17 00:00:00 2001 From: Danny Ryan Date: Thu, 13 Dec 2018 12:17:39 -0600 Subject: [PATCH] add doc string for new slashing helper funtions --- specs/core/0_beacon-chain.md | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/specs/core/0_beacon-chain.md b/specs/core/0_beacon-chain.md index 15cd4f6e5..30fb27c19 100644 --- a/specs/core/0_beacon-chain.md +++ b/specs/core/0_beacon-chain.md @@ -1043,6 +1043,11 @@ def verify_slashable_vote_data(state: BeaconState, vote_data: SlashableVoteData) ```python def is_double_vote(attestation_data_1: AttestationData, attestation_data_2: AttestationData) -> bool + """ + Assumes ``attestation_data_1`` is distinct from ``attestation_data_2``. + Returns True if the provided ``AttestationData`` are slashable + due to a 'double vote'. + """ return attestation_data_1.slot == attestation_data_2.slot ``` @@ -1051,6 +1056,13 @@ def is_double_vote(attestation_data_1: AttestationData, ```python def is_surround_vote(attestation_data_1: AttestationData, attestation_data_2: AttestationData) -> bool + """ + Assumes ``attestation_data_1`` is distinct from ``attestation_data_2``. + Returns True if the provided ``AttestationData`` is slashable + due to a 'surround vote'. + Note: parameter order matters as this function only checks + that ``attestation_data_1`` surrounds ``attestation_data_2``. + """ return ( (attestation_data_1.justified_slot < attestation_data_2.justified_slot) and (attestat_data_2.justified_slot + 1 == attestation_data_2.slot) and