feat: add cross-contract call failure attribution analyzer (#246)#252
Open
Awointa wants to merge 1 commit into
Open
feat: add cross-contract call failure attribution analyzer (#246)#252Awointa wants to merge 1 commit into
Awointa wants to merge 1 commit into
Conversation
Walk diagnostic event stream to detect fn_call/fn_return boundaries and error/panic events to pinpoint the exact contract and function in a sub-contract call chain that caused the failure. - Add FailureAttribution struct to types/report.rs - Add cross_contract_attribution field to DiagnosticReport - New decode/cross_contract.rs: attribute_failure() analyzer - Wire attribute_failure into decode pipeline (decode/mod.rs) - Render attribution section in CLI human output (human.rs)
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 #246
Summary
When a cross-contract call fails, the error previously surfaced at the top
level with no indication of which contract in the call chain actually caused
it. This PR implements an analyzer that traces the diagnostic event stream to
pinpoint the exact origin.
What changed
diagnosticEventsXdr in order, maintains a call stack via fn_call/fn_return
host events, and detects the first error/panic event to identify the failing
(contract_address, function_name, call_depth, origin_description) and
cross_contract_attribution: Option field on
DiagnosticReport
the decode pipeline after diagnostic enrichment
Attribution section when attribution is present
Behaviour
Attribution is only populated when the failure depth is > 0, meaning a
sub-contract caused the error. Top-level-only failures are unaffected and
produce no attribution noise.
Testing