6

I'm trying to debug in pallet-staking to figure out something about how validators/nominators join NPoS network.

https://github.com/paritytech/substrate/blob/master/frame/staking/src/pallet/impls.rs#L437

Code:

log!(info, "Staking: Try trigger new era: Election Result:{:?}", election_result);

Result when running node:

Staking: Try trigger new era: Election Result:[(, <wasm:stripped>), (, <wasm:stripped>)]

Question: What does<wasm:stripped> mean? This is only wasm binary? Can we convert this wasm to native rust?

2 Answers 2

4

When a type derives RuntimeDebug instead of Debug, then this string literal is printed ONLY in wasm. You have two options here:

  1. Run native via --execution Native.
  2. Change the derive, and make sure the type derives Debug.
3
  • SKIP_WASM_BUILD= cargo run -- --chain ... . Does this? I also tested this but it's not working with run native.
    – CocDap
    Commented Sep 8, 2022 at 6:36
  • edited my answer.
    – kianenigma
    Commented Sep 9, 2022 at 8:20
  • The reason for this, for those who are wondering, is because strings bloat the generated WebAssembly blob for the runtime and so it's better to leave them out.
    – rob
    Commented Sep 10, 2022 at 5:08
3

Today I learned there is a force-debug feature on crate sp-debug-derive, so if you add a dependency to that and enable that feature then you might well be able to see what you want to see.

https://github.com/paritytech/polkadot-sdk/blob/769bdd3ff33a291cbc70a800a3830638467e42a2/substrate/primitives/debug-derive/Cargo.toml#L31

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.