6

While building the Substrate Kitties Chain using the tutorial: https://docs.substrate.io/tutorials/v3/kitties/pt1/

I got the error like : PS C:\Users\msi\kitties-tutorial> cargo build --release warning: C:\Users\msi\kitties-tutorial\pallets\kitties\Cargo.toml: unused manifest key: dependencies.serde.feature warning: Git command failed with status: exit code: 128 warning: Could not find .git/HEAD searching from C:\Users\msi\kitties-tutorial\node upwards! Compiling node-kitties-runtime v4.0.0-dev (C:\Users\msi\kitties-tutorial\runtime) Compiling pallet-kitties v4.0.0-dev (C:\Users\msi\kitties-tutorial\pallets\kitties) error[E0433]: failed to resolve: use of undeclared crate or module sp_io
--> pallets\kitties\src\lib.rs:4:5 | 4 | use sp_io::hashing::blake2_128; | ^^^^^ use of undeclared crate or module sp_io

error[E0425]: cannot find value blake2_128 in this scope
--> pallets\kitties\src\lib.rs:135:26 | 135 | payload.using_encoded(blake2_128) | ^^^^^^^^^^ help: a unit struct with a similar name exists: Blake2_128 | ::: C:\Users\msi.cargo\git\checkouts\substrate-7e08433d4c370a21\22d40c7\frame\support\src\hash.rs:143:1 | 143 | pub struct Blake2_128; | ---------------------- similarly named unit struct Blake2_128 defined here

warning: unused import: scale_info::TypeInfo --> pallets\kitties\src\lib.rs:2:5 | 2 | use scale_info::TypeInfo; | ^^^^^^^^^^^^^^^^^^^^ | = note: #[warn(unused_imports)] on by default

I have added sp-io crates in pallets\kitties\cargo.toml in [dev-dependincies] as

sp-io = { default-features = false, version = "5.0.0", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.17" }

and in ["std"] as std = [ "codec/std", "scale-info/std", "frame-support/std", "frame-system/std", "frame-benchmarking/std", "sp-io/std", ]

2 Answers 2

4

I think you have declare sp-io in [dev-dependencies] if this is true then please moved sp-io from [dev-dependencies] to [dependencies].

1
  • 1
    This is probably the correct answer.
    – Shawn Tabrizi
    Commented Mar 13, 2022 at 22:00
0

It seems sp-io is using the v5, whereas the other crates are using v4. try using the v4 of sp-io :

[dependecies]
sp-io = { default-features = false, git = 'https://github.com/paritytech/substrate.git', tag = 'devhub/latest', version = '4.0.0-dev' }
1
  • It starts to give a cargo error: Execution failed (exit code 101). C:/Users/msi/.cargo/bin/cargo.exe metadata --verbose --format-version 1 --all-features stdout : Updating git repository https://github.com/paritytech/substrate.git error: failed to select a version for the requirement sp-io = "^4.0.0-dev" candidate versions found which didn't match: 5.0.0 location searched: Git repository github.com/paritytech/substrate.git?tag=devhub/latest required by package pallet-kitties v4.0.0-dev (C:\Users\msi\kitties-tutorial\pallets\kitties) stderr :
    – Ajit
    Commented Mar 13, 2022 at 12:55

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.