@@ -389,34 +389,35 @@ def prove_it(id_and_cfg: Tuple[str, Tuple[KCFG, Path]]) -> bool:
389
389
f'Target state reached at depth { depth } , inserted edge from { shorten_hashes ((curr_node .id ))} to { shorten_hashes ((target_node .id ))} .'
390
390
)
391
391
392
- next_state = CTerm (sanitize_config (foundry .definition , result ))
393
- next_node = cfg .get_or_create_node (next_state )
394
- if next_node != curr_node :
395
- _LOGGER .info (f'Found basic block at depth { depth } : { shorten_hashes ((curr_node .id , next_node .id ))} .' )
396
- cfg .create_edge (curr_node .id , next_node .id , mlTop (), depth )
397
-
398
- if KEVM .is_terminal (next_node .cterm ):
399
- cfg .add_expanded (next_node .id )
400
- _LOGGER .info (f'Terminal node: { shorten_hashes ((curr_node .id ))} .' )
401
-
402
- elif branching :
403
- branches = KEVM .extract_branches (next_state )
404
- if not branches :
405
- raise ValueError (
406
- f'Could not extract branch condition:\n { foundry .pretty_print (minimize_term (result ))} '
392
+ else :
393
+ next_state = CTerm (sanitize_config (foundry .definition , result ))
394
+ next_node = cfg .get_or_create_node (next_state )
395
+ if next_node != curr_node :
396
+ _LOGGER .info (f'Found basic block at depth { depth } : { shorten_hashes ((curr_node .id , next_node .id ))} .' )
397
+ cfg .create_edge (curr_node .id , next_node .id , mlTop (), depth )
398
+
399
+ if KEVM .is_terminal (next_node .cterm ):
400
+ cfg .add_expanded (next_node .id )
401
+ _LOGGER .info (f'Terminal node: { shorten_hashes ((curr_node .id ))} .' )
402
+
403
+ elif branching :
404
+ branches = KEVM .extract_branches (next_state )
405
+ if not branches :
406
+ raise ValueError (
407
+ f'Could not extract branch condition:\n { foundry .pretty_print (minimize_term (result ))} '
408
+ )
409
+ cfg .add_expanded (next_node .id )
410
+ _LOGGER .info (
411
+ f'Found { len (list (branches ))} branches at depth { depth } : { [foundry .pretty_print (b ) for b in branches ]} '
407
412
)
408
- cfg .add_expanded (next_node .id )
409
- _LOGGER .info (
410
- f'Found { len (list (branches ))} branches at depth { depth } : { [foundry .pretty_print (b ) for b in branches ]} '
411
- )
412
- for branch in branches :
413
- branch_cterm = next_state .add_constraint (branch )
414
- branch_node = cfg .get_or_create_node (branch_cterm )
415
- cfg .create_edge (next_node .id , branch_node .id , branch , 0 )
416
- _LOGGER .info (f'Made split: { shorten_hashes ((next_node .id , branch_node .id ))} ' )
417
- # TODO: have to store case splits as rewrites because of how frontier is handled for covers
418
- # cfg.create_cover(branch_node.id, next_node.id)
419
- # _LOGGER.info(f'Made cover: {shorten_hashes((branch_node.id, next_node.id))}')
413
+ for branch in branches :
414
+ branch_cterm = next_state .add_constraint (branch )
415
+ branch_node = cfg .get_or_create_node (branch_cterm )
416
+ cfg .create_edge (next_node .id , branch_node .id , branch , 0 )
417
+ _LOGGER .info (f'Made split: { shorten_hashes ((next_node .id , branch_node .id ))} ' )
418
+ # TODO: have to store case splits as rewrites because of how frontier is handled for covers
419
+ # cfg.create_cover(branch_node.id, next_node.id)
420
+ # _LOGGER.info(f'Made cover: {shorten_hashes((branch_node.id, next_node.id))}')
420
421
421
422
_write_cfg (cfg , cfgpath )
422
423
0 commit comments