Skip to content

Add CONTRACT_VERSION semantic-versioning check rejecting upgrade if breaking-major regression detected #483

Description

@thlpkee20-wq

Description

Today there is no programmatic check that an upgrade does not regress major version. Encode CONTRACT_VERSION semver and have migrate_storage reject upgrades whose to.major < from.major.

Requirements and context

  • Must be secure, tested, and documented
  • Should be efficient and easy to review
  • Relevant code: Revora-Contracts/src/lib.rs, Revora-Contracts/src/test_storage_layout_version.rs
  • Use a (u32, u32, u32) triple for semver to avoid string parsing

Suggested execution

  • Fork the repo and create a branch
  • git checkout -b feat/semver-upgrade-guard
  • Implement changes
    • Replace CONTRACT_VERSION: u32 with (MAJOR, MINOR, PATCH)
    • Add assert_semver_forward(from, to) helper
    • Reject downgrade with VersionDowngrade
  • Validate security and correctness assumptions

Test and commit

  • Run tests
    • cargo test --all
  • Cover edge cases
    • Same-version migration must reject NoOpMigration
  • Include test output and security notes

Example commit message

feat: enforce semver forward-only contract upgrades

Guidelines

  • Minimum 95 percent test coverage
  • Clear documentation
  • Timeframe: 96 hours

Metadata

Metadata

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions