Repository navigation
feat(contracts): add contract upgradeability plan + versioning tests (#1809) - #1848
Open
nissinanlung wants to merge 1 commit into
Open
nissinanlung wants to merge 1 commit into
nissinanlung wants to merge 1 commit into
Conversation
…martdevs17#1809) Document the upgradeability scheme (versioning, in-place migration flow, rollback, blue-green cutover) and add real-contract tests for the subscription upgrade hooks. Changes: - Add docs/CONTRACT_UPGRADE_PLAN.md: proxy+storage+implementation architecture, STORAGE_VERSION/ProxyVersion scheme, monotonic upgrade rules, step-by-step in-place upgrade procedure, rollback & emergency procedures, blue-green cutover for breaking changes, version history, and test coverage mapping - Add contracts/subscription/tests/upgrade_versioning.rs: 7 tests against the real SubTrackrSubscription + UpgradeableProxy + SubTrackrStorage trio — get_version, validate_upgrade boundary gates (0/1/2/3), migrate idempotency, unsupported-path rejection, v1→v2 UserPlanIndex rebuild (active only), and proxy-version tracking. Verified passing on stable. Acceptance criteria: - [x] Versioning — STORAGE_VERSION constant + ProxyVersion proxy storage; monotonic upgrades enforced; per-version migrate arms - [x] Migration steps — in-place schedule→timelock→validate→migrate→bump flow plus blue-green cutover for breaking changes; rollback path - [x] Tested — upgrade_flow.rs (proxy lifecycle) + upgrade_versioning.rs (real-contract versioning, compatibility gates, v1→v2 migration)
|
@nissinanlung 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! 🚀 |
This branch was successfully deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Closes #1809.
Storage/upgrade risks were unmanaged. This adds the authoritative upgradeability plan (versioning scheme, step-by-step migration flow, rollback/emergency procedures, blue-green cutover) plus real-contract tests for the subscription upgrade hooks.
Changes
docs/CONTRACT_UPGRADE_PLAN.md— proxy+storage+implementation architecture;STORAGE_VERSION/ProxyVersionscheme; monotonic upgrade rules; step-by-step in-place upgrade procedure (schedule → timelock → validate → migrate → version bump); rollback & emergency procedures; blue-green cutover for breaking changes; version history table; test coverage mapping.contracts/subscription/tests/upgrade_versioning.rs— 7 tests against the realSubTrackrSubscription+UpgradeableProxy+SubTrackrStoragetrio (no mocks):get_versionreturns currentSTORAGE_VERSIONvalidate_upgradeaccepts prior/current (1, 2), rejects 0 and future (3)migrateis a no-op at current version; rejects unsupported future pathmigrate_v1_to_v2_rebuilds_user_plan_index_for_active_only— dropsUserPlanIndexto simulate a v1 snapshot, runsmigrate(1), asserts the index is rebuilt for active subscriptions only (cancelled skipped)initializeAcceptance criteria
STORAGE_VERSIONconstant +ProxyVersionproxy storage; monotonic upgrades enforced; per-versionmigratearms.upgrade_flow.rs(proxy lifecycle) +upgrade_versioning.rs(real-contract versioning, compatibility gates, v1→v2 migration).Quality Gates
cargo test --test upgrade_versioning, stable)