refactor: contract initialization into upgradeable bootstrap pattern - #892
Open
mujahidyusuf962-code wants to merge 28 commits into
Conversation
|
@mujahidyusuf962-code 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! 🚀 |
|
@mujahidyusuf962-code is attempting to deploy a commit to the smartdevs17's projects Team on Vercel. A member of the Team first needs to authorize it. |
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.
Overview
This PR refactors the stellar-lend contract initialization flow into an upgradeable bootstrap pattern.
hello-worldandmigration-hubno longer rely on constructor-stylenew(); deployment now happens through a one-timebootstrap()entry point, followed by an admin-guardedupgrade()path that preserves contract state. The change makes future contract upgrades safe and deterministic, while keeping the existing public APIs fully backward compatible.Related Issue
Changes
🚀 Upgradeable Bootstrap Pattern
[ADD]
stellar-lend/contracts/migration-hub/src/bootstrap.rsbootstrap()entry point that initializes admin, asset registry, and protocol config from a singleInitializationDatastruct.Initializedstorage flag so a contract can only be bootstrapped once; idempotent-guard prevents re-initialization attacks.[ADD]
stellar-lend/contracts/migration-hub/src/upgrade.rsupgrade()andset_upgrade_authority()entry points behind the bootstrap guard.BootstrapCompleted/UpgradeCompletedevents.[MODIFY]
stellar-lend/contracts/hello-world/src/lib.rsnew()into a sharedtry_bootstrap()initialization flow.bootstrap()/upgrade()so hello-world follows the same upgradeable pattern as migration-hub.🧪 Tests & Documentation
[ADD]
stellar-lend/contracts/hello-world/src/test.rs[MODIFY]
stellar-lend/contracts/migration-hub/src/lib.rsbootstrapandupgrademodules; adds Rustdoc examples and upgrade-pattern documentation.📦 Build Configuration
Cargo.toml,stellar-lend/contracts/hello-world/Cargo.toml,stellar-lend/contracts/migration-hub/Cargo.tomlsoroban-sdktestutils/simnetdependencies required by the new integration tests.Verification Results
Closes #831