update test runner to handle merge phase

This commit is contained in:
protolambda 2021-05-05 15:35:52 +02:00
parent e2be7614cc
commit 470c6dcc6f
No known key found for this signature in database
GPG Key ID: EC89FDBB2B4C7623
2 changed files with 10 additions and 2 deletions

View File

@ -7,7 +7,7 @@ from eth2spec.utils import bls
from .exceptions import SkippedTest
from .helpers.constants import (
PHASE0, ALTAIR,
PHASE0, ALTAIR, MERGE,
ALL_PHASES, FORKS_BEFORE_ALTAIR, FORKS_BEFORE_MERGE,
)
from .helpers.genesis import create_genesis_state
@ -312,7 +312,7 @@ def with_phases(phases, other_phases=None):
return None
run_phases = [phase]
if PHASE0 not in run_phases and ALTAIR not in run_phases:
if PHASE0 not in run_phases and ALTAIR not in run_phases and MERGE not in run_phases:
dump_skipping_message("none of the recognized phases are executable, skipping test.")
return None
@ -331,12 +331,17 @@ def with_phases(phases, other_phases=None):
if ALTAIR in available_phases:
phase_dir[ALTAIR] = spec_altair
if MERGE in available_phases:
phase_dir[MERGE] = spec_merge
# return is ignored whenever multiple phases are ran.
# This return is for test generators to emit python generators (yielding test vector outputs)
if PHASE0 in run_phases:
ret = fn(spec=spec_phase0, phases=phase_dir, *args, **kw)
if ALTAIR in run_phases:
ret = fn(spec=spec_altair, phases=phase_dir, *args, **kw)
if MERGE in run_phases:
ret = fn(spec=spec_merge, phases=phase_dir, *args, **kw)
# TODO: merge, sharding, custody_game and das are not executable yet.
# Tests that specify these features will not run, and get ignored for these specific phases.

View File

@ -1,6 +1,7 @@
from eth2spec.test.helpers.constants import (
ALTAIR,
FORKS_BEFORE_ALTAIR,
MERGE,
)
from eth2spec.test.helpers.keys import pubkeys
@ -28,6 +29,8 @@ def create_genesis_state(spec, validator_balances, activation_threshold):
if spec.fork == ALTAIR:
current_version = spec.ALTAIR_FORK_VERSION
elif spec.fork == MERGE:
current_version = spec.MERGE_FORK_VERSION
state = spec.BeaconState(
genesis_time=0,