From 4aa676bae7ed01a6deaf34d5ad1f6d8484a3bbb0 Mon Sep 17 00:00:00 2001 From: Danny Ryan Date: Sun, 30 Jun 2019 13:52:35 -0500 Subject: [PATCH] fix mainnet attestation test --- .../test_process_attestation.py | 20 ++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/test_libs/pyspec/eth2spec/test/phase_0/block_processing/test_process_attestation.py b/test_libs/pyspec/eth2spec/test/phase_0/block_processing/test_process_attestation.py index 761fed633..ab46a0d8c 100644 --- a/test_libs/pyspec/eth2spec/test/phase_0/block_processing/test_process_attestation.py +++ b/test_libs/pyspec/eth2spec/test/phase_0/block_processing/test_process_attestation.py @@ -1,6 +1,7 @@ from eth2spec.test.context import spec_state_test, expect_assertion_error, always_bls, with_all_phases, with_phases from eth2spec.test.helpers.attestations import ( get_valid_attestation, + sign_aggregate_attestation, sign_attestation, ) from eth2spec.test.helpers.state import ( @@ -207,20 +208,21 @@ def test_old_target_epoch(spec, state): @with_all_phases @spec_state_test def test_future_target_epoch(spec, state): - # TODO: fails in mainnet, - # something with committee indices resulting in out of range validator indices (we only have 512 test validators). - # Disabled in mainnet for now. - if spec.SHARD_COUNT > 8: - return - assert spec.MIN_ATTESTATION_INCLUSION_DELAY < spec.SLOTS_PER_EPOCH * 2 attestation = get_valid_attestation(spec, state) - state.slot += spec.MIN_ATTESTATION_INCLUSION_DELAY - + participants = spec.get_attesting_indices( + state, + attestation.data, + attestation.aggregation_bits + ) attestation.data.target.epoch = spec.get_current_epoch(state) + 1 # target epoch will be too new to handle - sign_attestation(spec, state, attestation) + + # manually add signature for correct participants + attestation.signature = sign_aggregate_attestation(spec, state, attestation.data, participants) + + state.slot += spec.MIN_ATTESTATION_INCLUSION_DELAY yield from run_attestation_processing(spec, state, attestation, False)