CosmWasm / optimizer

Dockerfile and script to deterministically produce the smallest possible Wasm for your Rust contract
Apache License 2.0
117 stars 56 forks source link

Can't specify specific contract for build in workspace repositories #152

Open CyberHoward opened 2 months ago

CyberHoward commented 2 months ago

Problem

Recurring WASM compilation is required when developing smart-contracts that require WASM blob based testing (osmosis-test-tube / testnets). When working in a Rust workspace environment using the optimizer for these recompiles can take a lot of time as each contract in the workspace is recompiled. This slows down development and can really hurt productivity.

While tools like cw-optimizoooor exists, they don't have the WASM build options integration, making it an unsuitable tool for more advanced repositories.

Possible Solution

We could add an optional argument to the docker execution that specifies which contracts to build. This way the developer can specify only the contract that they want to compile as part of the workspace without having to resort to other tools or workflows.

Alternatively the builder could be called from the contract's specific directory. However in its current state this will fail because the builder will not make use of the workspace Cargo.toml that is oftentimes referenced by workspace members.

webmaster128 commented 2 months ago

I don't think CosmWasm/optimizer belongs in a dev workflow. You have a much easier life with a simple build script like this: https://github.com/noislabs/nois-contracts/blob/main/devtools/build_integration_wasm.sh