ink icon indicating copy to clipboard operation
ink copied to clipboard

Basic-contract-caller throws error

Open FrankBevr opened this issue 2 years ago • 2 comments

Basic-contract-caller doesnt work.

Error says

ERROR: Metadata: Pallet Contracts Call Contracts has incompatible metadata

Reproduce

  1. cd ~
  2. git clone https://github.com/paritytech/ink.git
  3. cd ink
  4. sudo systemclt start docker
  5. docker run -it -v /home/frank/ink:/ink -p 9944:9944 frankbevr/ink
  6. cd /ink
  7. cd /ink/integration-tests/basic-contract-caller/other-contract
  8. cargo test && cargo contract build
  9. cd /ink/integration-tests/basic-contract-caller
  10. cargo test && cargo contract build
  11. Ctrl + p + d splits terminal
  12. substrate-contracts-node --dev
  13. Ctrl + p + p + Enter switch to previous pane
  14. cd /ink/integration-tests/basic-contract-caller
  15. cargo contract upload --suri //Alice -x
  16. --> Error <--

Image of Error

image

Dockerfile of Image

Dockerfile inclued version, contract version, node version, etc.

# Start from rust offical docker image 
FROM rust:latest
# Set install shell as bash
SHELL ["/bin/bash", "-c"]
# Add Rust to PATH
ENV PATH="/root/.cargo/bin:${PATH}"
# Add Neovim to PATH
ENV PATH="/root/.local/share/bob/nvim-bin/:${PATH}"

# Install basics
# https://docs.substrate.io/install/linux/
RUN  apt update -y && apt upgrade -y &&\
  apt install cmake -y &&\
  apt install build-essential &&\
  apt install --assume-yes git clang curl libssl-dev protobuf-compiler

# Install Frank Dev Utils
# https://github.com/0atman/noboilerplate/blob/main/scripts/20-rust-userland.md#oxidise-your-life-1
RUN cargo install cargo-info ripgrep exa \
  bat irust nu zellij bacon \
  gitui rtx-cli starship nu \
  bob-nvim

# Add Neovim(AstroVim) via bob-nvim
# https://astronvim.com/
RUN bob install 0.9.1 && \
  bob use 0.9.1 &&\
  git clone --depth 1 https://github.com/AstroNvim/AstroNvim ~/.config/nvim &&\
  nvim --headless "+Lazy! sync" +qa

# Setup Franks NuShell
# https://www.nushell.sh/book/configuration.html
# https://starship.rs/guide/
RUN  mkdir ~/.config/nushell &&\
  touch ~/.config/nushell/env.nu &&\
  touch ~/.config/nushell/config.nu &&\
  mkdir ~/.cache/starship &&\
  touch ~/.cache/starship/init.nu &&\
  starship init nu >>  ~/.cache/starship/init.nu &&\
  touch ~/.config/starship.toml &&\
  starship preset pastel-powerline > ~/.config/starship.toml &&\
  echo "source-env ~/.cache/starship/init.nu" >> ~/.config/nushell/env.nu &&\
  echo "let-env config = { show_banner:false, edit_mode: nvim, }" >> ~/.config/nushell/config.nu

# Setup Ink Utitls
# https://use.ink/getting-started/setup
RUN rustup toolchain install nightly-2023-03-09 &&\
  rustup default nightly-2022-12-24 &&\
  rustup target add wasm32-unknown-unknown &&\
  rustup update nightly &&\
  rustup target add wasm32-unknown-unknown --toolchain nightly &&\
  cargo install --version 2.1.0 cargo-contract &&\
  cargo install contracts-node --git https://github.com/paritytech/substrate-contracts-node.git

# Add missing things 
RUN cargo install kondo &&\
  rustup component add rust-src --toolchain nightly-2022-12-24-x86_64-unknown-linux-gnu &&\
  rustup component add rustfmt &&\
  nvim --headless "+LspInstall rust_analyzer" +qa &&\
  nvim --headless "+MasonInstall rustfmt" +qa

# Start Zellij  
# https://zellij.dev/documentation/
CMD ["zellij", "options", "--default-shell", "nu", "--session-name", "Rusty"]

FrankBevr avatar Jun 16 '23 12:06 FrankBevr

maybe try using stable and 1.69 instead of 1.68

stable-x86_64-unknown-linux-gnu (default)
rustc 1.69.0 (84c898d65 2023-04-16)

i've been able to use it in my code here https://github.com/ltfschoen/InkTemplate/pull/16/files#diff-84af1add043372bf3be8123a2d3477b5f1d436cc0dbbf322c0bcd3c99249adb2 you can try my code by running these three commands after you clone my branch https://github.com/ltfschoen/InkTemplate/pull/16/files#diff-b335630551682c19a781afebcf4d07bf978fb1f8ac04c6bf87428ed5106870f5R142

I use this setup

  • Install latest Cargo Contract version
  • Install Rustup 1.69. See https://github.com/paritytech/cargo-contract/blob/master/.github/workflows/ci.yml#L185. If you do not use 1.69 you will get error ERROR: Loading of original wasm failed when running cargo contract build
rustup update
rustup default stable
rustup install 1.69 
rustup default 1.69
rustup override set 1.69
rustup component add rust-src --toolchain 1.69
rustup toolchain list
rustup show
  • Update Cargo Contract to latest version. Check latest version on Github then:
cargo-contract --version
cargo install --force --locked cargo-contract

ltfschoen avatar Jun 19 '23 03:06 ltfschoen

@FrankBevr is the issue still persisting?

SkymanOne avatar Aug 14 '23 19:08 SkymanOne