Modern Web3 applications are highly composable. A user interacts with a Router contract, which interacts with a Liquidity Pool, which interacts with a Token contract. If the Token contract fails, the error bubbles all the way back up to the Router, leaving a chaotic trail of generic Trapped or Reverted errors across the execution chain. Developers need to understand not just where it failed, but the entire chronological path of the transaction leading up to the failure. Currently, Grat treats every error in isolation, completely ignoring the hierarchical relationship between contract invocations.
Issues/what to fix
The ChainAnalyzer is a complex analytical algorithm that must reconstruct the transaction's Call Stack. It must parse the chronological sequence of DiagnosticEvent objects and utilize a Stack Data Structure to track the depth of contract invocations. When an invocation event occurs, the contract is pushed to the stack. When an error event occurs, the current stack represents the exact Execution Chain. The analyzer must format this stack into a visual hierarchy (e.g., Router to LiquidityPool to Token). It must identify the "Root Cause" contract (the one that threw the initial error) and the "Fault Line" (the contracts that subsequently failed because their sub invocations failed). The logic must be extremely robust to handle recursive contract calls (where Contract A calls Contract B, which calls Contract A again) without entering infinite loops.
Files to create / modify
Create: crates/core/src/decode/chain_analyzer.rs
Expected result
Grat will generate highly visual, trace like stack paths for multi contract transactions. Developers will no longer have to guess the order of operations; they will see exactly how the execution flowed through the decentralized ecosystem and precisely where the fault line fractured.
Contributor telegram group
https://t.me/+sII7WPhll2liMGNk
Modern Web3 applications are highly composable. A user interacts with a Router contract, which interacts with a Liquidity Pool, which interacts with a Token contract. If the Token contract fails, the error bubbles all the way back up to the Router, leaving a chaotic trail of generic Trapped or Reverted errors across the execution chain. Developers need to understand not just where it failed, but the entire chronological path of the transaction leading up to the failure. Currently, Grat treats every error in isolation, completely ignoring the hierarchical relationship between contract invocations.
Issues/what to fix
The ChainAnalyzer is a complex analytical algorithm that must reconstruct the transaction's Call Stack. It must parse the chronological sequence of DiagnosticEvent objects and utilize a Stack Data Structure to track the depth of contract invocations. When an invocation event occurs, the contract is pushed to the stack. When an error event occurs, the current stack represents the exact Execution Chain. The analyzer must format this stack into a visual hierarchy (e.g., Router to LiquidityPool to Token). It must identify the "Root Cause" contract (the one that threw the initial error) and the "Fault Line" (the contracts that subsequently failed because their sub invocations failed). The logic must be extremely robust to handle recursive contract calls (where Contract A calls Contract B, which calls Contract A again) without entering infinite loops.
Files to create / modify
Create: crates/core/src/decode/chain_analyzer.rs
Expected result
Grat will generate highly visual, trace like stack paths for multi contract transactions. Developers will no longer have to guess the order of operations; they will see exactly how the execution flowed through the decentralized ecosystem and precisely where the fault line fractured.
Contributor telegram group
https://t.me/+sII7WPhll2liMGNk