Merge pull request #3389 from ethereum/fork-settings

Turn off light client tests for feature specs
This commit is contained in:
Hsiao-Wei Wang
2023-06-01 14:59:27 +08:00
committed by GitHub
11 changed files with 39 additions and 430 deletions

View File

@@ -1,12 +1,12 @@
from eth2spec.test.context import (
spec_state_test,
with_altair_and_later,
with_light_client,
with_test_suite_name,
)
@with_test_suite_name("BeaconState")
@with_altair_and_later
@with_light_client
@spec_state_test
def test_current_sync_committee_merkle_proof(spec, state):
yield "object", state
@@ -27,7 +27,7 @@ def test_current_sync_committee_merkle_proof(spec, state):
@with_test_suite_name("BeaconState")
@with_altair_and_later
@with_light_client
@spec_state_test
def test_next_sync_committee_merkle_proof(spec, state):
yield "object", state
@@ -48,7 +48,7 @@ def test_next_sync_committee_merkle_proof(spec, state):
@with_test_suite_name("BeaconState")
@with_altair_and_later
@with_light_client
@spec_state_test
def test_finality_root_merkle_proof(spec, state):
yield "object", state

View File

@@ -9,7 +9,7 @@ from eth2spec.test.context import (
with_phases,
with_presets,
with_state,
with_altair_and_later,
with_light_client,
)
from eth2spec.test.helpers.attestations import (
next_slots_with_attestations,
@@ -26,7 +26,6 @@ from eth2spec.test.helpers.fork_transition import (
from eth2spec.test.helpers.forks import (
is_post_capella, is_post_deneb,
is_post_fork,
is_post_eip6110,
)
from eth2spec.test.helpers.light_client import (
get_sync_aggregate,
@@ -58,10 +57,6 @@ def needs_upgrade_to_deneb(d_spec, s_spec):
return is_post_deneb(s_spec) and not is_post_deneb(d_spec)
def needs_upgrade_to_eip6110(d_spec, s_spec):
return is_post_eip6110(s_spec) and not is_post_eip6110(d_spec)
def check_lc_header_equal(d_spec, s_spec, data, upgraded):
assert upgraded.beacon.slot == data.beacon.slot
assert upgraded.beacon.hash_tree_root() == data.beacon.hash_tree_root()
@@ -89,10 +84,6 @@ def upgrade_lc_bootstrap_to_store(d_spec, s_spec, data):
upgraded = s_spec.upgrade_lc_bootstrap_to_deneb(upgraded)
check_lc_bootstrap_equal(d_spec, s_spec, data, upgraded)
if needs_upgrade_to_eip6110(d_spec, s_spec):
upgraded = s_spec.upgrade_lc_bootstrap_to_eip6110(upgraded)
check_lc_bootstrap_equal(d_spec, s_spec, data, upgraded)
return upgraded
@@ -154,8 +145,6 @@ class LightClientSyncTest(object):
def get_store_fork_version(s_spec):
if is_post_eip6110(s_spec):
return s_spec.config.EIP6110_FORK_VERSION
if is_post_deneb(s_spec):
return s_spec.config.DENEB_FORK_VERSION
if is_post_capella(s_spec):
@@ -301,7 +290,7 @@ def compute_start_slot_at_next_sync_committee_period(spec, state):
return compute_start_slot_at_sync_committee_period(spec, sync_committee_period + 1)
@with_altair_and_later
@with_light_client
@spec_state_test_with_matching_config
@with_presets([MINIMAL], reason="too slow")
def test_light_client_sync(spec, state):
@@ -523,7 +512,7 @@ def test_light_client_sync(spec, state):
yield from finish_test(test)
@with_altair_and_later
@with_light_client
@spec_state_test_with_matching_config
@with_presets([MINIMAL], reason="too slow")
def test_supply_sync_committee_from_past_update(spec, state):
@@ -553,7 +542,7 @@ def test_supply_sync_committee_from_past_update(spec, state):
yield from finish_test(test)
@with_altair_and_later
@with_light_client
@spec_state_test_with_matching_config
@with_presets([MINIMAL], reason="too slow")
def test_advance_finality_without_sync_committee(spec, state):

View File

@@ -1,7 +1,7 @@
from eth2spec.test.context import (
spec_state_test,
with_presets,
with_altair_and_later,
with_light_client,
)
from eth2spec.test.helpers.attestations import (
next_slots_with_attestations,
@@ -29,7 +29,7 @@ def create_test_update(spec, test, with_next, with_finality, participation_rate)
)
@with_altair_and_later
@with_light_client
@spec_state_test
@with_presets([MINIMAL], reason="too slow")
def test_update_ranking(spec, state):

View File

@@ -3,7 +3,7 @@ from copy import deepcopy
from eth2spec.test.context import (
spec_state_test_with_matching_config,
with_presets,
with_altair_and_later,
with_light_client,
)
from eth2spec.test.helpers.attestations import (
next_epoch_with_attestations,
@@ -29,7 +29,7 @@ def setup_test(spec, state):
return (trusted_block, store)
@with_altair_and_later
@with_light_client
@spec_state_test_with_matching_config
def test_process_light_client_update_not_timeout(spec, state):
genesis_block, store = setup_test(spec, state)
@@ -61,7 +61,7 @@ def test_process_light_client_update_not_timeout(spec, state):
assert store.current_max_active_participants > 0
@with_altair_and_later
@with_light_client
@spec_state_test_with_matching_config
@with_presets([MINIMAL], reason="too slow")
def test_process_light_client_update_at_period_boundary(spec, state):
@@ -96,7 +96,7 @@ def test_process_light_client_update_at_period_boundary(spec, state):
assert store.current_max_active_participants > 0
@with_altair_and_later
@with_light_client
@spec_state_test_with_matching_config
@with_presets([MINIMAL], reason="too slow")
def test_process_light_client_update_timeout(spec, state):
@@ -131,7 +131,7 @@ def test_process_light_client_update_timeout(spec, state):
assert store.current_max_active_participants > 0
@with_altair_and_later
@with_light_client
@spec_state_test_with_matching_config
@with_presets([MINIMAL], reason="too slow")
def test_process_light_client_update_finality_updated(spec, state):

View File

@@ -18,6 +18,7 @@ from .helpers.constants import (
MINIMAL, MAINNET,
ALL_PHASES,
ALL_FORK_UPGRADES,
LIGHT_CLIENT_TESTING_FORKS,
)
from .helpers.forks import is_post_fork
from .helpers.typing import SpecForkName, PresetBaseName
@@ -428,13 +429,6 @@ def with_all_phases_except(exclusion_phases):
return decorator
with_altair_and_later = with_all_phases_from(ALTAIR)
with_bellatrix_and_later = with_all_phases_from(BELLATRIX)
with_capella_and_later = with_all_phases_from(CAPELLA)
with_deneb_and_later = with_all_phases_from(DENEB)
with_eip6110_and_later = with_all_phases_from(EIP6110)
def _get_preset_targets(kw):
preset_name = DEFAULT_TEST_PRESET
if 'preset' in kw:
@@ -540,6 +534,14 @@ def with_presets(preset_bases, reason=None):
return decorator
with_altair_and_later = with_all_phases_from(ALTAIR)
with_bellatrix_and_later = with_all_phases_from(BELLATRIX)
with_capella_and_later = with_all_phases_from(CAPELLA)
with_deneb_and_later = with_all_phases_from(DENEB)
with_eip6110_and_later = with_all_phases_from(EIP6110)
with_light_client = with_phases(LIGHT_CLIENT_TESTING_FORKS)
class quoted_str(str):
pass

View File

@@ -4,6 +4,7 @@ from .typing import SpecForkName, PresetBaseName
#
# SpecForkName
#
# Some of the Spec module functionality is exposed here to deal with phase-specific changes.
PHASE0 = SpecForkName('phase0')
ALTAIR = SpecForkName('altair')
@@ -17,15 +18,25 @@ CUSTODY_GAME = SpecForkName('custody_game')
DAS = SpecForkName('das')
EIP6110 = SpecForkName('eip6110')
#
# SpecFork settings
#
# The forks that are deployed on Mainnet
MAINNET_FORKS = (PHASE0, ALTAIR, BELLATRIX, CAPELLA)
LATEST_FORK = MAINNET_FORKS[-1]
# The forks that pytest can run with.
ALL_PHASES = (
# Formal forks
PHASE0, ALTAIR, BELLATRIX, CAPELLA, DENEB,
# Experimental patches
*MAINNET_FORKS,
DENEB,
# Experimental features
EIP6110,
)
# The forks that have light client specs
LIGHT_CLIENT_TESTING_FORKS = (*[item for item in MAINNET_FORKS if item != PHASE0], DENEB)
# The forks that output to the test vectors.
TESTGEN_FORKS = (PHASE0, ALTAIR, BELLATRIX, CAPELLA, DENEB, EIP6110)
TESTGEN_FORKS = (*MAINNET_FORKS, DENEB, EIP6110)
ALL_FORK_UPGRADES = {
# pre_fork_name: post_fork_name
@@ -46,7 +57,7 @@ AFTER_DENEB_UPGRADES = {key: value for key, value in ALL_FORK_UPGRADES.items()
AFTER_DENEB_PRE_POST_FORKS = AFTER_DENEB_UPGRADES.items()
#
# Config
# Config and Preset
#
MAINNET = PresetBaseName('mainnet')
MINIMAL = PresetBaseName('minimal')