-
Notifications
You must be signed in to change notification settings - Fork 152
CFG visualization and progress saving #1447
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Proof resuming doesn't work well in my cases. When I run kevm foundry-prove
the second time without adding --reinit
, I'm getting a parsing error. The new claim file includes several unexpected _
. But otherwise okay.
@qian-hu if everything else is working you should not press "Request Changes", because then I need to actually take some action to address your changes. See our GitHub Guidelines. As it is, you haven't actually given me anything actionable to do, I need to see the state that is not working for parsing, and ideally to see the entire input you are trying to run. Also, it's a known issue that it cannot handle proof resuming from inside calls. I will be able to fix that too, but it will take me a couple weeks, it's not as straightforward as it sounds. |
I've pushed a commit adding parenthesis when printing the |
Now I am also getting the same error that @qian-hu mentioned when I try to run
It looks like there is an extra underscore being added to the variable names. |
@ehildenb I see. Here is an example of the inputs and the error state. I do
There are some unexpected token '_'. And the error is the same as @lucasmt provided. New commit and everything else LGTM. |
definition_dir = foundry_out / 'kompiled' | ||
use_directory = foundry_out / 'specs' | ||
use_directory.mkdir(parents=True, exist_ok=True) | ||
kcfgs_dir = foundry_out / 'kcfgs' | ||
foundry = Foundry(definition_dir, profile=profile, use_directory=use_directory) | ||
kcfg_file = kcfgs_dir / f'{test}.json' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Consider extracting definition_dir
, use_dir
, kcfg_dir
, kcfg_file
as functions of a new module config.py
, e.g.
def kcfg_file(out_dir: Path, test_name: str) -> Path:
return kcfg_dir(out_dir) / f'{test_name}.json'
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You mean as helpers so we're not re-computing them over and again? Maybe they could be fields in the KEVM
class so they're jsut set at function init?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I took a quick look at this, and seems like more trouble than it's worth at the moment. Will consider it in my local tree, see if I can find a solution.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You mean as helpers so we're not re-computing them over and again
Re-computing the values is fine. The point is to have a single definition of these expressions so that e.g. the folder layout can be easily reconfigured.
@@ -49,3 +103,35 @@ def abstract_cell_vars(cterm: KInner, keep_vars: Collection[KVariable] = ()) -> | |||
if type(subst[s]) is KVariable and not is_anon_var(subst[s]) and subst[s] not in keep_vars: | |||
subst[s] = abstract_term_safely(KVariable('_'), base_name=s) | |||
return substitute(config, subst) | |||
|
|||
|
|||
def sanitize_config(defn: KDefinition, init_term: KInner) -> KInner: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's create an issue to mark that there is duplicated functionality between kevm_pyk
and ksummarize
that eventually should be factored out.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think this duplicated functionality will be long-lived. Plan to remove calls to sanitize_config once we have execute
endpoint working (in my local branch, but not pushed up yet).
3aa4504
to
ed00d8e
Compare
@qian-hu thanks for the more detail. I've added a test that this does not happen, and fixed this bug you found in the state saving. |
77cf27f
to
b3349b0
Compare
908997a
to
32978ab
Compare
32978ab
to
5a54cd5
Compare
This PR is the simpler components pull out of #1443.
In particular, it has:
This brings in a decent amount of functionality needed for making progress incremental on Foundry proofs:
KEVM.add_invariant
, and makes sure that the initial LHS states used for proofs are in the language invariant.kevm foundry-prove
command will now save the final counterexample state in the CFG on disk, so progress can be resumed from there.kevm foundry-show OUT_DIR Contract.Test
for displaying current CFG. Has options:--[no-]minimize
: minimize the configuration output.--node NODE_ID
: also display the selected node's configuration and constraints (respects--[no-]minimize
, repetition allowed).--node-delta NODE_ID_1,NODE_ID_2
: display the configuration delta between the given nodes (respects--[no-]minimie
, repetition allowed).kevm foundry-list OUT_DIR
for listing the current CFGs, and their progress towards being proved. Has options:--[no-]details
: show the details about progress to being proved for each CFG, instead of just their passed/failed state.If you do something ilke
kevm foundry-prove --depth 100 ...
, the proof will fail at depth 100, and that state will be saved in the KCFG. Then you can continue progress from there withkevm foundry-prove ...
again, and it will start from the 100th state the next time (you can add the--lemma
argument the second call, for example). You can add the--reinit
option tofoundry-prove
to start the proof over.