Skip to main content

compute_cfg_diff

Function compute_cfg_diff 

Source
pub fn compute_cfg_diff(
    backend: &Backend,
    function_id: i64,
    before_snapshot: &str,
    after_snapshot: &str,
) -> Result<CfgDiff>
Expand description

Compute CFG diff between two snapshots

This function compares the CFG of a function at two different snapshots, detecting structural changes and computing a similarity score.

§Arguments

  • backend - Storage backend for querying CFG data
  • function_id - Function entity ID to compare
  • before_snapshot - Snapshot identifier for “before” state (transaction ID or “current”)
  • after_snapshot - Snapshot identifier for “after” state (transaction ID or “current”)

§Returns

  • Ok(CfgDiff) - Diff result with all detected changes
  • Err(...) - Error if query or computation fails

§Note

The current implementation queries the current state for both snapshots. Future versions will support true snapshot-based comparison using SnapshotId.