I am using the latest substrate-node-template few weeks back it was building fine. But the same project isn't building now, I did not do any changes. Error is occurring in runtime interface. I am gettingenter image description here error[E0512]: cannot transmute between types of different sizes, or dependently-sized types.

PFA screenshot for detail error.

  • stackoverflow.com/help/minimal-reproducible-example please provide specific things you changed, and a MVE
    – Nuke
    May 21, 2022 at 17:52
  • You can access my repo link I just added my pow code separately. But even after removing that it gives the same error. I did not add any code in runtime. Please refer the github repo for code May 22, 2022 at 11:51

2 Answers 2


This means that you are trying to compile sp-io or just sp-runtime-interface without the std enabled. They currently assume that if std is not enabled, you are compiling for Wasm. There are checks to ensure that certain assumptions are correct and these checks are failing for you.

  • Thanks for highlighting this. You are correct. I did not have std crate in my cargo.toml. After I added and enabled it worked for me. Thanks May 24, 2022 at 6:53

I'm having the same problem.

It's due to some std leak somewhere, no_std not being used properly, enabled:

error[E0512]: cannot transmute between types of different sizes, or dependently-sized types --> /home/flipchan/.cargo/git/checkouts/substrate-7e08433d4c370a21/fc3fd07/primitives/runtime-interface/src/impls.rs:45:1  45 | assert_eq_size!(usize, u32); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: source type: usize (64 bits) = note: target type: u32 (32 bits) = note: this error originates in the macro assert_eq_size (in Nightly builds, run with -Z macro-backtrace for more info)

Have you double checked the no_std flags?

  • After adding std = [... "my-pallet/std", ...] in Cargo.toml it worked for me as well
    – Maario
    Jul 29, 2022 at 16:15

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.