-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into _update-deps/runtimeverification/wasm-sema…
…ntics
- Loading branch information
Showing
4 changed files
with
77 additions
and
57 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -276,11 +276,13 @@ TEST_MANDOS := $(POETRY_RUN) mandos --definition-dir $(llvm_dir)/mandos-kompiled | |
# | ||
# > error: package `clap_derive v4.4.0` cannot be built because it requires rustc 1.70.0 or newer, | ||
# > while the currently active rustc version is 1.69.0-nightly | ||
# | ||
# To avoid this, we enforce minimal version resolution before building the contract | ||
# > Either upgrade to rustc 1.70.0 or newer, or use | ||
# > cargo update -p [email protected] --precise ver | ||
# | ||
# Use a precise clap version. | ||
mxpy-build/%: | ||
if [ ! -f "$*/Cargo.lock" ]; then \ | ||
cargo generate-lockfile --manifest-path $*/Cargo.toml -Z minimal-versions ; \ | ||
cargo update --manifest-path $*/Cargo.toml -p clap --precise 4.1.0 ; \ | ||
fi | ||
|
||
mxpy contract build "$*" --wasm-symbols --no-wasm-opt | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
from __future__ import annotations | ||
|
||
import json | ||
from typing import TYPE_CHECKING, TypeVar | ||
|
||
from pyk.kast.inner import KSort | ||
from pykwasm import wasm2kast | ||
|
||
if TYPE_CHECKING: | ||
from pyk.kast.inner import KInner | ||
from pyk.kast.kast import KAst | ||
from pyk.ktool.krun import KRun | ||
|
||
T = TypeVar('T') | ||
|
||
|
||
def kast_to_json(config: KAst) -> dict: | ||
return {'format': 'KAST', 'version': config.version(), 'term': config.to_dict()} | ||
|
||
|
||
def kast_to_json_str(config: KAst) -> str: | ||
return json.dumps(kast_to_json(config), sort_keys=True) | ||
|
||
|
||
def flatten(l: list[list[T]]) -> list[T]: | ||
return [item for sublist in l for item in sublist] | ||
|
||
|
||
def load_wasm(filename: str) -> KInner: | ||
with open(filename, 'rb') as f: | ||
return wasm2kast.wasm2kast(f, filename) | ||
|
||
|
||
def krun_config(krun: KRun, conf: KInner) -> KInner: | ||
conf_kore = krun.kast_to_kore(conf, sort=KSort('GeneratedTopCell')) | ||
res_conf_kore = krun.run_kore_term(conf_kore, pipe_stderr=False) | ||
return krun.kore_to_kast(res_conf_kore) |