17 个版本 (9 个重大更新)
0.10.0 | 2023 年 6 月 29 日 |
---|---|
0.9.3 | 2023 年 3 月 27 日 |
0.9.2 | 2023 年 1 月 23 日 |
0.9.0 | 2022 年 12 月 21 日 |
0.6.1 | 2022 年 7 月 27 日 |
#8 in #cw
用于 cosm-orc
370KB
546 代码行
cw-optimizoor
是 CosmWasm/rust-optimizer 的快速替代方案,用于编译和优化 CW 智能合约。
主要用于加速本地开发和测试。
功能
- 快速 - 尤其适用于拥有许多合约的工作区
- 默认使用与
rust-optimizer
相同的优化 - 无需依赖 Docker
- 支持单合约和多合约工作区
- 作为 cargo 子命令 编写
- 跨平台,跨架构
安装
# Pre-requisites
$ rustup install 1.69.0
$ rustup target add wasm32-unknown-unknown
$ cargo install cw-optimizoor
你可能还需要以下任何一项
Linux
# Ubuntu
$ sudo apt install -y cmake pkg-config libssl-dev clang
# Fedora
$ sudo dnf install -y cmake openssl-devel clang
macOS
$ xcode-select --install # clang
$ brew install cmake pkg-config
Windows
使用方法
$ cargo cw-optimizoor -h
Usage: cargo cw-optimizoor [OPTIONS] [WORKSPACE_PATH]
Arguments:
[WORKSPACE_PATH] Path to the workspace dir or Cargo.toml
Options:
-f, --features <FEATURES> Space or comma separated list of features to activate
--all-features Activate all available features
--no-default-features Do not activate the `default` feature
-h, --help Print help information
-V, --version Print version information
示例
$ cargo cw-optimizoor # defaults to the current dir
# cargo cw-optimizoor Cargo.toml # or this for pointing directly at a Cargo manifest
# cargo cw-optimizoor . # or this for the current dir
🧐️ Compiling .../monorepo/Cargo.toml
Finished release [optimized] target(s) in 0.10s
🤓 Intermediate checksums:
...326a37596ef54377869d8f7caa37cec393333b9808c9ecc75ddadf1357193a50 contract_1.wasm
...170190ce817c36aa093263f4689abaffafe363909aea13e48b80c43a39a7cde9 contract_2.wasm
...6a718777f28b2e213e3f18f60ffbf62febe563072e8a89b0cfa5359b3e0bed1b contract_3.wasm
...9f9dae24e8a388730b40de3092117cf84476dacfb6ed0112bec53b1b21127333 contract_4.wasm
...9255c18758fd0b27de38c8aacd2030167b9d3c1575374d811f89742be8af4f8b contract_5.wasm
🥸 Ahh I'm optimiziing
...✅ contract_1 was optimized.
...⏭️ contract_2 is unchanged. Skipping.
...✅ contract_3 was optimized.
...⏭️ contract_4 is unchanged. Skipping.
...✅ contract_5 was optimized.
🤓 Final checksums:
...e11db2d5b9ff3e14deee2a04ee40be0d1f8da96c4a45bc55348ea74ff4a4d4ae contract_1-aarch64.wasm
...0565368394fd2fa1409909f63fe11d09f37a1f777f26bc5ddb65d17c2fc82bb9 contract_2-aarch64.wasm
...1364e024dab8cc057d090d8686042d8ab5e41e810b16d464be71a24aedc79ad3 contract_3-aarch64.wasm
...4f553da8e620137c194eddfddcaa7baa29239ec723d0b1b2b49d11fe625986e5 contract_4-aarch64.wasm
...61ea8988f4275c15785d7496c453a37ae4c3b021d4521120fc5c0d532287f864 contract_5-aarch64.wasm
🫡 Done. Saved optimized artifacts to:
.../monorepo/artifacts
依赖项
~73–110MB
~2M SLoC