1

I am trying substrate kitties Workshop. After setting environment and paste the bare-bone code of kitties pallet , when I run cargo build --release the following error occur after 2-3 minutes when building sp-runtime:

error[E0277]: the trait bound `H256: TypeInfo` is not satisfied
   --> /home/abuzar945/.cargo/git/checkouts/substrate-7e08433d4c370a21/a3ed011/primitives/runtime/src/testing.rs:260:14
    |
260 |     type Hash = <Header as traits::Header>::Hash;
    |                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `TypeInfo` is not implemented for `H256`
    |
    = help: the following other types implement trait `TypeInfo`:
              &T
              &mut T
              ()
              (A, B)
              (A, B, C)
              (A, B, C, D)
              (A, B, C, D, E)
              (A, B, C, D, E, F)
            and 117 others
note: required by a bound in `traits::Block::Hash`
   --> /home/abuzar945/.cargo/git/checkouts/substrate-7e08433d4c370a21/a3ed011/primitives/runtime/src/traits.rs:917:5
    |
904 |     type Hash: Member
    |          ---- required by a bound in this
...
917 |         + TypeInfo;
    |           ^^^^^^^^ required by this bound in `Block::Hash`

error[E0277]: the trait bound `H256: TypeInfo` is not satisfied
   --> /home/abuzar945/.cargo/git/checkouts/substrate-7e08433d4c370a21/a3ed011/primitives/runtime/src/traits.rs:700:16
    |
700 |     type Output = sp_core::H256;
    |                   ^^^^^^^^^^^^^ the trait `TypeInfo` is not implemented for `H256`
    |
    = help: the following other types implement trait `TypeInfo`:
              &T
              &mut T
              ()
              (A, B)
              (A, B, C)
              (A, B, C, D)
              (A, B, C, D, E)
              (A, B, C, D, E, F)
            and 117 others
note: required by a bound in `traits::Hash::Output`
   --> /home/abuzar945/.cargo/git/checkouts/substrate-7e08433d4c370a21/a3ed011/primitives/runtime/src/traits.rs:665:5
    |
654 |     type Output: Member
    |          ------ required by a bound in this
...
665 |         + TypeInfo;
    |           ^^^^^^^^ required by this bound in `Hash::Output`

error[E0277]: the trait bound `H256: TypeInfo` is not satisfied
   --> /home/abuzar945/.cargo/git/checkouts/substrate-7e08433d4c370a21/a3ed011/primitives/runtime/src/traits.rs:727:16
    |
727 |     type Output = sp_core::H256;
    |                   ^^^^^^^^^^^^^ the trait `TypeInfo` is not implemented for `H256`
    |
    = help: the following other types implement trait `TypeInfo`:
              &T
              &mut T
              ()
              (A, B)
              (A, B, C)
              (A, B, C, D)
              (A, B, C, D, E)
              (A, B, C, D, E, F)
            and 117 others
note: required by a bound in `traits::Hash::Output`
   --> /home/abuzar945/.cargo/git/checkouts/substrate-7e08433d4c370a21/a3ed011/primitives/runtime/src/traits.rs:665:5
    |
654 |     type Output: Member
    |          ------ required by a bound in this
...
665 |         + TypeInfo;
    |           ^^^^^^^^ required by this bound in `Hash::Output`

For more information about this error, try `rustc --explain E0277`.
error: could not compile `sp-runtime` due to 3 previous errors
4
  • Please add more details about your errors. Which substrate versions(branch) do you use? Which repo do you refer?
    – CocDap
    Commented Dec 26, 2022 at 5:55
  • Repository is substrate package
    – user3109
    Commented Dec 26, 2022 at 17:17
  • Please give the link that you fork/clone
    – CocDap
    Commented Dec 27, 2022 at 9:10
  • github.com/substrate-developer-hub/substrate-node-template/tree/…
    – user3109
    Commented Dec 27, 2022 at 17:50

1 Answer 1

1

This looks an issue with mismatching versions

In your error you complained about sp-runtime:

sp-runtime = { version = "5.0.0", git = "https://github.com/paritytech/substrate.git", tag = "devhub/latest" }

And you can see to sp_core:

sp-core = { version = "5.0.0", git = "https://github.com/paritytech/substrate.git", tag = "devhub/latest" }

I would suggest to delete Cargo.lock and the folder target:

rm -rf target && rm Cargo.lock

And build it again:

cargo build --release

You might need to update more later too, if you have more errors.

Your Answer

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