Feat: implement Upgradeable Contract pattern for Predictify#184
Merged
greatest0fallt1me merged 6 commits intoOct 5, 2025
Merged
Conversation
Test Coverage:
- Proposal lifecycle tests (creation, approval, execution)
- Validation tests (compatibility, breaking changes, safety)
- Version tracking tests (get version, history, statistics)
- Integration tests (full upgrade workflow with rollback)
- Edge cases (incompatible versions, missing rollback plans)
…ract upgradeability
…rsion tracking
Fix version storage issues that prevented tests from working correctly:
Changes:
- Remove #[cfg(test)] guards that disabled persistent storage in tests
- Fix get_version_history() to actually read from storage in tests
- Fix store_version_history() to actually write to storage in tests
- Fix track_contract_version() initial version check from len()==1 to len()==0
- Remove redundant Vec::new() call when replacing initial version
Impact:
- Version tracking now works correctly in test environment
- Tests can properly validate version persistence
- Enables upgrade manager tests to track contract versions
Contributor
|
LGTM! @emarc99 |
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.
Pull Request Description
📋 Basic Information
Adds comprehensive upgrade functionality with proposal workflows, version compatibility validation, rollback support, and complete audit trails.
Type of Change
Please select the type of change this PR introduces:
Related Issues
Priority Level
📝 Detailed Description
What does this PR do?
This PR implements a comprehensive upgrade management system for the Predictify Hybrid Soroban smart contract. It adds the ability to safely upgrade contract WASM code while maintaining state, with built-in safeguards including:
Why is this change needed?
Smart contracts need upgradeability to:
How was this tested?
Comprehensive Test Suite: 24 tests covering all scenarios (100% pass rate)
Test Categories:
Alternative Solutions Considered
🏗️ Smart Contract Specific
Key Features
env.deployer().update_current_contract_wasm()API
upgrade_contract()- Perform upgradesrollback_upgrade()- Rollback to previous versionget_contract_version()- Get current versioncheck_upgrade_available()- Check pending upgradesget_upgrade_history()- View upgrade historyget_upgrade_statistics()- Upgrade metricsvalidate_upgrade_compatibility()- Version validationtest_upgrade_safety()- Pre-upgrade safety checksTesting
Contract Changes
🧪 Testing
Test Coverage
Test Results
🔍 Code Quality
Code Review Checklist
✅ Final Checklist
Pre-Submission
Review Readiness
📸 Screenshots (if applicable)
Thank you for your contribution to Predictify! 🚀