Skip to content

Commit 54882e7

Browse files
committed
kevm-pyk/__main__: better logging/error messages
1 parent a958158 commit 54882e7

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

kevm-pyk/src/kevm_pyk/__main__.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -371,7 +371,7 @@ def prove_it(id_and_cfg: Tuple[str, Tuple[KCFG, Path]]) -> bool:
371371
iterations += 1
372372
curr_node = cfg.frontier[0]
373373
cfg.add_expanded(curr_node.id)
374-
_LOGGER.info(f'Advancing proof from node: {shorten_hashes(curr_node.id)}')
374+
_LOGGER.info(f'Advancing proof from node {cfgid}: {shorten_hashes(curr_node.id)}')
375375
edge = KCFG.Edge(curr_node, target_node, mlTop(), -1)
376376
claim = edge.to_claim()
377377
claim_id = f'gen-{curr_node.id}-to-{target_node.id}'
@@ -382,35 +382,35 @@ def prove_it(id_and_cfg: Tuple[str, Tuple[KCFG, Path]]) -> bool:
382382
if result == mlTop():
383383
cfg.create_edge(curr_node.id, target_node.id, mlTop(), depth)
384384
_LOGGER.info(
385-
f'Target state reached at depth {depth}, inserted edge from {shorten_hashes((curr_node.id))} to {shorten_hashes((target_node.id))}.'
385+
f'Target state reached at depth {depth} for {cfgid}: {shorten_hashes((curr_node.id, target_node.id))}.'
386386
)
387387

388388
else:
389389
next_state = CTerm(sanitize_config(foundry.definition, result))
390390
next_node = cfg.get_or_create_node(next_state)
391391
if next_node != curr_node:
392-
_LOGGER.info(f'Found basic block at depth {depth}: {shorten_hashes((curr_node.id, next_node.id))}.')
392+
_LOGGER.info(f'Found basic block at depth {depth} for {cfgid}: {shorten_hashes((curr_node.id, next_node.id))}.')
393393
cfg.create_edge(curr_node.id, next_node.id, mlTop(), depth)
394394

395395
if KEVM.is_terminal(next_node.cterm):
396396
cfg.add_expanded(next_node.id)
397-
_LOGGER.info(f'Terminal node: {shorten_hashes((curr_node.id))}.')
397+
_LOGGER.info(f'Terminal node {cfgid}: {shorten_hashes((curr_node.id))}.')
398398

399399
elif branching:
400400
branches = KEVM.extract_branches(next_state)
401401
if not branches:
402402
raise ValueError(
403-
f'Could not extract branch condition:\n{foundry.pretty_print(minimize_term(result))}'
403+
f'Could not extract branch condition {cfgid}:\n{foundry.pretty_print(minimize_term(result))}'
404404
)
405405
cfg.add_expanded(next_node.id)
406406
_LOGGER.info(
407-
f'Found {len(list(branches))} branches at depth {depth}: {[foundry.pretty_print(b) for b in branches]}'
407+
f'Found {len(list(branches))} branches at depth {depth} for {cfgid}: {[foundry.pretty_print(b) for b in branches]}'
408408
)
409409
for branch in branches:
410410
branch_cterm = next_state.add_constraint(branch)
411411
branch_node = cfg.get_or_create_node(branch_cterm)
412412
cfg.create_edge(next_node.id, branch_node.id, branch, 0)
413-
_LOGGER.info(f'Made split: {shorten_hashes((next_node.id, branch_node.id))}')
413+
_LOGGER.info(f'Made split for {cfgid}: {shorten_hashes((next_node.id, branch_node.id))}')
414414
# TODO: have to store case splits as rewrites because of how frontier is handled for covers
415415
# cfg.create_cover(branch_node.id, next_node.id)
416416
# _LOGGER.info(f'Made cover: {shorten_hashes((branch_node.id, next_node.id))}')

0 commit comments

Comments
 (0)