import type { ASTNode, Location } from "../types.js"; /** * Represents a basic block in the control flow graph * A basic block is a sequence of statements with no branches except at the end */ export interface CFGNode { id: string; type: CFGNodeType; statements: ASTNode[]; location?: Location; metadata?: CFGNodeMetadata; } export type CFGNodeType = "entry" | "exit" | "basic" | "condition" | "loop-header" | "loop-body" | "external-call" | "state-update" | "revert" | "return"; export interface CFGNodeMetadata { stateReads: string[]; stateWrites: string[]; externalCalls: ExternalCallInfo[]; canRevert: boolean; isCriticalStateUpdate: boolean; } export interface ExternalCallInfo { target: string; method: string; location: Location; isLowLevel: boolean; returnValueChecked: boolean; } /** * Represents an edge between CFG nodes */ export interface CFGEdge { from: string; to: string; type: CFGEdgeType; condition?: string; } export type CFGEdgeType = "sequential" | "conditional" | "loop-back" | "loop-exit" | "exception" | "return"; /** * Control Flow Graph for a single function */ export interface ControlFlowGraph { functionName: string; nodes: Map; edges: CFGEdge[]; entryNode: string; exitNodes: string[]; metadata: CFGMetadata; } export interface CFGMetadata { hasExternalCalls: boolean; hasStateUpdates: boolean; hasReentrancyRisk: boolean; cyclomaticComplexity: number; potentialVulnerabilities: string[]; } /** * Analysis results from CFG-based rules */ export interface CFGAnalysisResult { ruleId: string; violations: CFGViolation[]; confidence: "high" | "medium" | "low"; exploitPath?: CFGPath; } export interface CFGViolation { nodeId: string; description: string; severity: "critical" | "high" | "medium" | "low"; location: Location; evidence: CFGEvidence; } export interface CFGEvidence { externalCallNode?: string; stateUpdateNode?: string; pathToViolation: string[]; codeSnippet?: string; } export interface CFGPath { nodes: string[]; description: string; isExploitable: boolean; } //# sourceMappingURL=types.d.ts.map