Coder Social home page Coder Social logo

cw-optimizoor's People

Contributors

de-husk avatar dependabot[bot] avatar mandrean avatar nicolaslara avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

cw-optimizoor's Issues

Support activating certain features

Running cargo build --feature x or cargo build --all-features works well, but trying to specify it on cw-optimizoor:

โฏ cargo cw-optimizoor -- --all-features

exits with no output and empty artifacts/

Sometimes creates empty wasm binaries

Awesome project!

I ran into an issue trying to use it with this workspace: https://github.com/DA0-DA0/dao-contracts

It produced nearly empty optimized wasm binaries for cw20_stake and cw_core contracts.

When I tried to use them, I got this error:

Error calling the VM: Error during static Wasm validation: Wasm contract doesn't have required export: "instantiate". Exports required by VM: ["allocate", "deallocate", "instantiate"].: create wasm contract failed: invalid request

Im wondering if optimizoor is compiling them with the library feature enabled?

Unkown opcode error

With Rust 1.70, unsupported op codes appear when uploading the wasms on-chain. (See : CosmWasm/cosmwasm#1727)

One fix is available on that issue. Would it be possible to implement that ?

Thanks

Produces larger binaries than cosmwasm workspace-optimizer

I noticed that the cw-optimizoor optimized binaries are a bit larger than the rust workspace-optimizer for the DAO DAO contracts.

cw-optimizoor:

$ ls -lh artifacts | grep wasm | awk '{print $5,$9}'
293K cw20_stake-x86_64.wasm
295K cw20_staked_balance_voting-x86_64.wasm
196K cw4_voting-x86_64.wasm
278K cw721_stake-x86_64.wasm
161K cw_admin_factory-x86_64.wasm
404K cw_core-x86_64.wasm
175K cw_named_groups-x86_64.wasm
209K cw_names_registry-x86_64.wasm
219K cw_native_staked_balance_voting-x86_64.wasm
495K cw_proposal_multiple-x86_64.wasm
501K cw_proposal_single-x86_64.wasm
178K cw_token_swap-x86_64.wasm
244K stake_cw20_external_rewards-x86_64.wasm
190K stake_cw20_reward_distributor-x86_64.wasm

cosmwasm workspace optimizer:

$ ls -lh artifacts | grep wasm | awk '{print $5,$9}'
257K cw20_stake.wasm
261K cw20_staked_balance_voting.wasm
193K cw4_voting.wasm
276K cw721_stake.wasm
143K cw_admin_factory.wasm
407K cw_core.wasm
173K cw_named_groups.wasm
188K cw_names_registry.wasm
216K cw_native_staked_balance_voting.wasm
455K cw_proposal_multiple.wasm
460K cw_proposal_single.wasm
171K cw_token_swap.wasm
226K stake_cw20_external_rewards.wasm
171K stake_cw20_reward_distributor.wasm

You can see the % difference here: DA0-DA0/dao-contracts#474 (comment)

I wonder if there is a different optimization flag being used?

When contracts import each other, the imported contracts skip the entry points

If you compile two contracts A and B where the B one imports the A, then A one will be built both as a contract and as a library.

As a consequence, the .wasm artifact for the A being built as a contract will be overwritten by the .wasm of A being built as a library. This means that there is no way to obtain A as a contract. This can be seen in the following workspace: https://github.com/osmosis-labs/osmosis/tree/main/x/ibc-hooks.

I think I know how to fix this, so I'll try to submit a PR when I have time, but leaving the issue here in case someone gets to it before me.

It doesn't error when it can't create wasms

In case it doesn't have permission to write binaries to directory (created by the docker, for ex.) after finishing it simply prints:

๐Ÿค“  Intermediate checksums:

But it didn't create any binaries, so IMO it should throw an error

Optimizes the wrong file version?

Still not sure the root of the problem but when optimizing my contract I was getting schemas that were very old (like not even on in my repo old). Problem was solved by using the normal docker optimizer.

Add self-updater functionality

Something like:

There is a newer version (v0.6.0) of cw-optimizoor available!
Current version is 0.5.1. To update, run: cargo install cw-optimizoor

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.