substrate-docs icon indicating copy to clipboard operation
substrate-docs copied to clipboard

error after uploading contract code in "prepare your first contract tutorial"

Open Daanvdplas opened this issue 2 years ago • 1 comments

Is there an existing issue?

  • [X] I have searched the existing issues

Experiencing problems? Have you tried our Stack Exchange first?

  • [X] This is not a support question.

Bug report for compiling, code snippets, templates, etc.

An error after uploading flipper.contract code on the contracts ui. I was following the tutorial: https://docs.substrate.io/tutorials/smart-contracts/prepare-your-first-contract/ Issue has come up for multiple people: https://substrate.stackexchange.com/questions/5259/rust-ink-execution-finished-with-debug-buffer

Steps to reproduce the problem

follow tutorial: https://docs.substrate.io/tutorials/smart-contracts/prepare-your-first-contract/

Daanvdplas avatar Oct 21 '22 15:10 Daanvdplas

@Daanvdplas, were you following this part of the tutorial with the workaround to use a specific nightly build:

If the command indicates you are using version 1.5.0, run the following commands to update Rust to use a compatible version of the toolchain:

rustup toolchain install nightly-2022-08-15 rustup target add wasm32-unknown-unknown --toolchain nightly-2022-08-15 rustup component add rust-src --toolchain nightly-2022-08-15

You can then compile contracts using this toolchain by running the following command:

cargo +nightly-2022-08-15 contract build

It seems like it is fixed in ink 3.4.0 that was just released. I was able to remove cargo-contract and re-install it and then compile flipper with the latest version of ink!

Related PR to remove the workaround: https://github.com/substrate-developer-hub/substrate-docs/pull/1600

lisa-parity avatar Oct 21 '22 22:10 lisa-parity

I tried it again and I'm having the same issue. The moment I upload the smart contract I receive this message: Screenshot 2022-10-24 at 09 35 32

Other than that everything is working, so I can use the smart contract (last steps of the tutorial). I do not however get any output in my terminal when using the get() or flip() of the contract (I don't know if it should).

Last, I read somewhere that production of blocks is changed to when a extrinsic is received. This is not changed in the document. So after starting the substrate-contracts-node the document says it should produce blocks, but this shouldn't be the case due to this change.

Hope this all helps!

Daanvdplas avatar Oct 24 '22 07:10 Daanvdplas

@Daanvdplas, were you following this part of the tutorial with the workaround to use a specific nightly build:

If the command indicates you are using version 1.5.0, run the following commands to update Rust to use a compatible version of the toolchain:

rustup toolchain install nightly-2022-08-15 rustup target add wasm32-unknown-unknown --toolchain nightly-2022-08-15 rustup component add rust-src --toolchain nightly-2022-08-15

You can then compile contracts using this toolchain by running the following command:

cargo +nightly-2022-08-15 contract build

It seems like it is fixed in ink 3.4.0 that was just released. I was able to remove cargo-contract and re-install it and then compile flipper with the latest version of ink!

Related PR to remove the workaround: #1600

hello, could you please teach me how to remove and reinstall cargo-contract, and which commands I should use? "cargo +nightly-2022-08-15 contract build" seems too complex to use. Thanks for answer my question !

xiaozeplus avatar Nov 14 '22 06:11 xiaozeplus

To remove the installed package: cargo uninstall cargo-contract

To re-install: cargo install cargo-contract --force

lisa-parity avatar Nov 14 '22 17:11 lisa-parity