Brushfam / openbrush-contracts

https://openbrush.io
MIT License
25 stars 10 forks source link

Build failure in openbrush examples #122

Open joshua8321 opened 1 year ago

joshua8321 commented 1 year ago

I'm trying to build psp34 metadata example from here, and it goes into failure with the following error:

... Compiling my_psp34_metadata v4.0.0-beta (/tmp/cargo-contract_dCY6la) Finished release [optimized] target(s) in 56.21s [2/4] Post processing code ERROR: Loading of original wasm failed

Caused by: 0: Loading of wasm module at '.../openbrush-contracts/examples/psp34_extensions/metadata/target/ink/wasm32-unknown-unknown/release/my_psp34_metadata.wasm' failed 1: Unknown opcode 192

I ran this command to build the example: cargo +nightly contract build --release

here is the information of my toolchain:

rustc --version rustc 1.73.0-nightly

rustup toolchain list nightly-x86_64-unknown-linux-gnu (default)

h4nsu commented 1 year ago

I'm getting the same error with the current stable toolchain. All other psp34 extenstion examples work, but the metadata one fails with the same "opcode 192" error.

Artemka374 commented 1 year ago

Hey! First of all, it should be built with stable toolchain, that's true, second thing - could you try using 1.69 version of stable? Sometimes there appear problems in ink! contracts with versions upper

h4nsu commented 1 year ago

You're right, it works with 1.69 version. You need to add relevant rust-toolchain files to the repo and probably also mention it in the README. Using non-latest stable toolchain is a very unusual practice, it's hard to just guess this solution.

beach-dev commented 1 year ago

@Artemka374 Thanks for the information. Could you guide me how to go back to version 1.69 and install necessary toolchain please?

h4nsu commented 1 year ago
$ rustup install 1.69
$ rustup component add rust-src --toolchain 1.69
$ rustup target add wasm32-unknown-unknown --toolchain 1.69

$ cargo +1.69 contract build --release
coreggon11 commented 1 year ago

This is a problem with cargo contract, not OpenBrush. It is fixed in the latest cargo-contract v4.