Merge pull request #2437 from ralexstokes/clean-up-attestation-helper
Clean up outdated attestation helper
This commit is contained in:
commit
f753ca3f9d
|
@ -7,8 +7,7 @@ from eth2spec.test.helpers.constants import CUSTODY_GAME
|
|||
from eth2spec.test.helpers.state import transition_to
|
||||
from eth2spec.test.helpers.attestations import (
|
||||
run_attestation_processing,
|
||||
get_valid_late_attestation,
|
||||
get_valid_on_time_attestation,
|
||||
get_valid_attestation,
|
||||
)
|
||||
|
||||
|
||||
|
@ -16,7 +15,7 @@ from eth2spec.test.helpers.attestations import (
|
|||
@spec_state_test
|
||||
@always_bls
|
||||
def test_on_time_success(spec, state):
|
||||
attestation = get_valid_on_time_attestation(spec, state, signed=True)
|
||||
attestation = get_valid_attestation(spec, state, signed=True)
|
||||
|
||||
transition_to(spec, state, state.slot + spec.MIN_ATTESTATION_INCLUSION_DELAY)
|
||||
|
||||
|
@ -27,7 +26,7 @@ def test_on_time_success(spec, state):
|
|||
@spec_state_test
|
||||
@always_bls
|
||||
def test_late_success(spec, state):
|
||||
attestation = get_valid_late_attestation(spec, state, signed=True)
|
||||
attestation = get_valid_attestation(spec, state, signed=True)
|
||||
|
||||
transition_to(spec, state, state.slot + spec.MIN_ATTESTATION_INCLUSION_DELAY + 1)
|
||||
|
||||
|
|
|
@ -4,7 +4,7 @@ from eth2spec.test.helpers.custody import (
|
|||
get_sample_shard_transition,
|
||||
)
|
||||
from eth2spec.test.helpers.attestations import (
|
||||
get_valid_on_time_attestation,
|
||||
get_valid_attestation,
|
||||
)
|
||||
from eth2spec.test.helpers.constants import (
|
||||
CUSTODY_GAME,
|
||||
|
@ -80,7 +80,7 @@ def test_challenge_appended(spec, state):
|
|||
shard = 0
|
||||
offset_slots = spec.get_offset_slots(state, shard)
|
||||
shard_transition = get_sample_shard_transition(spec, state.slot, [2**15 // 3] * len(offset_slots))
|
||||
attestation = get_valid_on_time_attestation(spec, state, index=shard, signed=True,
|
||||
attestation = get_valid_attestation(spec, state, index=shard, signed=True,
|
||||
shard_transition=shard_transition)
|
||||
|
||||
transition_to(spec, state, state.slot + spec.MIN_ATTESTATION_INCLUSION_DELAY)
|
||||
|
@ -104,7 +104,7 @@ def test_challenge_empty_element_replaced(spec, state):
|
|||
shard = 0
|
||||
offset_slots = spec.get_offset_slots(state, shard)
|
||||
shard_transition = get_sample_shard_transition(spec, state.slot, [2**15 // 3] * len(offset_slots))
|
||||
attestation = get_valid_on_time_attestation(spec, state, index=shard, signed=True,
|
||||
attestation = get_valid_attestation(spec, state, index=shard, signed=True,
|
||||
shard_transition=shard_transition)
|
||||
|
||||
transition_to(spec, state, state.slot + spec.MIN_ATTESTATION_INCLUSION_DELAY)
|
||||
|
@ -130,7 +130,7 @@ def test_duplicate_challenge(spec, state):
|
|||
shard = 0
|
||||
offset_slots = spec.get_offset_slots(state, shard)
|
||||
shard_transition = get_sample_shard_transition(spec, state.slot, [2**15 // 3] * len(offset_slots))
|
||||
attestation = get_valid_on_time_attestation(spec, state, index=shard, signed=True,
|
||||
attestation = get_valid_attestation(spec, state, index=shard, signed=True,
|
||||
shard_transition=shard_transition)
|
||||
|
||||
transition_to(spec, state, state.slot + spec.MIN_ATTESTATION_INCLUSION_DELAY)
|
||||
|
@ -156,7 +156,7 @@ def test_second_challenge(spec, state):
|
|||
shard = 0
|
||||
offset_slots = spec.get_offset_slots(state, shard)
|
||||
shard_transition = get_sample_shard_transition(spec, state.slot, [2**15 // 3] * len(offset_slots))
|
||||
attestation = get_valid_on_time_attestation(spec, state, index=shard, signed=True,
|
||||
attestation = get_valid_attestation(spec, state, index=shard, signed=True,
|
||||
shard_transition=shard_transition)
|
||||
|
||||
transition_to(spec, state, state.slot + spec.MIN_ATTESTATION_INCLUSION_DELAY)
|
||||
|
@ -185,7 +185,7 @@ def test_multiple_epochs_custody(spec, state):
|
|||
shard = 0
|
||||
offset_slots = spec.get_offset_slots(state, shard)
|
||||
shard_transition = get_sample_shard_transition(spec, state.slot, [2**15 // 3] * len(offset_slots))
|
||||
attestation = get_valid_on_time_attestation(spec, state, index=shard, signed=True,
|
||||
attestation = get_valid_attestation(spec, state, index=shard, signed=True,
|
||||
shard_transition=shard_transition)
|
||||
|
||||
transition_to(spec, state, state.slot + spec.MIN_ATTESTATION_INCLUSION_DELAY)
|
||||
|
@ -210,7 +210,7 @@ def test_many_epochs_custody(spec, state):
|
|||
shard = 0
|
||||
offset_slots = spec.get_offset_slots(state, shard)
|
||||
shard_transition = get_sample_shard_transition(spec, state.slot, [2**15 // 3] * len(offset_slots))
|
||||
attestation = get_valid_on_time_attestation(spec, state, index=shard, signed=True,
|
||||
attestation = get_valid_attestation(spec, state, index=shard, signed=True,
|
||||
shard_transition=shard_transition)
|
||||
|
||||
transition_to(spec, state, state.slot + spec.MIN_ATTESTATION_INCLUSION_DELAY)
|
||||
|
@ -235,7 +235,7 @@ def test_off_chain_attestation(spec, state):
|
|||
shard = 0
|
||||
offset_slots = spec.get_offset_slots(state, shard)
|
||||
shard_transition = get_sample_shard_transition(spec, state.slot, [2**15 // 3] * len(offset_slots))
|
||||
attestation = get_valid_on_time_attestation(spec, state, index=shard, signed=True,
|
||||
attestation = get_valid_attestation(spec, state, index=shard, signed=True,
|
||||
shard_transition=shard_transition)
|
||||
|
||||
transition_to(spec, state, state.slot + spec.SLOTS_PER_EPOCH * (spec.EPOCHS_PER_CUSTODY_PERIOD - 1))
|
||||
|
@ -256,7 +256,7 @@ def test_custody_response(spec, state):
|
|||
shard = 0
|
||||
offset_slots = spec.get_offset_slots(state, shard)
|
||||
shard_transition = get_sample_shard_transition(spec, state.slot, [2**15 // 3] * len(offset_slots))
|
||||
attestation = get_valid_on_time_attestation(spec, state, index=shard, signed=True,
|
||||
attestation = get_valid_attestation(spec, state, index=shard, signed=True,
|
||||
shard_transition=shard_transition)
|
||||
|
||||
transition_to(spec, state, state.slot + spec.MIN_ATTESTATION_INCLUSION_DELAY)
|
||||
|
@ -287,7 +287,7 @@ def test_custody_response_chunk_index_2(spec, state):
|
|||
shard = 0
|
||||
offset_slots = spec.get_offset_slots(state, shard)
|
||||
shard_transition = get_sample_shard_transition(spec, state.slot, [2**15 // 3] * len(offset_slots))
|
||||
attestation = get_valid_on_time_attestation(spec, state, index=shard, signed=True,
|
||||
attestation = get_valid_attestation(spec, state, index=shard, signed=True,
|
||||
shard_transition=shard_transition)
|
||||
|
||||
transition_to(spec, state, state.slot + spec.MIN_ATTESTATION_INCLUSION_DELAY)
|
||||
|
@ -319,7 +319,7 @@ def test_custody_response_multiple_epochs(spec, state):
|
|||
shard = 0
|
||||
offset_slots = spec.get_offset_slots(state, shard)
|
||||
shard_transition = get_sample_shard_transition(spec, state.slot, [2**15 // 3] * len(offset_slots))
|
||||
attestation = get_valid_on_time_attestation(spec, state, index=shard, signed=True,
|
||||
attestation = get_valid_attestation(spec, state, index=shard, signed=True,
|
||||
shard_transition=shard_transition)
|
||||
|
||||
transition_to(spec, state, state.slot + spec.MIN_ATTESTATION_INCLUSION_DELAY)
|
||||
|
@ -351,7 +351,7 @@ def test_custody_response_many_epochs(spec, state):
|
|||
shard = 0
|
||||
offset_slots = spec.get_offset_slots(state, shard)
|
||||
shard_transition = get_sample_shard_transition(spec, state.slot, [2**15 // 3] * len(offset_slots))
|
||||
attestation = get_valid_on_time_attestation(spec, state, index=shard, signed=True,
|
||||
attestation = get_valid_attestation(spec, state, index=shard, signed=True,
|
||||
shard_transition=shard_transition)
|
||||
|
||||
transition_to(spec, state, state.slot + spec.MIN_ATTESTATION_INCLUSION_DELAY)
|
||||
|
|
|
@ -3,7 +3,7 @@ from eth2spec.test.helpers.custody import (
|
|||
get_custody_slashable_shard_transition,
|
||||
)
|
||||
from eth2spec.test.helpers.attestations import (
|
||||
get_valid_on_time_attestation,
|
||||
get_valid_attestation,
|
||||
)
|
||||
from eth2spec.test.helpers.constants import (
|
||||
CUSTODY_GAME,
|
||||
|
@ -96,7 +96,7 @@ def run_standard_custody_slashing_test(spec,
|
|||
slashable=correct,
|
||||
)
|
||||
|
||||
attestation = get_valid_on_time_attestation(spec, state, index=shard, signed=True,
|
||||
attestation = get_valid_attestation(spec, state, index=shard, signed=True,
|
||||
shard_transition=shard_transition)
|
||||
|
||||
transition_to(spec, state, state.slot + spec.MIN_ATTESTATION_INCLUSION_DELAY)
|
||||
|
|
|
@ -3,7 +3,7 @@ from eth2spec.test.helpers.custody import (
|
|||
get_sample_shard_transition,
|
||||
)
|
||||
from eth2spec.test.helpers.attestations import (
|
||||
get_valid_on_time_attestation,
|
||||
get_valid_attestation,
|
||||
)
|
||||
from eth2spec.test.helpers.state import transition_to, transition_to_valid_shard_slot
|
||||
from eth2spec.test.context import (
|
||||
|
@ -36,7 +36,7 @@ def test_validator_slashed_after_chunk_challenge(spec, state):
|
|||
shard = 0
|
||||
offset_slots = spec.get_offset_slots(state, shard)
|
||||
shard_transition = get_sample_shard_transition(spec, state.slot, [2**15 // 3] * len(offset_slots))
|
||||
attestation = get_valid_on_time_attestation(spec, state, index=shard, signed=True,
|
||||
attestation = get_valid_attestation(spec, state, index=shard, signed=True,
|
||||
shard_transition=shard_transition)
|
||||
|
||||
transition_to(spec, state, state.slot + spec.MIN_ATTESTATION_INCLUSION_DELAY)
|
||||
|
|
|
@ -8,7 +8,7 @@ from eth2spec.test.helpers.custody import (
|
|||
get_sample_shard_transition
|
||||
)
|
||||
from eth2spec.test.helpers.attestations import (
|
||||
get_valid_on_time_attestation,
|
||||
get_valid_attestation,
|
||||
)
|
||||
from eth2spec.test.helpers.state import next_epoch_via_block, transition_to, transition_to_valid_shard_slot
|
||||
from eth2spec.test.context import (
|
||||
|
@ -77,7 +77,7 @@ def test_validator_withdrawal_suspend_after_chunk_challenge(spec, state):
|
|||
shard = 0
|
||||
offset_slots = spec.get_offset_slots(state, shard)
|
||||
shard_transition = get_sample_shard_transition(spec, state.slot, [2**15 // 3] * len(offset_slots))
|
||||
attestation = get_valid_on_time_attestation(spec, state, index=shard, signed=True,
|
||||
attestation = get_valid_attestation(spec, state, index=shard, signed=True,
|
||||
shard_transition=shard_transition)
|
||||
|
||||
transition_to(spec, state, state.slot + spec.MIN_ATTESTATION_INCLUSION_DELAY)
|
||||
|
@ -126,7 +126,7 @@ def test_validator_withdrawal_resume_after_chunk_challenge_response(spec, state)
|
|||
shard = 0
|
||||
offset_slots = spec.get_offset_slots(state, shard)
|
||||
shard_transition = get_sample_shard_transition(spec, state.slot, [2**15 // 3] * len(offset_slots))
|
||||
attestation = get_valid_on_time_attestation(spec, state, index=shard, signed=True,
|
||||
attestation = get_valid_attestation(spec, state, index=shard, signed=True,
|
||||
shard_transition=shard_transition)
|
||||
|
||||
transition_to(spec, state, state.slot + spec.MIN_ATTESTATION_INCLUSION_DELAY)
|
||||
|
|
|
@ -5,7 +5,7 @@ from eth2spec.test.context import (
|
|||
spec_state_test,
|
||||
with_presets,
|
||||
)
|
||||
from eth2spec.test.helpers.attestations import get_valid_on_time_attestation
|
||||
from eth2spec.test.helpers.attestations import get_valid_attestation
|
||||
from eth2spec.test.helpers.block import build_empty_block
|
||||
from eth2spec.test.helpers.constants import (
|
||||
CUSTODY_GAME,
|
||||
|
@ -60,7 +60,7 @@ def test_with_shard_transition_with_custody_challenge_and_response(spec, state):
|
|||
shard_block = build_shard_block(spec, state, shard, body=body, slot=state.slot, signed=True)
|
||||
shard_block_dict: Dict[spec.Shard, Sequence[spec.SignedShardBlock]] = {shard: [shard_block]}
|
||||
shard_transitions = get_shard_transitions(spec, state, shard_block_dict)
|
||||
attestation = get_valid_on_time_attestation(
|
||||
attestation = get_valid_attestation(
|
||||
spec, state, index=committee_index,
|
||||
shard_transition=shard_transitions[shard], signed=True,
|
||||
)
|
||||
|
@ -127,7 +127,7 @@ def test_custody_slashing(spec, state):
|
|||
shard_block_dict: Dict[spec.Shard, Sequence[spec.SignedShardBlock]] = {shard: [shard_block]}
|
||||
shard_transitions = get_shard_transitions(spec, state, shard_block_dict)
|
||||
|
||||
attestation = get_valid_on_time_attestation(
|
||||
attestation = get_valid_attestation(
|
||||
spec, state, index=committee_index,
|
||||
shard_transition=shard_transitions[shard], signed=True,
|
||||
)
|
||||
|
|
|
@ -50,7 +50,7 @@ def run_attestation_processing(spec, state, attestation, valid=True):
|
|||
yield 'post', state
|
||||
|
||||
|
||||
def build_attestation_data(spec, state, slot, index, shard=None, on_time=True):
|
||||
def build_attestation_data(spec, state, slot, index, shard=None):
|
||||
assert state.slot >= slot
|
||||
|
||||
if slot == state.slot:
|
||||
|
@ -85,45 +85,12 @@ def build_attestation_data(spec, state, slot, index, shard=None, on_time=True):
|
|||
return data
|
||||
|
||||
|
||||
def get_valid_on_time_attestation(spec, state, slot=None, index=None, signed=False):
|
||||
'''
|
||||
Construct on-time attestation for next slot
|
||||
'''
|
||||
if slot is None:
|
||||
slot = state.slot
|
||||
if index is None:
|
||||
index = 0
|
||||
|
||||
return get_valid_attestation(
|
||||
spec,
|
||||
state,
|
||||
slot=slot,
|
||||
index=index,
|
||||
signed=signed,
|
||||
on_time=True,
|
||||
)
|
||||
|
||||
|
||||
def get_valid_late_attestation(spec, state, slot=None, index=None, signed=False):
|
||||
'''
|
||||
Construct on-time attestation for next slot
|
||||
'''
|
||||
if slot is None:
|
||||
slot = state.slot
|
||||
if index is None:
|
||||
index = 0
|
||||
|
||||
return get_valid_attestation(spec, state, slot=slot, index=index,
|
||||
signed=signed, on_time=False)
|
||||
|
||||
|
||||
def get_valid_attestation(spec,
|
||||
state,
|
||||
slot=None,
|
||||
index=None,
|
||||
filter_participant_set=None,
|
||||
signed=False,
|
||||
on_time=True):
|
||||
signed=False):
|
||||
# If filter_participant_set filters everything, the attestation has 0 participants, and cannot be signed.
|
||||
# Thus strictly speaking invalid when no participant is added later.
|
||||
if slot is None:
|
||||
|
@ -132,7 +99,7 @@ def get_valid_attestation(spec,
|
|||
index = 0
|
||||
|
||||
attestation_data = build_attestation_data(
|
||||
spec, state, slot=slot, index=index, on_time=on_time
|
||||
spec, state, slot=slot, index=index
|
||||
)
|
||||
|
||||
beacon_committee = spec.get_beacon_committee(
|
||||
|
@ -219,7 +186,7 @@ def add_attestations_to_state(spec, state, attestations, slot):
|
|||
spec.process_attestation(state, attestation)
|
||||
|
||||
|
||||
def _get_valid_attestation_at_slot(state, spec, slot_to_attest, participation_fn=None, on_time=True):
|
||||
def _get_valid_attestation_at_slot(state, spec, slot_to_attest, participation_fn=None):
|
||||
committees_per_slot = spec.get_committee_count_per_slot(state, spec.compute_epoch_at_slot(slot_to_attest))
|
||||
for index in range(committees_per_slot):
|
||||
def participants_filter(comm):
|
||||
|
@ -234,7 +201,6 @@ def _get_valid_attestation_at_slot(state, spec, slot_to_attest, participation_fn
|
|||
slot_to_attest,
|
||||
index=index,
|
||||
signed=True,
|
||||
on_time=on_time,
|
||||
filter_participant_set=participants_filter
|
||||
)
|
||||
|
||||
|
@ -269,7 +235,6 @@ def next_slots_with_attestations(spec,
|
|||
post_state,
|
||||
spec,
|
||||
slot_to_attest,
|
||||
on_time=False,
|
||||
participation_fn=participation_fn
|
||||
)
|
||||
for attestation in attestations:
|
||||
|
|
|
@ -45,7 +45,7 @@ def test_success_multi_proposer_index_iterations(spec, state):
|
|||
@with_all_phases
|
||||
@spec_state_test
|
||||
def test_success_previous_epoch(spec, state):
|
||||
attestation = get_valid_attestation(spec, state, signed=True, on_time=False)
|
||||
attestation = get_valid_attestation(spec, state, signed=True)
|
||||
next_epoch_via_block(spec, state)
|
||||
|
||||
yield from run_attestation_processing(spec, state, attestation)
|
||||
|
@ -96,7 +96,7 @@ def test_before_inclusion_delay(spec, state):
|
|||
@with_all_phases
|
||||
@spec_state_test
|
||||
def test_after_epoch_slots(spec, state):
|
||||
attestation = get_valid_attestation(spec, state, signed=True, on_time=False)
|
||||
attestation = get_valid_attestation(spec, state, signed=True)
|
||||
|
||||
# increment past latest inclusion slot
|
||||
transition_to_slot_via_block(spec, state, state.slot + spec.SLOTS_PER_EPOCH + 1)
|
||||
|
@ -197,7 +197,7 @@ def test_mismatched_target_and_slot(spec, state):
|
|||
next_epoch_via_block(spec, state)
|
||||
next_epoch_via_block(spec, state)
|
||||
|
||||
attestation = get_valid_attestation(spec, state, on_time=False)
|
||||
attestation = get_valid_attestation(spec, state)
|
||||
attestation.data.slot = attestation.data.slot - spec.SLOTS_PER_EPOCH
|
||||
|
||||
sign_attestation(spec, state, attestation)
|
||||
|
@ -210,7 +210,7 @@ def test_mismatched_target_and_slot(spec, state):
|
|||
def test_old_target_epoch(spec, state):
|
||||
assert spec.MIN_ATTESTATION_INCLUSION_DELAY < spec.SLOTS_PER_EPOCH * 2
|
||||
|
||||
attestation = get_valid_attestation(spec, state, signed=True, on_time=False)
|
||||
attestation = get_valid_attestation(spec, state, signed=True)
|
||||
|
||||
next_slots(spec, state, spec.SLOTS_PER_EPOCH * 2) # target epoch will be too old to handle
|
||||
|
||||
|
@ -275,7 +275,7 @@ def test_invalid_current_source_root(spec, state):
|
|||
state.previous_justified_checkpoint = spec.Checkpoint(epoch=3, root=b'\x01' * 32)
|
||||
state.current_justified_checkpoint = spec.Checkpoint(epoch=4, root=b'\x32' * 32)
|
||||
|
||||
attestation = get_valid_attestation(spec, state, slot=(spec.SLOTS_PER_EPOCH * 3) + 1, on_time=False)
|
||||
attestation = get_valid_attestation(spec, state, slot=(spec.SLOTS_PER_EPOCH * 3) + 1)
|
||||
next_slots(spec, state, spec.MIN_ATTESTATION_INCLUSION_DELAY)
|
||||
|
||||
# Test logic sanity checks:
|
||||
|
@ -348,7 +348,7 @@ def test_correct_min_inclusion_delay(spec, state):
|
|||
@with_all_phases
|
||||
@spec_state_test
|
||||
def test_correct_sqrt_epoch_delay(spec, state):
|
||||
attestation = get_valid_attestation(spec, state, signed=True, on_time=False)
|
||||
attestation = get_valid_attestation(spec, state, signed=True)
|
||||
next_slots(spec, state, spec.integer_squareroot(spec.SLOTS_PER_EPOCH))
|
||||
|
||||
yield from run_attestation_processing(spec, state, attestation)
|
||||
|
@ -357,7 +357,7 @@ def test_correct_sqrt_epoch_delay(spec, state):
|
|||
@with_all_phases
|
||||
@spec_state_test
|
||||
def test_correct_epoch_delay(spec, state):
|
||||
attestation = get_valid_attestation(spec, state, signed=True, on_time=False)
|
||||
attestation = get_valid_attestation(spec, state, signed=True)
|
||||
next_slots(spec, state, spec.SLOTS_PER_EPOCH)
|
||||
|
||||
yield from run_attestation_processing(spec, state, attestation)
|
||||
|
@ -366,7 +366,7 @@ def test_correct_epoch_delay(spec, state):
|
|||
@with_all_phases
|
||||
@spec_state_test
|
||||
def test_correct_after_epoch_delay(spec, state):
|
||||
attestation = get_valid_attestation(spec, state, signed=True, on_time=False)
|
||||
attestation = get_valid_attestation(spec, state, signed=True)
|
||||
|
||||
# increment past latest inclusion slot
|
||||
next_slots(spec, state, spec.SLOTS_PER_EPOCH + 1)
|
||||
|
@ -393,7 +393,7 @@ def test_incorrect_head_min_inclusion_delay(spec, state):
|
|||
@with_all_phases
|
||||
@spec_state_test
|
||||
def test_incorrect_head_sqrt_epoch_delay(spec, state):
|
||||
attestation = get_valid_attestation(spec, state, signed=False, on_time=False)
|
||||
attestation = get_valid_attestation(spec, state, signed=False)
|
||||
next_slots(spec, state, spec.integer_squareroot(spec.SLOTS_PER_EPOCH))
|
||||
|
||||
attestation.data.beacon_block_root = b'\x42' * 32
|
||||
|
@ -405,7 +405,7 @@ def test_incorrect_head_sqrt_epoch_delay(spec, state):
|
|||
@with_all_phases
|
||||
@spec_state_test
|
||||
def test_incorrect_head_epoch_delay(spec, state):
|
||||
attestation = get_valid_attestation(spec, state, signed=False, on_time=False)
|
||||
attestation = get_valid_attestation(spec, state, signed=False)
|
||||
next_slots(spec, state, spec.SLOTS_PER_EPOCH)
|
||||
|
||||
attestation.data.beacon_block_root = b'\x42' * 32
|
||||
|
@ -417,7 +417,7 @@ def test_incorrect_head_epoch_delay(spec, state):
|
|||
@with_all_phases
|
||||
@spec_state_test
|
||||
def test_incorrect_head_after_epoch_delay(spec, state):
|
||||
attestation = get_valid_attestation(spec, state, signed=False, on_time=False)
|
||||
attestation = get_valid_attestation(spec, state, signed=False)
|
||||
|
||||
# increment past latest inclusion slot
|
||||
next_slots(spec, state, spec.SLOTS_PER_EPOCH + 1)
|
||||
|
@ -448,7 +448,7 @@ def test_incorrect_head_and_target_min_inclusion_delay(spec, state):
|
|||
@with_all_phases
|
||||
@spec_state_test
|
||||
def test_incorrect_head_and_target_sqrt_epoch_delay(spec, state):
|
||||
attestation = get_valid_attestation(spec, state, signed=False, on_time=False)
|
||||
attestation = get_valid_attestation(spec, state, signed=False)
|
||||
next_slots(spec, state, spec.integer_squareroot(spec.SLOTS_PER_EPOCH))
|
||||
|
||||
attestation.data.beacon_block_root = b'\x42' * 32
|
||||
|
@ -461,7 +461,7 @@ def test_incorrect_head_and_target_sqrt_epoch_delay(spec, state):
|
|||
@with_all_phases
|
||||
@spec_state_test
|
||||
def test_incorrect_head_and_target_epoch_delay(spec, state):
|
||||
attestation = get_valid_attestation(spec, state, signed=False, on_time=False)
|
||||
attestation = get_valid_attestation(spec, state, signed=False)
|
||||
next_slots(spec, state, spec.SLOTS_PER_EPOCH)
|
||||
|
||||
attestation.data.beacon_block_root = b'\x42' * 32
|
||||
|
@ -474,7 +474,7 @@ def test_incorrect_head_and_target_epoch_delay(spec, state):
|
|||
@with_all_phases
|
||||
@spec_state_test
|
||||
def test_incorrect_head_and_target_after_epoch_delay(spec, state):
|
||||
attestation = get_valid_attestation(spec, state, signed=False, on_time=False)
|
||||
attestation = get_valid_attestation(spec, state, signed=False)
|
||||
# increment past latest inclusion slot
|
||||
next_slots(spec, state, spec.SLOTS_PER_EPOCH + 1)
|
||||
|
||||
|
@ -504,7 +504,7 @@ def test_incorrect_target_min_inclusion_delay(spec, state):
|
|||
@with_all_phases
|
||||
@spec_state_test
|
||||
def test_incorrect_target_sqrt_epoch_delay(spec, state):
|
||||
attestation = get_valid_attestation(spec, state, signed=False, on_time=False)
|
||||
attestation = get_valid_attestation(spec, state, signed=False)
|
||||
next_slots(spec, state, spec.integer_squareroot(spec.SLOTS_PER_EPOCH))
|
||||
|
||||
attestation.data.target.root = b'\x42' * 32
|
||||
|
@ -516,7 +516,7 @@ def test_incorrect_target_sqrt_epoch_delay(spec, state):
|
|||
@with_all_phases
|
||||
@spec_state_test
|
||||
def test_incorrect_target_epoch_delay(spec, state):
|
||||
attestation = get_valid_attestation(spec, state, signed=False, on_time=False)
|
||||
attestation = get_valid_attestation(spec, state, signed=False)
|
||||
next_slots(spec, state, spec.SLOTS_PER_EPOCH)
|
||||
|
||||
attestation.data.target.root = b'\x42' * 32
|
||||
|
@ -528,7 +528,7 @@ def test_incorrect_target_epoch_delay(spec, state):
|
|||
@with_all_phases
|
||||
@spec_state_test
|
||||
def test_incorrect_target_after_epoch_delay(spec, state):
|
||||
attestation = get_valid_attestation(spec, state, signed=False, on_time=False)
|
||||
attestation = get_valid_attestation(spec, state, signed=False)
|
||||
# increment past latest inclusion slot
|
||||
next_slots(spec, state, spec.SLOTS_PER_EPOCH + 1)
|
||||
|
||||
|
|
|
@ -771,7 +771,7 @@ def test_attestation(spec, state):
|
|||
# if spec.fork == SHARDING:
|
||||
# TODO add shard data to block to vote on
|
||||
|
||||
attestation = get_valid_attestation(spec, state, index=index, signed=True, on_time=True)
|
||||
attestation = get_valid_attestation(spec, state, index=index, signed=True)
|
||||
|
||||
if not is_post_altair(spec):
|
||||
pre_current_attestations_len = len(state.current_epoch_attestations)
|
||||
|
|
Loading…
Reference in New Issue