Skip to content

Do not hardcode the Rust toolchain used to build contracts #3

@ptagl

Description

@ptagl

Currently, the rust-contract tool uses stable as Rust toolchain channel as it's hardcoded in the build_contract() function inside __init__.py.

This has always worked perfectly until Rust introduced a breaking change with the release 1.81, affecting the rscdk. This means that having an environment with an updated stable toolchain makes it impossible to compile correctly any contract.

Steps to reproduce

  1. Install the latest nightly version of Rust (version >= 1.81.0)
  2. Clone the rscdk repository and switch to an example contract folder
  3. Compile using rust-contract
rustup update
git clone git@github.com:uuosio/rscdk.git
cd rscdk/examples/token
rust-contract build --stack-size 8192

The compilation returns the following error:

error[E0599]: no method named `unwrap` found for struct `PanicMessage` in the current scope
  --> crates/chain/src/lib.rs:16:46
   |
16 |     let msg = format!("{:?}", info.message().unwrap().as_str().unwrap());
   |                                              ^^^^^^ method not found in `PanicMessage<'_>`

Expected behavior

  • rust-contract can build both with Rust 1.81 and older versions (this depends on fixing Cannot compile with Rust nightly-1.81.0 rscdk#8)
  • rust-contract doesn't force users to run the compilation with the stable toolchain, so that eventual future breaking changes could easily be fixed by switching to a different toolchain (which is impossible today)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions