Skip to content

Commit 0fe0cc4

Browse files
authored
feat: add --step-timeout option for kontrol prove (#1160)
Exposes pyk's per-step timeout through `kontrol prove`. When `--step-timeout S` is set, each rewrite step is given a wall-clock budget of `S` whole seconds; on timeout the backend request is interrupted, the execution depth is halved, and the step is retried (enforced by `APRProver`, threaded via `run_prover`). Default `None` disables the timeout, leaving prior behavior unchanged.
1 parent 51a968c commit 0fe0cc4

3 files changed

Lines changed: 10 additions & 0 deletions

File tree

src/kontrol/cli.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -576,6 +576,13 @@ def parse(s: str) -> list[T]:
576576
action='store_true',
577577
help='Generate a Solidity test contract with concrete counterexample values when proofs fail.',
578578
)
579+
prove_args.add_argument(
580+
'--step-timeout',
581+
type=int,
582+
default=None,
583+
dest='step_timeout',
584+
help='Per-step wall-clock budget in whole seconds; on timeout the backend request is interrupted and the execution depth is halved before retrying. Disabled by default.',
585+
)
579586

580587
show_args = command_parser.add_parser(
581588
'show',

src/kontrol/options.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -350,6 +350,7 @@ class ProveOptions(
350350
extra_module: str | None
351351
symbolic_caller: bool
352352
generate_counterexample: bool
353+
step_timeout: int | None
353354

354355
def __init__(self, args: dict[str, Any]) -> None:
355356
super().__init__(args)
@@ -383,6 +384,7 @@ def default() -> dict[str, Any]:
383384
'extra_module': None,
384385
'symbolic_caller': False,
385386
'generate_counterexample': False,
387+
'step_timeout': None,
386388
}
387389

388390
@staticmethod

src/kontrol/prove.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -461,6 +461,7 @@ def create_kcfg_explore() -> KCFGExplore:
461461
assume_defined=options.assume_defined,
462462
extra_module=lemmas_module,
463463
optimize_kcfg=options.optimize_kcfg,
464+
step_timeout=options.step_timeout,
464465
)
465466

466467
if progress is not None and task is not None:

0 commit comments

Comments
 (0)