Skip to content
This repository was archived by the owner on Feb 1, 2024. It is now read-only.
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
7 changes: 6 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
/docs/orchestrate/book
/target
/result
/.direnv
/.direnv

flamegraph.svg
*.log
*.data
*.data.old
21 changes: 19 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,26 @@

Experimental, minimalistic, `no_std` friendly abstract virtual machine for CosmWasm contracts execution.

Based on `wasmi` interpeter and can be run in other VM. Allows to host CosmWasm VM inside other Wasm VM.
In contrast, Cosmos `wasmd` VM can run only on native host.

[Specification](SPEC.md)

### Getting started

- [Install Nix](https://zero-to-nix.com/start/install)
- Enter the dev env with: `nix develop`
- [Install Nix](https://zero-to-nix.com/start/install) and enter the dev env with: `nix develop`.
- Or install latest Rust nightly.
- Run test suite using: `cargo test`

### Research

Install `flamegraph` (in nix shell already installed)

`RUST_LOG=trace cargo run --bin research --release 2>&1 | tee research.log` and see some output for deep logging.

`RUST_LOG=info cargo run --bin research --release` and see some output long run with coarse grain output.

`flamegraph target/release/research`

Modify `research.rs` as needed.

1,246 changes: 1,246 additions & 0 deletions SPEC.md

Large diffs are not rendered by default.

Binary file added fixtures/wyndex_factory.wasm
Binary file not shown.
Binary file added fixtures/wyndex_pair.wasm
Binary file not shown.
8 changes: 1 addition & 7 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,11 @@
overlays = [ rust-overlay.overlays.default ];
};
in let
# Nightly rust used for wasm runtime compilation
rust-nightly =
pkgs.rust-bin.fromRustupToolchainFile ./rust-toolchain.toml;

# Crane lib instantiated with current nixpkgs
crane-lib = crane.mkLib pkgs;

# Crane pinned to nightly Rust
crane-nightly = crane-lib.overrideToolchain rust-nightly;

src = pkgs.lib.cleanSourceWith {
Expand All @@ -40,17 +37,14 @@
};
};

# Default args to crane
common-args = {
inherit src;
buildInputs = [ pkgs.pkg-config pkgs.openssl ]
++ (pkgs.lib.optionals pkgs.stdenv.isDarwin
(with pkgs.darwin.apple_sdk.frameworks; [ Security ]));
};

# Common dependencies used for caching
common-deps = crane-nightly.buildDepsOnly common-args;

common-cached-args = common-args // { cargoArtifacts = common-deps; };

in rec {
Expand All @@ -67,7 +61,7 @@
};
devShell = pkgs.mkShell {
buildInputs = [ rust-nightly ]
++ (with pkgs; [ openssl openssl.dev pkgconfig taplo nixfmt bacon ]);
++ (with pkgs; [ openssl openssl.dev pkgconfig taplo nixfmt bacon flamegraph cargo-flamegraph]);
};
});
}
13 changes: 13 additions & 0 deletions vm-wasmi/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@ authors = [
]
homepage = "https://composable.finance"

# [[bin]]
# name = "research"
# test = true

[features]
default = ["iterator", "stargate", "ibc3"]
iterator = ["cosmwasm-vm/iterator"]
Expand All @@ -30,10 +34,19 @@ cosmwasm-std = { git = "https://github.com/ComposableFi/cosmwasm", rev = "34af48
cosmwasm-vm = { path = "../vm", default-features = false }
hex = { version = "0.4", default-features = false, features = ["alloc"] }

# # benches
# tracing = "0.1"
# tracing-subscriber = "0.3"
# tracing-opentelemetry = "*"
# opentelemetry = "*"

# wyndex = { git = "https://github.com/wynddao/wynddex", rev = "a578f8b645433e108a10613e85ae49385c2fc63c", default-features = false }

[dev-dependencies]
wat = "1.0"
env_logger = "0.9"
cosmwasm-crypto = { git = "https://github.com/ComposableFi/cosmwasm", rev = "7d288c23772d03e8cd666b76cb5bbdc5952721dd" }

cw20-ics20 = { git = "https://github.com/CosmWasm/cw-plus", rev = "53dc88fdb81888cbd3dae8742e7318b35d3d0c0f", default-features = false, features = [
"library",
] }
Loading