Skip to content

Improve debuggability in wasm #3005

@bkchr

Description

@bkchr

Over the years we have tried to prevent any kind of leakage of the Debug trait into wasm to decrease the size of the wasm binary. However, AFAIK we never really looked into the impact of having Debug implemented for types. Especially as the linker should remove unused Debug implementation any way. We even have introduced RuntimeDebug that just prints wasm:stripped on no_std. The problem with all this is that it complicates debugging in wasm. In the future when there will be no native runtime, it is even more important. So, we should look into deriving Debug everywhere instead of RuntimeDebug. We should also change RuntimeDebug to always derive the default Debug to not break any downstream code, but still have proper debug output.

So, for this issue:

  1. Compile some runtimes and note their size.
  2. Change RuntimeDebug to always derive default Debug.
  3. Compile again and compare the runtime sizes against the ones noted in 1.
  4. If the difference in size isn't that big, remove RuntimeDebug everywhere in the code base.

Metadata

Metadata

Labels

C1-mentorA task where a mentor is available. Please indicate in the issue who the mentor could be.C2-good-first-issueA task for a first time contributor to become familiar with the Polkadot-SDK.D0-easyCan be fixed primarily by duplicating and adapting code by an intermediate coder.I4-refactorCode needs refactoring.

Type

No type

Projects

Status

Backlog

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions