Document SchemaVersion, version(), and the migration workflow
Description
contracts/escrow/src/lib.rs distinguishes the compiled version() (returns 2) from the persisted SchemaVersion (get_schema_version, defaulting to 1) and exposes migrate_v1_to_v2, but the relationship and the operational workflow are documented only in scattered /// comments. Operators have no guide for when and how to migrate. This issue captures the model.
Requirements and context
- Repository scope:
Agentpay-Org/Agentpay-contracts only.
- Add
docs/escrow/migrations.md explaining: the difference between code version() and SchemaVersion; why v2 reads default sensibly for absent slots; how the MigrationVersionMismatch (#11) guard prevents double-runs.
- Provide a step-by-step migration runbook (deploy/redeploy →
migrate_v1_to_v2 → verify get_schema_version).
- Note the forward path for future
migrate_v2_to_v3-style functions and the append-only versioning convention.
- Link the doc from
README.md.
Suggested execution
- Fork the repo and create a branch
git checkout -b docs/contracts-28-migration-docs
- Implement changes
- Write code in:
contracts/escrow/src/lib.rs — only /// clarifications if needed.
- Write comprehensive tests in:
contracts/escrow/src/test.rs — optionally a doc-aligned migration assertion.
- Add documentation: add
docs/escrow/migrations.md; link from README.md.
- Include NatSpec-style doc comments (
///) where gaps are found.
- Validate security: migration cannot be run by non-admin (documented and cross-checked).
- Test and commit
Test and commit
- Run
cargo fmt --all -- --check, cargo build, and cargo test.
- Cover edge cases: documenting the double-run guard behaviour accurately.
- Include the full
cargo test output and a short security notes section in the PR description.
Example commit message
docs: document schema-versioning and migration workflow
Guidelines
- Minimum 95 percent test coverage for impacted modules.
- Clear, reviewer-focused documentation.
- Timeframe: 96 hours.
Community & contribution rewards
- 💬 Join the AgentPay community on Discord for questions, reviews, and faster merges: https://discord.gg/eXvRKkgcv
- ⭐ This is a GrantFox OSS / Official Campaign task and may be rewarded. When your PR is merged you'll be prompted to rate the project — if this issue and the maintainers helped you ship, we'd be grateful for a 5-star rating. Clear questions in Discord and tidy, well-tested PRs are the fastest path to a merge and a reward.
Document SchemaVersion, version(), and the migration workflow
Description
contracts/escrow/src/lib.rsdistinguishes the compiledversion()(returns 2) from the persistedSchemaVersion(get_schema_version, defaulting to 1) and exposesmigrate_v1_to_v2, but the relationship and the operational workflow are documented only in scattered///comments. Operators have no guide for when and how to migrate. This issue captures the model.Requirements and context
Agentpay-Org/Agentpay-contractsonly.docs/escrow/migrations.mdexplaining: the difference between codeversion()andSchemaVersion; why v2 reads default sensibly for absent slots; how theMigrationVersionMismatch (#11)guard prevents double-runs.migrate_v1_to_v2→ verifyget_schema_version).migrate_v2_to_v3-style functions and the append-only versioning convention.README.md.Suggested execution
git checkout -b docs/contracts-28-migration-docscontracts/escrow/src/lib.rs— only///clarifications if needed.contracts/escrow/src/test.rs— optionally a doc-aligned migration assertion.docs/escrow/migrations.md; link fromREADME.md.///) where gaps are found.Test and commit
cargo fmt --all -- --check,cargo build, andcargo test.cargo testoutput and a short security notes section in the PR description.Example commit message
docs: document schema-versioning and migration workflowGuidelines
Community & contribution rewards