fix mainnet attestation test

This commit is contained in:
Danny Ryan 2019-06-30 13:52:35 -05:00
parent ed182e5e9d
commit 4aa676bae7
No known key found for this signature in database
GPG Key ID: 2765A792E42CE07A
1 changed files with 11 additions and 9 deletions

View File

@ -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.context import spec_state_test, expect_assertion_error, always_bls, with_all_phases, with_phases
from eth2spec.test.helpers.attestations import ( from eth2spec.test.helpers.attestations import (
get_valid_attestation, get_valid_attestation,
sign_aggregate_attestation,
sign_attestation, sign_attestation,
) )
from eth2spec.test.helpers.state import ( from eth2spec.test.helpers.state import (
@ -207,20 +208,21 @@ def test_old_target_epoch(spec, state):
@with_all_phases @with_all_phases
@spec_state_test @spec_state_test
def test_future_target_epoch(spec, state): 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 assert spec.MIN_ATTESTATION_INCLUSION_DELAY < spec.SLOTS_PER_EPOCH * 2
attestation = get_valid_attestation(spec, state) 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 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) yield from run_attestation_processing(spec, state, attestation, False)