DiagnosticEventWalker: pinpoint failing contracts in call chains (#339) - #365
Merged
codeZe-us merged 1 commit intoJul 19, 2026
Merged
Conversation
…hains Implements a chronological event walker that maintains a call stack of contract IDs (pushing on fn_call, popping on fn_return) to identify the exact contract that failed in multi-contract Soroban transactions. Closes Toolbox-Lab#339
Marvelg256
force-pushed
the
feat/339-diagnostic-event-walker
branch
from
July 18, 2026 20:20
b1814f3 to
00c330e
Compare
codeZe-us
self-requested a review
July 19, 2026 14:22
codeZe-us
approved these changes
Jul 19, 2026
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.
Summary
Implements
DiagnosticEventWalker— a chronological event walker that maintains a contract call stack to identify the exact contract that caused a failure in multi-contract Soroban transactions.Closes #339
Problem
When a multi-contract Soroban transaction fails (e.g., Contract A → B → C, where C panics), the raw result only shows the top-level invocation failed. Grat would mistakenly blame Contract A for errors deep in Contract C, sending developers on wild goose chases.
Solution
A new module
crates/core/src/decode/event_walker.rsprovidesDiagnosticEventWalkerwith alocate_failing_contract()method that:DiagnosticEventobjects in the order the VM emitted themfn_callsystem events, pops onfn_returnin_successful_contract_call = false(VM flag)ScVal::Errorpayload (HostError/ContractError return values)error,panic,revert,hosterror,failed,trapfn_callwithout contract_id, nested calls with returnsFiles Changed
crates/core/src/decode/event_walker.rs(new) — 413 lines implementing the walker with 16 unit testscrates/core/src/decode/mod.rs— addedpub mod event_walker;Testing
All 252 tests pass, including 16 new tests covering:
error,panic,revert,hosterror,ScVal::Error,failed,trap)