feat(stellar): Structure failed tx status_reason#765
Conversation
Replace the free-form failure sentence with a key=value layout that surfaces the outer XDR result code, inner result code, op result code, and an optional contract-level error extracted from Soroban diagnostic events. Adds a contract_error field on the "stellar transaction failed" warn log. Old: Transaction failed on-chain. Provider status: FAILED. Specific XDR reason: TxFeeBumpInnerFailed. New: Transaction failed on-chain. reason=TxFeeBumpInnerFailed inner=TxFailed op=Trapped contract_error=Contract(8) message="failing with contract error" Verified against 24h of prod-mainnet traffic (~40k on-chain failures, 99.5% Trapped) by decoding real diagnosticEventsXdr through the new extractor. Includes 11 new unit tests including a real prod XDR fixture. Signed-off-by: Dylan Kilkenny <dylankilkenny95@gmail.com>
|
Caution Review failedFailed to post review comments WalkthroughThe Stellar status handling module enriches transaction failure diagnostics by extracting contract-level errors from Soroban diagnostic events and building structured, multi-part failure reasons that replace simple provider-status messages. New helper functions format failure details and sanitize error messages. ChangesStellar Transaction Failure Diagnostics
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~22 minutes
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Tip 💬 Introducing Slack Agent: The best way for teams to turn conversations into code.Slack Agent is built on CodeRabbit's deep understanding of your code, so your team can collaborate across the entire SDLC without losing context.
Built for teams:
One agent for your entire SDLC. Right inside Slack. Comment |
Codecov Report❌ Patch coverage is
Additional details and impacted files
Flags with carried forward coverage won't be shown. Click here to find out more. @@ Coverage Diff @@
## main #765 +/- ##
==========================================
+ Coverage 90.31% 90.32% +0.01%
==========================================
Files 291 291
Lines 124258 124502 +244
==========================================
+ Hits 112219 112453 +234
- Misses 12039 12049 +10
🚀 New features to boost your workflow:
|
Summary
The
status_reasonwritten for failed Stellar transactions today is a single free-form sentence:This PR replaces it with a structured, layered key=value form that includes those, and adds a matching
contract_errorfield to thestellar transaction failedwarn log line.Components are emitted only when their source data is available, so non-Soroban / classic failures stay clean (no
op=unknownplaceholders, no spuriouscontract_error=).Compatibility
status_reasonis free-form text but its wording has changed. Anything downstream that parses or grep-matches the prior sentence ("Provider status: FAILED. Specific XDR reason: <code>.") will need updating. Keys (reason=,inner=,op=,contract_error=,message="...") are stable going forward.Summary by CodeRabbit
Bug Fixes
Tests