add doc string for new slashing helper funtions
This commit is contained in:
parent
7c833fafc5
commit
697d3c5eb5
|
@ -1043,6 +1043,11 @@ def verify_slashable_vote_data(state: BeaconState, vote_data: SlashableVoteData)
|
||||||
```python
|
```python
|
||||||
def is_double_vote(attestation_data_1: AttestationData,
|
def is_double_vote(attestation_data_1: AttestationData,
|
||||||
attestation_data_2: AttestationData) -> bool
|
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
|
return attestation_data_1.slot == attestation_data_2.slot
|
||||||
```
|
```
|
||||||
|
|
||||||
|
@ -1051,6 +1056,13 @@ def is_double_vote(attestation_data_1: AttestationData,
|
||||||
```python
|
```python
|
||||||
def is_surround_vote(attestation_data_1: AttestationData,
|
def is_surround_vote(attestation_data_1: AttestationData,
|
||||||
attestation_data_2: AttestationData) -> bool
|
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 (
|
return (
|
||||||
(attestation_data_1.justified_slot < attestation_data_2.justified_slot) and
|
(attestation_data_1.justified_slot < attestation_data_2.justified_slot) and
|
||||||
(attestat_data_2.justified_slot + 1 == attestation_data_2.slot) and
|
(attestat_data_2.justified_slot + 1 == attestation_data_2.slot) and
|
||||||
|
|
Loading…
Reference in New Issue