fix(payment): stop truncating revert reasons and persist payment errors to a log file - #205
Merged
Merged
Conversation
…rs to a log file A tester's rc.2 failure arrived as a screenshot ending at "reverted with the following signature:" - viem puts the revert selector/reason on a second line of shortMessage, and both shortReason() and paymentErrorSummary() truncated at the first newline. The selector is the only clue to WHY a payment reverts, and it was also captured nowhere: the webview console.error is unreachable in production (no devtools) and Rust tracing wrote to stderr only (discarded for a windowed app). - Flatten newlines in shortReason()/paymentErrorSummary() so the selector (10 chars, e.g. 0x1fb3b5a2) or reason string survives into the status label and toast. - Mirror the full payment error dump (message + stack of the whole cause chain, so the wrapped viem diagnostics survive) into Rust tracing via a new log_frontend_error command. - Give the tracing subscriber a rolling file layer: ~/.config/autonomi/ant-gui/logs/ant-gui.<date>.log, daily rotation, 7 files kept, stderr layer unchanged. Falls back to stderr-only if the log dir is unwritable. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
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.
Problem
A tester's payment failure on v0.9.6-rc.2 arrived as a screenshot ending mid-sentence:
Two independent gaps made that report undiagnosable:
…the following signature:\n0x<selector>— the selector sits on a second line ofshortMessage, and bothshortReason()(utils/payment.ts) andpaymentErrorSummary()(stores/files.ts) cut at the first newline. The one string identifying why the contract reverts never reached the UI.console.errordies in the webview (production ships without devtools), Rust tracing wrote to stderr only (discarded for a windowed app), andupload_history.jsonpersists completed uploads only. The screenshot was literally the only artifact.Fix
shortReason()/paymentErrorSummary()so the selector or reason string survives into the status label and toast. Size impact on the UI: a selector is 10 chars (0x+ 8 hex); a decoded reason is a short sentence — no risk of the old full-dump overflow, which came from viem's multi-line.messageand stays out of the UI.log_frontend_errorcommand —paymentErrorSummarynow mirrors the full dump (message + stack for the whole cause chain, so the wrapped viem diagnostics survive the preflight's plain-Error wrapper) into Rust tracing under targetant_gui::frontend, fire-and-forget.~/.config/autonomi/ant-gui/logs/ant-gui.<date>.log(platform config-dir equivalent), daily rotation, 7 files kept, ANSI off. The stderr layer is unchanged for dev; if the log dir is unwritable the app falls back to stderr-only.Testing
nuxi typecheck,cargo check,clippy -D warnings,fmt --checkall clean.🤖 Generated with Claude Code