Cache claim parses
Nobody has claimed this yet.
Assessment
- Difficulty
- 5/5
- Estimated time
- Over a week
- Newbie friendliness
- 35/100
Research direction
Start in pyk/src/pyk/ktool/kprove.py at the kprove --dry-run invocation around line 265, then trace the outer parser and use_directory flow. Implement the parse-cache lookup and fallback described in the issue, including required files; done means unchanged definitions reuse cached JSON while cache misses still run the dry parse and store its result.
Written by the indexing model from the issue text.
Description
Currently, in KEVM, when we run any command involving a claim, we run kprove --dry-run ... to get the claims out of the text files. Then we check the hash of the claim to find out the proof id on disc, and load that proof if it already exists. For some large claim structures, this whole process can take ~100s, even though all we're doing is pruning a node from the proof for example, which can be done much quicker. But we need to read the claim in to know if the proof stored on disc is up-to-date or not (by parsing it and checking its hash).
We should cache parses of claims, by using the newly merged outer parser. Specifically:
- Here is where we invoke
kprove --dry-run: https://github.com/runtimeverification/k/blob/a03b705805f72b116219997993863e0051b14195/pyk/src/pyk/ktool/kprove.py#L265 - We should first (if the
use_directoryexists, otherwise skip):- Invoke the outer parser on the selected file.
- Read in any
require ...files as well, and invoke the outer parser on them. - Take a hash of the outer-parsed definition.
- Check if the given hash exists in the
f{use_directory}/parse_cache(or some similar folder), and if so read in the JSON representation of the parsed definition and return that. - If the given hash doesn't exist in the parse cache, then actually invoke
kprove --dry-run ...and store the parse in the cache.
We perhaps don't even need to do outer-parsing at this point, but we need to be able to slurp in the required files to make sure the parse cache is actually up to date, so maybe it does make sense to do outer parser, and it's pretty quick anyway.
Eventually, we want to improve the cache granularity to be able to detect "does reparsing need to happen for my claim?". If no syntax declarations changed, and only a handful of claims changed, then we only need to reparse that handful of claims.
- Dominant language
- Python
- Stars
- 591
- Forks
- 163
- PR merge metrics
- No merged PRs in 30d
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from runtimeverification/k
-
runtimeverification/k#4939 · 1 assignee ·
-
Concolic Explorer Open
Difficulty 5/5 Over a week Newbie friendliness 32/100
runtimeverification/k#4937 ·
-
Difficulty 5/5 Over a week Newbie friendliness 30/100
runtimeverification/k#4936 ·
-
type:epic
runtimeverification/k#4934 · 4 comments · 1 assignee ·
-
runtimeverification/k#4924 · 1 assignee ·
All issues in runtimeverification/k
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
bancolombia/sentinel#23 ·
-
test md OpenCI
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
-
integration:quickjs org:external priority:backlog topic:code-interpreter topic:middleware type:feature
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
langchain-ai/deepagents#6450 ·
-
bug client
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 74/100