docs: add storage versioning guide and link it in README - #514
Merged
fati-Onchain merged 2 commits intoJul 30, 2026
Conversation
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.
#Closes
#447
PR Description
📌 Title
docs: add storage versioning guide and reference test suites
📝 Summary
This PR adds documentation for FacilPay's smart contract storage schema versioning convention and data migration protocols. It details how persistent schema versions are tracked on-chain across the payment, refund, and escrow contracts and provides a contributor workflow guide for modifying stored data shapes safely.
🎯 Acceptance Criteria Addressed
Created
docs/STORAGE_VERSIONING.md
explaining storage schema version tracking and migration conventions.
Referenced existing schema version and migration test files (schema_version_test.rs and migration_test.rs) as concrete implementation examples.
Updated root
README.md
to include a link to the new Storage Versioning Guide.
🛠️ Key Changes
Storage Keys & Inspection: Documents contract-specific storage keys (ConfigKey::SchemaVersion vs SystemKey::SchemaVersion) and public inspection getter get_schema_version(env).
Migration Strategies:
Pattern A (Direct Schema Upgrade): Used in payment and refund contracts for administrative schema bumps via migrate_schema().
Pattern B (Multi-Step / Batch Migration): Used in escrow contract for pausing state, batching item rewrites (migrate_escrow_batch), and final completion (complete_migration).
Contributor Workflow: Step-by-step checklist when altering stored data shapes (bumping constants, handling struct defaults/conversions, writing unit tests, and updating SDK documentation).
Test Implementation References:
contracts/payment/src/schema_version_test.rs
contracts/refund/src/schema_version_test.rs
contracts/escrow/src/migration_test.rs
Added - Storage Versioning Guide under the 🔗 Links section of the primary repository README.
🧪 Verification & Testing
Ran targeted cargo tests for schema versioning and migration modules across workspace packages:
bash
Payments Contract Schema Version Tests
cargo test -p payments schema_version_test
Result: 2 passed, 0 failed
Escrow Contract Migration Tests
cargo test -p escrow migration_test
Result: 16 passed, 0 failed
🔗 Related Resources
Branch: docs/storage-versioning-guide
Documentation File:
docs/STORAGE_VERSIONING.md