Skip to content

feat: add deterministic storage snapshot diff helper#575

Open
Deyanju23 wants to merge 3 commits into
CalloraOrg:mainfrom
Deyanju23:feature/snapshot-diff
Open

feat: add deterministic storage snapshot diff helper#575
Deyanju23 wants to merge 3 commits into
CalloraOrg:mainfrom
Deyanju23:feature/snapshot-diff

Conversation

@Deyanju23

Copy link
Copy Markdown

Closes #505

Summary

Adds a reusable helper for diffing two storage snapshots and producing a deterministic, compact list of changes suitable for external reporting tools and CI automation.

Changes

Snapshot Diff Helper

Added:

  • contracts/helpers/src/snapshot_diff.rs

Implemented a helper that:

  • compares two storage snapshots
  • detects added keys
  • detects removed keys
  • detects modified values
  • ignores unchanged entries
  • produces a compact diff representation
  • guarantees deterministic ordering of output

Cargo Integration

Updated:

  • contracts/helpers/Cargo.toml

Registered the new helper module and any required dependencies following the project's existing conventions.

Tests

Added comprehensive tests covering:

  • identical snapshots
  • added entries
  • removed entries
  • modified values
  • multiple simultaneous changes
  • empty snapshots
  • deterministic output ordering
  • realistic storage snapshot fixtures

Documentation

Added Rust /// documentation explaining:

  • helper purpose
  • diff semantics
  • output format
  • ordering guarantees
  • intended usage by reporting tools

Security

  • Read-only helper.
  • No contract state changes.
  • No authentication behavior modified.
  • No unwrap() introduced in production code.
  • Overflow-safe implementation maintained.

Testing

Executed:

cargo test
cargo clippy --workspace --all-targets -- -D warnings

Notes

  • Helper-only addition.
  • No behavioral changes to contracts.
  • No unrelated refactoring.

@drips-wave

drips-wave Bot commented Jun 28, 2026

Copy link
Copy Markdown

@Deyanju23 Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

@GBOYEE

GBOYEE commented Jun 28, 2026

Copy link
Copy Markdown

@GBOYEE has applied to work on this issue as part of the Stellar Wave Program's 6th wave.

Implement following existing patterns and conventions. Add tests, ensure CI passes, and document any new API surface.

ℹ️ Repo Maintainers: To accept this application, review their application or assign @GBOYEE to this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add a snapshot diff helper for off-chain reporting

2 participants