Skip to content
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

"execute" endpoint returns SMT error instead of Branching result #373

Closed
geo2a opened this issue Nov 16, 2023 · 1 comment · Fixed by #392
Closed

"execute" endpoint returns SMT error instead of Branching result #373

geo2a opened this issue Nov 16, 2023 · 1 comment · Fixed by #392
Assignees

Comments

@geo2a
Copy link
Contributor

geo2a commented Nov 16, 2023

Consider the following scenario:

  • Proxy receives an "execute" request
  • Booster aborts and falls back to Kore
  • Kore's "execute" handler cannot decide a rule side-condition, emits a DecidePredicateUnknown warning and returns Branching
  • Proxy gets the branching result and applies the post-exec simplification to the three sub-states: the pre-branch state and two post-branch states. Now, the post-exec simplification effectively sends and internal "simplify" request to Kore. Naturally, it fails to decide the same predicate (that's Kore branched in the first place), but now it throws an DecidePredicateUnknown error
  • The error is caught by the Proxy's handler, wrapped into JsonRPC error and returned to the client.

In the end, the client gets a not-so-helpful error (which we've just made a little more helpful in #371). What the client should get instead is the Branching response, and, perhaps, the predicate that could not be decided.

I suppose the same problem is the case for all other execute results as well.

@geo2a
Copy link
Contributor Author

geo2a commented Nov 20, 2023

The culprit seems to be Kore.Rewrite.SMT.Evaluator.decidePredicate, which throws ErrorDecidePredictateUnknwon when called by Kore.Rewrite.SMT.Evaluator.filterMultiOr.

Do we ever want decidePredicate throw DecidePredictateUnknwon as error, rather than emitting a warning? We probably do not want the error when we process an "execute" request. However, when processing "simplify", we may want the exception, so that we can catch it and return to the client the unknown predicate to pretty print.

rv-jenkins added a commit that referenced this issue Dec 8, 2023
Fixes
#373

This PR makes `kore-rpc-booster` return `"execute"` responses with
`"reason": "aborted"` in cases when Kore's simplifier fails due to
`DecidePredicateUnknown` in the post-exec simplification in `Proxy.hs`.

**Scenario before**
```
"execute" request -> booster execute (X steps) > kore execute (0-1steps) -> kore simplify -> DecidePredicateUnknown -> JsonRpcError`
``` 
returning `JsonRpcError` resulted in loosing information gained by
executing in booster for X steps + in kore for up to 1 step.
**Scenario now**
```
"execute" request -> booster execute (X steps) > kore execute (0-1steps) -> kore simplify -> DecidePredicateUnknown -> ExecuteResult {reason=Aborted, unknownPredicate = <predicate>}`
``` 
this this change, we return the reached state (may be branching) and do
not lose information anymore. Additionaly, we return the unknown
predicate, so that `pyk` can decide what to do with these.

PR to `pyk` that takes advantage of this feature by intrroducing
`Undecided` nodes to KCFG:
runtimeverification/pyk#744

---------

Co-authored-by: Samuel Balco <[email protected]>
Co-authored-by: github-actions <[email protected]>
Co-authored-by: rv-jenkins <[email protected]>
jberthold pushed a commit to runtimeverification/haskell-backend that referenced this issue Apr 10, 2024
Fixes
runtimeverification/hs-backend-booster#373

This PR makes `kore-rpc-booster` return `"execute"` responses with
`"reason": "aborted"` in cases when Kore's simplifier fails due to
`DecidePredicateUnknown` in the post-exec simplification in `Proxy.hs`.

**Scenario before**
```
"execute" request -> booster execute (X steps) > kore execute (0-1steps) -> kore simplify -> DecidePredicateUnknown -> JsonRpcError`
``` 
returning `JsonRpcError` resulted in loosing information gained by
executing in booster for X steps + in kore for up to 1 step.
**Scenario now**
```
"execute" request -> booster execute (X steps) > kore execute (0-1steps) -> kore simplify -> DecidePredicateUnknown -> ExecuteResult {reason=Aborted, unknownPredicate = <predicate>}`
``` 
this this change, we return the reached state (may be branching) and do
not lose information anymore. Additionaly, we return the unknown
predicate, so that `pyk` can decide what to do with these.

PR to `pyk` that takes advantage of this feature by intrroducing
`Undecided` nodes to KCFG:
runtimeverification/pyk#744

---------

Co-authored-by: Samuel Balco <[email protected]>
Co-authored-by: github-actions <[email protected]>
Co-authored-by: rv-jenkins <[email protected]>
jberthold pushed a commit to runtimeverification/haskell-backend that referenced this issue Apr 10, 2024
Fixes
runtimeverification/hs-backend-booster#373

This PR makes `kore-rpc-booster` return `"execute"` responses with
`"reason": "aborted"` in cases when Kore's simplifier fails due to
`DecidePredicateUnknown` in the post-exec simplification in `Proxy.hs`.

**Scenario before**
```
"execute" request -> booster execute (X steps) > kore execute (0-1steps) -> kore simplify -> DecidePredicateUnknown -> JsonRpcError`
``` 
returning `JsonRpcError` resulted in loosing information gained by
executing in booster for X steps + in kore for up to 1 step.
**Scenario now**
```
"execute" request -> booster execute (X steps) > kore execute (0-1steps) -> kore simplify -> DecidePredicateUnknown -> ExecuteResult {reason=Aborted, unknownPredicate = <predicate>}`
``` 
this this change, we return the reached state (may be branching) and do
not lose information anymore. Additionaly, we return the unknown
predicate, so that `pyk` can decide what to do with these.

PR to `pyk` that takes advantage of this feature by intrroducing
`Undecided` nodes to KCFG:
runtimeverification/pyk#744

---------

Co-authored-by: Samuel Balco <[email protected]>
Co-authored-by: github-actions <[email protected]>
Co-authored-by: rv-jenkins <[email protected]>
jberthold pushed a commit to runtimeverification/haskell-backend that referenced this issue Apr 10, 2024
Fixes
runtimeverification/hs-backend-booster#373

This PR makes `kore-rpc-booster` return `"execute"` responses with
`"reason": "aborted"` in cases when Kore's simplifier fails due to
`DecidePredicateUnknown` in the post-exec simplification in `Proxy.hs`.

**Scenario before**
```
"execute" request -> booster execute (X steps) > kore execute (0-1steps) -> kore simplify -> DecidePredicateUnknown -> JsonRpcError`
``` 
returning `JsonRpcError` resulted in loosing information gained by
executing in booster for X steps + in kore for up to 1 step.
**Scenario now**
```
"execute" request -> booster execute (X steps) > kore execute (0-1steps) -> kore simplify -> DecidePredicateUnknown -> ExecuteResult {reason=Aborted, unknownPredicate = <predicate>}`
``` 
this this change, we return the reached state (may be branching) and do
not lose information anymore. Additionaly, we return the unknown
predicate, so that `pyk` can decide what to do with these.

PR to `pyk` that takes advantage of this feature by intrroducing
`Undecided` nodes to KCFG:
runtimeverification/pyk#744

---------

Co-authored-by: Samuel Balco <[email protected]>
Co-authored-by: github-actions <[email protected]>
Co-authored-by: rv-jenkins <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant