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

Rust 1.82+ enables reference-types / multivalue wasm target features #1469

Open
7 tasks
leighmcculloch opened this issue Sep 29, 2024 · 1 comment
Open
7 tasks

Comments

@leighmcculloch
Copy link
Member

leighmcculloch commented Sep 29, 2024

Rust 1.82 coming to stable on Oct 17th updates to using LLVM 19.

reference-types and multivalue are enabled, which will change how the WASM binaries are built.

From the announcement blog post:

any WebAssembly module with an indirect function call (which is almost always the case for Rust code) will produce a WebAssembly binary that cannot be decoded by engines and tooling that do not support the reference-types proposal

Ref: https://blog.rust-lang.org/2024/09/24/webassembly-targets-change-in-default-target-features.html

We have these features disabled in wasmi in Protocol 21 (current protocol) and in Protocol 22 (the next protocol), which means builds of contracts with Rust 1.82+ will be rejected by the network. This will require contract developers to use Rust 1.81 or earlier for a time until we can catch up.

We need to also in general check that our tooling are updated to be able to decode the new types of wasm files if they can't already.

Tasks

Links:

github-merge-queue bot pushed a commit to stellar/rs-soroban-sdk that referenced this issue Oct 1, 2024
### What
Add compile errors when built with unsupported wasm features
reference-types and multivalue.

### Why
Rust 1.82 is likely to ship with target feature reference-types and
multivalue enabled on wasm builds. These target features are not
supported by the Soroban Env in the current protocol 21 or next planned
protocol 22. It's not trivial for developers to disable target features
because of how the rustc compiler only exposes the ability to buildstd
with nightly.

These compile errors will prevent someone from building .wasm files with
the sdk when either of those target features are enabled.

A Rust version check is not being done because it's actually easier to
do a target feature check, and in the off chain somehow Rust 1.82
shipped without the target features enabled then the sdk could still be
used with 1.82.

Links:
- https://discord.com/channels/897514728459468821/1289090985569026048
- stellar/rs-soroban-env#1469
- WebAssembly/tool-conventions#233


### Releasing
This change will be merged to `main` targeting v22, then should be
backported to a v21 patch release immediately following.
leighmcculloch added a commit to stellar/rs-soroban-sdk that referenced this issue Oct 1, 2024
### What
Add compile errors when built with unsupported wasm features
reference-types and multivalue.

### Why
Rust 1.82 is likely to ship with target feature reference-types and
multivalue enabled on wasm builds. These target features are not
supported by the Soroban Env in the current protocol 21 or next planned
protocol 22. It's not trivial for developers to disable target features
because of how the rustc compiler only exposes the ability to buildstd
with nightly.

These compile errors will prevent someone from building .wasm files with
the sdk when either of those target features are enabled.

A Rust version check is not being done because it's actually easier to
do a target feature check, and in the off chain somehow Rust 1.82
shipped without the target features enabled then the sdk could still be
used with 1.82.

Links:
- https://discord.com/channels/897514728459468821/1289090985569026048
- stellar/rs-soroban-env#1469
- WebAssembly/tool-conventions#233

### Releasing
This change will be merged to `main` targeting v22, then should be
backported to a v21 patch release immediately following.

(cherry picked from commit 6c45fb9)
@anupsdf
Copy link
Contributor

anupsdf commented Oct 2, 2024

We should also evaluate extended-const, nontrapping-fptoint, simd128 and relaxed_simd target features. Found them when comparing rustv1.74.0 with rustv1.81.0.

github-merge-queue bot pushed a commit to stellar/rs-soroban-sdk that referenced this issue Oct 23, 2024
leighmcculloch added a commit to stellar/rs-soroban-sdk that referenced this issue Oct 23, 2024
### What
Prevent use with rust 1.82+. And run CI builds with 1.81.

### Why
stellar/rs-soroban-env#1469

Discussion:
https://stellarfoundation.slack.com/archives/C030Z9EHVQE/p1729217606684609
(cherry picked from commit 9e674f2)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants