From 5e8457e62d1272e36de0f55ce3e83543258cddf1 Mon Sep 17 00:00:00 2001 From: Hsiao-Wei Wang Date: Sat, 23 May 2020 21:53:55 +0800 Subject: [PATCH] Fix phase1 on-time sign_indexed_attestation --- tests/core/pyspec/eth2spec/test/helpers/attestations.py | 5 ++++- .../block_processing/test_process_attester_slashing.py | 3 +-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/tests/core/pyspec/eth2spec/test/helpers/attestations.py b/tests/core/pyspec/eth2spec/test/helpers/attestations.py index 79f752411..4d246c8c6 100644 --- a/tests/core/pyspec/eth2spec/test/helpers/attestations.py +++ b/tests/core/pyspec/eth2spec/test/helpers/attestations.py @@ -211,7 +211,10 @@ def sign_indexed_attestation(spec, state, indexed_attestation): indexed_attestation.attestation.aggregation_bits, ) data = indexed_attestation.attestation.data - indexed_attestation.attestation.signature = sign_aggregate_attestation(spec, state, data, participants) + if any(indexed_attestation.attestation.custody_bits_blocks): + sign_on_time_attestation(spec, state, indexed_attestation.attestation) + else: + indexed_attestation.attestation.signature = sign_aggregate_attestation(spec, state, data, participants) def sign_on_time_attestation(spec, state, attestation): diff --git a/tests/core/pyspec/eth2spec/test/phase_0/block_processing/test_process_attester_slashing.py b/tests/core/pyspec/eth2spec/test/phase_0/block_processing/test_process_attester_slashing.py index 8d7638f51..11ead6033 100644 --- a/tests/core/pyspec/eth2spec/test/phase_0/block_processing/test_process_attester_slashing.py +++ b/tests/core/pyspec/eth2spec/test/phase_0/block_processing/test_process_attester_slashing.py @@ -1,6 +1,6 @@ from eth2spec.test.context import ( PHASE0, PHASE1, - spec_state_test, expect_assertion_error, always_bls, never_bls, with_all_phases, with_phases + spec_state_test, expect_assertion_error, always_bls, with_all_phases, with_phases ) from eth2spec.test.helpers.attestations import sign_indexed_attestation from eth2spec.test.helpers.attester_slashings import get_valid_attester_slashing, \ @@ -89,7 +89,6 @@ def test_success_double(spec, state): @with_all_phases @spec_state_test -@never_bls def test_success_surround(spec, state): next_epoch_via_block(spec, state)