ensure no leak on "normal" transitions

This commit is contained in:
Alex Stokes 2021-08-22 10:07:31 -07:00
parent 270814e20f
commit 993997aca5
No known key found for this signature in database
GPG Key ID: 99B3D88FD6C55A69

View File

@ -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 = [