Add `disable_process_reveal_deadlines` decorator

This commit is contained in:
Hsiao-Wei Wang 2020-08-12 21:50:36 +08:00
parent 52ba90d719
commit 7eeb754f7d
No known key found for this signature in database
GPG Key ID: 95B070122902DEA4
4 changed files with 20 additions and 5 deletions

View File

@ -300,3 +300,11 @@ def with_phases(phases, other_phases=None):
return ret return ret
return wrapper return wrapper
return decorator return decorator
def disable_process_reveal_deadlines(fn):
def entry(*args, spec: Spec, **kw):
if hasattr(spec, 'process_reveal_deadlines'):
spec.process_reveal_deadlines = lambda state: None
return fn(*args, spec=spec, **kw)
return with_meta_tags({'reveal_deadlines_setting': 1})(entry)

View File

@ -23,6 +23,7 @@ from eth2spec.test.helpers.shard_transitions import get_shard_transition_of_comm
from eth2spec.test.context import ( from eth2spec.test.context import (
PHASE0, PHASE1, PHASE0, PHASE1,
spec_state_test, with_all_phases, expect_assertion_error, always_bls, with_phases, spec_state_test, with_all_phases, expect_assertion_error, always_bls, with_phases,
disable_process_reveal_deadlines,
) )
@ -762,8 +763,9 @@ def prepare_signed_exits(spec, state, indices):
# exceeding the minimal-config randao mixes memory size. # exceeding the minimal-config randao mixes memory size.
# Applies to all voluntary-exit sanity block tests. # Applies to all voluntary-exit sanity block tests.
@with_phases([PHASE0]) @with_all_phases
@spec_state_test @spec_state_test
@disable_process_reveal_deadlines
def test_voluntary_exit(spec, state): def test_voluntary_exit(spec, state):
validator_index = spec.get_active_validator_indices(state, spec.get_current_epoch(state))[-1] validator_index = spec.get_active_validator_indices(state, spec.get_current_epoch(state))[-1]
@ -811,8 +813,9 @@ def test_double_validator_exit_same_block(spec, state):
yield 'post', None yield 'post', None
@with_phases([PHASE0]) @with_all_phases
@spec_state_test @spec_state_test
@disable_process_reveal_deadlines
def test_multiple_different_validator_exits_same_block(spec, state): def test_multiple_different_validator_exits_same_block(spec, state):
validator_indices = [ validator_indices = [
spec.get_active_validator_indices(state, spec.get_current_epoch(state))[i] spec.get_active_validator_indices(state, spec.get_current_epoch(state))[i]

View File

@ -165,6 +165,9 @@ bls_setting: int -- optional, can have 3 different values:
but there is no change of outcome when running the test if BLS is ON or OFF. but there is no change of outcome when running the test if BLS is ON or OFF.
1: known as "BLS required" - if the test validity is strictly dependent on BLS being ON 1: known as "BLS required" - if the test validity is strictly dependent on BLS being ON
2: known as "BLS ignored" - if the test validity is strictly dependent on BLS being OFF 2: known as "BLS ignored" - if the test validity is strictly dependent on BLS being OFF
reveal_deadlines_setting: -- optional, can have 2 different values:
0: default, `process_reveal_deadlines` is ON.
1: `process_reveal_deadlines` is OFF.
``` ```

View File

@ -9,6 +9,7 @@ Sanity tests to cover a series of one or more blocks being processed, aiming to
```yaml ```yaml
description: string -- Optional. Description of test case, purely for debugging purposes. description: string -- Optional. Description of test case, purely for debugging purposes.
bls_setting: int -- see general test-format spec. bls_setting: int -- see general test-format spec.
reveal_deadlines_setting: int -- see general test-format spec.
blocks_count: int -- the number of blocks processed in this test. blocks_count: int -- the number of blocks processed in this test.
``` ```