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

enhancement: use panic_hook to retrieve message from a failed WASM execution #1404

Merged
merged 1 commit into from
Oct 9, 2023

Conversation

lostman
Copy link
Contributor

@lostman lostman commented Oct 9, 2023

Description

Closes #1402.

This PR adds WasmIndexerError::Panic variant and registers a panic hook in the WASM indexer.

The panic message is stored in a static mut String, and an early_exit is triggered. The message is then retrieved by thy indexer service and logged.

Testing steps

CI tests should pass.

For manual testing, deploy an indexer that causes panic (for instance, by calling unwrap() on the None value in the handler function), and observe the panic error message in the logs of fuel-indexer.

Changelog

  • Add WasmIndexerError::Panic
  • Generate code to store and retrieve panic messages in the WASM.
  • Add get_panic_message function to Executor trait. For native executor, it always returns an error.

@lostman lostman force-pushed the maciej/wasm-panic-hook branch 2 times, most recently from 28fe8d4 to 5dcc930 Compare October 9, 2023 13:56
@lostman lostman self-assigned this Oct 9, 2023
@lostman lostman marked this pull request as ready for review October 9, 2023 16:39
Copy link
Contributor

@ra0x3 ra0x3 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It works, thanks @lostman

@ra0x3 ra0x3 merged commit e74ae9c into develop Oct 9, 2023
19 checks passed
@ra0x3 ra0x3 deleted the maciej/wasm-panic-hook branch October 9, 2023 18:20
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 this pull request may close these issues.

Use panic_hook to get an error message from WASM panic
3 participants