From 0a150677d218c004bf4136b887b0bf33c1788325 Mon Sep 17 00:00:00 2001 From: Jay Geng Date: Fri, 19 May 2023 18:10:43 -0400 Subject: [PATCH] Rename crate to reflect fork, update README, add Makefile Move workflow files from "soroban-wasmi-v.16" branch over Unfork all crates except for `wasmi` --- .github/workflows/bump-version.yml | 16 + .github/workflows/publish.yml | 12 + .github/workflows/rust.yml | 391 ++---------------- Cargo.toml | 7 +- Makefile | 10 + README.md | 196 +-------- crates/arena/Cargo.toml | 1 + crates/cli/Cargo.toml | 5 +- crates/core/Cargo.toml | 1 + crates/wasi/Cargo.toml | 3 +- crates/wasmi/Cargo.toml | 8 +- crates/wasmi/benches/bench/mod.rs | 1 + crates/wasmi/benches/benches.rs | 1 + crates/wasmi/src/func/funcref.rs | 1 + crates/wasmi/src/lib.rs | 1 + .../tests/e2e/v1/fuel_consumption_mode.rs | 1 + crates/wasmi/tests/e2e/v1/fuel_metering.rs | 1 + crates/wasmi/tests/e2e/v1/func.rs | 1 + crates/wasmi/tests/e2e/v1/host_calls_wasm.rs | 1 + crates/wasmi/tests/e2e/v1/resource_limiter.rs | 1 + crates/wasmi/tests/e2e/v1/resumable_call.rs | 1 + crates/wasmi/tests/spec/context.rs | 1 + crates/wasmi/tests/spec/error.rs | 1 + crates/wasmi/tests/spec/mod.rs | 1 + crates/wasmi/tests/spec/run.rs | 1 + 25 files changed, 121 insertions(+), 543 deletions(-) create mode 100644 .github/workflows/bump-version.yml create mode 100644 .github/workflows/publish.yml create mode 100644 Makefile diff --git a/.github/workflows/bump-version.yml b/.github/workflows/bump-version.yml new file mode 100644 index 0000000000..9939b6eae2 --- /dev/null +++ b/.github/workflows/bump-version.yml @@ -0,0 +1,16 @@ +name: Bump Version + +on: + workflow_dispatch: + inputs: + version: + description: 'Version to bump to' + required: true + +jobs: + + bump-version: + uses: stellar/actions/.github/workflows/rust-bump-version.yml@main + with: + version: ${{ inputs.version }} + base: soroban-wasmi-v0.31-soroban diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml new file mode 100644 index 0000000000..6a132a0983 --- /dev/null +++ b/.github/workflows/publish.yml @@ -0,0 +1,12 @@ +name: Publish + +on: + release: + types: [published] + +jobs: + + publish: + uses: stellar/actions/.github/workflows/rust-publish.yml@main + secrets: + CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }} diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index 8366616dc1..e46217bc92 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -1,361 +1,58 @@ -name: Rust - Continuous Integration +name: Rust on: push: - branches: [master] pull_request: - branches: [master] -# disable running jobs on earlier commits -concurrency: - group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} - cancel-in-progress: true +env: + RUSTFLAGS: -D warnings jobs: - check: - name: Build - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - - uses: actions-rs/toolchain@v1 - with: - profile: minimal - toolchain: stable - target: wasm32-unknown-unknown - override: true - - name: Set up Cargo cache - uses: actions/cache@v3 - continue-on-error: false - with: - path: | - ~/.cargo/bin/ - ~/.cargo/registry/index/ - ~/.cargo/registry/cache/ - ~/.cargo/git/db/ - target/ - key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} - restore-keys: ${{ runner.os }}-cargo- - - name: Add extra targets - # Workaround for https://github.com/actions-rs/toolchain/issues/165 - run: | - rustup target add thumbv7em-none-eabi - - name: Build (default features) - uses: actions-rs/cargo@v1 - with: - command: build - args: --workspace - - name: Build (all features) - uses: actions-rs/cargo@v1 - with: - command: build - args: --workspace --all-features - - name: Build (no_std) - uses: actions-rs/cargo@v1 - with: - command: build - args: --workspace --lib --no-default-features --target thumbv7em-none-eabi --exclude wasmi_cli --exclude wasmi_wasi - - name: Build (wasm32) - uses: actions-rs/cargo@v1 - with: - command: build - args: --workspace --lib --no-default-features --target wasm32-unknown-unknown --exclude wasmi_cli --exclude wasmi_wasi - - test: - name: Test - strategy: - matrix: - # windows-latest was pinned to windows-2019 - # because of https://github.com/paritytech/wasmi/runs/5021520759 - os: [ubuntu-latest, windows-latest, macos-latest] - runs-on: ${{ matrix.os }} - steps: - - uses: actions/checkout@v3 - - uses: actions-rs/toolchain@v1 - with: - profile: minimal - toolchain: stable - override: true - - name: Set up Cargo cache - uses: actions/cache@v3 - continue-on-error: false - with: - path: | - ~/.cargo/bin/ - ~/.cargo/registry/index/ - ~/.cargo/registry/cache/ - ~/.cargo/git/db/ - target/ - key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} - restore-keys: ${{ runner.os }}-cargo- - - name: Checkout Submodules - run: git submodule update --init --recursive - - name: Test (default features) - uses: actions-rs/cargo@v1 - env: - RUSTFLAGS: "--cfg debug_assertions" - with: - command: test - args: --workspace --release - - name: Test (all features) - uses: actions-rs/cargo@v1 - env: - RUSTFLAGS: "--cfg debug_assertions" - with: - command: test - args: --workspace --release --all-features - - fmt: - name: Formatting - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - - uses: actions-rs/toolchain@v1 - with: - profile: minimal - toolchain: nightly - override: true - components: rustfmt - - uses: actions-rs/cargo@v1 - with: - command: fmt - args: --all -- --check - doc: - name: Documentation + complete: + if: always() + needs: [rust-analyzer-compat, build-and-test, publish-dry-run] runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 - - uses: actions-rs/toolchain@v1 - with: - profile: minimal - toolchain: stable - override: true - components: rust-docs, rust-src - - name: Set up Cargo cache - uses: actions/cache@v3 - continue-on-error: false - with: - path: | - ~/.cargo/bin/ - ~/.cargo/registry/index/ - ~/.cargo/registry/cache/ - ~/.cargo/git/db/ - target/ - key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} - restore-keys: ${{ runner.os }}-cargo- - - uses: actions-rs/cargo@v1 - env: - RUSTDOCFLAGS: "-D warnings" - with: - command: doc - args: --workspace --all-features --no-deps --document-private-items + - if: contains(needs.*.result, 'failure') || contains(needs.*.result, 'cancelled') + run: exit 1 - audit: - name: Audit + rust-analyzer-compat: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 - - uses: actions-rs/toolchain@v1 - with: - profile: minimal - toolchain: stable - override: true - - uses: actions-rs/cargo@v1 - with: - command: audit - args: "" + - uses: actions/checkout@v3 + - run: rustup update + - run: rustup +nightly component add rust-analyzer + - name: Check if rust-analyzer encounters any errors parsing project + run: rustup run nightly rust-analyzer analysis-stats . 2>&1 | (! grep ERROR) - udeps: - name: uDeps - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - - uses: actions-rs/toolchain@v1 - with: - profile: minimal - toolchain: nightly - override: true - - name: Set up Cargo cache - uses: actions/cache@v3 - continue-on-error: false - with: - path: | - ~/.cargo/bin/ - ~/.cargo/registry/index/ - ~/.cargo/registry/cache/ - ~/.cargo/git/db/ - target/ - key: ${{ runner.os }}-cargo-udeps-${{ hashFiles('**/Cargo.lock') }} - restore-keys: ${{ runner.os }}-cargo-udeps- - - name: Checkout Submodules - run: git submodule update --init --recursive - - name: Install cargo-udeps - run: | - # Note: We use `|| true` because cargo install returns an error - # if cargo-udeps was already installed on the CI runner. - cargo install --locked cargo-udeps || true - - uses: actions-rs/cargo@v1 - with: - command: udeps - args: --all-targets - - fuzz: - name: Fuzzing - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - - uses: actions-rs/toolchain@v1 - with: - profile: minimal - toolchain: nightly - override: true - - name: Set up Cargo cache - uses: actions/cache@v3 - continue-on-error: false - with: - path: | - ~/.cargo/bin/ - ~/.cargo/registry/index/ - ~/.cargo/registry/cache/ - ~/.cargo/git/db/ - target/ - fuzz/target/ - key: ${{ runner.os }}-cargo-fuzz-${{ hashFiles('**/Cargo.lock') }} - restore-keys: ${{ runner.os }}-cargo-fuzz- - - name: Checkout Submodules - run: git submodule update --init --recursive - - name: Install cargo-fuzz - run: | - # Note: We use `|| true` because cargo install returns an error - # if cargo-udeps was already installed on the CI runner. - cargo install --locked cargo-fuzz || true - - name: Fuzz Translate - uses: actions-rs/cargo@v1 - with: - command: fuzz - args: run translate -j 2 --verbose -- -max_total_time=60 # 1 minute of fuzzing - - name: Fuzz Translate (metered) - uses: actions-rs/cargo@v1 - with: - command: fuzz - args: run translate -j 2 --verbose -- -max_total_time=60 # 1 minute of fuzzing - - miri: - name: Miri - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - - uses: actions-rs/toolchain@v1 - with: - profile: minimal - toolchain: nightly - override: true - components: miri - - name: Set up Cargo cache - uses: actions/cache@v3 - continue-on-error: false - with: - path: | - ~/.cargo/bin/ - ~/.cargo/registry/index/ - ~/.cargo/registry/cache/ - ~/.cargo/git/db/ - target/ - key: ${{ runner.os }}-cargo-miri-${{ hashFiles('**/Cargo.lock') }} - restore-keys: ${{ runner.os }}-cargo-miri- - - name: Clippy (--lib) - uses: actions-rs/cargo@v1 - with: - command: miri - args: test --lib --workspace - - name: Clippy (--doc) - uses: actions-rs/cargo@v1 - with: - command: miri - args: test --doc --workspace - - clippy: - name: Clippy - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - - uses: actions-rs/toolchain@v1 - with: - profile: minimal - toolchain: nightly - override: true - components: clippy - - name: Set up Cargo cache - uses: actions/cache@v3 - continue-on-error: false - with: - path: | - ~/.cargo/bin/ - ~/.cargo/registry/index/ - ~/.cargo/registry/cache/ - ~/.cargo/git/db/ - target/ - key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} - restore-keys: ${{ runner.os }}-cargo- - - name: Clippy (default features) - uses: actions-rs/cargo@v1 - with: - command: clippy - args: --workspace -- -D warnings - - name: Clippy (all features) - uses: actions-rs/cargo@v1 - with: - command: clippy - args: --workspace --all-features -- -D warnings - - name: Clippy (no_std) - uses: actions-rs/cargo@v1 - with: - command: clippy - args: --workspace --no-default-features -- -D warnings - - name: Clippy (tests) - uses: actions-rs/cargo@v1 - with: - command: clippy - args: --workspace --tests -- -D warnings - - coverage: - name: Coverage - runs-on: ubuntu-latest - steps: - - name: Checkout repository - uses: actions/checkout@v3 - with: - fetch-depth: 0 - - name: Install stable toolchain - uses: actions-rs/toolchain@v1 - with: - toolchain: stable - override: true - - name: Set up Cargo cache - uses: actions/cache@v3 - continue-on-error: false - with: - path: | - ~/.cargo/bin/ - ~/.cargo/registry/index/ - ~/.cargo/registry/cache/ - ~/.cargo/git/db/ - target/ - key: ${{ runner.os }}-cargo-coverage-${{ hashFiles('**/Cargo.lock') }} - restore-keys: ${{ runner.os }}-cargo-coverage- - - name: Checkout Submodules - run: git submodule update --init --recursive - - name: Run cargo-tarpaulin (default features) - uses: actions-rs/tarpaulin@v0.1 - with: - version: "0.18.0" - args: --workspace - - name: Upload to codecov.io - uses: codecov/codecov-action@v3.1.4 - with: - token: ${{secrets.CODECOV_TOKEN}} - - name: Archive code coverage results - uses: actions/upload-artifact@v3 - with: - name: code-coverage-report - path: cobertura.xml + build-and-test: + strategy: + matrix: + sys: + - os: ubuntu-latest + target: x86_64-unknown-linux-gnu + runs-on: ${{ matrix.sys.os }} + steps: + - uses: actions/checkout@v3 + - uses: stellar/actions/rust-cache@main + - run: rustup update + - run: rustup target add ${{ matrix.sys.target }} + - run: cargo install --target-dir ~/.cargo/target --locked --version 0.5.16 cargo-hack + - run: git submodule update --init --recursive + - run: cargo hack build --target ${{ matrix.sys.target }} + - run: cargo hack test --target ${{ matrix.sys.target }} + + publish-dry-run: + if: startsWith(github.head_ref, 'release/') + strategy: + matrix: + sys: + - os: ubuntu-latest + target: x86_64-unknown-linux-gnu + cargo-hack-feature-options: '' + uses: stellar/actions/.github/workflows/rust-publish-dry-run.yml@main + with: + runs-on: ${{ matrix.sys.os }} + cargo-hack-feature-options: ${{ matrix.sys.cargo-hack-feature-options }} + target: ${{ matrix.sys.target }} diff --git a/Cargo.toml b/Cargo.toml index 4ff4a18f4c..e580673054 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -4,11 +4,8 @@ exclude = [] resolver = "2" [workspace.package] -authors = [ - "Parity Technologies ", - "Robin Freyler ", -] -repository = "https://github.com/paritytech/wasmi" +authors = ["Stellar Development Foundation "] +repository = "https://github.com/stellar/wasmi" edition = "2021" readme = "README.md" license = "MIT/Apache-2.0" diff --git a/Makefile b/Makefile new file mode 100644 index 0000000000..874119f9a6 --- /dev/null +++ b/Makefile @@ -0,0 +1,10 @@ + +# Build all projects as if they are being published to crates.io, and do so for +# all feature and target combinations. +publish-dry-run-top: + cargo +stable publish --locked --dry-run --package soroban-wasmi + +# Publish publishes the crate to crates.io. The dry-run is a dependency because +# the dry-run target will verify all feature set combinations. +publish-top: publish-dry-run-top + cargo +stable publish --locked --package soroban-wasmi diff --git a/README.md b/README.md index dd12886e50..92cb2e2542 100644 --- a/README.md +++ b/README.md @@ -1,187 +1,20 @@ +# soroban-wasmi -| Continuous Integration | Test Coverage | Documentation | Crates.io | -|:----------------------:|:--------------------:|:----------------:|:--------------------:| -| [![ci][1]][2] | [![codecov][3]][4] | [![docs][5]][6] | [![crates][7]][8] | +This is a fork of https://github.com/paritytech/wasmi with a small set of local +patches applied for customizing interaction with https://soroban.stellar.org -[1]: https://github.com/paritytech/wasmi/workflows/Rust%20-%20Continuous%20Integration/badge.svg?branch=master -[2]: https://github.com/paritytech/wasmi/actions?query=workflow%3A%22Rust+-+Continuous+Integration%22+branch%3Amaster -[3]: https://codecov.io/gh/paritytech/wasmi/branch/master/graph/badge.svg -[4]: https://codecov.io/gh/paritytech/wasmi/branch/master -[5]: https://docs.rs/wasmi/badge.svg -[6]: https://docs.rs/wasmi -[7]: https://img.shields.io/crates/v/wasmi.svg -[8]: https://crates.io/crates/wasmi +It may be abandoned at some point if Soroban is able to meet its needs strictly +with upstream interfaces. The fork was for expedience during development. -[license-mit-badge]: https://img.shields.io/badge/license-MIT-blue.svg -[license-apache-badge]: https://img.shields.io/badge/license-APACHE-orange.svg +Other projects should not use it, and should use upstream instead. -# `wasmi`- WebAssembly (Wasm) Interpreter +The Parity authors have been removed from the Cargo.toml metadata to avoid the +implication that this fork is their responsibility or action, and to emphasize +that users should not bother the Parity authors with support requests for this +crate. -`wasmi` is an efficient WebAssembly interpreter with low-overhead and support -for embedded environment such as WebAssembly itself. - -At Parity we are using `wasmi` in [Substrate](https://github.com/paritytech/substrate) -as the execution engine for our WebAssembly based smart contracts. -Furthermore we run `wasmi` within the Substrate runtime which is a WebAssembly -environment itself and driven via [Wasmtime] at the time of this writing. -As such `wasmi`'s implementation requires a high degree of correctness and -Wasm specification conformance. - -Since `wasmi` is relatively lightweight compared to other Wasm virtual machines -such as Wasmtime it is also a decent option for initial prototyping. - -[Wasmtime]: https://github.com/bytecodealliance/wasmtime - -## Distinct Features - -The following list states some of the distinct features of `wasmi`. - -- Focus on simple, correct and deterministic WebAssembly execution. -- Can itself run inside of WebAssembly. -- Low-overhead and cross-platform WebAssembly runtime. -- Loosely mirrors the [Wasmtime API](https://docs.rs/wasmtime/). -- Resumable function calls. -- Built-in support for fuel metering. -- 100% official WebAssembly spec testsuite compliance. - -## WebAssembly Proposals - -The new `wasmi` engine supports a variety of WebAssembly proposals and will support even more of them in the future. - -| WebAssembly Proposal | Status | Comment | -|:--|:--:|:--| -| [`mutable-global`] | ✅ | Since version `0.14.0`. | -| [`saturating-float-to-int`] | ✅ | Since version `0.14.0`. | -| [`sign-extension`] | ✅ | Since version `0.14.0`. | -| [`multi-value`] | ✅ | Since version `0.14.0`. | -| [`bulk-memory`] | ✅ | Since version `0.24.0`. [(#628)] | -| [`reference-types`] | ✅ | Since version `0.24.0`. [(#635)] | -| [`simd`] | ❌ | Unlikely to be supported. | -| [`tail-calls`] | ✅ | Since version `0.28.0`. [(#683)] | -| [`extended-const`] | ✅ | Since version `0.29.0`. [(#707)] | -| | | -| [WASI] | 🟡 | Experimental support via the [`wasmi_wasi` crate] or the `wasmi` CLI application. | - -[`mutable-global`]: https://github.com/WebAssembly/mutable-global -[`saturating-float-to-int`]: https://github.com/WebAssembly/nontrapping-float-to-int-conversions -[`sign-extension`]: https://github.com/WebAssembly/sign-extension-ops -[`multi-value`]: https://github.com/WebAssembly/multi-value -[`reference-types`]: https://github.com/WebAssembly/reference-types -[`bulk-memory`]: https://github.com/WebAssembly/bulk-memory-operations -[`simd` ]: https://github.com/webassembly/simd -[`tail-calls`]: https://github.com/WebAssembly/tail-call -[`extended-const`]: https://github.com/WebAssembly/extended-const - -[WASI]: https://github.com/WebAssembly/WASI -[`wasmi_wasi` crate]: ./crates/wasi - -[(#363)]: https://github.com/paritytech/wasmi/issues/363 -[(#364)]: https://github.com/paritytech/wasmi/issues/364 -[(#496)]: https://github.com/paritytech/wasmi/issues/496 -[(#628)]: https://github.com/paritytech/wasmi/pull/628 -[(#635)]: https://github.com/paritytech/wasmi/pull/635 -[(#638)]: https://github.com/paritytech/wasmi/pull/638 -[(#683)]: https://github.com/paritytech/wasmi/pull/683 -[(#707)]: https://github.com/paritytech/wasmi/pull/707 - -## Usage - -### As CLI Application - -Install the newest `wasmi` CLI version via: -```console -cargo install wasmi_cli -``` -Then run arbitrary `wasm32-unknown-unknown` Wasm blobs via: -```console -wasmi_cli []* -``` - -### As Rust Library - -Any Rust crate can depend on the [`wasmi` crate](https://crates.io/crates/wasmi) -in order to integrate a WebAssembly intepreter into their stack. - -Refer to the [`wasmi` crate docs](https://docs.rs/wasmi) to learn how to use the `wasmi` crate as library. - -## Development - -### Building - -Clone `wasmi` from our official repository and then build using the standard `cargo` procedure: - -```console -git clone https://github.com/paritytech/wasmi.git -cd wasmi -cargo build -``` - -### Testing - -In order to test `wasmi` you need to initialize and update the Git submodules using: - -```console -git submodule update --init --recursive -``` - -Alternatively you can provide `--recursive` flag to `git clone` command while cloning the repository: - -```console -git clone https://github.com/paritytech/wasmi.git --recursive -``` - -After Git submodules have been initialized and updated you can test using: - -```console -cargo test --workspace -``` - -### Benchmarks - -In order to benchmark `wasmi` use the following command: - -```console -cargo bench -``` - -You can filter which set of benchmarks to run: -- `cargo bench translate` - - Only runs benchmarks concerned with WebAssembly module translation. - -- `cargo bench instantiate` - - Only runs benchmarks concerned with WebAssembly module instantiation. - -- `cargo bench execute` - - Only runs benchmarks concerned with executing WebAssembly functions. - -## Supported Platforms - -Supported platforms are primarily Linux, MacOS, Windows and WebAssembly. -Other platforms might be working but are not guaranteed to be so by the `wasmi` maintainers. - -Use the following command in order to produce a WebAssembly build: - -```console -cargo build --no-default-features --target wasm32-unknown-unknown -``` - -## Production Builds - -In order to reap the most performance out of `wasmi` we highly recommended -to compile the `wasmi` crate using the following Cargo `profile`: - -```toml -[profile.release] -lto = "fat" -codegen-units = 1 -``` - -When compiling for the WebAssembly target we highly recommend to post-optimize -`wasmi` using [Binaryen]'s `wasm-opt` tool since our experiments displayed a -80-100% performance improvements when executed under Wasmtime and also -slightly smaller Wasm binaries. - -[Binaryen]: https://github.com/WebAssembly/binaryen +This crate was still entirely (with the exception of a couple small patches) +written by Parity Technologies, and their copyright notices are maintained. ## License @@ -190,8 +23,3 @@ license and the APACHE license (Version 2.0), at your choice. See `LICENSE-APACHE` and `LICENSE-MIT` for details. -## Contribution - -Unless you explicitly state otherwise, any contribution intentionally submitted -for inclusion in `wasmi` by you, as defined in the APACHE 2.0 license, shall be -dual licensed as above, without any additional terms or conditions. diff --git a/crates/arena/Cargo.toml b/crates/arena/Cargo.toml index 38e2447221..5a75b25211 100644 --- a/crates/arena/Cargo.toml +++ b/crates/arena/Cargo.toml @@ -11,6 +11,7 @@ readme.workspace = true license.workspace = true keywords.workspace = true categories.workspace = true +publish = false [features] default = ["std"] diff --git a/crates/cli/Cargo.toml b/crates/cli/Cargo.toml index ee145cead7..455218dc1e 100644 --- a/crates/cli/Cargo.toml +++ b/crates/cli/Cargo.toml @@ -10,12 +10,13 @@ readme.workspace = true license.workspace = true keywords.workspace = true categories.workspace = true +publish = false [dependencies] anyhow = "1" clap = { version = "4", features = ["derive"] } -wasmi = { version = "0.31.0", path = "../wasmi" } -wasmi_wasi = { version = "0.31.0", path = "../wasi" } +wasmi = { version = "0.31.0", git = "https://github.com/paritytech/wasmi.git" } +wasmi_wasi = { version = "0.31.0", git = "https://github.com/paritytech/wasmi.git" } wat = "1" [dev-dependencies] diff --git a/crates/core/Cargo.toml b/crates/core/Cargo.toml index dd553f1ab3..c094bb11a1 100644 --- a/crates/core/Cargo.toml +++ b/crates/core/Cargo.toml @@ -10,6 +10,7 @@ readme.workspace = true license.workspace = true keywords.workspace = true categories.workspace = true +publish = false [dependencies] libm = "0.2.1" diff --git a/crates/wasi/Cargo.toml b/crates/wasi/Cargo.toml index 8253a9d05e..b7da9194b1 100644 --- a/crates/wasi/Cargo.toml +++ b/crates/wasi/Cargo.toml @@ -10,12 +10,13 @@ readme.workspace = true license.workspace = true keywords.workspace = true categories.workspace = true +publish = false [dependencies] wasi-common = "2.0" wasi-cap-std-sync = "2.0" wiggle = { version = "2.0", default-features = false, features = ["wiggle_metadata"] } -wasmi = { version = "0.31.0", path = "../wasmi" } +wasmi = { version = "0.31.0", git = "https://github.com/paritytech/wasmi.git" } [dev-dependencies] wat = "1.0.50" diff --git a/crates/wasmi/Cargo.toml b/crates/wasmi/Cargo.toml index 5ba8d1007f..6e3d7dd19d 100644 --- a/crates/wasmi/Cargo.toml +++ b/crates/wasmi/Cargo.toml @@ -1,8 +1,7 @@ [package] -name = "wasmi" -version = "0.31.0" -documentation = "https://docs.rs/wasmi/" -description = "WebAssembly interpreter" +name = "soroban-wasmi" +version = "0.31.0-soroban" +description = "Soroban fork of Parity WebAssembly interpreter" exclude = ["tests/*", "benches/*"] authors.workspace = true repository.workspace = true @@ -36,4 +35,5 @@ std = ["wasmi_core/std", "wasmi_arena/std", "wasmparser/std", "spin/std"] [[bench]] name = "benches" +path = "benches/benches.rs" harness = false diff --git a/crates/wasmi/benches/bench/mod.rs b/crates/wasmi/benches/bench/mod.rs index 9f9bf33a13..997928c1a3 100644 --- a/crates/wasmi/benches/bench/mod.rs +++ b/crates/wasmi/benches/bench/mod.rs @@ -1,3 +1,4 @@ +use soroban_wasmi as wasmi; use std::{fs::File, io::Read as _}; use wasmi::{Config, StackLimits}; diff --git a/crates/wasmi/benches/benches.rs b/crates/wasmi/benches/benches.rs index 2d08cbe3cd..b97155bb68 100644 --- a/crates/wasmi/benches/benches.rs +++ b/crates/wasmi/benches/benches.rs @@ -1,3 +1,4 @@ +use soroban_wasmi as wasmi; mod bench; use self::bench::{ diff --git a/crates/wasmi/src/func/funcref.rs b/crates/wasmi/src/func/funcref.rs index c1e496c9fe..1a0346f509 100644 --- a/crates/wasmi/src/func/funcref.rs +++ b/crates/wasmi/src/func/funcref.rs @@ -85,6 +85,7 @@ impl FuncRef { /// # Examples /// /// ```rust + /// # use soroban_wasmi as wasmi; /// # use wasmi::{Func, FuncRef, Store, Engine}; /// # let engine = Engine::default(); /// # let mut store = >::new(&engine, ()); diff --git a/crates/wasmi/src/lib.rs b/crates/wasmi/src/lib.rs index e34176f4d5..68604a18f7 100644 --- a/crates/wasmi/src/lib.rs +++ b/crates/wasmi/src/lib.rs @@ -14,6 +14,7 @@ //! [Wasmtime's API example](https://docs.rs/wasmtime/0.39.1/wasmtime/). //! //! ``` +//! use soroban_wasmi as wasmi; //! use anyhow::{anyhow, Result}; //! use wasmi::*; //! diff --git a/crates/wasmi/tests/e2e/v1/fuel_consumption_mode.rs b/crates/wasmi/tests/e2e/v1/fuel_consumption_mode.rs index 4f8179e82c..4736b941da 100644 --- a/crates/wasmi/tests/e2e/v1/fuel_consumption_mode.rs +++ b/crates/wasmi/tests/e2e/v1/fuel_consumption_mode.rs @@ -1,5 +1,6 @@ //! Tests to check if wasmi's fuel metering works as intended. +use soroban_wasmi as wasmi; use wasmi::{Config, Engine, FuelConsumptionMode, Func, Linker, Module, Store}; use wasmi_core::Trap; diff --git a/crates/wasmi/tests/e2e/v1/fuel_metering.rs b/crates/wasmi/tests/e2e/v1/fuel_metering.rs index 9f795f4f1a..7be6d8c9e4 100644 --- a/crates/wasmi/tests/e2e/v1/fuel_metering.rs +++ b/crates/wasmi/tests/e2e/v1/fuel_metering.rs @@ -1,5 +1,6 @@ //! Tests to check if wasmi's fuel metering works as intended. +use soroban_wasmi as wasmi; use std::fmt::Debug; use wasmi::{Config, Engine, Func, Linker, Module, Store}; use wasmi_core::{Trap, TrapCode}; diff --git a/crates/wasmi/tests/e2e/v1/func.rs b/crates/wasmi/tests/e2e/v1/func.rs index 65010433c0..085f4aa416 100644 --- a/crates/wasmi/tests/e2e/v1/func.rs +++ b/crates/wasmi/tests/e2e/v1/func.rs @@ -2,6 +2,7 @@ use core::slice; +use soroban_wasmi as wasmi; use assert_matches::assert_matches; use wasmi::{errors::FuncError, Engine, Error, Func, FuncType, Store, Value}; use wasmi_core::{ValueType, F32, F64}; diff --git a/crates/wasmi/tests/e2e/v1/host_calls_wasm.rs b/crates/wasmi/tests/e2e/v1/host_calls_wasm.rs index a30a4ff3b2..e9532abeb2 100644 --- a/crates/wasmi/tests/e2e/v1/host_calls_wasm.rs +++ b/crates/wasmi/tests/e2e/v1/host_calls_wasm.rs @@ -1,6 +1,7 @@ //! Test to assert that host functions that call back into //! Wasm works correctly. +use soroban_wasmi as wasmi; use wasmi::{Caller, Engine, Extern, Func, Linker, Module, Store}; fn test_setup() -> (Store<()>, Linker<()>) { diff --git a/crates/wasmi/tests/e2e/v1/resource_limiter.rs b/crates/wasmi/tests/e2e/v1/resource_limiter.rs index 7010117c87..5ce0b21a6a 100644 --- a/crates/wasmi/tests/e2e/v1/resource_limiter.rs +++ b/crates/wasmi/tests/e2e/v1/resource_limiter.rs @@ -1,4 +1,5 @@ //! Tests to check if wasmi's ResourceLimiter works as intended. +use soroban_wasmi as wasmi; use wasmi::{ Config, Engine, diff --git a/crates/wasmi/tests/e2e/v1/resumable_call.rs b/crates/wasmi/tests/e2e/v1/resumable_call.rs index d2d9d73824..bf639b19c1 100644 --- a/crates/wasmi/tests/e2e/v1/resumable_call.rs +++ b/crates/wasmi/tests/e2e/v1/resumable_call.rs @@ -1,5 +1,6 @@ //! Test to assert that resumable call feature works as intended. +use soroban_wasmi as wasmi; use core::slice; use wasmi::{ diff --git a/crates/wasmi/tests/spec/context.rs b/crates/wasmi/tests/spec/context.rs index bfc3390e2c..3b91ba3aa9 100644 --- a/crates/wasmi/tests/spec/context.rs +++ b/crates/wasmi/tests/spec/context.rs @@ -1,3 +1,4 @@ +use soroban_wasmi as wasmi; use super::{TestDescriptor, TestError, TestProfile, TestSpan}; use anyhow::Result; use std::collections::HashMap; diff --git a/crates/wasmi/tests/spec/error.rs b/crates/wasmi/tests/spec/error.rs index 1b76d7bbc4..43c333c333 100644 --- a/crates/wasmi/tests/spec/error.rs +++ b/crates/wasmi/tests/spec/error.rs @@ -1,3 +1,4 @@ +use soroban_wasmi as wasmi; use std::{error::Error, fmt, fmt::Display}; use wasmi::Error as WasmiError; diff --git a/crates/wasmi/tests/spec/mod.rs b/crates/wasmi/tests/spec/mod.rs index 2cb4cec246..bc07e78af2 100644 --- a/crates/wasmi/tests/spec/mod.rs +++ b/crates/wasmi/tests/spec/mod.rs @@ -1,3 +1,4 @@ +use soroban_wasmi as wasmi; mod context; mod descriptor; mod error; diff --git a/crates/wasmi/tests/spec/run.rs b/crates/wasmi/tests/spec/run.rs index f701323e99..ae80f95f6d 100644 --- a/crates/wasmi/tests/spec/run.rs +++ b/crates/wasmi/tests/spec/run.rs @@ -1,3 +1,4 @@ +use soroban_wasmi as wasmi; use super::{error::TestError, TestContext, TestDescriptor}; use anyhow::Result; use wasmi::{Config, ExternRef, FuncRef, Instance, Value};