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

Make kevm-dist extensible #2114

Merged
merged 8 commits into from
Oct 18, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
7 changes: 5 additions & 2 deletions kevm-pyk/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ build-backend = "poetry.core.masonry.api"

[tool.poetry]
name = "kevm-pyk"
version = "1.0.316"
version = "1.0.317"
description = ""
authors = [
"Runtime Verification, Inc. <contact@runtimeverification.com>",
Expand Down Expand Up @@ -42,10 +42,13 @@ pyupgrade = "*"
[tool.poetry.scripts]
kevm = "kevm_pyk.__main__:main"
kevm-pyk = "kevm_pyk.__main__:main"
kevm-dist = "kevm_pyk.dist:main"
kevm-dist = "kevm_pyk.kdist.__main__:main"
gst-to-kore = "kevm_pyk.gst_to_kore:main"
kontrolx = "kontrolx.__main__:main"

[tool.poetry.plugins.kdist]
evm-semantics = "kevm_pyk.kdist.plugin"

[tool.isort]
profile = "black"
line_length = 120
Expand Down
2 changes: 1 addition & 1 deletion kevm-pyk/src/kevm_pyk/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@
from typing import Final


VERSION: Final = '1.0.316'
VERSION: Final = '1.0.317'
19 changes: 9 additions & 10 deletions kevm-pyk/src/kevm_pyk/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,8 @@
from pyk.proof.tui import APRProofViewer
from pyk.utils import single

from . import VERSION, config
from . import VERSION, config, kdist
from .cli import KEVMCLIArgs, node_id_like
from .dist import DistTarget
from .gst_to_kore import SORT_ETHEREUM_SIMULATION, gst_to_kore, kore_pgm_to_kore
from .kevm import KEVM, KEVMSemantics, kevm_node_printer
from .kompile import KompileTarget, kevm_kompile
Expand Down Expand Up @@ -160,7 +159,7 @@ def exec_prove_legacy(
_ignore_arg(kwargs, 'md_selector', f'--md-selector: {kwargs["md_selector"]}')

if definition_dir is None:
definition_dir = DistTarget.HASKELL.get()
definition_dir = kdist.get('haskell')

kevm = KEVM(definition_dir, use_directory=save_directory)

Expand Down Expand Up @@ -231,7 +230,7 @@ def exec_prove(
md_selector = 'k'

if definition_dir is None:
definition_dir = DistTarget.HASKELL.get()
definition_dir = kdist.get('haskell')

if smt_timeout is None:
smt_timeout = 300
Expand Down Expand Up @@ -525,16 +524,16 @@ def exec_run(
schedule: str,
mode: str,
chainid: int,
target: DistTarget | None = None,
target: str | None = None,
save_directory: Path | None = None,
debugger: bool = False,
**kwargs: Any,
) -> None:
if target is None:
target = DistTarget.LLVM
target = 'llvm'

_ignore_arg(kwargs, 'definition_dir', f'--definition: {kwargs["definition_dir"]}')
kevm = KEVM(target.get(), use_directory=save_directory)
kevm = KEVM(kdist.get(target), use_directory=save_directory)

try:
json_read = json.loads(input_file.read_text())
Expand Down Expand Up @@ -562,15 +561,15 @@ def exec_kast(
schedule: str,
mode: str,
chainid: int,
target: DistTarget | None = None,
target: str | None = None,
save_directory: Path | None = None,
**kwargs: Any,
) -> None:
if target is None:
target = DistTarget.LLVM
target = 'llvm'

_ignore_arg(kwargs, 'definition_dir', f'--definition: {kwargs["definition_dir"]}')
kevm = KEVM(target.get(), use_directory=save_directory)
kevm = KEVM(kdist.get(target), use_directory=save_directory)

try:
json_read = json.loads(input_file.read_text())
Expand Down
3 changes: 1 addition & 2 deletions kevm-pyk/src/kevm_pyk/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
from pyk.cli.args import KCLIArgs
from pyk.cli.utils import dir_path

from .dist import DistTarget
from .utils import arg_pair_of

if TYPE_CHECKING:
Expand Down Expand Up @@ -38,7 +37,7 @@ class KEVMCLIArgs(KCLIArgs):
@cached_property
def target_args(self) -> ArgumentParser:
args = ArgumentParser(add_help=False)
args.add_argument('--target', type=DistTarget, choices=list(DistTarget))
args.add_argument('--target', choices=['llvm', 'haskell', 'haskell-standalone', 'foundry'])
return args

@cached_property
Expand Down
Loading