Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement panic handler #1296

Closed
webmaster128 opened this issue May 5, 2022 · 0 comments · Fixed by #1299
Closed

Implement panic handler #1296

webmaster128 opened this issue May 5, 2022 · 0 comments · Fixed by #1299

Comments

@webmaster128
Copy link
Member

webmaster128 commented May 5, 2022

Right now when a Rust contract panics, we don't get the panic message or location in a Wasm build. We just see an unreachable in a Wasmer error message. This is because an unreachable Wasm instruction is hit that terminates the contract.

Now what we can do to get more information is install a panic handler in the contract (i.e. Wasm) that sends those information out before the contract stops. This can be done with set_hook. In PanicInfo we see that we at least get the panic message and location.

With this information the contract can call the host and send the information along with an abort request. The VM can log the information and stop the execution.

Implementing this requres a new import which we can add as chain feature for compatibility. Then panic handlers can only be used on chains that support it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant