Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add wasm-opt-for-rust proposal #1070

Merged
merged 5 commits into from
Jul 20, 2022
Merged

Add wasm-opt-for-rust proposal #1070

merged 5 commits into from
Jul 20, 2022

Conversation

brson
Copy link
Contributor

@brson brson commented Jul 18, 2022

Project Abstract

This project makes the wasm-opt tool more accessible to Rust programmers. wasm-opt is a WebAssembly optimizer and is required by most software toolchains that produce WebAssembly binaries.

This project is to package wasm-opt as a cargo crate, so that it can be installed by typing

cargo install wasm-opt

Additionally, it will provide a Rust API so that toolchain developers may, if they desire, call wasm-opt programmatically, so that their users are not required to manually install the tool.

For which grant level are you applying?

  • Level 1: Up to $10,000, 2 approvals
  • Level 2: Up to $30,000, 3 approvals
  • Level 3: Unlimited, 5 approvals (for >$100k: Web3 Foundation Council approval)

Application Checklist

  • The application template has been copied, renamed ( project_name.md) and updated.
  • I have read and understood the FAQs, application guidelines and announcement guidelines.
  • A BTC, Ethereum (USDT/USDC/DAI) or Polkadot/Kusama (aUSD) address for the payment of the milestones is provided inside the application.
  • I have read and acknowledge the terms and conditions.
  • The software delivered for this grant will be released under an open-source license specified in the application.
  • The initial PR contains only one commit (squash and force-push if needed).
  • The grant will only be announced once the first milestone has been accepted.
  • I prefer the discussion of this application to be in a private Element/Matrix channel. My username is: @_______

How Did You Hear About our grants program?

  • Social Media
  • Hackathon
  • Personal Recommendation
  • Substrate Builders Program
  • Investor/VC
  • Online Search
  • Other: _______

@CLAassistant
Copy link

CLAassistant commented Jul 18, 2022

CLA assistant check
All committers have signed the CLA.

@brson
Copy link
Contributor Author

brson commented Jul 18, 2022

cc @cmichi @Robbepop @kripken a proposal to create Rust wasm-opt bindings.

@cmichi
Copy link

cmichi commented Jul 18, 2022

This application is great! It'll heavily improve the developer experience with cargo-contract, as well as benefit the broader Wasm ecosystem.

PS: A nit ‒ the project name is "ink!", the backstory is that we started out with a "normal" macro and wanted a tip of the hat to that, as well as maximizing the amount of "Dots" in our project name, as another tip of the hat to Polkadot :-).

Noc2
Noc2 previously approved these changes Jul 18, 2022
Copy link
Collaborator

@Noc2 Noc2 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks a lot for the application! I’m happy to approve it and mark it as ready for review. If you have any questions feel free to reach out to grants@web3.foundation We are also flexible to amend the grant application at any time, if it makes sense to change it (additional work, certain problems etc.)

@Noc2 Noc2 added the ready for review The project is ready to be reviewed by the committee members. label Jul 18, 2022
| 0d. | Docker | Docker is not required for this project. |
| 0e. | Article | None. |
| 1. | `wasm-opt` binary | Produce a `wasm-opt` binary that can be built by cargo but is otherwise identical to stock `wasm-opt`. |
| 2. | APIs | Write an idiomatic, but possibly incomplete, Rust API for loading wasm, optimizing it, and writing it again. |
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this imply that milestone 2 will have the complete API? Do you know which parts might be incomplete or why??

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It does imply that M2 will have a complete API, and I have updated the M2 text to clarify.

For the most part wasm-opt uses well defined C++ APIs within binaryen, and these will be easy to expose in Rust, and we will probably get them done quickly for M1.

Some API matters that could be punted to M2 include:

  • Features provided by the wasm-opt binary that aren't provided by binaryen APIs. There are a few, particularly related to fuzzing.
  • There are also some wasm-opt flags that specifically affect console output, that probably don't make sense for a programmatic API, but may want to be accounted for in some way. For example there are flags for printing various things to the console - an API probably wouldn't just print things to the console, but may provide access to the appropriate info such that the caller can do that printing on their own.
  • For ease of integration into existing tools it may be desirable to let API callers pass the textual command-line options they already use directly to the API. This may especially be true if any tools allow command-line options to be passed-through to wasm-opt. This would likely require a custom-written Rust parser for the wasm-opt command line options.

If you want I can reflect these specifics in the text.

takahser
takahser previously approved these changes Jul 18, 2022
Copy link
Collaborator

@takahser takahser left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@brson thanks for submitting this grant application. I think this is something that would make ink! development more convenient, hence adding plenty of value to the community. I'm happy to go ahead with it. 👍

applications/wasm-opt-for-rust.md Outdated Show resolved Hide resolved
applications/wasm-opt-for-rust.md Outdated Show resolved Hide resolved
ashlink11
ashlink11 previously approved these changes Jul 19, 2022
Copy link
Contributor

@ashlink11 ashlink11 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for applying to build a useful/core crate in the rust/wasm/cargo/ink! ecosystem. I'm glad your long-term plan is to apply for maintenance grants to maintain it. I'm looking forward to the article part of M2 to understand more about your work and how Layer 0 works in more detail.

@brson brson dismissed stale reviews from ashlink11, takahser, and Noc2 via aed2b1a July 20, 2022 00:43
brson and others added 3 commits July 19, 2022 19:43
Co-authored-by: S E R A Y A <takahser@users.noreply.github.com>
Co-authored-by: S E R A Y A <takahser@users.noreply.github.com>
@brson
Copy link
Contributor Author

brson commented Jul 20, 2022

I have fixed the capitalization and punctuation for the name ink!, accepted suggestions, and clarified the API deliverables. Thanks for the reviews and enthusiasm.

@brson
Copy link
Contributor Author

brson commented Jul 20, 2022

Let me know if I should squash the commits.

Copy link
Collaborator

@Noc2 Noc2 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks a lot for the update. You don’t need to squash the commits.

@Noc2
Copy link
Collaborator

Noc2 commented Jul 20, 2022

Btw. @brson could you sign the latest version of our terms & conditions. See the CLAassistant bot.

Copy link
Contributor

@alxs alxs left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems very useful, happy to support it! I would love to see more grants for low-level tooling like this.

Copy link
Collaborator

@takahser takahser left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Re-Approving

@semuelle semuelle merged commit f6c825d into w3f:master Jul 20, 2022
@github-actions
Copy link
Contributor

Congratulations and welcome to the Web3 Foundation Grants Program! Please refer to our Milestone Delivery repository for instructions on how to submit milestones and invoices, our FAQ for frequently asked questions and the support section of our README for more ways to find answers to your questions.

Before you start, take a moment to read through our announcement guidelines for all communications related to the grant or make them known to the right person in your organisation. In particular, please don't announce the grant publicly before at least the first milestone of your project has been approved. At that point or shortly before, you can get in touch with us at grantsPR@web3.foundation and we'll be happy to collaborate on an announcement about the work you’re doing.

Lastly, please remember to let us know in case you run into any delays or deviate from the deliverables in your application. You can either leave a comment here or directly request to amend your application via PR. We wish you luck with your project! 🚀

@brson
Copy link
Contributor Author

brson commented Jul 20, 2022

Btw. @brson could you sign the latest version of our terms & conditions. See the CLAassistant bot.

I have re-signed the CLA as requested.

@brson
Copy link
Contributor Author

brson commented Jul 20, 2022

Thanks for the support all!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ready for review The project is ready to be reviewed by the committee members.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

9 participants