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

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

Open
ptagl opened this issue Sep 13, 2024 · 0 comments
Open

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

ptagl opened this issue Sep 13, 2024 · 0 comments

Comments

@ptagl
Copy link

ptagl commented Sep 13, 2024

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 [email protected]: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)
ptagl added a commit to telosnetwork/rust-contracts-builder that referenced this issue Sep 13, 2024
This is useful in order to give users additional flexibility.
The change was originally meant to fix the following issue:

uuosio#3

Caused by:

uuosio/rscdk#8
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

1 participant