You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
src/simulationDiff.ts exists but does not provide a structured comparison between two separate simulation runs (e.g. a baseline vs a modified transaction). During development and debugging, engineers need to understand exactly how a change to a transaction affects resource consumption, auth entries, and footprint size. A diff comparator should accept two simulation results and return a typed, human-readable difference object.
Technical Context
Extend src/simulationDiff.ts. Accepts two SorobanRpc.SimulateTransactionResponse objects. Compares fields: cost.cpuInsns, cost.memBytes, minResourceFee, footprint.readOnly, footprint.readWrite, and auth entries. Adds SimulationDiff and ResourceDelta to src/types.ts. Integrates with src/profiler.ts to emit diffs on each profiling run.
Acceptance Criteria
compareSimulations(baseline, revised): SimulationDiff returns a typed object with cpuDelta, memDelta, feeDelta, footprintAdded[], footprintRemoved[], and authChanged: boolean
Positive deltas indicate the revised simulation uses more resources; negative indicates fewer
footprintAdded and footprintRemoved list the LedgerKey XDR base64 strings that differ between the two runs
formatDiffSummary(diff: SimulationDiff): string produces a human-readable multi-line summary for logging
Unit tests assert correct deltas for: identical simulations (all zeros), revised simulation with 2× CPU usage, revised simulation with additional auth entry
All CI checks (npm test, npm run build, ESLint/TypeScript) pass and the branch has no merge conflicts
Description
src/simulationDiff.tsexists but does not provide a structured comparison between two separate simulation runs (e.g. a baseline vs a modified transaction). During development and debugging, engineers need to understand exactly how a change to a transaction affects resource consumption, auth entries, and footprint size. A diff comparator should accept two simulation results and return a typed, human-readable difference object.Technical Context
Extend
src/simulationDiff.ts. Accepts twoSorobanRpc.SimulateTransactionResponseobjects. Compares fields:cost.cpuInsns,cost.memBytes,minResourceFee,footprint.readOnly,footprint.readWrite, andauthentries. AddsSimulationDiffandResourceDeltatosrc/types.ts. Integrates withsrc/profiler.tsto emit diffs on each profiling run.Acceptance Criteria
compareSimulations(baseline, revised): SimulationDiffreturns a typed object withcpuDelta,memDelta,feeDelta,footprintAdded[],footprintRemoved[], andauthChanged: booleanfootprintAddedandfootprintRemovedlist theLedgerKeyXDR base64 strings that differ between the two runsformatDiffSummary(diff: SimulationDiff): stringproduces a human-readable multi-line summary for logging