mirror of
https://github.com/status-im/eth2.0-specs.git
synced 2025-02-23 07:48:12 +00:00
ensure no leak on "normal" transitions
This commit is contained in:
parent
270814e20f
commit
993997aca5
@ -124,8 +124,19 @@ def _validate_is_leaking(spec, state):
|
|||||||
return spec.is_in_inactivity_leak(state)
|
return spec.is_in_inactivity_leak(state)
|
||||||
|
|
||||||
|
|
||||||
|
def _validate_is_not_leaking(spec, state):
|
||||||
|
return not _validate_is_leaking(spec, state)
|
||||||
|
|
||||||
|
|
||||||
# transitions
|
# transitions
|
||||||
|
|
||||||
|
def _with_validation(transition, validation):
|
||||||
|
if isinstance(transition, Callable):
|
||||||
|
transition = transition()
|
||||||
|
transition["validation"] = validation
|
||||||
|
return transition
|
||||||
|
|
||||||
|
|
||||||
def _no_op_transition():
|
def _no_op_transition():
|
||||||
return {}
|
return {}
|
||||||
|
|
||||||
@ -264,8 +275,9 @@ def _generate_randomized_scenarios():
|
|||||||
|
|
||||||
# and preface each block transition with the possible leak transitions
|
# and preface each block transition with the possible leak transitions
|
||||||
# (... either no leak or transition to a leak before applying the block transition)
|
# (... either no leak or transition to a leak before applying the block transition)
|
||||||
|
_transition_without_leak = _with_validation(_no_op_transition, _validate_is_not_leaking)
|
||||||
leak_transitions = (
|
leak_transitions = (
|
||||||
_no_op_transition,
|
_transition_without_leak,
|
||||||
_transition_to_leaking,
|
_transition_to_leaking,
|
||||||
)
|
)
|
||||||
scenarios = [
|
scenarios = [
|
||||||
|
Loading…
x
Reference in New Issue
Block a user