`ALL_FORKS` sounds like a list of fork names. Rename it to `ALL_FORK_UPGRADES`
This commit is contained in:
parent
fa4dc0c168
commit
0641d1c184
|
@ -5,7 +5,7 @@ from eth2spec.test.context import (
|
|||
with_fork_metas,
|
||||
)
|
||||
from eth2spec.test.helpers.constants import (
|
||||
ALL_FORKS,
|
||||
ALL_PRE_POST_FORKS,
|
||||
MINIMAL,
|
||||
)
|
||||
from eth2spec.test.helpers.fork_transition import (
|
||||
|
@ -24,7 +24,7 @@ from eth2spec.test.helpers.random import (
|
|||
# Exit
|
||||
#
|
||||
|
||||
@with_fork_metas([ForkMeta(pre_fork_name=pre, post_fork_name=post, fork_epoch=2) for pre, post in ALL_FORKS.items()])
|
||||
@with_fork_metas([ForkMeta(pre_fork_name=pre, post_fork_name=post, fork_epoch=2) for pre, post in ALL_PRE_POST_FORKS])
|
||||
@with_presets([MINIMAL],
|
||||
reason="only test with enough validators such that at least one exited index is not in sync committee")
|
||||
def test_transition_with_one_fourth_exiting_validators_exit_post_fork(state,
|
||||
|
@ -84,7 +84,7 @@ def test_transition_with_one_fourth_exiting_validators_exit_post_fork(state,
|
|||
yield "post", state
|
||||
|
||||
|
||||
@with_fork_metas([ForkMeta(pre_fork_name=pre, post_fork_name=post, fork_epoch=2) for pre, post in ALL_FORKS.items()])
|
||||
@with_fork_metas([ForkMeta(pre_fork_name=pre, post_fork_name=post, fork_epoch=2) for pre, post in ALL_PRE_POST_FORKS])
|
||||
def test_transition_with_one_fourth_exiting_validators_exit_at_fork(state,
|
||||
fork_epoch,
|
||||
spec,
|
||||
|
@ -142,7 +142,7 @@ def test_transition_with_one_fourth_exiting_validators_exit_at_fork(state,
|
|||
#
|
||||
|
||||
|
||||
@with_fork_metas([ForkMeta(pre_fork_name=pre, post_fork_name=post, fork_epoch=2) for pre, post in ALL_FORKS.items()])
|
||||
@with_fork_metas([ForkMeta(pre_fork_name=pre, post_fork_name=post, fork_epoch=2) for pre, post in ALL_PRE_POST_FORKS])
|
||||
def test_transition_with_non_empty_activation_queue(state, fork_epoch, spec, post_spec, pre_tag, post_tag):
|
||||
"""
|
||||
Create some deposits before the transition
|
||||
|
@ -170,7 +170,7 @@ def test_transition_with_non_empty_activation_queue(state, fork_epoch, spec, pos
|
|||
yield "post", state
|
||||
|
||||
|
||||
@with_fork_metas([ForkMeta(pre_fork_name=pre, post_fork_name=post, fork_epoch=2) for pre, post in ALL_FORKS.items()])
|
||||
@with_fork_metas([ForkMeta(pre_fork_name=pre, post_fork_name=post, fork_epoch=2) for pre, post in ALL_PRE_POST_FORKS])
|
||||
def test_transition_with_activation_at_fork_epoch(state, fork_epoch, spec, post_spec, pre_tag, post_tag):
|
||||
"""
|
||||
Create some deposits before the transition
|
||||
|
|
|
@ -3,7 +3,7 @@ from eth2spec.test.context import (
|
|||
with_fork_metas,
|
||||
)
|
||||
from eth2spec.test.helpers.constants import (
|
||||
ALL_FORKS,
|
||||
ALL_PRE_POST_FORKS,
|
||||
)
|
||||
from eth2spec.test.helpers.fork_transition import (
|
||||
do_fork,
|
||||
|
@ -12,7 +12,7 @@ from eth2spec.test.helpers.fork_transition import (
|
|||
)
|
||||
|
||||
|
||||
@with_fork_metas([ForkMeta(pre_fork_name=pre, post_fork_name=post, fork_epoch=7) for pre, post in ALL_FORKS.items()])
|
||||
@with_fork_metas([ForkMeta(pre_fork_name=pre, post_fork_name=post, fork_epoch=7) for pre, post in ALL_PRE_POST_FORKS])
|
||||
def test_transition_with_leaking_pre_fork(state, fork_epoch, spec, post_spec, pre_tag, post_tag):
|
||||
"""
|
||||
Leaking starts at epoch 6 (MIN_EPOCHS_TO_INACTIVITY_PENALTY + 2).
|
||||
|
@ -40,7 +40,7 @@ def test_transition_with_leaking_pre_fork(state, fork_epoch, spec, post_spec, pr
|
|||
yield "post", state
|
||||
|
||||
|
||||
@with_fork_metas([ForkMeta(pre_fork_name=pre, post_fork_name=post, fork_epoch=6) for pre, post in ALL_FORKS.items()])
|
||||
@with_fork_metas([ForkMeta(pre_fork_name=pre, post_fork_name=post, fork_epoch=6) for pre, post in ALL_PRE_POST_FORKS])
|
||||
def test_transition_with_leaking_at_fork(state, fork_epoch, spec, post_spec, pre_tag, post_tag):
|
||||
"""
|
||||
Leaking starts at epoch 6 (MIN_EPOCHS_TO_INACTIVITY_PENALTY + 2).
|
||||
|
|
|
@ -5,7 +5,7 @@ from eth2spec.test.context import (
|
|||
with_presets,
|
||||
)
|
||||
from eth2spec.test.helpers.constants import (
|
||||
ALL_FORKS,
|
||||
ALL_PRE_POST_FORKS,
|
||||
MINIMAL,
|
||||
)
|
||||
from eth2spec.test.helpers.fork_transition import (
|
||||
|
@ -18,7 +18,7 @@ from eth2spec.test.helpers.fork_transition import (
|
|||
# PROPOSER_SLASHING
|
||||
#
|
||||
|
||||
@with_fork_metas([ForkMeta(pre_fork_name=pre, post_fork_name=post, fork_epoch=2) for pre, post in ALL_FORKS.items()])
|
||||
@with_fork_metas([ForkMeta(pre_fork_name=pre, post_fork_name=post, fork_epoch=2) for pre, post in ALL_PRE_POST_FORKS])
|
||||
@always_bls
|
||||
def test_transition_with_proposer_slashing_right_after_fork(state, fork_epoch, spec, post_spec, pre_tag, post_tag):
|
||||
"""
|
||||
|
@ -36,7 +36,7 @@ def test_transition_with_proposer_slashing_right_after_fork(state, fork_epoch, s
|
|||
)
|
||||
|
||||
|
||||
@with_fork_metas([ForkMeta(pre_fork_name=pre, post_fork_name=post, fork_epoch=2) for pre, post in ALL_FORKS.items()])
|
||||
@with_fork_metas([ForkMeta(pre_fork_name=pre, post_fork_name=post, fork_epoch=2) for pre, post in ALL_PRE_POST_FORKS])
|
||||
@always_bls
|
||||
def test_transition_with_proposer_slashing_right_before_fork(state, fork_epoch, spec, post_spec, pre_tag, post_tag):
|
||||
"""
|
||||
|
@ -59,7 +59,7 @@ def test_transition_with_proposer_slashing_right_before_fork(state, fork_epoch,
|
|||
#
|
||||
|
||||
|
||||
@with_fork_metas([ForkMeta(pre_fork_name=pre, post_fork_name=post, fork_epoch=2) for pre, post in ALL_FORKS.items()])
|
||||
@with_fork_metas([ForkMeta(pre_fork_name=pre, post_fork_name=post, fork_epoch=2) for pre, post in ALL_PRE_POST_FORKS])
|
||||
@always_bls
|
||||
def test_transition_with_attester_slashing_right_after_fork(state, fork_epoch, spec, post_spec, pre_tag, post_tag):
|
||||
"""
|
||||
|
@ -77,7 +77,7 @@ def test_transition_with_attester_slashing_right_after_fork(state, fork_epoch, s
|
|||
)
|
||||
|
||||
|
||||
@with_fork_metas([ForkMeta(pre_fork_name=pre, post_fork_name=post, fork_epoch=2) for pre, post in ALL_FORKS.items()])
|
||||
@with_fork_metas([ForkMeta(pre_fork_name=pre, post_fork_name=post, fork_epoch=2) for pre, post in ALL_PRE_POST_FORKS])
|
||||
@always_bls
|
||||
def test_transition_with_attester_slashing_right_before_fork(state, fork_epoch, spec, post_spec, pre_tag, post_tag):
|
||||
"""
|
||||
|
@ -100,7 +100,7 @@ def test_transition_with_attester_slashing_right_before_fork(state, fork_epoch,
|
|||
#
|
||||
|
||||
|
||||
@with_fork_metas([ForkMeta(pre_fork_name=pre, post_fork_name=post, fork_epoch=2) for pre, post in ALL_FORKS.items()])
|
||||
@with_fork_metas([ForkMeta(pre_fork_name=pre, post_fork_name=post, fork_epoch=2) for pre, post in ALL_PRE_POST_FORKS])
|
||||
def test_transition_with_deposit_right_after_fork(state, fork_epoch, spec, post_spec, pre_tag, post_tag):
|
||||
"""
|
||||
Create a deposit right *after* the transition
|
||||
|
@ -117,7 +117,7 @@ def test_transition_with_deposit_right_after_fork(state, fork_epoch, spec, post_
|
|||
)
|
||||
|
||||
|
||||
@with_fork_metas([ForkMeta(pre_fork_name=pre, post_fork_name=post, fork_epoch=2) for pre, post in ALL_FORKS.items()])
|
||||
@with_fork_metas([ForkMeta(pre_fork_name=pre, post_fork_name=post, fork_epoch=2) for pre, post in ALL_PRE_POST_FORKS])
|
||||
def test_transition_with_deposit_right_before_fork(state, fork_epoch, spec, post_spec, pre_tag, post_tag):
|
||||
"""
|
||||
Create a deposit right *before* the transition
|
||||
|
@ -139,7 +139,7 @@ def test_transition_with_deposit_right_before_fork(state, fork_epoch, spec, post
|
|||
#
|
||||
|
||||
|
||||
@with_fork_metas([ForkMeta(pre_fork_name=pre, post_fork_name=post, fork_epoch=66) for pre, post in ALL_FORKS.items()])
|
||||
@with_fork_metas([ForkMeta(pre_fork_name=pre, post_fork_name=post, fork_epoch=66) for pre, post in ALL_PRE_POST_FORKS])
|
||||
@with_presets([MINIMAL], reason="too slow")
|
||||
def test_transition_with_voluntary_exit_right_after_fork(state, fork_epoch, spec, post_spec, pre_tag, post_tag):
|
||||
"""
|
||||
|
@ -161,7 +161,7 @@ def test_transition_with_voluntary_exit_right_after_fork(state, fork_epoch, spec
|
|||
)
|
||||
|
||||
|
||||
@with_fork_metas([ForkMeta(pre_fork_name=pre, post_fork_name=post, fork_epoch=66) for pre, post in ALL_FORKS.items()])
|
||||
@with_fork_metas([ForkMeta(pre_fork_name=pre, post_fork_name=post, fork_epoch=66) for pre, post in ALL_PRE_POST_FORKS])
|
||||
@with_presets([MINIMAL], reason="too slow")
|
||||
def test_transition_with_voluntary_exit_right_before_fork(state, fork_epoch, spec, post_spec, pre_tag, post_tag):
|
||||
"""
|
||||
|
|
|
@ -5,7 +5,7 @@ from eth2spec.test.context import (
|
|||
with_presets,
|
||||
)
|
||||
from eth2spec.test.helpers.constants import (
|
||||
ALL_FORKS,
|
||||
ALL_PRE_POST_FORKS,
|
||||
MINIMAL,
|
||||
)
|
||||
from eth2spec.test.helpers.fork_transition import (
|
||||
|
@ -18,7 +18,7 @@ from eth2spec.test.helpers.random import (
|
|||
)
|
||||
|
||||
|
||||
@with_fork_metas([ForkMeta(pre_fork_name=pre, post_fork_name=post, fork_epoch=1) for pre, post in ALL_FORKS.items()])
|
||||
@with_fork_metas([ForkMeta(pre_fork_name=pre, post_fork_name=post, fork_epoch=1) for pre, post in ALL_PRE_POST_FORKS])
|
||||
@with_presets([MINIMAL],
|
||||
reason="only test with enough validators such that at least one exited index is not in sync committee")
|
||||
def test_transition_with_one_fourth_slashed_active_validators_pre_fork(state,
|
||||
|
|
|
@ -4,7 +4,7 @@ from eth2spec.test.context import (
|
|||
with_fork_metas,
|
||||
)
|
||||
from eth2spec.test.helpers.constants import (
|
||||
ALL_FORKS,
|
||||
ALL_PRE_POST_FORKS,
|
||||
)
|
||||
from eth2spec.test.helpers.state import (
|
||||
next_epoch_via_signed_block,
|
||||
|
@ -20,7 +20,7 @@ from eth2spec.test.helpers.fork_transition import (
|
|||
)
|
||||
|
||||
|
||||
@with_fork_metas([ForkMeta(pre_fork_name=pre, post_fork_name=post, fork_epoch=2) for pre, post in ALL_FORKS.items()])
|
||||
@with_fork_metas([ForkMeta(pre_fork_name=pre, post_fork_name=post, fork_epoch=2) for pre, post in ALL_PRE_POST_FORKS])
|
||||
def test_normal_transition(state, fork_epoch, spec, post_spec, pre_tag, post_tag):
|
||||
"""
|
||||
Transition from the initial ``state`` to the epoch after the ``fork_epoch``,
|
||||
|
@ -56,7 +56,7 @@ def test_normal_transition(state, fork_epoch, spec, post_spec, pre_tag, post_tag
|
|||
yield "post", state
|
||||
|
||||
|
||||
@with_fork_metas([ForkMeta(pre_fork_name=pre, post_fork_name=post, fork_epoch=2) for pre, post in ALL_FORKS.items()])
|
||||
@with_fork_metas([ForkMeta(pre_fork_name=pre, post_fork_name=post, fork_epoch=2) for pre, post in ALL_PRE_POST_FORKS])
|
||||
def test_transition_missing_first_post_block(state, fork_epoch, spec, post_spec, pre_tag, post_tag):
|
||||
"""
|
||||
Transition from the initial ``state`` to the epoch after the ``fork_epoch``,
|
||||
|
@ -93,7 +93,7 @@ def test_transition_missing_first_post_block(state, fork_epoch, spec, post_spec,
|
|||
yield "post", state
|
||||
|
||||
|
||||
@with_fork_metas([ForkMeta(pre_fork_name=pre, post_fork_name=post, fork_epoch=2) for pre, post in ALL_FORKS.items()])
|
||||
@with_fork_metas([ForkMeta(pre_fork_name=pre, post_fork_name=post, fork_epoch=2) for pre, post in ALL_PRE_POST_FORKS])
|
||||
def test_transition_missing_last_pre_fork_block(state, fork_epoch, spec, post_spec, pre_tag, post_tag):
|
||||
"""
|
||||
Transition from the initial ``state`` to the epoch after the ``fork_epoch``,
|
||||
|
@ -132,7 +132,7 @@ def test_transition_missing_last_pre_fork_block(state, fork_epoch, spec, post_sp
|
|||
yield "post", state
|
||||
|
||||
|
||||
@with_fork_metas([ForkMeta(pre_fork_name=pre, post_fork_name=post, fork_epoch=2) for pre, post in ALL_FORKS.items()])
|
||||
@with_fork_metas([ForkMeta(pre_fork_name=pre, post_fork_name=post, fork_epoch=2) for pre, post in ALL_PRE_POST_FORKS])
|
||||
def test_transition_only_blocks_post_fork(state, fork_epoch, spec, post_spec, pre_tag, post_tag):
|
||||
"""
|
||||
Transition from the initial ``state`` to the epoch after the ``fork_epoch``,
|
||||
|
@ -258,7 +258,7 @@ def _run_transition_test_with_attestations(state,
|
|||
yield "post", state
|
||||
|
||||
|
||||
@with_fork_metas([ForkMeta(pre_fork_name=pre, post_fork_name=post, fork_epoch=3) for pre, post in ALL_FORKS.items()])
|
||||
@with_fork_metas([ForkMeta(pre_fork_name=pre, post_fork_name=post, fork_epoch=3) for pre, post in ALL_PRE_POST_FORKS])
|
||||
def test_transition_with_finality(state, fork_epoch, spec, post_spec, pre_tag, post_tag):
|
||||
"""
|
||||
Transition from the initial ``state`` to the epoch after the ``fork_epoch``,
|
||||
|
@ -267,7 +267,7 @@ def test_transition_with_finality(state, fork_epoch, spec, post_spec, pre_tag, p
|
|||
yield from _run_transition_test_with_attestations(state, fork_epoch, spec, post_spec, pre_tag, post_tag)
|
||||
|
||||
|
||||
@with_fork_metas([ForkMeta(pre_fork_name=pre, post_fork_name=post, fork_epoch=3) for pre, post in ALL_FORKS.items()])
|
||||
@with_fork_metas([ForkMeta(pre_fork_name=pre, post_fork_name=post, fork_epoch=3) for pre, post in ALL_PRE_POST_FORKS])
|
||||
def test_transition_with_random_three_quarters_participation(state, fork_epoch, spec, post_spec, pre_tag, post_tag):
|
||||
"""
|
||||
Transition from the initial ``state`` to the epoch after the ``fork_epoch``,
|
||||
|
@ -294,7 +294,7 @@ def test_transition_with_random_three_quarters_participation(state, fork_epoch,
|
|||
)
|
||||
|
||||
|
||||
@with_fork_metas([ForkMeta(pre_fork_name=pre, post_fork_name=post, fork_epoch=3) for pre, post in ALL_FORKS.items()])
|
||||
@with_fork_metas([ForkMeta(pre_fork_name=pre, post_fork_name=post, fork_epoch=3) for pre, post in ALL_PRE_POST_FORKS])
|
||||
def test_transition_with_random_half_participation(state, fork_epoch, spec, post_spec, pre_tag, post_tag):
|
||||
rng = random.Random(2020)
|
||||
|
||||
|
@ -318,7 +318,7 @@ def test_transition_with_random_half_participation(state, fork_epoch, spec, post
|
|||
)
|
||||
|
||||
|
||||
@with_fork_metas([ForkMeta(pre_fork_name=pre, post_fork_name=post, fork_epoch=3) for pre, post in ALL_FORKS.items()])
|
||||
@with_fork_metas([ForkMeta(pre_fork_name=pre, post_fork_name=post, fork_epoch=3) for pre, post in ALL_PRE_POST_FORKS])
|
||||
def test_transition_with_no_attestations_until_after_fork(state, fork_epoch, spec, post_spec, pre_tag, post_tag):
|
||||
"""
|
||||
Transition from the initial ``state`` to the ``fork_epoch`` with no attestations,
|
||||
|
|
|
@ -11,7 +11,7 @@ from .exceptions import SkippedTest
|
|||
from .helpers.constants import (
|
||||
PHASE0, ALTAIR, MERGE, MINIMAL, MAINNET,
|
||||
ALL_PHASES, FORKS_BEFORE_ALTAIR, FORKS_BEFORE_MERGE,
|
||||
ALL_FORKS,
|
||||
ALL_FORK_UPGRADES,
|
||||
)
|
||||
from .helpers.typing import SpecForkName, PresetBaseName
|
||||
from .helpers.genesis import create_genesis_state
|
||||
|
@ -432,7 +432,7 @@ def with_phases(phases, other_phases=None):
|
|||
# When running test generator, it sets specific `phase`
|
||||
phase = kw['phase']
|
||||
_phases = [phase]
|
||||
_other_phases = [ALL_FORKS[phase]]
|
||||
_other_phases = [ALL_FORK_UPGRADES[phase]]
|
||||
ret = _run_test_case_with_phases(fn, _phases, _other_phases, kw, args, is_fork_transition=True)
|
||||
else:
|
||||
# When running pytest, go through `fork_metas`
|
||||
|
|
|
@ -21,11 +21,13 @@ TESTGEN_FORKS = (PHASE0, ALTAIR, MERGE)
|
|||
|
||||
FORKS_BEFORE_ALTAIR = (PHASE0,)
|
||||
FORKS_BEFORE_MERGE = (PHASE0, ALTAIR)
|
||||
ALL_FORKS = {
|
||||
ALL_FORK_UPGRADES = {
|
||||
# pre_fork_name: post_fork_name
|
||||
PHASE0: ALTAIR,
|
||||
ALTAIR: MERGE,
|
||||
}
|
||||
ALL_PRE_POST_FORKS = ALL_FORK_UPGRADES.items()
|
||||
|
||||
|
||||
#
|
||||
# Config
|
||||
|
|
|
@ -3,7 +3,7 @@ from typing import Iterable
|
|||
from eth2spec.test.helpers.constants import (
|
||||
MINIMAL,
|
||||
MAINNET,
|
||||
ALL_FORKS,
|
||||
ALL_FORK_UPGRADES,
|
||||
)
|
||||
from eth2spec.gen_helpers.gen_base import gen_runner, gen_typing
|
||||
from eth2spec.gen_helpers.gen_from_tests.gen import (
|
||||
|
@ -45,7 +45,7 @@ if __name__ == "__main__":
|
|||
test_altair_operations,
|
||||
)
|
||||
for transition_test_module in altair_tests:
|
||||
for pre_fork, post_fork in ALL_FORKS.items():
|
||||
for pre_fork, post_fork in ALL_PRE_POST_FORKS:
|
||||
gen_runner.run_generator("transition", [
|
||||
create_provider(transition_test_module, MINIMAL, pre_fork, post_fork),
|
||||
create_provider(transition_test_module, MAINNET, pre_fork, post_fork),
|
||||
|
|
Loading…
Reference in New Issue