Skip to content
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
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ RUN python3 -m pip install --upgrade pip

RUN wget -O rustup.sh https://sh.rustup.rs && \
chmod +x rustup.sh && \
./rustup.sh --verbose --default-toolchain nightly-2023-12-11 --target wasm32-unknown-unknown -y
./rustup.sh --verbose --target wasm32-unknown-unknown -y

ENV PATH="/home/${USER}/.cargo/bin:${PATH}"

RUN cargo install multiversx-sc-meta --version ~0.47 --locked
RUN cargo install multiversx-sc-meta --version ~0.50 --locked
2 changes: 1 addition & 1 deletion deps/mx-sdk-rs
Submodule mx-sdk-rs updated 2020 files
2 changes: 1 addition & 1 deletion kmultiversx/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 = "kmultiversx"
version = "0.1.61"
version = "0.1.62"
description = "Python tools for Elrond semantics"
authors = [
"Runtime Verification, Inc. <contact@runtimeverification.com>",
Expand Down
18 changes: 14 additions & 4 deletions kmultiversx/src/kmultiversx/scenario.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,14 @@
from pyk.prelude.collections import set_of
from pykwasm.kwasm_ast import KBytes, KInt, KString

from kmultiversx.utils import flatten, kast_to_json_str, krun_config, load_wasm, read_mandos_runtime
from kmultiversx.utils import (
flatten,
kast_to_json_str,
krun_config,
load_wasm,
load_wasm_from_mxsc,
read_mandos_runtime,
)

if TYPE_CHECKING:
from pyk.kast.inner import KInner
Expand Down Expand Up @@ -445,7 +452,7 @@ def mandos_to_deploy_tx(tx: dict, filename: str, output_dir: str) -> KInner:
value = mandos_int_to_kint(get_egld_value(tx))
arguments = mandos_arguments_to_klist(tx['arguments'])
gas_limit = mandos_int_to_kint(tx['gasLimit'])
gas_price = mandos_int_to_kint(tx['gasPrice'], default_when_empty=0)
gas_price = mandos_int_to_kint(tx.get('gasPrice', '0'), default_when_empty=0)

code = get_contract_code(tx['contractCode'], filename)
assert isinstance(code, str)
Expand All @@ -462,7 +469,7 @@ def mandos_to_call_tx(tx: dict) -> KInner:
function = KWasmString(tx['function'])
arguments = mandos_arguments_to_klist(tx.get('arguments', []))
gas_limit = mandos_int_to_kint(tx['gasLimit'])
gas_price = mandos_int_to_kint(tx['gasPrice'], default_when_empty=0)
gas_price = mandos_int_to_kint(tx.get('gasPrice', '0'), default_when_empty=0)

return KApply('callTx', [sender, to, value, esdt_value, function, arguments, gas_limit, gas_price])

Expand Down Expand Up @@ -574,6 +581,9 @@ def file_to_module_decl(filename: str, output_dir: str) -> KInner:
return load_wasm(filename)
if filename[-5:] == '.wast' or filename[-4:] == '.wat':
return wat_file_to_module_decl(filename, output_dir)
if filename[-10:] == '.mxsc.json':
return load_wasm_from_mxsc(filename)

raise ValueError(f'Filetype not yet supported: {filename}')


Expand Down Expand Up @@ -602,7 +612,7 @@ def get_external_file_path(test_file: str, rel_path_to_new_file: str) -> str:


def get_contract_code(code: str, filename: str) -> Optional[str]:
if code[0:5] == 'file:':
if code[0:5] in ('file:', 'mxsc:'):
return get_external_file_path(filename, code[5:])
if code == '':
return None
Expand Down
9 changes: 9 additions & 0 deletions kmultiversx/src/kmultiversx/utils.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
from __future__ import annotations

import json
from io import BytesIO
from pathlib import Path
from typing import TYPE_CHECKING, TypeVar

Expand Down Expand Up @@ -51,6 +52,14 @@ def load_wasm(filename: str) -> KInner:
return wasm2kast.wasm2kast(f, filename)


def load_wasm_from_mxsc(filename: str) -> KInner:
with open(filename, 'r') as f:
contract_json = json.load(f)
code_hex = contract_json['code']
code_bytes = bytes.fromhex(code_hex)
return wasm2kast.wasm2kast(BytesIO(code_bytes), filename)


def krun_config(krun: KRun, conf: KInner, pipe_stderr: bool = False) -> KInner:
conf_kore = krun.kast_to_kore(conf, sort=GENERATED_TOP_CELL)
res_conf_kore = krun.run_pattern(conf_kore, pipe_stderr=pipe_stderr)
Expand Down
2 changes: 1 addition & 1 deletion package/version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.1.61
0.1.62
3 changes: 1 addition & 2 deletions src/esdt-system-sc/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,7 @@ publish = false
path = "src/esdt_system_sc.rs"

[dependencies.multiversx-sc]
version = "0.43.4"
path = "../../deps/mx-sdk-rs/framework/base"
version = "0.50.1"

[dev-dependencies.multiversx-sc-scenario]
version = "0.43.4"
Expand Down
3 changes: 1 addition & 2 deletions src/esdt-system-sc/meta/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,4 @@ publish = false
path = ".."

[dependencies.multiversx-sc-meta]
version = "0.43.4"
path = "../../../deps/mx-sdk-rs/framework/meta"
version = "0.50.1"
3 changes: 1 addition & 2 deletions src/esdt-system-sc/wasm/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,7 @@ panic = "abort"
path = ".."

[dependencies.multiversx-sc-wasm-adapter]
version = "0.43.4"
path = "../../../deps/mx-sdk-rs/framework/wasm-adapter"
version = "0.50.1"

[workspace]
members = ["."]
2 changes: 1 addition & 1 deletion src/testapi/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ edition = "2021"
num-bigint = "0.4.2"

[dependencies.multiversx-sc]
version = "0.48.0"
version = "0.50.1"

[lib]
path = "src/testapi.rs"
4 changes: 3 additions & 1 deletion tests/basic_features.test
Original file line number Diff line number Diff line change
Expand Up @@ -37,13 +37,13 @@ deps/mx-sdk-rs/contracts/feature-tests/basic-features/scenarios/managed_buffer_c
deps/mx-sdk-rs/contracts/feature-tests/basic-features/scenarios/managed_buffer_copy_slice.scen.json
deps/mx-sdk-rs/contracts/feature-tests/basic-features/scenarios/managed_buffer_eq.scen.json
deps/mx-sdk-rs/contracts/feature-tests/basic-features/scenarios/managed_vec_address_push.scen.json
deps/mx-sdk-rs/contracts/feature-tests/basic-features/scenarios/managed_vec_array_push.scen.json
deps/mx-sdk-rs/contracts/feature-tests/basic-features/scenarios/managed_vec_biguint_push.scen.json
deps/mx-sdk-rs/contracts/feature-tests/basic-features/scenarios/only_owner.scen.json
deps/mx-sdk-rs/contracts/feature-tests/basic-features/scenarios/only_user_account.scen.json
deps/mx-sdk-rs/contracts/feature-tests/basic-features/scenarios/panic.scen.json
deps/mx-sdk-rs/contracts/feature-tests/basic-features/scenarios/return_codes.scen.json
deps/mx-sdk-rs/contracts/feature-tests/basic-features/scenarios/sc_properties.scen.json
deps/mx-sdk-rs/contracts/feature-tests/basic-features/scenarios/small_num_overflow.scen.json
deps/mx-sdk-rs/contracts/feature-tests/basic-features/scenarios/storage_big_int.scen.json
deps/mx-sdk-rs/contracts/feature-tests/basic-features/scenarios/storage_big_uint.scen.json
deps/mx-sdk-rs/contracts/feature-tests/basic-features/scenarios/storage_bool.scen.json
Expand All @@ -55,6 +55,8 @@ deps/mx-sdk-rs/contracts/feature-tests/basic-features/scenarios/storage_managed_
deps/mx-sdk-rs/contracts/feature-tests/basic-features/scenarios/storage_map1.scen.json
deps/mx-sdk-rs/contracts/feature-tests/basic-features/scenarios/storage_map2.scen.json
deps/mx-sdk-rs/contracts/feature-tests/basic-features/scenarios/storage_map3.scen.json
deps/mx-sdk-rs/contracts/feature-tests/basic-features/scenarios/storage_mapper_address_to_id.scen.json
deps/mx-sdk-rs/contracts/feature-tests/basic-features/scenarios/storage_mapper_get_at_address.scen.json
deps/mx-sdk-rs/contracts/feature-tests/basic-features/scenarios/storage_mapper_linked_list.scen.json
deps/mx-sdk-rs/contracts/feature-tests/basic-features/scenarios/storage_mapper_map.scen.json
deps/mx-sdk-rs/contracts/feature-tests/basic-features/scenarios/storage_mapper_map_storage.scen.json
Expand Down
12 changes: 6 additions & 6 deletions tests/composability_features.test
Original file line number Diff line number Diff line change
@@ -1,9 +1,3 @@
deps/mx-sdk-rs/contracts/feature-tests/composability/scenarios-promises/promises_call_async_accept_egld.scen.json
deps/mx-sdk-rs/contracts/feature-tests/composability/scenarios-promises/promises_call_async_accept_esdt.scen.json
deps/mx-sdk-rs/contracts/feature-tests/composability/scenarios-promises/promises_call_async_retrieve_egld.scen.json
deps/mx-sdk-rs/contracts/feature-tests/composability/scenarios-promises/promises_call_async_retrieve_esdt.scen.json
deps/mx-sdk-rs/contracts/feature-tests/composability/scenarios-promises/promises_call_callback_directly.scen.json
deps/mx-sdk-rs/contracts/feature-tests/composability/scenarios-promises/promises_multi_transfer.scen.json
deps/mx-sdk-rs/contracts/feature-tests/composability/scenarios/forwarder_builtin_nft_add_quantity.scen.json
deps/mx-sdk-rs/contracts/feature-tests/composability/scenarios/forwarder_builtin_nft_burn.scen.json
deps/mx-sdk-rs/contracts/feature-tests/composability/scenarios/forwarder_builtin_nft_create.scen.json
Expand Down Expand Up @@ -62,6 +56,12 @@ deps/mx-sdk-rs/contracts/feature-tests/composability/scenarios/forw_raw_sync_ech
deps/mx-sdk-rs/contracts/feature-tests/composability/scenarios/forw_raw_sync_egld.scen.json
deps/mx-sdk-rs/contracts/feature-tests/composability/scenarios/forw_raw_transf_exec_accept_egld.scen.json
deps/mx-sdk-rs/contracts/feature-tests/composability/scenarios/forw_raw_transf_exec_reject_egld.scen.json
deps/mx-sdk-rs/contracts/feature-tests/composability/scenarios/promises_call_async_accept_egld.scen.json
deps/mx-sdk-rs/contracts/feature-tests/composability/scenarios/promises_call_async_accept_esdt.scen.json
deps/mx-sdk-rs/contracts/feature-tests/composability/scenarios/promises_call_async_retrieve_egld.scen.json
deps/mx-sdk-rs/contracts/feature-tests/composability/scenarios/promises_call_async_retrieve_esdt.scen.json
deps/mx-sdk-rs/contracts/feature-tests/composability/scenarios/promises_call_callback_directly.scen.json
deps/mx-sdk-rs/contracts/feature-tests/composability/scenarios/promises_multi_transfer.scen.json
deps/mx-sdk-rs/contracts/feature-tests/composability/scenarios/proxy_test_message_sameShard_callback.scen.json
deps/mx-sdk-rs/contracts/feature-tests/composability/scenarios/proxy_test_message_sameShard.scen.json
deps/mx-sdk-rs/contracts/feature-tests/composability/scenarios/proxy_test_payment_sameShard_callback.scen.json
Expand Down
2 changes: 1 addition & 1 deletion tests/contracts/addercaller/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ path = "src/addercaller.rs"
num-bigint = "0.4.2"

[dependencies.multiversx-sc]
version = "0.48.0"
version = "0.50.1"

[dev-dependencies.multiversx-sc-scenario]
version = "0.48.0"
Loading