Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Shift all fork choice tests to Altair & later #3294

Merged
merged 1 commit into from
Mar 15, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from eth2spec.test.context import (
MAINNET,
spec_state_test,
with_all_phases,
with_altair_and_later,
with_presets,
)
from eth2spec.test.helpers.attestations import (
Expand Down Expand Up @@ -31,7 +31,7 @@ def _apply_base_block_a(spec, state, store, test_steps):
assert spec.get_head(store) == signed_block_a.message.hash_tree_root()


@with_all_phases
@with_altair_and_later
@spec_state_test
def test_ex_ante_vanilla(spec, state):
"""
Expand Down Expand Up @@ -118,7 +118,7 @@ def _get_greater_than_proposer_boost_score(spec, store, state, proposer_boost_ro
return proposer_score // base_effective_balance + 1


@with_all_phases
@with_altair_and_later
@with_presets([MAINNET], reason="to create non-duplicate committee")
@spec_state_test
def test_ex_ante_attestations_is_greater_than_proposer_boost_with_boost(spec, state):
Expand Down Expand Up @@ -191,7 +191,7 @@ def _filter_participant_set(participants):
yield 'steps', test_steps


@with_all_phases
@with_altair_and_later
@spec_state_test
def test_ex_ante_sandwich_without_attestations(spec, state):
"""
Expand Down Expand Up @@ -254,7 +254,7 @@ def test_ex_ante_sandwich_without_attestations(spec, state):
yield 'steps', test_steps


@with_all_phases
@with_altair_and_later
@spec_state_test
def test_ex_ante_sandwich_with_honest_attestation(spec, state):
"""
Expand Down Expand Up @@ -335,7 +335,7 @@ def _filter_participant_set(participants):
yield 'steps', test_steps


@with_all_phases
@with_altair_and_later
@with_presets([MAINNET], reason="to create non-duplicate committee")
@spec_state_test
def test_ex_ante_sandwich_with_boost_not_sufficient(spec, state):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

from eth2spec.test.context import (
spec_state_test,
with_all_phases,
with_altair_and_later,
with_presets,
)
Expand Down Expand Up @@ -38,7 +37,7 @@
rng = random.Random(1001)


@with_all_phases
@with_altair_and_later
@spec_state_test
def test_genesis(spec, state):
test_steps = []
Expand All @@ -62,7 +61,7 @@ def test_genesis(spec, state):
yield 'description', 'meta', f"Although it's not phase 0, we may use {spec.fork} spec to start testnets."


@with_all_phases
@with_altair_and_later
@spec_state_test
def test_chain_no_attestations(spec, state):
test_steps = []
Expand Down Expand Up @@ -91,7 +90,7 @@ def test_chain_no_attestations(spec, state):
yield 'steps', test_steps


@with_all_phases
@with_altair_and_later
@spec_state_test
def test_split_tie_breaker_no_attestations(spec, state):
test_steps = []
Expand Down Expand Up @@ -130,7 +129,7 @@ def test_split_tie_breaker_no_attestations(spec, state):
yield 'steps', test_steps


@with_all_phases
@with_altair_and_later
@spec_state_test
def test_shorter_chain_but_heavier_weight(spec, state):
test_steps = []
Expand Down Expand Up @@ -170,7 +169,7 @@ def test_shorter_chain_but_heavier_weight(spec, state):
yield 'steps', test_steps


@with_all_phases
@with_altair_and_later
@spec_state_test
@with_presets([MINIMAL], reason="too slow")
def test_filtered_block_tree(spec, state):
Expand Down Expand Up @@ -247,7 +246,7 @@ def test_filtered_block_tree(spec, state):
yield 'steps', test_steps


@with_all_phases
@with_altair_and_later
@spec_state_test
def test_proposer_boost_correct_head(spec, state):
test_steps = []
Expand Down Expand Up @@ -302,7 +301,7 @@ def test_proposer_boost_correct_head(spec, state):
yield 'steps', test_steps


@with_all_phases
@with_altair_and_later
@spec_state_test
def test_discard_equivocations_on_attester_slashing(spec, state):
test_steps = []
Expand Down Expand Up @@ -374,7 +373,7 @@ def test_discard_equivocations_on_attester_slashing(spec, state):
yield 'steps', test_steps


@with_all_phases
@with_altair_and_later
@spec_state_test
@with_presets([MINIMAL], reason="too slow")
def test_discard_equivocations_slashed_validator_censoring(spec, state):
Expand Down Expand Up @@ -636,7 +635,7 @@ def test_voting_source_beyond_two_epoch(spec, state):
The block being a descendant of store.justified_checkpoint.root is necessary because
filter_block_tree descends the tree starting at store.justified_checkpoint.root

@with_all_phases
@with_altair_and_later
@spec_state_test
def test_incorrect_finalized(spec, state):
# Check that the store doesn't allow for a head block that has:
Expand Down
41 changes: 20 additions & 21 deletions tests/core/pyspec/eth2spec/test/phase0/fork_choice/test_on_block.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
from eth2spec.test.context import (
MINIMAL,
spec_state_test,
with_all_phases,
with_altair_and_later,
with_presets
)
Expand Down Expand Up @@ -47,7 +46,7 @@ def _drop_random_one_third(_slot, _index, indices):
return rng.sample(sorted(indices), participant_count)


@with_all_phases
@with_altair_and_later
@spec_state_test
def test_basic(spec, state):
test_steps = []
Expand Down Expand Up @@ -77,7 +76,7 @@ def test_basic(spec, state):
# TODO: add tests for justified_root and finalized_root


@with_all_phases
@with_altair_and_later
@spec_state_test
@with_presets([MINIMAL], reason="too slow")
def test_on_block_checkpoints(spec, state):
Expand Down Expand Up @@ -114,7 +113,7 @@ def test_on_block_checkpoints(spec, state):
yield 'steps', test_steps


@with_all_phases
@with_altair_and_later
@spec_state_test
def test_on_block_future_block(spec, state):
test_steps = []
Expand All @@ -135,7 +134,7 @@ def test_on_block_future_block(spec, state):
yield 'steps', test_steps


@with_all_phases
@with_altair_and_later
@spec_state_test
def test_on_block_bad_parent_root(spec, state):
test_steps = []
Expand All @@ -161,7 +160,7 @@ def test_on_block_bad_parent_root(spec, state):
yield 'steps', test_steps


@with_all_phases
@with_altair_and_later
@spec_state_test
@with_presets([MINIMAL], reason="too slow")
def test_on_block_before_finalized(spec, state):
Expand Down Expand Up @@ -193,7 +192,7 @@ def test_on_block_before_finalized(spec, state):
yield 'steps', test_steps


@with_all_phases
@with_altair_and_later
@spec_state_test
@with_presets([MINIMAL], reason="too slow")
def test_on_block_finalized_skip_slots(spec, state):
Expand Down Expand Up @@ -240,7 +239,7 @@ def test_on_block_finalized_skip_slots(spec, state):
yield 'steps', test_steps


@with_all_phases
@with_altair_and_later
@spec_state_test
@with_presets([MINIMAL], reason="too slow")
def test_on_block_finalized_skip_slots_not_in_skip_chain(spec, state):
Expand Down Expand Up @@ -287,7 +286,7 @@ def test_on_block_finalized_skip_slots_not_in_skip_chain(spec, state):


"""
@with_all_phases
@with_altair_and_later
@spec_state_test
@with_presets([MINIMAL], reason="too slow")
def test_new_finalized_slot_is_not_justified_checkpoint_ancestor(spec, state):
Expand Down Expand Up @@ -369,7 +368,7 @@ def test_new_finalized_slot_is_not_justified_checkpoint_ancestor(spec, state):
"""


@with_all_phases
@with_altair_and_later
@spec_state_test
@with_presets([MINIMAL], reason="too slow")
def test_new_finalized_slot_is_justified_checkpoint_ancestor(spec, state):
Expand Down Expand Up @@ -441,7 +440,7 @@ def test_new_finalized_slot_is_justified_checkpoint_ancestor(spec, state):
yield 'steps', test_steps


@with_all_phases
@with_altair_and_later
@spec_state_test
def test_proposer_boost(spec, state):
test_steps = []
Expand Down Expand Up @@ -500,7 +499,7 @@ def test_proposer_boost(spec, state):
yield 'steps', test_steps


@with_all_phases
@with_altair_and_later
@spec_state_test
def test_proposer_boost_root_same_slot_untimely_block(spec, state):
test_steps = []
Expand Down Expand Up @@ -534,7 +533,7 @@ def test_proposer_boost_root_same_slot_untimely_block(spec, state):
yield 'steps', test_steps


@with_all_phases
@with_altair_and_later
@spec_state_test
@with_presets([MINIMAL], reason="too slow")
def test_justification_withholding(spec, state):
Expand Down Expand Up @@ -616,7 +615,7 @@ def test_justification_withholding(spec, state):
yield 'steps', test_steps


@with_all_phases
@with_altair_and_later
@spec_state_test
@with_presets([MINIMAL], reason="too slow")
def test_justification_withholding_reverse_order(spec, state):
Expand Down Expand Up @@ -693,7 +692,7 @@ def test_justification_withholding_reverse_order(spec, state):
yield 'steps', test_steps


@with_all_phases
@with_altair_and_later
@spec_state_test
@with_presets([MINIMAL], reason="too slow")
def test_justification_update_beginning_of_epoch(spec, state):
Expand Down Expand Up @@ -742,7 +741,7 @@ def test_justification_update_beginning_of_epoch(spec, state):
yield 'steps', test_steps


@with_all_phases
@with_altair_and_later
@spec_state_test
@with_presets([MINIMAL], reason="too slow")
def test_justification_update_end_of_epoch(spec, state):
Expand Down Expand Up @@ -792,7 +791,7 @@ def test_justification_update_end_of_epoch(spec, state):
yield 'steps', test_steps


@with_all_phases
@with_altair_and_later
@spec_state_test
@with_presets([MINIMAL], reason="too slow")
def test_incompatible_justification_update_start_of_epoch(spec, state):
Expand Down Expand Up @@ -868,7 +867,7 @@ def test_incompatible_justification_update_start_of_epoch(spec, state):
yield 'steps', test_steps


@with_all_phases
@with_altair_and_later
@spec_state_test
@with_presets([MINIMAL], reason="too slow")
def test_incompatible_justification_update_end_of_epoch(spec, state):
Expand Down Expand Up @@ -945,7 +944,7 @@ def test_incompatible_justification_update_end_of_epoch(spec, state):
yield 'steps', test_steps


@with_all_phases
@with_altair_and_later
@spec_state_test
@with_presets([MINIMAL], reason="too slow")
def test_justified_update_not_realized_finality(spec, state):
Expand Down Expand Up @@ -1018,7 +1017,7 @@ def test_justified_update_not_realized_finality(spec, state):
yield 'steps', test_steps


@with_all_phases
@with_altair_and_later
@spec_state_test
@with_presets([MINIMAL], reason="too slow")
def test_justified_update_monotonic(spec, state):
Expand Down Expand Up @@ -1097,7 +1096,7 @@ def test_justified_update_monotonic(spec, state):
yield 'steps', test_steps


@with_all_phases
@with_altair_and_later
@spec_state_test
@with_presets([MINIMAL], reason="too slow")
def test_justified_update_always_if_better(spec, state):
Expand Down
Loading