Skip to content

[Feature]: Investigate the Impact of Using wasm-opt on Contracts to Reduce Gas Costs #468

Closed
@0xNeshi

Description

@0xNeshi

What is the feature you would like to see?

Optimizing the generated contract wasm for size or speed could impact the gas costs associated with both deploying the contract, and calling the contract. This could have major effects on cryptographic function-related gas costs, ideally further proving the benefits of using Stylus over Solidity.

We have a couple of big contracts that we had to break up (e.g. Erc1155 and Erc721 examples), which is a problem our lib users will also have. A contract size reduction could mean the difference between deploying one contract, and deploying multiple contracts to avoid the size issue (as we had to do).

There's a tool called wasm-opt that can perform these optimizations.

We should investigate its the impact on Stylus contracts.

If wasm-opt turns out useful, it could be beneficial to push the Stylus team to integrate it into the Stylus CLI, so that everyone will have its gas cost benefits, without having to manually integrate it into their workflow, as most probably won't bother.

https://rustwasm.github.io/docs/book/reference/code-size.html#use-the-wasm-opt-tool

Contribution Guidelines

  • I agree to follow this project's Contribution Guidelines

Metadata

Metadata

Assignees

No one assigned

    Labels

    effort: mediumDefault level of effort.type: buildRelated to build configuration.type: perfPerformance work.

    Type

    No type

    Projects

    Status

    Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions