Skip to content

docs: add storage versioning guide and link it in README - #514

Merged
fati-Onchain merged 2 commits into
Facil-Pay:mainfrom
A-one-tech:docs/storage-versioning-guide
Jul 30, 2026
Merged

docs: add storage versioning guide and link it in README#514
fati-Onchain merged 2 commits into
Facil-Pay:mainfrom
A-one-tech:docs/storage-versioning-guide

Conversation

@A-one-tech

Copy link
Copy Markdown

#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

  1. New Storage Versioning Guide (docs/STORAGE_VERSIONING.md)
    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
  2. Root Documentation Link (README.md)
    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

@fati-Onchain
fati-Onchain merged commit 1c226ae into Facil-Pay:main Jul 30, 2026
1 check failed
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.

3 participants