Skip to content

Versioned storage schema and migration path for persistent structs - #1369

Merged
Calebux merged 1 commit into
Calebux:mainfrom
IjayAbby:ft_versioned_storage
Sep 2, 2026
Merged

Versioned storage schema and migration path for persistent structs#1369
Calebux merged 1 commit into
Calebux:mainfrom
IjayAbby:ft_versioned_storage

Conversation

@IjayAbby

Copy link
Copy Markdown
Contributor

Description

Fix: SubscriptionData, EscrowAgreement, Card and PaymentChannel are stored directly as contracttype structs in persistent storage. Adding a field to any of them silently breaks deserialization of existing entries after an upgrade, and contract-upgrade has no story for migrating state — only for swapping WASM.


Related Issue

Closes #1227


Test Plan

  • Tested locally
  • Verified expected behavior
  • No regressions introduced

Acceptance Criteria

  • Every persisted struct carries a schema version.
  • Each contract exposes an admin-gated migrate() that is idempotent and rejects out-of-order versions.
  • A test creates v1 state, performs an upgrade, and asserts values survive intact.
  • contracts/DEPLOYMENT.md documents the migration procedure and the rollback constraint.

Checklist

  • Code builds successfully
  • Tests pass
  • Follows project conventions
  • No sensitive data exposed

@IjayAbby
IjayAbby requested a review from Calebux as a code owner August 30, 2026 11:31
@drips-wave

drips-wave Bot commented Aug 30, 2026

Copy link
Copy Markdown

@IjayAbby Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

@Calebux Calebux closed this Aug 30, 2026
@IjayAbby

Copy link
Copy Markdown
Contributor Author

Hello @Calebux, you closed the issue without merging it, which means I have not received points.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[v2][contracts] Versioned storage schema and migration path for persistent structs

2 participants