Description
upgrade_manager.rs and versioning.rs drive contract upgrades and storage migrations. Before any migration applies, the manager must verify the caller is an authorized admin, that each step passes Migration::validate, and that irreversible steps are explicitly flagged so an operator cannot accidentally apply a non-reversible migration without acknowledgement.
Requirements and Context
- Audit
contracts/predictify-hybrid/src/upgrade_manager.rs apply path for require_auth and step validation.
- Use
Migration::is_reversible/validate to gate application and record mark_completed/mark_failed.
- Reject downgrades or version-incompatible migrations using
Version::is_compatible_with.
- Must be secure, tested, and documented
- Should be efficient and easy to review
Suggested Execution
- Fork the repo and create a branch
git checkout -b task/upgrade-migration-guards
- Implement changes
contracts/predictify-hybrid/src/upgrade_manager.rs, contracts/predictify-hybrid/src/versioning.rs
- Test and commit
cargo test -p predictify-hybrid -- upgrade version
- Cover edge cases: unauthorized caller, invalid step, downgrade attempt, irreversible step
- Include test output and notes in the PR
Example commit message
task: enforce auth and validation on upgrade migrations
Acceptance Criteria
Guidelines
- Minimum 95% coverage on touched code, validate auth and version-compatibility assumptions
- Clear documentation and inline comments
- Timeframe: 96 hours
Description
upgrade_manager.rsandversioning.rsdrive contract upgrades and storage migrations. Before any migration applies, the manager must verify the caller is an authorized admin, that each step passesMigration::validate, and that irreversible steps are explicitly flagged so an operator cannot accidentally apply a non-reversible migration without acknowledgement.Requirements and Context
contracts/predictify-hybrid/src/upgrade_manager.rsapply path forrequire_authand step validation.Migration::is_reversible/validateto gate application and recordmark_completed/mark_failed.Version::is_compatible_with.Suggested Execution
contracts/predictify-hybrid/src/upgrade_manager.rs,contracts/predictify-hybrid/src/versioning.rscargo test -p predictify-hybrid -- upgrade versionExample commit message
Acceptance Criteria
Guidelines