Skip to content

feat(contracts): add governed upgrade manager for deployed contracts - #996

Merged
Hydrax117 merged 3 commits into
Arenax-gaming:mainfrom
petahade:feature/issue-969-contract-upgrade-mechanism
Aug 31, 2026
Merged

feat(contracts): add governed upgrade manager for deployed contracts#996
Hydrax117 merged 3 commits into
Arenax-gaming:mainfrom
petahade:feature/issue-969-contract-upgrade-mechanism

Conversation

@petahade

Copy link
Copy Markdown
Contributor

Summary

Adds a new upgrade-manager Soroban contract that implements a governed, proxy-equivalent upgrade lifecycle for deployed ArenaX contracts. Soroban has no delegatecall-style proxy — a contract's address stays constant while its wasm implementation can be swapped via Env::deployer().update_current_contract_wasm(hash). This contract is the governance layer in front of that primitive.

  • Proxy pattern implementation — stable contract address across wasm swaps via update_current_contract_wasm; other contracts integrate by reading get_approved_wasm_hash and applying it to themselves in their own admin-gated upgrade() entrypoint.
  • Upgrade governance votepropose_upgradevote_upgrade (one vote per governor) → execution requires approval_threshold yes-votes.
  • Implementation validationvalidate_upgrade records a validation verdict; execution is blocked until a positive verdict is recorded.
  • Rollback capabilityrollback_upgrade restores the previously-approved wasm hash for a contract (or re-applies it immediately for the manager's own implementation), with a recorded reason.
  • Upgrade history logged — every execution/rollback appends to a per-contract get_upgrade_history log, and each lifecycle step emits a versioned event via a new arenax-events::upgrade_manager module.

Also registers the new event namespace in arenax-events' events_registry list (lib.rs, events_registry.rs) alongside the existing domains, and adds upgrade-manager to the contracts workspace members.

See contracts/upgrade-manager/README.md for the full design rationale and an integration example for a target contract's own upgrade() entrypoint.

Test plan

  • cargo build / cargo test across the contracts workspace (not run in this environment — no Rust toolchain available here)
  • Exercise the propose → validate → vote → execute flow against testnet
  • Exercise rollback after a bad upgrade

Closes #969

Implements a proxy-equivalent upgrade mechanism for Soroban contracts:
propose/validate/vote/execute lifecycle with a governance approval
threshold, timelock, rollback to the previous approved wasm hash, and
a per-contract append-only upgrade history log surfaced via versioned
events.

Closes Arenax-gaming#969
@petahade
petahade requested a review from anonfedora as a code owner August 26, 2026 09:05
@drips-wave

drips-wave Bot commented Aug 26, 2026

Copy link
Copy Markdown

@petahade 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

@vercel

vercel Bot commented Aug 26, 2026

Copy link
Copy Markdown

@petahade is attempting to deploy a commit to the paul joseph's projects Team on Vercel.

A member of the Team first needs to authorize it.

@petahade
petahade requested a review from Hydrax117 as a code owner August 27, 2026 20:50
@Hydrax117
Hydrax117 merged commit faa9426 into Arenax-gaming:main Aug 31, 2026
1 of 6 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.

[contract] - Add contract upgrade mechanism

2 participants