Skip to content

Validate upgrade_manager migration steps are reversible and authorized before apply #558

@greatest0fallt1me

Description

@greatest0fallt1me

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

  1. Fork the repo and create a branch
    git checkout -b task/upgrade-migration-guards
  2. Implement changes
    • contracts/predictify-hybrid/src/upgrade_manager.rs, contracts/predictify-hybrid/src/versioning.rs
  3. 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

  • Migration apply requires admin auth
  • Each step is validated and irreversible steps are flagged
  • Version-incompatible/downgrade migrations are rejected

Guidelines

  • Minimum 95% coverage on touched code, validate auth and version-compatibility assumptions
  • Clear documentation and inline comments
  • Timeframe: 96 hours

Metadata

Metadata

Labels

Stellar WaveIssues in the Stellar wave programsecuritySecurity hardeningsmart-contractSoroban smart-contract worksorobanSoroban SDK / Stellar

Type

No fields configured for Task.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions