Enable improved panic error reporting in runtime#1493
Open
hitchho wants to merge 1 commit into
Open
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Enables the
sp-io/improved_panic_error_reportingfeature for the hydradx runtime, so runtime panics reach RPC callers as readable messages instead of opaque wasm traps.Motivation
While debugging #1491, a parameter-decode failure in
DryRunApi.dry_run_callsurfaced over public RPC as:The actual panic message —
Bad input data provided to dry_run_call: Codec error. Nothing bad happened: someone sent an invalid transaction to the node.— only exists in node logs, invisible to the RPC caller. It cost a chopsticks fork to see it, and the symptom was initially misdiagnosed as a runtime bug.With this feature,
sp-io's wasm panic handler calls theext_panic_handler_abort_on_panichost function instead of executingunreachable, and the client executor returnsRuntime panicked: <message>(sc-executorAbortedDueToPanic) — making every future decode error, defensive panic, andpanic!diagnosable directly from the RPC response.Safety
sc-executor-wasmtimehas captured the message viaHostState::panic_messagesince 2022; smoldot implementsext_panic_handler_abort_on_panic_version_1.panic_handler, but it instantiates withallow_missing_func_imports: true, so the import resolves to a stub. A panic during validation then traps exactly as it does today — outcome-identical (candidate invalid).#[panic_handler]/#[alloc_error_handler]compiled into the wasm blob; no behavior change on the success path.For reference, this is the same mechanism
substrate/client/executor/runtime-testuses upstream.