Skip to content

Commit

Permalink
Remove typed maps (#155)
Browse files Browse the repository at this point in the history
* Remove MapInt2Int

* Remove MapIntToBytes

---------

Co-authored-by: devops <[email protected]>
Co-authored-by: Jost Berthold <[email protected]>
Co-authored-by: Bruce Collie <[email protected]>
  • Loading branch information
4 people authored Jul 10, 2024
1 parent e32daf5 commit 10ba7a7
Show file tree
Hide file tree
Showing 18 changed files with 55 additions and 67 deletions.
2 changes: 1 addition & 1 deletion deps/mx-semantics_release
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.1.88
0.1.92
22 changes: 11 additions & 11 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
pyk.url = "github:runtimeverification/k/v7.1.30?dir=pyk";
nixpkgs-pyk.follows = "pyk/nixpkgs";
poetry2nix.follows = "pyk/poetry2nix";
mx-semantics.url = "github:runtimeverification/mx-semantics/v0.1.88";
mx-semantics.url = "github:runtimeverification/mx-semantics/v0.1.92";
nixpkgs.follows = "k-framework/nixpkgs";
flake-utils.follows = "k-framework/flake-utils";
rv-utils.url = "github:runtimeverification/rv-nix-tools";
Expand Down
44 changes: 22 additions & 22 deletions kmxwasm/poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions kmxwasm/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 = "kmxwasm"
version = "0.1.72"
version = "0.1.73"
description = "Symbolic execution for the MultiversX blockchain with the Wasm semantics, using pyk."
authors = [
"Runtime Verification, Inc. <[email protected]>",
Expand All @@ -22,7 +22,7 @@ pytest-kmxwasm = "kmxwasm.testing.fixtures"

[tool.poetry.dependencies]
python = "^3.10"
kmultiversx = { git = "https://github.com/runtimeverification/mx-semantics.git", tag = "v0.1.88", subdirectory = "kmultiversx" }
kmultiversx = { git = "https://github.com/runtimeverification/mx-semantics.git", tag = "v0.1.92", subdirectory = "kmultiversx" }

[tool.poetry.group.dev.dependencies]
autoflake = "*"
Expand Down
12 changes: 1 addition & 11 deletions kmxwasm/src/kmxwasm/ast/mx.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

from pyk.kast.inner import KApply, KInner, KSequence, KSort, KToken, collect

from .collections import cell_map, full_list, k_map, simple_list
from .collections import cell_map, full_list, simple_list
from .generic import (
find_with_path,
get_with_path,
Expand Down Expand Up @@ -73,16 +73,6 @@ def listBytes(items: Iterable[KInner]) -> KInner: # noqa: N802
return full_list(concat_label='_ListBytes_', item_label='ListBytesItem', empty_label='.ListBytes', items=items)


def mapIntToBytes(int_to_bytes: dict[KInner, KInner]) -> KInner: # noqa: N802
return k_map(
concat_label='_MapIntToBytes_', item_label='_Int2Bytes|->_', empty_label='.MapIntToBytes', items=int_to_bytes
)


def mapIntToInt(int_to_int: dict[KInner, KInner]) -> KInner: # noqa: N802
return k_map(concat_label='_MapIntToInt_', item_label='_Int2Int|->_', empty_label='.MapIntToInt', items=int_to_int)


def bytesStack(items: Iterable[KInner]) -> KInner: # noqa: N802
return simple_list(concat_label='bytesStackList', empty_label='.List{"bytesStackList"}', items=items)

Expand Down
6 changes: 3 additions & 3 deletions kmxwasm/src/kmxwasm/proofs.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
from pyk.ktool.kprint import KPrint
from pyk.ktool.krun import KRunOutput, _krun
from pyk.prelude.bytes import BYTES, bytesToken_from_str
from pyk.prelude.collections import MAP
from pyk.prelude.k import K
from pyk.prelude.kbool import TRUE, andBool, notBool
from pyk.prelude.kint import INT, intToken, leInt, ltInt
Expand Down Expand Up @@ -60,7 +61,6 @@
SUMMARIES_DIR = DATA_DIR / 'summaries'

GENERATED_RULE_PRIORITY = 20
MAP = KSort('Map')

# Setting this disables compilation.
DEBUG_ID = '' #'ca3493ec081b72857fe96a8b6d3b3f969505e6bc09d91d16eaff9995f2c551ad'
Expand Down Expand Up @@ -661,8 +661,8 @@ def run_for_input(
('<funcIds>', 'MyFuncIds', MAP),
# Real symbolic inputs
# <elrond>
('<bufferHeap>', 'MyBuffers', KSort('MapIntToBytes')),
('<bigIntHeap>', 'MyInts', KSort('MapIntToInt')),
('<bufferHeap>', 'MyBuffers', MAP),
('<bigIntHeap>', 'MyInts', MAP),
# <elrond>/<node>/<callState>
('<callArgs>', 'MyCallArgs', KSort('ListBytes')),
('<caller>', 'MyCaller', BYTES),
Expand Down
6 changes: 2 additions & 4 deletions kmxwasm/src/kmxwasm/property_testing/wasm_krun_initializer.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@
get_contract_mod_idx_cell,
get_wasm_cell,
listBytes,
mapIntToBytes,
mapIntToInt,
replace_contract_mod_idx_cell,
replace_wasm_cell,
set_accounts_cell_content,
Expand Down Expand Up @@ -83,8 +81,8 @@ def __prepare_krun_cell(self, start_cell: KInner, first: KInner) -> KInner:
krun_cell = set_logging_cell_content(krun_cell, token(''))
krun_cell = set_generated_counter_cell_content(krun_cell, token(0))
krun_cell = set_call_args_cell_content(krun_cell, listBytes([]))
krun_cell = set_big_int_heap_cell_content(krun_cell, mapIntToInt({}))
krun_cell = set_buffer_heap_cell_content(krun_cell, mapIntToBytes({}))
krun_cell = set_big_int_heap_cell_content(krun_cell, map_empty())
krun_cell = set_buffer_heap_cell_content(krun_cell, map_empty())
krun_cell = set_exit_code_cell_content(krun_cell, token(0))
krun_cell = set_cur_block_timestamp_cell_content(krun_cell, token(0))
krun_cell = set_cur_block_nonce_cell_content(krun_cell, token(0))
Expand Down

Large diffs are not rendered by default.

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion kmxwasm/src/tests/integration/data/test_call_add-spec.json

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion kmxwasm/src/tests/integration/data/test_fund-spec.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion kmxwasm/src/tests/integration/data/test_swap-spec.json

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions kmxwasm/src/tests/integration/test_claims.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
from pyk.prelude.string import stringToken

from kmxwasm.ast.configuration import wrap_with_generated_top_if_needed
from kmxwasm.ast.mx import accountCellMap, bytesStack, directCall, listAsyncCall, listBytes, mapIntToBytes, mapIntToInt
from kmxwasm.ast.mx import accountCellMap, bytesStack, directCall, listAsyncCall, listBytes
from kmxwasm.ast.wasm import (
elemInstCellMap,
funcDefCellMap,
Expand Down Expand Up @@ -80,8 +80,8 @@ def callStateCell() -> KInner: # noqa: N802
),
),
wasmCell(),
KApply('<bigIntHeap>', mapIntToInt({})),
KApply('<bufferHeap>', mapIntToBytes({})),
KApply('<bigIntHeap>', map_empty()),
KApply('<bufferHeap>', map_empty()),
KApply('<bytesStack>', bytesStack([])),
KApply('<contractModIdx>', optionalInt_empty()),
KApply('<asyncCalls>', listAsyncCall([])),
Expand Down
2 changes: 1 addition & 1 deletion package/version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.1.72
0.1.73

0 comments on commit 10ba7a7

Please sign in to comment.