Skip to content

Add contract upgrade state-schema migration safeguards in upgrade-governance #398

@Emeka000

Description

@Emeka000

Summary

The upgrade-governance contract approves WASM binary upgrades but does not validate that the new binary is backward-compatible with the existing on-chain storage schema. A schema-breaking upgrade can corrupt all patient data silently.

Proposed Design

  • Add a schema_version: u32 field to each contract's storage
  • Require the new WASM to declare its minimum compatible schema version
  • Reject upgrade proposals where the new binary's minimum schema version is greater than the currently stored version (migration required first)
  • Add a migrate_schema(from_version, to_version) entry point pattern for contracts with schema changes

Acceptance Criteria

  • Schema version is stored and incremented on migrations
  • Upgrade proposals include schema compatibility assertion
  • Incompatible upgrades are rejected at proposal time
  • Migration entry point pattern is documented in the upgrade guide

Metadata

Metadata

Assignees

No one assigned

    Labels

    Stellar WaveIssues in the Stellar wave programenhancementNew feature or request

    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