Add decorators to diable testing with mainnet config
This commit is contained in:
parent
74a2a1c0d4
commit
a0d646e1e0
|
@ -329,12 +329,15 @@ def disable_process_reveal_deadlines(fn):
|
|||
return with_meta_tags({'reveal_deadlines_setting': 1})(entry)
|
||||
|
||||
|
||||
def with_configs(configs):
|
||||
def with_configs(configs, reason=None):
|
||||
def decorator(fn):
|
||||
def wrapper(*args, spec: Spec, **kw):
|
||||
available_configs = set(configs)
|
||||
if spec.CONFIG_NAME not in available_configs:
|
||||
dump_skipping_message(f"doesn't support this config: {spec.CONFIG_NAME}")
|
||||
message = f"doesn't support this config: {spec.CONFIG_NAME}."
|
||||
if reason is not None:
|
||||
message = f"{message} Reason: {reason}"
|
||||
dump_skipping_message(message)
|
||||
return None
|
||||
|
||||
return fn(*args, spec=spec, **kw)
|
||||
|
|
|
@ -9,10 +9,12 @@ from eth2spec.test.helpers.attestations import (
|
|||
from eth2spec.test.helpers.state import transition_to, transition_to_valid_shard_slot
|
||||
from eth2spec.test.context import (
|
||||
PHASE0,
|
||||
MINIMAL,
|
||||
expect_assertion_error,
|
||||
disable_process_reveal_deadlines,
|
||||
spec_state_test,
|
||||
with_all_phases_except,
|
||||
with_configs,
|
||||
)
|
||||
from eth2spec.test.phase0.block_processing.test_process_attestation import run_attestation_processing
|
||||
|
||||
|
@ -68,6 +70,7 @@ def run_custody_chunk_response_processing(spec, state, custody_response, valid=T
|
|||
|
||||
@with_all_phases_except([PHASE0])
|
||||
@spec_state_test
|
||||
@with_configs([MINIMAL], reason="too slow")
|
||||
@disable_process_reveal_deadlines
|
||||
def test_challenge_appended(spec, state):
|
||||
transition_to_valid_shard_slot(spec, state)
|
||||
|
@ -92,6 +95,7 @@ def test_challenge_appended(spec, state):
|
|||
@with_all_phases_except([PHASE0])
|
||||
@spec_state_test
|
||||
@disable_process_reveal_deadlines
|
||||
@with_configs([MINIMAL], reason="too slow")
|
||||
def test_challenge_empty_element_replaced(spec, state):
|
||||
transition_to_valid_shard_slot(spec, state)
|
||||
transition_to(spec, state, state.slot + 1) # Make len(offset_slots) == 1
|
||||
|
@ -117,6 +121,7 @@ def test_challenge_empty_element_replaced(spec, state):
|
|||
@with_all_phases_except([PHASE0])
|
||||
@spec_state_test
|
||||
@disable_process_reveal_deadlines
|
||||
@with_configs([MINIMAL], reason="too slow")
|
||||
def test_duplicate_challenge(spec, state):
|
||||
transition_to_valid_shard_slot(spec, state)
|
||||
transition_to(spec, state, state.slot + 1) # Make len(offset_slots) == 1
|
||||
|
@ -142,6 +147,7 @@ def test_duplicate_challenge(spec, state):
|
|||
@with_all_phases_except([PHASE0])
|
||||
@spec_state_test
|
||||
@disable_process_reveal_deadlines
|
||||
@with_configs([MINIMAL], reason="too slow")
|
||||
def test_second_challenge(spec, state):
|
||||
transition_to_valid_shard_slot(spec, state)
|
||||
transition_to(spec, state, state.slot + 1) # Make len(offset_slots) == 1
|
||||
|
@ -169,6 +175,7 @@ def test_second_challenge(spec, state):
|
|||
@with_all_phases_except([PHASE0])
|
||||
@spec_state_test
|
||||
@disable_process_reveal_deadlines
|
||||
@with_configs([MINIMAL], reason="too slow")
|
||||
def test_multiple_epochs_custody(spec, state):
|
||||
transition_to_valid_shard_slot(spec, state)
|
||||
transition_to(spec, state, state.slot + spec.SLOTS_PER_EPOCH * 3)
|
||||
|
@ -193,6 +200,7 @@ def test_multiple_epochs_custody(spec, state):
|
|||
@with_all_phases_except([PHASE0])
|
||||
@spec_state_test
|
||||
@disable_process_reveal_deadlines
|
||||
@with_configs([MINIMAL], reason="too slow")
|
||||
def test_many_epochs_custody(spec, state):
|
||||
transition_to_valid_shard_slot(spec, state)
|
||||
transition_to(spec, state, state.slot + spec.SLOTS_PER_EPOCH * 20)
|
||||
|
@ -217,6 +225,7 @@ def test_many_epochs_custody(spec, state):
|
|||
@with_all_phases_except([PHASE0])
|
||||
@spec_state_test
|
||||
@disable_process_reveal_deadlines
|
||||
@with_configs([MINIMAL], reason="too slow")
|
||||
def test_off_chain_attestation(spec, state):
|
||||
transition_to_valid_shard_slot(spec, state)
|
||||
transition_to(spec, state, state.slot + spec.SLOTS_PER_EPOCH)
|
||||
|
@ -237,6 +246,7 @@ def test_off_chain_attestation(spec, state):
|
|||
@with_all_phases_except([PHASE0])
|
||||
@spec_state_test
|
||||
@disable_process_reveal_deadlines
|
||||
@with_configs([MINIMAL], reason="too slow")
|
||||
def test_custody_response(spec, state):
|
||||
transition_to_valid_shard_slot(spec, state)
|
||||
transition_to(spec, state, state.slot + spec.SLOTS_PER_EPOCH)
|
||||
|
@ -268,6 +278,7 @@ def test_custody_response(spec, state):
|
|||
@with_all_phases_except([PHASE0])
|
||||
@spec_state_test
|
||||
@disable_process_reveal_deadlines
|
||||
@with_configs([MINIMAL], reason="too slow")
|
||||
def test_custody_response_chunk_index_2(spec, state):
|
||||
transition_to(spec, state, state.slot + spec.SLOTS_PER_EPOCH)
|
||||
|
||||
|
@ -298,6 +309,7 @@ def test_custody_response_chunk_index_2(spec, state):
|
|||
@with_all_phases_except([PHASE0])
|
||||
@spec_state_test
|
||||
@disable_process_reveal_deadlines
|
||||
@with_configs([MINIMAL], reason="too slow")
|
||||
def test_custody_response_multiple_epochs(spec, state):
|
||||
transition_to_valid_shard_slot(spec, state)
|
||||
transition_to(spec, state, state.slot + spec.SLOTS_PER_EPOCH * 3)
|
||||
|
@ -329,6 +341,7 @@ def test_custody_response_multiple_epochs(spec, state):
|
|||
@with_all_phases_except([PHASE0])
|
||||
@spec_state_test
|
||||
@disable_process_reveal_deadlines
|
||||
@with_configs([MINIMAL], reason="too slow")
|
||||
def test_custody_response_many_epochs(spec, state):
|
||||
transition_to_valid_shard_slot(spec, state)
|
||||
transition_to(spec, state, state.slot + spec.SLOTS_PER_EPOCH * 20)
|
||||
|
|
|
@ -10,10 +10,12 @@ from eth2spec.utils.ssz.ssz_typing import ByteList
|
|||
from eth2spec.test.helpers.state import get_balance, transition_to
|
||||
from eth2spec.test.context import (
|
||||
PHASE0,
|
||||
MINIMAL,
|
||||
with_all_phases_except,
|
||||
spec_state_test,
|
||||
expect_assertion_error,
|
||||
disable_process_reveal_deadlines,
|
||||
with_configs,
|
||||
)
|
||||
from eth2spec.test.phase0.block_processing.test_process_attestation import run_attestation_processing
|
||||
|
||||
|
@ -113,6 +115,7 @@ def run_standard_custody_slashing_test(spec,
|
|||
@with_all_phases_except([PHASE0])
|
||||
@spec_state_test
|
||||
@disable_process_reveal_deadlines
|
||||
@with_configs([MINIMAL], reason="too slow")
|
||||
def test_custody_slashing(spec, state):
|
||||
yield from run_standard_custody_slashing_test(spec, state)
|
||||
|
||||
|
@ -120,6 +123,7 @@ def test_custody_slashing(spec, state):
|
|||
@with_all_phases_except([PHASE0])
|
||||
@spec_state_test
|
||||
@disable_process_reveal_deadlines
|
||||
@with_configs([MINIMAL], reason="too slow")
|
||||
def test_incorrect_custody_slashing(spec, state):
|
||||
yield from run_standard_custody_slashing_test(spec, state, correct=False)
|
||||
|
||||
|
@ -127,6 +131,7 @@ def test_incorrect_custody_slashing(spec, state):
|
|||
@with_all_phases_except([PHASE0])
|
||||
@spec_state_test
|
||||
@disable_process_reveal_deadlines
|
||||
@with_configs([MINIMAL], reason="too slow")
|
||||
def test_multiple_epochs_custody(spec, state):
|
||||
yield from run_standard_custody_slashing_test(spec, state, shard_lateness=spec.SLOTS_PER_EPOCH * 3)
|
||||
|
||||
|
@ -134,6 +139,7 @@ def test_multiple_epochs_custody(spec, state):
|
|||
@with_all_phases_except([PHASE0])
|
||||
@spec_state_test
|
||||
@disable_process_reveal_deadlines
|
||||
@with_configs([MINIMAL], reason="too slow")
|
||||
def test_many_epochs_custody(spec, state):
|
||||
yield from run_standard_custody_slashing_test(spec, state, shard_lateness=spec.SLOTS_PER_EPOCH * 5)
|
||||
|
||||
|
@ -141,6 +147,7 @@ def test_many_epochs_custody(spec, state):
|
|||
@with_all_phases_except([PHASE0])
|
||||
@spec_state_test
|
||||
@disable_process_reveal_deadlines
|
||||
@with_configs([MINIMAL], reason="too slow")
|
||||
def test_invalid_custody_slashing(spec, state):
|
||||
yield from run_standard_custody_slashing_test(
|
||||
spec,
|
||||
|
|
|
@ -8,8 +8,10 @@ from eth2spec.test.helpers.attestations import (
|
|||
from eth2spec.test.helpers.state import transition_to, transition_to_valid_shard_slot
|
||||
from eth2spec.test.context import (
|
||||
PHASE0,
|
||||
with_all_phases_except,
|
||||
MINIMAL,
|
||||
spec_state_test,
|
||||
with_all_phases_except,
|
||||
with_configs,
|
||||
)
|
||||
from eth2spec.test.phase0.block_processing.test_process_attestation import run_attestation_processing
|
||||
from eth2spec.test.phase0.epoch_processing.run_epoch_process_base import run_epoch_processing_with
|
||||
|
@ -25,6 +27,7 @@ def run_process_challenge_deadlines(spec, state):
|
|||
|
||||
@with_all_phases_except([PHASE0])
|
||||
@spec_state_test
|
||||
@with_configs([MINIMAL], reason="too slow")
|
||||
def test_validator_slashed_after_chunk_challenge(spec, state):
|
||||
transition_to_valid_shard_slot(spec, state)
|
||||
transition_to(spec, state, state.slot + 1) # Make len(offset_slots) == 1
|
||||
|
|
|
@ -4,7 +4,9 @@ from eth2spec.test.helpers.custody import (
|
|||
from eth2spec.test.helpers.state import transition_to
|
||||
from eth2spec.test.context import (
|
||||
PHASE0,
|
||||
MINIMAL,
|
||||
with_all_phases_except,
|
||||
with_configs,
|
||||
spec_state_test,
|
||||
)
|
||||
from eth2spec.test.phase0.epoch_processing.run_epoch_process_base import run_epoch_processing_with
|
||||
|
@ -17,6 +19,7 @@ def run_process_challenge_deadlines(spec, state):
|
|||
|
||||
@with_all_phases_except([PHASE0])
|
||||
@spec_state_test
|
||||
@with_configs([MINIMAL], reason="too slow")
|
||||
def test_validator_slashed_after_reveal_deadline(spec, state):
|
||||
assert state.validators[0].slashed == 0
|
||||
transition_to(spec, state, spec.get_randao_epoch_for_custody_period(0, 0) * spec.SLOTS_PER_EPOCH)
|
||||
|
@ -36,6 +39,7 @@ def test_validator_slashed_after_reveal_deadline(spec, state):
|
|||
|
||||
@with_all_phases_except([PHASE0])
|
||||
@spec_state_test
|
||||
@with_configs([MINIMAL], reason="too slow")
|
||||
def test_validator_not_slashed_after_reveal(spec, state):
|
||||
transition_to(spec, state, spec.EPOCHS_PER_CUSTODY_PERIOD * spec.SLOTS_PER_EPOCH)
|
||||
custody_key_reveal = get_valid_custody_key_reveal(spec, state)
|
||||
|
|
Loading…
Reference in New Issue