Skip to content

feat: implement contract upgradeability API (Closes #125)#145

Merged
Cybermaxi7 merged 1 commit intoMarketXpress:mainfrom
Abrahamojobo:feature/upgrade-ability
Mar 28, 2026
Merged

feat: implement contract upgradeability API (Closes #125)#145
Cybermaxi7 merged 1 commit intoMarketXpress:mainfrom
Abrahamojobo:feature/upgrade-ability

Conversation

@Abrahamojobo
Copy link
Copy Markdown
Contributor

Closes #125

Description

This PR integrates the standard Soroban mutable upgrade execution pipelines into the MarketXContract. It unlocks the ability for the Admin to hot-swap bug fixes and patch enhancements directly onto the deployed contract map without migrating the underlying ledger.

Changes Included

  • Upgrade Trait Integration (lib.rs):
    • Added the upgrade endpoint that safely executes the native env.deployer().update_current_contract_wasm(new_wasm_hash) vector.
    • Placed an overarching Self::assert_admin(&env)? boundary block, explicitly trapping any execution requests from end-users, fee collectors, or unauthorized arbiters.
  • Deep Native Tests (test.rs):
    • test_upgrade_auth_failure: Validates authentication blocks by spinning up a mock upgrade environment and asserting that external random non-admin invokers fail cleanly with an is_err() catch.
    • test_upgrade_state_persistence: Simulates a fully funded Escrow node and executes a live test dummy hash upgrade across the test ledger, subsequently re-querying the exact escrow_id node mapping to mathematically assert escrow.amount == 1000 is preserved linearly across the environment transaction line unharmed.

Review Guide

Reviewers should specifically verify the upgrade logic inside the Admin Block in contracts/marketx/src/lib.rs.

@Cybermaxi7 Cybermaxi7 merged commit a17f2b6 into MarketXpress:main Mar 28, 2026
0 of 3 checks passed
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.

Upgradeability and Data Migration

3 participants