diff --git a/.circleci/config.yml b/.circleci/config.yml index 8f73fa6add..a404753028 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -28,11 +28,11 @@ jobs: - cargocache-std-rust:1.40.0-{{ checksum "Cargo.lock" }} - run: name: Build standard library - working_directory: ~/project/lib/std + working_directory: ~/project/packages/std command: cargo build --locked - run: name: Run standard library tests - working_directory: ~/project/lib/std + working_directory: ~/project/packages/std command: cargo test --locked - save_cache: paths: @@ -58,11 +58,11 @@ jobs: - cargocache-singlepass-rust:nightly-{{ checksum "Cargo.lock" }} - run: name: Build all targets (including workspaces) - working_directory: ~/project/lib/vm + working_directory: ~/project/packages/vm command: cargo build --locked - run: name: Run all tests (including workspaces) - working_directory: ~/project/lib/vm + working_directory: ~/project/packages/vm command: cargo test --locked - save_cache: paths: @@ -88,11 +88,11 @@ jobs: - cargocache-cranelift-rust:1.40.0-{{ checksum "Cargo.lock" }} - run: name: Build all targets (including workspaces) - working_directory: ~/project/lib/vm + working_directory: ~/project/packages/vm command: cargo build --locked --no-default-features --features default-cranelift - run: name: Run all tests (including workspaces) - working_directory: ~/project/lib/vm + working_directory: ~/project/packages/vm command: cargo test --locked --no-default-features --features default-cranelift - save_cache: paths: @@ -236,11 +236,11 @@ jobs: command: rustup component add clippy - run: name: Clippy linting on std - working_directory: ~/project/lib/std + working_directory: ~/project/packages/std command: cargo clippy -- -D warnings - run: name: Clippy linting on vm (use flags for Rust stable support) - working_directory: ~/project/lib/vm + working_directory: ~/project/packages/vm command: cargo clippy --no-default-features --features default-cranelift - run: name: Clippy linting on hackatom diff --git a/Cargo.toml b/Cargo.toml index 5812a26758..3c5dd82722 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [workspace] members = [ - "lib/std", - "lib/vm", + "packages/std", + "packages/vm", ] exclude = ["contracts"] diff --git a/README.md b/README.md index c69e6439fc..24f9ce337f 100644 --- a/README.md +++ b/README.md @@ -36,8 +36,8 @@ around 40% of the code size. **Executing contracts:** -* [cosmwasm-vm](https://github.com/CosmWasm/cosmwasm/tree/master/lib/vm) - A sub-crate. Uses the [wasmer](https://github.com/wasmerio/wasmer) engine -to execute a given smart contract. Also contains code for gas metering, storing, and caching wasm artifacts. Read more [here](lib/vm/README.md). +* [cosmwasm-vm](https://github.com/CosmWasm/cosmwasm/tree/master/packages/vm) - A sub-crate. Uses the [wasmer](https://github.com/wasmerio/wasmer) engine +to execute a given smart contract. Also contains code for gas metering, storing, and caching wasm artifacts. Read more [here](packages/vm/README.md). * [go-cosmwasm](https://github.com/CosmWasm/go-cosmwasm) - High-level go bindings to all the power inside `cosmwasm-vm`. Easily allows you to upload, instantiate and execute contracts, making use of all the optimizations and caching available inside `cosmwasm-vm`. * [wasmd](https://github.com/CosmWasm/wasmd) - A basic Cosmos SDK app to host WebAssembly smart contracts. @@ -180,7 +180,7 @@ You may also want to ensure the compiled contract interacts with the environment properly. To do so, you will want to create a canonical release build of the `.wasm` file and then write tests in with the same VM tooling we will use in production. This is a bit more complicated but -we added some tools to help in [cosmwasm-vm](https://github.com/CosmWasm/cosmwasm/tree/master/lib/vm) +we added some tools to help in [cosmwasm-vm](https://github.com/CosmWasm/cosmwasm/tree/master/packages/vm) which can be added as a `dev-dependency`. You will need to first compile the contract using `cargo wasm`, diff --git a/contracts/hackatom/Cargo.toml b/contracts/hackatom/Cargo.toml index 81983a1cf3..bc0c5eede6 100644 --- a/contracts/hackatom/Cargo.toml +++ b/contracts/hackatom/Cargo.toml @@ -28,11 +28,11 @@ cranelift = ["cosmwasm-vm/default-cranelift"] singlepass = ["cosmwasm-vm/default-singlepass"] [dependencies] -cosmwasm = { path = "../../lib/std", version = "0.7.1" } +cosmwasm = { path = "../../packages/std", version = "0.7.1" } schemars = "0.5" serde = { version = "1.0.103", default-features = false, features = ["derive"] } snafu = { version = "0.5.0", default-features = false, features = ["rust_1_30"] } [dev-dependencies] -cosmwasm-vm = { path = "../../lib/vm", version = "0.7.1", default-features = false } +cosmwasm-vm = { path = "../../packages/vm", version = "0.7.1", default-features = false } serde_json = "1.0" diff --git a/lib/std/.cargo/config b/packages/std/.cargo/config similarity index 100% rename from lib/std/.cargo/config rename to packages/std/.cargo/config diff --git a/lib/std/API.md b/packages/std/API.md similarity index 100% rename from lib/std/API.md rename to packages/std/API.md diff --git a/lib/std/Cargo.toml b/packages/std/Cargo.toml similarity index 100% rename from lib/std/Cargo.toml rename to packages/std/Cargo.toml diff --git a/lib/std/examples/schema.rs b/packages/std/examples/schema.rs similarity index 100% rename from lib/std/examples/schema.rs rename to packages/std/examples/schema.rs diff --git a/lib/std/schema/contract_result.json b/packages/std/schema/contract_result.json similarity index 100% rename from lib/std/schema/contract_result.json rename to packages/std/schema/contract_result.json diff --git a/lib/std/schema/cosmos_msg.json b/packages/std/schema/cosmos_msg.json similarity index 100% rename from lib/std/schema/cosmos_msg.json rename to packages/std/schema/cosmos_msg.json diff --git a/lib/std/schema/env.json b/packages/std/schema/env.json similarity index 100% rename from lib/std/schema/env.json rename to packages/std/schema/env.json diff --git a/lib/std/schema/query_result.json b/packages/std/schema/query_result.json similarity index 100% rename from lib/std/schema/query_result.json rename to packages/std/schema/query_result.json diff --git a/lib/std/src/demo.rs b/packages/std/src/demo.rs similarity index 100% rename from lib/std/src/demo.rs rename to packages/std/src/demo.rs diff --git a/lib/std/src/encoding.rs b/packages/std/src/encoding.rs similarity index 100% rename from lib/std/src/encoding.rs rename to packages/std/src/encoding.rs diff --git a/lib/std/src/errors.rs b/packages/std/src/errors.rs similarity index 100% rename from lib/std/src/errors.rs rename to packages/std/src/errors.rs diff --git a/lib/std/src/exports.rs b/packages/std/src/exports.rs similarity index 100% rename from lib/std/src/exports.rs rename to packages/std/src/exports.rs diff --git a/lib/std/src/imports.rs b/packages/std/src/imports.rs similarity index 100% rename from lib/std/src/imports.rs rename to packages/std/src/imports.rs diff --git a/lib/std/src/lib.rs b/packages/std/src/lib.rs similarity index 100% rename from lib/std/src/lib.rs rename to packages/std/src/lib.rs diff --git a/lib/std/src/memory.rs b/packages/std/src/memory.rs similarity index 100% rename from lib/std/src/memory.rs rename to packages/std/src/memory.rs diff --git a/lib/std/src/mock.rs b/packages/std/src/mock.rs similarity index 100% rename from lib/std/src/mock.rs rename to packages/std/src/mock.rs diff --git a/lib/std/src/serde.rs b/packages/std/src/serde.rs similarity index 100% rename from lib/std/src/serde.rs rename to packages/std/src/serde.rs diff --git a/lib/std/src/storage.rs b/packages/std/src/storage.rs similarity index 100% rename from lib/std/src/storage.rs rename to packages/std/src/storage.rs diff --git a/lib/std/src/traits.rs b/packages/std/src/traits.rs similarity index 100% rename from lib/std/src/traits.rs rename to packages/std/src/traits.rs diff --git a/lib/std/src/types.rs b/packages/std/src/types.rs similarity index 100% rename from lib/std/src/types.rs rename to packages/std/src/types.rs diff --git a/lib/vm/Cargo.toml b/packages/vm/Cargo.toml similarity index 94% rename from lib/vm/Cargo.toml rename to packages/vm/Cargo.toml index f98912ea99..c222600bf7 100644 --- a/lib/vm/Cargo.toml +++ b/packages/vm/Cargo.toml @@ -4,7 +4,7 @@ version = "0.7.1" authors = ["Ethan Frey "] edition = "2018" description = "VM bindings to run cosmwams contracts" -repository = "https://github.com/CosmWasm/cosmwasm/tree/master/lib/vm" +repository = "https://github.com/CosmWasm/cosmwasm/tree/master/packages/vm" license = "Apache-2.0" [badges] diff --git a/lib/vm/LICENSE b/packages/vm/LICENSE similarity index 100% rename from lib/vm/LICENSE rename to packages/vm/LICENSE diff --git a/lib/vm/README.md b/packages/vm/README.md similarity index 91% rename from lib/vm/README.md rename to packages/vm/README.md index 2dfed7e308..1dddc224e3 100644 --- a/lib/vm/README.md +++ b/packages/vm/README.md @@ -19,7 +19,7 @@ docker run --rm -v "$(pwd)":/code \ --mount type=volume,source=$(basename "$(pwd)")_cache,target=/code/target \ --mount type=volume,source=registry_cache,target=/usr/local/cargo/registry \ confio/cosmwasm-opt:0.7.2 ./contracts/hackatom -cp contracts/hackatom/contract.wasm lib/vm/testdata/contract_0.7.wasm +cp contracts/hackatom/contract.wasm packages/vm/testdata/contract_0.7.wasm ``` ## Testing @@ -28,13 +28,13 @@ By default, this repository is built and tested with the singlepass backend. Thi requires running Rust nighty: ```sh -cd lib/vm +cd packages/vm cargo +nightly test ``` To test with Rust stable, you need to switch to cranelift: ```sh -cd lib/vm +cd packages/vm cargo test --no-default-features --features default-cranelift ``` diff --git a/lib/vm/src/backends/cranelift.rs b/packages/vm/src/backends/cranelift.rs similarity index 100% rename from lib/vm/src/backends/cranelift.rs rename to packages/vm/src/backends/cranelift.rs diff --git a/lib/vm/src/backends/mod.rs b/packages/vm/src/backends/mod.rs similarity index 100% rename from lib/vm/src/backends/mod.rs rename to packages/vm/src/backends/mod.rs diff --git a/lib/vm/src/backends/singlepass.rs b/packages/vm/src/backends/singlepass.rs similarity index 100% rename from lib/vm/src/backends/singlepass.rs rename to packages/vm/src/backends/singlepass.rs diff --git a/lib/vm/src/cache.rs b/packages/vm/src/cache.rs similarity index 100% rename from lib/vm/src/cache.rs rename to packages/vm/src/cache.rs diff --git a/lib/vm/src/calls.rs b/packages/vm/src/calls.rs similarity index 100% rename from lib/vm/src/calls.rs rename to packages/vm/src/calls.rs diff --git a/lib/vm/src/compatability.rs b/packages/vm/src/compatability.rs similarity index 100% rename from lib/vm/src/compatability.rs rename to packages/vm/src/compatability.rs diff --git a/lib/vm/src/context.rs b/packages/vm/src/context.rs similarity index 100% rename from lib/vm/src/context.rs rename to packages/vm/src/context.rs diff --git a/lib/vm/src/errors.rs b/packages/vm/src/errors.rs similarity index 100% rename from lib/vm/src/errors.rs rename to packages/vm/src/errors.rs diff --git a/lib/vm/src/instance.rs b/packages/vm/src/instance.rs similarity index 100% rename from lib/vm/src/instance.rs rename to packages/vm/src/instance.rs diff --git a/lib/vm/src/lib.rs b/packages/vm/src/lib.rs similarity index 100% rename from lib/vm/src/lib.rs rename to packages/vm/src/lib.rs diff --git a/lib/vm/src/memory.rs b/packages/vm/src/memory.rs similarity index 100% rename from lib/vm/src/memory.rs rename to packages/vm/src/memory.rs diff --git a/lib/vm/src/middleware/deterministic.rs b/packages/vm/src/middleware/deterministic.rs similarity index 100% rename from lib/vm/src/middleware/deterministic.rs rename to packages/vm/src/middleware/deterministic.rs diff --git a/lib/vm/src/middleware/mod.rs b/packages/vm/src/middleware/mod.rs similarity index 100% rename from lib/vm/src/middleware/mod.rs rename to packages/vm/src/middleware/mod.rs diff --git a/lib/vm/src/modules.rs b/packages/vm/src/modules.rs similarity index 100% rename from lib/vm/src/modules.rs rename to packages/vm/src/modules.rs diff --git a/lib/vm/src/testing.rs b/packages/vm/src/testing.rs similarity index 100% rename from lib/vm/src/testing.rs rename to packages/vm/src/testing.rs diff --git a/lib/vm/src/wasm_store.rs b/packages/vm/src/wasm_store.rs similarity index 100% rename from lib/vm/src/wasm_store.rs rename to packages/vm/src/wasm_store.rs diff --git a/lib/vm/testdata/README.md b/packages/vm/testdata/README.md similarity index 100% rename from lib/vm/testdata/README.md rename to packages/vm/testdata/README.md diff --git a/lib/vm/testdata/contract.wasm b/packages/vm/testdata/contract.wasm similarity index 100% rename from lib/vm/testdata/contract.wasm rename to packages/vm/testdata/contract.wasm diff --git a/lib/vm/testdata/contract_0.6.wasm b/packages/vm/testdata/contract_0.6.wasm similarity index 100% rename from lib/vm/testdata/contract_0.6.wasm rename to packages/vm/testdata/contract_0.6.wasm diff --git a/lib/vm/testdata/contract_0.7.wasm b/packages/vm/testdata/contract_0.7.wasm similarity index 100% rename from lib/vm/testdata/contract_0.7.wasm rename to packages/vm/testdata/contract_0.7.wasm diff --git a/lib/vm/testdata/corrupted.wasm b/packages/vm/testdata/corrupted.wasm similarity index 100% rename from lib/vm/testdata/corrupted.wasm rename to packages/vm/testdata/corrupted.wasm