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

WebAssembly contracts built with the Rust toolchain 1.70 or later cannot be deployed #9143

Closed
nagisa opened this issue Jun 5, 2023 · 4 comments
Labels
C-tracking-issue Category: a tracking issue

Comments

@nagisa
Copy link
Collaborator

nagisa commented Jun 5, 2023

If you attempt to deploy a contract built with the Rust toolchain version 1.70 or later the deployment of the contract will likely fail with an error message along the lines of "deserialize".

This is because in Rust 1.70 the version of LLVM was upgraded to 16.0 series, and in this version of LLVM a WebAssembly proposal – sign extensions – was enabled by default. This proposal has introduced new instructions that aren't supported by the NEAR protocol contract runtime at this point in time. Whenever these instructions occur in the deployed WebAssembly module, the deployment will immediately fail.

There are a couple of approaches you can take in order to maintain the contract in a deployable state:

  1. Use Rust toolchain 1.69 or earlier;
  2. If you must use the Rust toolchain 1.70 or later, use a nightly toolchain and adjust the build command in one of the following ways (note the RUSTFLAGS environment variable and the -Zbuild-std cargo flag):
    • env RUSTFLAGS='-Ctarget-cpu=mvp' cargo build -Zbuild-std=panic_abort,std ...; or
    • env RUSTFLAGS='-Ctarget-feature=-sign-ext' cargo build -Zbuild-std=panic_abort,std ....
@nagisa
Copy link
Collaborator Author

nagisa commented Jun 14, 2023

NB: when the network deploys 1.35 and votes on the new protocol version the deploys should start working again.

near-bulldozer bot pushed a commit that referenced this issue Jun 19, 2023
With 1.70 toolchain, the contracts are by default compiled in a way
which requires updates to wasmer 2.4.1 as well.

I looked also into replacing usage of once_cell crate but sadly
std::sync::OnceLock doesn’t implement wait method.

Co-authored-by: Jakob Meier <mail@jakobmeier.ch>
Co-authored-by: Simonas Kazlauskas <git@kazlauskas.me>
Issue: near/create-near-app#2009
Issue: #9143
@robert-zaremba
Copy link
Contributor

Integration tests fail as well with rustc 1.70, so workspace-rs will have to be updated.

@anshulWeb3
Copy link

anshulWeb3 commented Jun 29, 2023

NB: when the network deploys 1.35 and votes on the new protocol version the deploys should start working again.

How can i know more about it? as far as i can see the 1.35 rc1 build has been released and the voting was expected to start on 27th. How can i know the outcome of the voting?

@nagisa
Copy link
Collaborator Author

nagisa commented Aug 2, 2023

The protocol upgrade has happened, so this should be resolved now. Your contracts built with newer versions of the Rust toolchain should work just fine.

@nagisa nagisa closed this as completed Aug 2, 2023
@bowenwang1996 bowenwang1996 unpinned this issue Aug 12, 2023
github-merge-queue bot pushed a commit to aurora-is-near/aurora-engine that referenced this issue Aug 31, 2023
…ging toolchain (#832)

# Description

Currently impossible to update toolchain, it's related to [NEAR
issue](near/nearcore#9143).

And it is impossible to do `cargo update`, because
[issue](rust-cli/anstyle#118 (comment)).

- Updated clippy requirements to `nightly-2023-08-24`, without updating
`rust-toolchain`.
- Fixed clippy issues, related to clippy requirements for
`nightly-2023-08-24` version.
aleksuss pushed a commit to aurora-is-near/aurora-engine that referenced this issue Sep 25, 2023
…ging toolchain (#832)

# Description

Currently impossible to update toolchain, it's related to [NEAR
issue](near/nearcore#9143).

And it is impossible to do `cargo update`, because
[issue](rust-cli/anstyle#118 (comment)).

- Updated clippy requirements to `nightly-2023-08-24`, without updating
`rust-toolchain`.
- Fixed clippy issues, related to clippy requirements for
`nightly-2023-08-24` version.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-tracking-issue Category: a tracking issue
Projects
None yet
Development

No branches or pull requests

3 participants