-
Notifications
You must be signed in to change notification settings - Fork 1
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 fxdao-ledger-hostfuns
- Loading branch information
Showing
11 changed files
with
283 additions
and
122 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 |
---|---|---|
@@ -1 +1 @@ | ||
7.1.165 | ||
7.1.167 |
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 |
---|---|---|
@@ -1 +1 @@ | ||
0.1.112 | ||
0.1.113 |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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 |
---|---|---|
@@ -1 +1 @@ | ||
0.1.39 | ||
0.1.40 |
Large diffs are not rendered by default.
Oops, something went wrong.
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 |
---|---|---|
|
@@ -4,7 +4,7 @@ build-backend = "poetry.core.masonry.api" | |
|
||
[tool.poetry] | ||
name = "komet" | ||
version = "0.1.39" | ||
version = "0.1.40" | ||
description = "K tooling for the Soroban platform" | ||
authors = [ | ||
"Runtime Verification, Inc. <[email protected]>", | ||
|
@@ -18,7 +18,7 @@ soroban-semantics = "komet.kdist.plugin" | |
|
||
[tool.poetry.dependencies] | ||
python = "^3.10" | ||
pykwasm = { git = "https://github.com/runtimeverification/wasm-semantics.git", tag = "v0.1.112", subdirectory = "pykwasm" } | ||
pykwasm = { git = "https://github.com/runtimeverification/wasm-semantics.git", tag = "v0.1.113", subdirectory = "pykwasm" } | ||
|
||
[tool.poetry.group.dev.dependencies] | ||
autoflake = "*" | ||
|
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
15 changes: 15 additions & 0 deletions
15
src/tests/integration/data/soroban/contracts/test_custom_types/Cargo.toml
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,15 @@ | ||
[package] | ||
name = "test_custom_types" | ||
version = "0.0.0" | ||
edition = "2021" | ||
publish = false | ||
|
||
[lib] | ||
crate-type = ["cdylib"] | ||
doctest = false | ||
|
||
[dependencies] | ||
soroban-sdk = { workspace = true } | ||
|
||
[dev-dependencies] | ||
soroban-sdk = { workspace = true, features = ["testutils"] } |
50 changes: 50 additions & 0 deletions
50
src/tests/integration/data/soroban/contracts/test_custom_types/src/lib.rs
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,50 @@ | ||
#![no_std] | ||
use soroban_sdk::{contract, contractimpl, contracttype, symbol_short, Address, Bytes, Env, FromVal, Symbol, TryFromVal, TryIntoVal, Val, Vec, EnvBase}; | ||
|
||
#[contract] | ||
pub struct TestCustomTypesContract; | ||
|
||
#[contracttype] | ||
#[derive(PartialEq)] | ||
pub enum MyBool { | ||
True, | ||
False | ||
} | ||
|
||
fn to_bool(p: &MyBool) -> bool { | ||
match p { | ||
MyBool::True => true, | ||
MyBool::False => false | ||
} | ||
} | ||
|
||
fn from_bool(p: bool) -> MyBool { | ||
if p { | ||
MyBool::True | ||
} else { | ||
MyBool::False | ||
} | ||
} | ||
|
||
|
||
#[contractimpl] | ||
impl TestCustomTypesContract { | ||
|
||
pub fn test_my_bool_roundtrip(env: Env, p: bool) -> bool { | ||
|
||
// mp:MyBool lives in the Wasm memory | ||
let mp = from_bool(p); | ||
|
||
// convert MyBool to a host object | ||
let v: Val = mp.try_into_val(&env).unwrap(); | ||
|
||
// convert v:Val to MyBool, load it to the Wasm memory | ||
// (using the 'symbol_index_in_linear_memory' host function under the hood) | ||
let mp2: MyBool = MyBool::try_from_val(&env, &v).unwrap(); | ||
|
||
let p2 = to_bool(&mp2); | ||
|
||
mp == mp2 && p == p2 | ||
} | ||
|
||
} |