Skip to content

Introduce RPC based prover to kevm #1538

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

Merged
merged 79 commits into from
Feb 17, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
79 commits
Select commit Hold shift + click to select a range
513edab
include/evm: name various CALL rules
ehildenb Dec 16, 2022
70863cd
kevm-pyk/kevm: add KEVM.{is_terminal,extract_branches,abstract}
ehildenb Oct 21, 2022
c76b39b
kevm-pyk/kevm: make KEVM.abstract a staticmethod
ehildenb Dec 9, 2022
c30ca5b
kevm-pyk/kevm: refine the KEVM.is_terminal check
ehildenb Dec 10, 2022
00acb95
kevm-pyk/kevm: avoid duplicate unique call
ehildenb Jan 13, 2023
4958d22
kevm-pyk/{__main__,utils}: use upstream KCFGExplore class for auto-ex…
ehildenb Oct 21, 2022
991178c
kevm-pyk/__main__: remove unused --lemma argument
ehildenb Jan 13, 2023
1000e70
kevm-pyk/__main__: remove unused arguments
ehildenb Jan 13, 2023
c92c476
kevm-pyk/__main__: set defauft for max_depth, max_iterations
ehildenb Jan 13, 2023
0fb1137
kevm-pyk/__main__: more default arguments
ehildenb Jan 13, 2023
e5672e9
kevm-pyk/{utils,__main__}: factor out parallel_kcfg_explore
ehildenb Jan 13, 2023
64e045b
kevm-pyk/gst_to_kore: fix quoting warning
ehildenb Jan 14, 2023
1c5adf9
kevm_pyk/{utils,__main__}: simplify passing proof problems to paralle…
ehildenb Jan 14, 2023
a076361
kevm_pyk/__main__: adapt exec_prove to use parallel_kcfg_explore
ehildenb Jan 14, 2023
64d056c
kevm_pyk/__main__: promote --md-selector to k_args from k_kompile_args
ehildenb Jan 14, 2023
90618ba
kevm-pyk/{utils,__main__}: correctly handle saving proofs to a given …
ehildenb Jan 14, 2023
b51efac
kevm-pyk/utils: pack arguments to _call_rpc correctly
ehildenb Jan 14, 2023
0a34e77
bin/kevm, kevm-pyk/__main__: add kevm view-kcfg command
ehildenb Jan 19, 2023
725e5cc
Makefile: go further for each block on CI, simplify initial states
ehildenb Nov 2, 2022
497f1ee
.github/test-pr: increase parallelism
ehildenb Dec 10, 2022
f021948
kevm-pyk/utils: remove unused function
ehildenb Jan 21, 2023
331a700
kevm-pyk/{utils,__main__}: adapt to new upstream KCFGExplore
ehildenb Jan 21, 2023
7a9083c
kevm-pyk/kevm: implement short-info method
ehildenb Jan 21, 2023
72ff154
kevm_pyk/kevm: avoid crashes due to missing cells in configuration
ehildenb Jan 23, 2023
9b8bee6
Makefile, tests/failing-symbolic.pyk: enable pyk prover for haskell b…
ehildenb Jan 23, 2023
e3453e5
kevm-pyk/: default to random base port, not hardcoded one
ehildenb Jan 24, 2023
d404ae8
Makefile: activate pyk before calling prover
ehildenb Jan 26, 2023
2d39b47
tests/foundry: exclude tests that reach #Bottom
ehildenb Jan 26, 2023
19070b9
tests/failing-symbolic.pyk: add tests which are not passing with incr…
ehildenb Jan 26, 2023
cb8d98d
kevm-pyk/__main__: default to checking implication every block of exe…
ehildenb Jan 26, 2023
8268181
tests/failing-symbolic.pyk: re-enable tests with incremental exploration
ehildenb Jan 26, 2023
26da816
.github/test-pr: increases parallelism
ehildenb Jan 26, 2023
7e0940e
kevm-pyk/__main__: new foundry-simplify-node command
ehildenb Jan 26, 2023
a6620b0
kevm-pyk/__main__: use KCFGExplore for foundry-simplify-node
ehildenb Jan 26, 2023
37828ca
Merge remote-tracking branch 'upstream/master' into incremental-explo…
ehildenb Jan 26, 2023
81372bf
tests/failing-symbolic.pyk: add failing tests
ehildenb Jan 26, 2023
6fd8c55
kevm-pyk/__main__: do not crash on bottom result
ehildenb Jan 26, 2023
6035524
.github/test-pr: remove --retry option for foundry proofs
ehildenb Jan 26, 2023
da7239c
Merge remote-tracking branch 'upstream/master' into incremental-explo…
ehildenb Jan 26, 2023
eab1a57
kevm-pyk/__main__: small fix to simplify_init logic
ehildenb Jan 26, 2023
7a2da24
tests/failing-symbolic.pyk: ignore functional specs
ehildenb Jan 26, 2023
3d7a3f4
kevm-pyk/__main__: factor out explore_args
ehildenb Jan 27, 2023
f58c372
Makefile: increase block size on proofs
ehildenb Jan 27, 2023
90c0afb
kevm-pyk/__main__: factor out more explore_args
ehildenb Jan 27, 2023
f84da03
kevm-pyk/kevm: remove comment
ehildenb Jan 27, 2023
2fbec0d
kevm-pyk/kevm: remove useless statement
ehildenb Jan 27, 2023
bd48de1
kevm-pyk/utils: simplify zip call
ehildenb Jan 27, 2023
8a0bfc8
kevm-pyk/{utils,__main__}: hoist effectful printing of results to mai…
ehildenb Jan 27, 2023
47ca4ee
Merge branch 'master' into incremental-exploration-next
ehildenb Jan 27, 2023
66aee72
Makefile: run proofs with poetry
ehildenb Jan 27, 2023
8749451
Merge branch 'master' into incremental-exploration-next
rv-jenkins Jan 27, 2023
b0ebe3e
kevm-pyk/__main__: make sure to actually save Foundry KCFGs
ehildenb Jan 27, 2023
0dcb273
kevm-pyk/{utils,__main__}: make sure we are using consistent naming s…
ehildenb Jan 28, 2023
6df29cd
tests/failing-symbolic.pyk: add bihu functional tests
ehildenb Jan 28, 2023
0526d70
tests/failing-symbolic.pyk: add another two failing tests
ehildenb Jan 28, 2023
d2a8b8b
Merge remote-tracking branch 'upstream/master' into incremental-explo…
ehildenb Jan 31, 2023
95d1663
Merge branch 'master' into incremental-exploration-next
ehildenb Feb 1, 2023
a1d237f
kevm-pyk/{utils,__main__}: use KCFGExplore.{read_cfg,write_cfg}
ehildenb Jan 28, 2023
5092c4e
kevm-pyk/__main__: use short info node printer in KCFGViewer
ehildenb Jan 28, 2023
112de12
bin/kevm: pass --debug through to kevm-pyk
ehildenb Jan 28, 2023
3e19f1f
kevm-pyk/__main__: correct how logging levels are handled
ehildenb Jan 28, 2023
8923a21
tests/foundry/exclude: remove tests failing due to out of gas
ehildenb Feb 1, 2023
2b1badd
.github/test-pr: decrease parallelism slightly
ehildenb Feb 1, 2023
adbb33f
Merge remote-tracking branch 'upstream/master' into incremental-explo…
ehildenb Feb 12, 2023
a424e88
tests/specs/functional/infinite-gas-spec: add failing gas comparison …
ehildenb Feb 12, 2023
0eb1cd5
include/kframework/{infinite-gas,lemmas/int-simplification}: add lemm…
ehildenb Feb 12, 2023
cc41cfa
kevm-pyk/kevm: remove unused method KEVM.abstract
ehildenb Feb 12, 2023
823539c
Makefile: bring back --no-simplify-init on CI
ehildenb Feb 12, 2023
3a4d792
tests/specs/function/infinite-gas-spec: another failing test
ehildenb Feb 12, 2023
9049ac5
include/{infinite-gas,lemmas/int-simplification}: more simplifications
ehildenb Feb 12, 2023
44608b8
Merge remote-tracking branch 'origin/master' into incremental-explora…
anvacaru Feb 14, 2023
3a274cc
Merge branch 'master' into incremental-exploration-next
anvacaru Feb 14, 2023
bc89bfa
Merge branch 'master' into incremental-exploration-next
ehildenb Feb 15, 2023
caa7644
Merge branch 'master' into incremental-exploration-next
ehildenb Feb 15, 2023
2df85c8
Merge remote-tracking branch 'upstream/master' into incremental-explo…
ehildenb Feb 16, 2023
cb62246
Merge remote-tracking branch 'upstream/master' into incremental-explo…
ehildenb Feb 16, 2023
0ea8de9
kevm-pyk/utils: remove unused function
ehildenb Feb 16, 2023
d7c902b
Merge branch 'master' into incremental-exploration-next
anvacaru Feb 17, 2023
b02b3cc
Merge branch 'master' into incremental-exploration-next
anvacaru Feb 17, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/test-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ jobs:
- name: 'Build Definitions'
run: docker exec -u user kevm-ci-haskell-${GITHUB_SHA} /bin/bash -c 'make build-prove-haskell -j4'
- name: 'Prove Haskell'
run: docker exec -u user kevm-ci-haskell-${GITHUB_SHA} /bin/bash -c 'make test-prove -j6 TEST_SYMBOLIC_BACKEND=haskell'
run: docker exec -u user kevm-ci-haskell-${GITHUB_SHA} /bin/bash -c 'make test-prove -j9 TEST_SYMBOLIC_BACKEND=haskell'
- name: 'Tear down Docker'
if: always()
run: |
Expand All @@ -85,7 +85,7 @@ jobs:
- name: 'Build Foundry'
run: docker exec -u user kevm-ci-foundry-${GITHUB_SHA} /bin/bash -c 'make build-foundry -j2'
- name: 'Test Foundry'
run: docker exec -u user kevm-ci-foundry-${GITHUB_SHA} /bin/bash -c 'make test-foundry -j2 FOUNDRY_PAR=4 KPROVE_OPTS=--retry'
run: docker exec -u user kevm-ci-foundry-${GITHUB_SHA} /bin/bash -c 'make test-foundry -j2 FOUNDRY_PAR=12'
- name: 'Tear down Docker'
if: always()
run: |
Expand Down
9 changes: 7 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -506,7 +506,7 @@ tests/foundry/out/kompiled/foundry.k: tests/foundry/out/kompiled/timestamp

tests/foundry/out/kompiled/foundry.k.prove: tests/foundry/out/kompiled/timestamp
$(KEVM) foundry-prove tests/foundry/out \
-j$(FOUNDRY_PAR) --no-simplify-init \
-j$(FOUNDRY_PAR) --no-simplify-init --max-depth 1000 \
$(KEVM_OPTS) $(KPROVE_OPTS) \
$(addprefix --exclude-test , $(shell cat tests/foundry/exclude))

Expand All @@ -533,7 +533,7 @@ tests/specs/examples/empty-bin-runtime.k: tests/specs/examples/Empty.sol $(KEVM_

.SECONDEXPANSION:
tests/specs/%.prove: tests/specs/% tests/specs/$$(firstword $$(subst /, ,$$*))/$$(KPROVE_FILE)/$(TEST_SYMBOLIC_BACKEND)/timestamp
$(KEVM) prove $< $(KEVM_OPTS) --backend $(TEST_SYMBOLIC_BACKEND) $(KPROVE_OPTS) \
$(POETRY_RUN) $(KEVM) prove $< $(KEVM_OPTS) --backend $(TEST_SYMBOLIC_BACKEND) $(KPROVE_OPTS) \
--definition tests/specs/$(firstword $(subst /, ,$*))/$(KPROVE_FILE)/$(TEST_SYMBOLIC_BACKEND)

tests/specs/%/timestamp: tests/specs/$$(firstword $$(subst /, ,$$*))/$$(KPROVE_FILE).$$(KPROVE_EXT) $(kevm_includes) $(plugin_includes) $(KEVM_BIN)/kevm
Expand Down Expand Up @@ -592,6 +592,7 @@ test-bchain: $(passing_bchain_tests:=.run)

prove_specs_dir := tests/specs
prove_failing_tests := $(shell cat tests/failing-symbolic.$(TEST_SYMBOLIC_BACKEND))
prove_pyk_failing_tests := $(shell cat tests/failing-symbolic.pyk)
prove_slow_tests := $(shell cat tests/slow.$(TEST_SYMBOLIC_BACKEND))
prove_skip_tests := $(prove_failing_tests) $(prove_slow_tests)
prove_benchmarks_tests := $(filter-out $(prove_skip_tests), $(wildcard $(prove_specs_dir)/benchmarks/*-spec.k))
Expand All @@ -602,6 +603,8 @@ prove_bihu_tests := $(filter-out $(prove_skip_tests), $(wildcard $(prove
prove_examples_tests := $(filter-out $(prove_skip_tests), $(wildcard $(prove_specs_dir)/examples/*-spec.k) $(wildcard $(prove_specs_dir)/examples/*-spec.md))
prove_mcd_tests := $(filter-out $(prove_skip_tests), $(wildcard $(prove_specs_dir)/mcd/*-spec.k))
prove_optimization_tests := $(filter-out $(prove_skip_tests), tests/specs/opcodes/evm-optimizations-spec.md)
prove_all_tests := $(prove_benchmarks_tests) $(prove_functional_tests) $(prove_opcodes_tests) $(prove_erc20_tests) $(prove_bihu_tests) $(prove_examples_tests) $(prove_mcd_tests) $(prove_optimization_tests)
prove_pyk_tests := $(filter-out $(prove_pyk_failing_tests), $(prove_all_tests))
prove_smoke_tests := $(shell cat tests/specs/smoke)

## best-effort list of prove kompiled definitions to produce ahead of time
Expand Down Expand Up @@ -643,6 +646,8 @@ test-failing-prove: $(prove_failing_tests:=.prove)
test-klab-prove: KPROVE_OPTS += --debugger
test-klab-prove: $(smoke_tests_prove:=.prove)

$(prove_pyk_tests:=.prove): KPROVE_OPTS += --pyk --max-depth 1000

# to generate optimizations.md, run: ./optimizer/optimize.sh &> output
tests/specs/opcodes/evm-optimizations-spec.md: include/kframework/optimizations.md
cat $< | sed 's/^rule/claim/' | sed 's/EVM-OPTIMIZATIONS/EVM-OPTIMIZATIONS-SPEC/' | grep -v 'priority(40)' > $@
Expand Down
24 changes: 13 additions & 11 deletions bin/kevm
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ run_kevm_pyk() {
local pyk_command pyk_args
pyk_command="$1" ; shift
case "${pyk_command}" in
kompile|run|prove|solc-to-k|foundry-kompile|foundry-prove)
kompile|run|prove|solc-to-k|foundry-kompile|foundry-prove|view-kcfg)
pyk_args=(--definition "${backend_dir}")
pyk_args+=(-I "${INSTALL_INCLUDE}/kframework")
;;
Expand Down Expand Up @@ -365,6 +365,7 @@ kevm_port='8545'
kevm_host='127.0.0.1'
[[ ! "${run_command}" == prove ]] || backend=haskell
[[ ! "${run_command}" == solc-to-k ]] || backend=haskell
[[ ! "${run_command}" == view-kcfg ]] || backend=haskell
[[ ! "${run_command}" == foundry-* ]] || backend=foundry
[[ ! "${run_command}" == interpret ]] || unparse=false
args=()
Expand Down Expand Up @@ -410,7 +411,7 @@ if ${pyk}; then
fi

# get the run file
if [[ "${run_command}" != foundry-* ]]; then
if [[ "${run_command}" != foundry-* ]] && [[ "${run_command}" != 'view-kcfg' ]]; then
run_file="$1" ; shift
if [[ "${run_file}" == '-' ]]; then
tmp_input="$(mktemp)"
Expand All @@ -432,14 +433,15 @@ cCHAINID_kast="#token(\"${chainid}\",\"Int\")"
! ${debug} || set -x

case "$run_command-$backend" in
kompile-@(llvm|haskell|node|foundry) ) run_kompile "$@" ;;
run-@(llvm|haskell) ) run_krun "$@" ;;
kast-@(llvm|haskell) ) run_kast "$@" ;;
interpret-@(llvm|haskell) ) run_interpret "$@" ;;
prove-@(haskell|foundry) ) run_prove "$@" ;;
search-@(haskell) ) run_search "$@" ;;
klab-view-* ) view_klab "$@" ;;
solc-to-k-* ) run_solc "$@" ;;
foundry-* ) run_foundry "$@" ;;
kompile-@(llvm|haskell|node|foundry) ) run_kompile "$@" ;;
run-@(llvm|haskell) ) run_krun "$@" ;;
kast-@(llvm|haskell) ) run_kast "$@" ;;
interpret-@(llvm|haskell) ) run_interpret "$@" ;;
prove-@(haskell|foundry) ) run_prove "$@" ;;
search-@(haskell) ) run_search "$@" ;;
klab-view-* ) view_klab "$@" ;;
view-kcfg-* ) run_kevm_pyk view-kcfg "$@" ;;
solc-to-k-* ) run_solc "$@" ;;
foundry-* ) run_foundry "$@" ;;
*) ${KEVM} help ; fatal "Unknown command on backend: $run_command $backend" ;;
esac
Loading