2019-05-15 16:36:32 +00:00
|
|
|
from copy import deepcopy
|
|
|
|
|
2019-05-15 17:31:02 +00:00
|
|
|
from eth2spec.test.helpers.attestations import get_valid_attestation, sign_attestation
|
2019-05-15 16:36:32 +00:00
|
|
|
|
|
|
|
|
2019-05-30 20:57:18 +00:00
|
|
|
def get_valid_attester_slashing(spec, state, signed_1=False, signed_2=False):
|
|
|
|
attestation_1 = get_valid_attestation(spec, state, signed=signed_1)
|
2019-05-15 17:53:35 +00:00
|
|
|
|
2019-05-15 16:36:32 +00:00
|
|
|
attestation_2 = deepcopy(attestation_1)
|
|
|
|
attestation_2.data.target_root = b'\x01' * 32
|
|
|
|
|
2019-05-15 17:53:35 +00:00
|
|
|
if signed_2:
|
2019-05-30 20:57:18 +00:00
|
|
|
sign_attestation(spec, state, attestation_2)
|
2019-05-15 16:36:32 +00:00
|
|
|
|
2019-05-30 20:57:18 +00:00
|
|
|
return spec.AttesterSlashing(
|
|
|
|
attestation_1=spec.convert_to_indexed(state, attestation_1),
|
|
|
|
attestation_2=spec.convert_to_indexed(state, attestation_2),
|
2019-05-15 16:36:32 +00:00
|
|
|
)
|