diff --git a/test_libs/pyspec/eth2spec/test/phase_0/block_processing/test_process_attester_slashing.py b/test_libs/pyspec/eth2spec/test/phase_0/block_processing/test_process_attester_slashing.py index c51f5a8a9..2d8f9d31a 100644 --- a/test_libs/pyspec/eth2spec/test/phase_0/block_processing/test_process_attester_slashing.py +++ b/test_libs/pyspec/eth2spec/test/phase_0/block_processing/test_process_attester_slashing.py @@ -142,12 +142,39 @@ def test_participants_already_slashed(spec, state): @with_all_phases @spec_state_test -def test_custody_bit_0_and_1(spec, state): +def test_custody_bit_0_and_1_intersect(spec, state): attester_slashing = get_valid_attester_slashing(spec, state, signed_1=False, signed_2=True) - attester_slashing.attestation_1.custody_bit_1_indices = ( - attester_slashing.attestation_1.custody_bit_0_indices + attester_slashing.attestation_1.custody_bit_1_indices.append( + attester_slashing.attestation_1.custody_bit_0_indices[0] ) + sign_indexed_attestation(spec, state, attester_slashing.attestation_1) yield from run_attester_slashing_processing(spec, state, attester_slashing, False) + + +@with_all_phases +@spec_state_test +def test_attester_slashing_invalid_att_1(spec, state): + attester_slashing = get_valid_attester_slashing(spec, state, signed_1=False, signed_2=True) + + indices = attester_slashing.attestation_1.custody_bit_0_indices + assert len(indices) >= 3 + indices[1], indices[2] = indices[2], indices[1] # unsort second and third index + sign_indexed_attestation(spec, state, attester_slashing.attestation_1) + + yield from run_attester_slashing_processing(spec, state, attester_slashing, False) + + +@with_all_phases +@spec_state_test +def test_attester_slashing_invalid_att_2(spec, state): + attester_slashing = get_valid_attester_slashing(spec, state, signed_1=True, signed_2=False) + + indices = attester_slashing.attestation_2.custody_bit_0_indices + assert len(indices) >= 3 + indices[1], indices[2] = indices[2], indices[1] # unsort second and third index + sign_indexed_attestation(spec, state, attester_slashing.attestation_2) + + yield from run_attester_slashing_processing(spec, state, attester_slashing, False)