Skip to content
This repository was archived by the owner on Nov 15, 2023. It is now read-only.
This repository was archived by the owner on Nov 15, 2023. It is now read-only.

Improve wasm panic handler #10585

@bkchr

Description

@bkchr

The current wasm panic handler can be found here. It prints the panic message logging host function as error. While this works, it is not really nice. There are situations where it would be really nice to know the reason why something panicked as part of the returned error (without needing to grep stderr for it). For example in tests it would be much better to directly check the error message. Besides that it would also be nice for the relay chain, because currently it means that any failing parachain validation will print something to the output of the relay chain validator. This isn't that nice actually and also here it would be more be better to have more control over this.

So, my proposal is to add a new host function which only purpose is to handle such a panic case. I once created a pr for this with the proposed name PanicHandler, but @pepyakin didn't liked it. So, we should find a better name for this.

Besides that we will need to change the runtime-interface macros to support returning an error that will stop the execution and will return this error as error of the execution itself.

It would also be nice to be able to get the stack trace of the runtime and to attach this to the error (currently we already see the stack trace when a panic occurs and this can be quite helpful).

Metadata

Metadata

Assignees

Labels

J0-enhancementAn additional feature request.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions