feat: wire up Execution DAG engine and in-browser event search worker - #414
Merged
Osuochasam merged 3 commits intoAug 25, 2026
Conversation
Wire the fully-built but disconnected DAG reconstruction engine into the application pipeline so Soroban cross-contract call trees are actually produced, persisted, analyzed, and visible in the UI. Wire the in-browser inverted-index event search worker into the dashboard so the live event feed has instant client-side full-text search. Execution DAG (Issue Open-audit-foundation#8): - Enhance DagNode types with authorizedBy, reentrancyDetails, authTraces - Implement stack-based reentrancy detection with full call path tracking - Implement auth tracing to attribute Stellar accounts to DAG nodes - Add ExecutionDag Prisma model with migration support - Wire onDag callback in server.ts and worker/indexer.ts for persistence - Create GET /api/v1/dag API route with txHash, id, ledger, reentrancy queries - Build interactive DagPanel visualization with collapsible nodes, reentrancy highlighting, auth badges, and contract filtering - Replace placeholder DAG page with real transaction search and visualization Event Search Worker (Issue Open-audit-foundation#9): - Add ADD_EVENTS/REMOVE_EVENTS message types to event search worker - Add addEvents/removeEvents/destroy to EventSearchClient wrapper - Create useEventSearch hook with debounced search and incremental indexing - Wire client-side full-text search into DashboardClient alongside server search - Worker properly cleaned up on component unmount Tests: - 16 reentrancy detection tests: positive (direct, chain, self, multi-branch), negative (sequential, deep linear, separate branches, system fn, empty), and edge cases - 7 event search hook tests: worker lifecycle, debounce, index building, incremental updates, search results, clear results Closes Open-audit-foundation#408
…tests, fallback Fix 5 gaps identified by acceptance criteria audit: Auth tracing: - Implement extractTopLevelAccounts (was a stub returning []) - Accept optional authAddresses param in reconstructDagFromMetaXdr - Pass tx.source_account from indexer as top-level authorizing account - Add 3 auth tracing tests: explicit auth attribution, no-auth nodes, multiple authorized nodes in a tree Prisma migration: - Create migration SQL for ExecutionDag table + Event.executionDagId FK API route tests: - 9 tests for GET /api/v1/dag: txHash, id, ledger, reentrancy queries, 400 for missing params, 404 for not found, invalid ledger, error handling Web Worker fallback: - Implement synchronous main-thread search in useEventSearch hook - Track isFallback state, display fallback indicator in dashboard - Fallback handles buildIndex, addEvents, removeEvents, and search EventSearchClient unit tests: - 10 tests covering buildIndex, addEvents, removeEvents, search, destroy lifecycle, hash-based skip/rebuild, SEARCH_ERROR handling Also fix: persistence.ts import paths (./client -> ../db/client, ../dag/types -> ./types)
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
Wire two fully-built but completely disconnected subsystems into the application so they actually run, persist data, and are visible in the UI.
Closes #408
Execution DAG Engine (
lib/dag/)The
lib/dag/engine.tsmodule could reconstruct Soroban cross-contract call trees from TransactionMeta XDR, but nothing in the codebase ever called it. Now it does.extractTopLevelAccountscorrelates Stellar authorization entries from transaction metadata with DAG nodes to answer "whose authorization made this specific nested call possible." The indexer passestx.source_accountas the top-level authorizing account for each reconstructed DAG.ExecutionDagPrisma model stores reconstructed DAGs linked to events, queryable after the fact. Includes a Prisma migration.onDagcallback inserver.tsandsrc/worker/indexer.tsproduces and persists DAGs for every Soroban transaction that has diagnostic events.GET /api/v1/dagwith query params fortxHash,id,ledger, andreentrancy(boolean flag filter). Returns the full DAG includingreentrancyDetails,authTraces, and per-nodeauthorizedByfields.DagPanelcomponent with collapsible tree nodes, contract address badges, kind labels (contract_fn/create_contract/system_fn), reentrancy path highlighting, and an auth trace info panel. Replaced the placeholder/dagpage with a real transaction search interface.In-Browser Event Search Worker (
lib/workers/)The
lib/workers/eventSearch.worker.tsandlib/workers/eventSearchClient.tsimplemented a full inverted-index search engine over event text fields, but nothing in the dashboard ever called it. Now it runs.ADD_EVENTS/REMOVE_EVENTSmessage types to the worker so the index updates as new events stream in without a full rebuild.addEvents(),removeEvents(), anddestroy()methods toEventSearchClient.useEventSearchhook with 300ms debounced search, lazy worker instantiation, and proper cleanup on unmount. Falls back to synchronous main-thread search when Web Workers are unavailable.Prisma
ExecutionDagmodel with fields fortxHash,ledger,contractId,reentrancy,reentrancyDetails(JSON),authTraces(JSON),dagData(JSON), and timestamps.executionDagIdforeign key on theEventmodel.20260825000000_add_execution_dag_model.Tests (47 passing)
lib/dag/engine.test.ts):lib/workers/eventSearchClient.test.ts): Worker lifecycle cleanup, debounce, index building, incremental add, search results, clear results, empty query, isFallback check.lib/workers/eventSearchClient.unit.test.ts): API contract, buildIndex, addEvents, removeEvents, search, destroy, hash skip/rebuild, SEARCH_ERROR handling.app/api/v1/dag/route.test.ts): txHash/id/ledger queries, reentrancy filter, 400/404/500 error handling, invalid ledger rejection.