feat(core): extract error from failed transaction XDR (#193)#204
Open
cybermax4200 wants to merge 1 commit into
Open
feat(core): extract error from failed transaction XDR (#193)#204cybermax4200 wants to merge 1 commit into
cybermax4200 wants to merge 1 commit into
Conversation
- Add from_transaction_result() that navigates TransactionResult → TxFailed ops → InvokeHostFunctionResult and maps each failure variant to the correct ErrorCategory + code - Add NotSorobanTransaction and TransactionSucceeded variants to PrismError for invalid-input cases - Wire classify_error() to prefer XDR-based classification via from_transaction_result() when resultXdr is present - Add unit tests covering Trapped, ResourceLimitExceeded, EntryArchived, IHF success, TxSuccess, and missing IHF cases
|
@cybermax4200 Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits. You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀 |
Emrys02
reviewed
May 29, 2026
Contributor
Emrys02
left a comment
There was a problem hiding this comment.
@cybermax4200 Fix conflict in your branch
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.
Closes #193
Summary
Implements
from_transaction_result()— the entry point called byprism decode— which navigates a decodedTransactionResultXDR down to theInvokeHostFunctionResult, extracts the failure variant, and maps it to the correctErrorCategory+ code.Also adds two new
PrismErrorvariants required by the spec and wiresclassify_error()to prefer XDR-based classification whenresultXdris present.Changes
crates/core/src/error.rs— addNotSorobanTransactionandTransactionSucceededvariants toPrismErrorcrates/core/src/decode/host_error.rsfrom_transaction_result(): navigatesTxFailed → OperationResult → InvokeHostFunctionResultand maps each variant to(ErrorCategory, code, is_contract_error)classify_error(): updated to delegate tofrom_transaction_result()whenresultXdris availableTest coverage
TrappedErrorCategory::ContractResourceLimitExceededErrorCategory::BudgetEntryArchivedErrorCategory::StorageIHF::SuccessErr(TransactionSucceeded)TxSuccessErr(TransactionSucceeded)Err(NotSorobanTransaction)