Skip to content

Commit cbd2e3b

Browse files
committed
kevm-pyk/__main__: no need to sanitize configuration
1 parent 87b87ab commit cbd2e3b

File tree

1 file changed

+10
-9
lines changed

1 file changed

+10
-9
lines changed

kevm-pyk/src/kevm_pyk/__main__.py

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -372,13 +372,17 @@ def prove_it(id_and_cfg: Tuple[str, Tuple[KCFG, Path]]) -> bool:
372372
iterations += 1
373373
curr_node = cfg.frontier[0]
374374

375+
_LOGGER.info(
376+
f'Checking subsumption into target state {cfgid}: {shorten_hashes((curr_node.id, target_node.id))}'
377+
)
375378
if subst := foundry.check_implication(curr_node.cterm, target_node.cterm):
376379
cfg.create_cover(curr_node.id, target_node.id, witness=(subst, mlTop()))
377380
_LOGGER.info(f'Subsumed into target node: {shorten_hashes((curr_node.id, target_node.id))}')
378381
continue
379382

380383
cfg.add_expanded(curr_node.id)
381384

385+
_LOGGER.info(f'Checking terminal node {cfgid}: {shorten_hashes((curr_node.id))}')
382386
if KEVM.is_terminal(curr_node.cterm):
383387
_LOGGER.info(f'Terminal node {cfgid}: {shorten_hashes((curr_node.id))}.')
384388
continue
@@ -389,28 +393,27 @@ def prove_it(id_and_cfg: Tuple[str, Tuple[KCFG, Path]]) -> bool:
389393
_LOGGER.info(f'Found stuck node {cfgid}: {shorten_hashes(curr_node.id)}')
390394
continue
391395

392-
# next_state = CTerm(sanitize_config(foundry.definition, cterm.kast))
393-
next_state = cterm
394-
next_node = cfg.get_or_create_node(next_state)
396+
next_node = cfg.get_or_create_node(cterm)
397+
cfg.create_edge(curr_node.id, next_node.id, mlTop(), depth)
395398
_LOGGER.info(
396399
f'Found basic block at depth {depth} for {cfgid}: {shorten_hashes((curr_node.id, next_node.id))}.'
397400
)
398-
cfg.create_edge(curr_node.id, next_node.id, mlTop(), depth)
399401

400402
if len(next_cterms) == 0:
401403
continue
402404

403405
if len(next_cterms) == 1:
404406
raise ValueError(f'Found a single successor cterm: {(depth, cterm, next_cterms)}')
405407

408+
_LOGGER.info(f'Extracting branchings from node in {cfgid}: {shorten_hashes((curr_node.id))}')
406409
cfg.add_expanded(next_node.id)
407-
branches = KEVM.extract_branches(next_state)
410+
branches = KEVM.extract_branches(cterm)
408411
if len(list(branches)) > 0:
409412
_LOGGER.info(
410413
f'Found {len(list(branches))} branches at depth {depth} for {cfgid}: {[foundry.pretty_print(b) for b in branches]}'
411414
)
412415
for branch in branches:
413-
branch_cterm = next_state.add_constraint(branch)
416+
branch_cterm = cterm.add_constraint(branch)
414417
branch_node = cfg.get_or_create_node(branch_cterm)
415418
cfg.create_edge(next_node.id, branch_node.id, branch, 0)
416419
_LOGGER.info(f'Made split for {cfgid}: {shorten_hashes((next_node.id, branch_node.id))}')
@@ -419,9 +422,7 @@ def prove_it(id_and_cfg: Tuple[str, Tuple[KCFG, Path]]) -> bool:
419422
# _LOGGER.info(f'Made cover: {shorten_hashes((branch_node.id, next_node.id))}')
420423
else:
421424
_LOGGER.warning(f'Falling back to extracted next states for {cfgid}:\n{next_node.id}')
422-
branch_constraints = [
423-
[c for c in s.constraints if c not in next_state.constraints] for s in next_cterms
424-
]
425+
branch_constraints = [[c for c in s.constraints if c not in cterm.constraints] for s in next_cterms]
425426
_LOGGER.info(
426427
f'Found {len(list(next_cterms))} branches manually at depth 1 for {cfgid}: {[foundry.pretty_print(mlAnd(bc)) for bc in branch_constraints]}'
427428
)

0 commit comments

Comments
 (0)