Closed ehildenb closed 1 year ago
Once we have the testing harness for IMP
setup in teh pyk repo and at least 2 tests (one of successful call to get-model, one of failing call), we can merge it and then begin testing downstream with kevm. If things do not work with downstream KEVM, we'll add more tests to the test-harness and start making adjustments to the get-model endpoint.
The cterm_get_model
function is added in the cterm-get-model branch of pyk with two passing tests (one successful, and one unsuccessful). The integration with KEVM in the foundry_prove
function is added in foundry-counterexamples.
This issue is currently blocked on runtimeverification/haskell-backend#3616. While for some simple asserts the counterexamples are demonstrated correctly, the predicates involving chop
are not evaluated in the get-model
request, which produces incorrect assignments in the counterexamples.
runtimeverification/haskell-backend#3616 is fixed by adding an smt-hook
for the chop
function. This issue, however, helped identify that the SMT solver has issues with reasoning about non-linear arithmetic expressions (e.g., 2 ^ 256
), which might appear in other get-model
requests.
Related: https://github.com/runtimeverification/evm-semantics/issues/1700 and https://github.com/runtimeverification/evm-semantics/pull/1716
~Blocked on: https://github.com/runtimeverification/haskell-backend/issues/3616~
Following https://github.com/runtimeverification/evm-semantics/pull/1716, we now have the path-feasibility constraints being output on failing proofs. We want to improve on this by providing the user with concrete assignment to variables which demonstrates the failed test. This is now possible, because we have implemented the
get-model
endpoint in the Haskell backend: (https://github.com/runtimeverification/haskell-backend/commit/06c9515d802093b7e3267e2d3e7460f4a2cf8ede and https://github.com/runtimeverification/pyk/pull/509).We should expose this functionality in the KEVM foundry integration in these ways:
KCFGExplore.get_model(cterm: CTerm) -> Subst | None
, which takes a constrained term and returns either aSubst
(model found), orNone
, no model found. This should happen inKCFGExplore
class, and can have psuedocode like:KCFGExplore.get_model
, which tests it with IMP. That can look something like:foundry_prove
(here: https://github.com/runtimeverification/evm-semantics/blob/93e5e06800d88663bc206fcdafb15c7df917357b/kevm-pyk/src/kevm_pyk/foundry.py#L537), to check if there are any failing nodes, and if so, callget_model
on them, and output that information to the failure log. That can look something like this:kevm foundry-get-model TEST_NAME NODE_ID
, which gets a model for a specific node, and can take options--failing
and--pending
, to pre-populate the list of nodes to include in the get-model call (similar to howexec_foundry_show
works). We can also modifyexec_foundry_show
to include get-model information directly perhaps.