Skip to content

Commit

Permalink
Use kdist.get
Browse files Browse the repository at this point in the history
  • Loading branch information
tothtamas28 committed Oct 18, 2023
1 parent be4b4c9 commit 8774a62
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
8 changes: 4 additions & 4 deletions src/kontrol/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
from argparse import ArgumentParser
from typing import TYPE_CHECKING

from kevm_pyk import kdist
from kevm_pyk.cli import node_id_like
from kevm_pyk.dist import DistTarget
from kevm_pyk.utils import arg_pair_of
from pyk.cli.utils import file_path
from pyk.proof.tui import APRProofViewer
Expand Down Expand Up @@ -87,14 +87,14 @@ def exec_solc_to_k(
main_module: str | None,
requires: list[str],
imports: list[str],
target: DistTarget | None = None,
target: str | None = None,
**kwargs: Any,
) -> None:
if target is None:
target = DistTarget.HASKELL
target = 'haskell'

k_text = solc_to_k(
definition_dir=target.get(),
definition_dir=kdist.get(target),
contract_file=contract_file,
contract_name=contract_name,
main_module=main_module,
Expand Down
6 changes: 3 additions & 3 deletions src/kontrol/kompile.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
from pathlib import Path
from typing import TYPE_CHECKING

from kevm_pyk.dist import DistTarget
from kevm_pyk import kdist
from kevm_pyk.kevm import KEVM
from kevm_pyk.kompile import KompileTarget, kevm_kompile
from pyk.kast.outer import KDefinition, KFlatModule, KImport, KRequire
Expand Down Expand Up @@ -82,7 +82,7 @@ def foundry_kompile(
copied_requires = []
copied_requires += [f'requires/{name}' for name in list(requires_paths.keys())]
imports = ['FOUNDRY']
kevm = KEVM(DistTarget.FOUNDRY.get())
kevm = KEVM(kdist.get('foundry'))
empty_config = kevm.definition.empty_config(Foundry.Sorts.FOUNDRY_CELL)
bin_runtime_definition = _foundry_to_contract_def(
empty_config=empty_config,
Expand All @@ -99,7 +99,7 @@ def foundry_kompile(
)

kevm = KEVM(
DistTarget.FOUNDRY.get(),
kdist.get('foundry'),
extra_unparsing_modules=(bin_runtime_definition.all_modules + contract_main_definition.all_modules),
)
foundry_contracts_file.write_text(kevm.pretty_print(bin_runtime_definition, unalias=False) + '\n')
Expand Down
4 changes: 2 additions & 2 deletions src/tests/integration/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
from pathlib import Path
from typing import TYPE_CHECKING

from kevm_pyk.dist import DistTarget
from kevm_pyk import kdist
from pyk.utils import check_dir_path

from kontrol.solc_to_k import solc_to_k
Expand All @@ -23,7 +23,7 @@ def gen_bin_runtime(contract_file: Path, output_dir: Path) -> tuple[Path, str]:
main_file = output_dir / f'{contract_name.lower()}-bin-runtime.k'

k_text = solc_to_k(
definition_dir=DistTarget.HASKELL.get(),
definition_dir=kdist.get('haskell'),
contract_file=contract_file,
contract_name=contract_name,
main_module=main_module_name,
Expand Down

0 comments on commit 8774a62

Please sign in to comment.