stellar / rs-soroban-env

Rust environment for Soroban contracts.
Apache License 2.0
61 stars 42 forks source link

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

Open leighmcculloch opened 1 week ago

leighmcculloch commented 1 week ago

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
- [ ] Add compile error to Rust sdk usage to prevent building with the target features (temporary) cc @stellar/contract-committers https://github.com/stellar/rs-soroban-sdk/pull/1353
- [ ] Update wasmi usage to allow the target features cc @stellar/contract-committers
- [ ] Check if Rust SDK can decode and extract contract specs from imported contracts built with the features enabled cc @stellar/contract-committers
- [ ] Remove compile errors from the Rust SDK once target features are enabled cc @stellar/contract-committers
- [ ] Check if JS Stellar SDK can decode and extract contract specs from contracts built with the features enabled cc @Shaptic @stellar/devx
- [ ] Check if Stellar CLI can decode and extract contract specs from contracts built with the features enabled cc @stellar/devx
- [ ] Answer the question: How do we find out about breaking changes to rust like this sooner?

Links:

anupsdf commented 6 days ago

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.