add doc string for new slashing helper funtions

This commit is contained in:
Danny Ryan 2018-12-13 12:17:39 -06:00
parent 7c833fafc5
commit 697d3c5eb5
No known key found for this signature in database
GPG Key ID: 2765A792E42CE07A
1 changed files with 12 additions and 0 deletions

View File

@ -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