Skip to content
Open
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
113 changes: 91 additions & 22 deletions Cargo.lock

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

2 changes: 2 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
members = [
"example_contract",
"example_contract_permissioned",
"example_toy_vm/example",
"example_toy_vm/toy_vm",
"starstream_cli",
"starstream_compiler",
"starstream_sandbox",
Expand Down
1 change: 1 addition & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,4 @@ cargo:
all: vsc
vsc:
@cd starstream_vscode && npm i && npx vsce package

37 changes: 37 additions & 0 deletions example_toy_vm/example/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
cargo-features = ["per-package-target"]

[package]
name = "example_toy_vm"
version = "0.0.0"
edition = "2024"
license = "MIT"

forced-target = "wasm32-unknown-unknown"

[lib]
test = false

[[bin]]
name = "example_toy_vm"
test = false

# do this only so that `cargo test --workspace` doesn't fail by trying to
# link with starstream functions, since outside of wasm those are not imported
# dynamically.
[target.'cfg(not(target_arch = "wasm32"))'.dependencies]
toy_vm = { path = "../toy_vm", features = [] }

[target.'cfg(target_arch = "wasm32")'.dependencies]
toy_vm = { path = "../toy_vm", features = ["starstream"] }

[dependencies]
stack_dst = { version = "0.8.1", default-features = false, features = ["const_generics"] }
starstream_sys = { path = "../../starstream_sys" }
talc = "4.4.2"
spin = "0.10.0"
rand = { version = "0.9.1", default-features = false }
rand_chacha = { version = "0.9.0", default-features = false }

[dev-dependencies]
starstream_vm = { path = "../../starstream_vm" }
wasmi = { git = "https://github.com/ICME-Lab/zkEngine_dev" }
24 changes: 24 additions & 0 deletions example_toy_vm/example/src/lib.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#![no_std]

use starstream::utxo_import;

#[link(wasm_import_module = "starstream_utxo:example_toy_vm")]
unsafe extern "C" {
safe fn starstream_new_VmUtxo_new() -> VmUtxo;
}

utxo_import! {
"starstream_utxo:example_toy_vm";
VmUtxo;
starstream_status_VmUtxo;
starstream_resume_VmUtxo;
();
}

impl VmUtxo {
#[allow(clippy::new_without_default)]
#[inline]
pub fn new() -> Self {
starstream_new_VmUtxo_new()
}
}
Loading