Skip to content

feat(vesting): add upgrade and admin lock mechanisms - #431

Merged
zachyo merged 3 commits into
soropad:masterfrom
MJ-RWA:feature/vesting-contract-upgradeability
Aug 3, 2026
Merged

feat(vesting): add upgrade and admin lock mechanisms#431
zachyo merged 3 commits into
soropad:masterfrom
MJ-RWA:feature/vesting-contract-upgradeability

Conversation

@MJ-RWA

@MJ-RWA MJ-RWA commented Jul 30, 2026

Copy link
Copy Markdown
Contributor

Closes #362


Add Upgradeability and Admin Lock Controls to Vesting Contract

Summary

This PR adds an upgrade path to the vesting contract, bringing it in line with the token contract's upgrade capabilities and enabling future remediation of deployed vesting contracts.

The implementation mirrors the token contract's upgrade flow, including validation, admin authorization, lock-state enforcement, and upgrade event emission. It also introduces admin revocation and locking functionality, allowing vesting contracts to become permanently immutable once vesting schedules are finalized.

Additionally, the AdminPanel UI is extended to support upgrades for both token and vesting contracts.

Changes

Smart Contract

  • Added upgrade(new_wasm_hash: BytesN<32>) to the vesting contract.
  • Implemented validation to reject zero-value WASM hashes.
  • Enforced existing lock-state restrictions during upgrades.
  • Added upgrade event emission containing the new WASM hash.
  • Added revoke_admin functionality.
  • Added contract locking mechanism to permanently disable future administrative actions when desired.

AdminPanel

  • Extended upgrade controls to support vesting contracts in addition to token contracts.
  • Updated contract selection logic and related UI flows.
  • Ensured compatibility with existing token upgrade workflows.

Motivation

The vesting contract currently lacks any upgrade mechanism, making deployed instances permanently fixed to their original implementation.

Recent findings identified multiple issues affecting the vesting module, including:

  • Overflow risks
  • TTL-related contract bricking scenarios
  • Unbounded storage growth
  • Trust and authorization concerns

Without an upgrade path, remediation requires manual migration of users and vesting schedules to entirely new contracts. This PR provides a controlled and auditable upgrade mechanism while preserving the ability to permanently lock contracts once finalized.

Testing

  • Added tests for successful upgrades.
  • Added tests for zero-hash rejection.
  • Added tests for lock-state enforcement.
  • Added tests for admin revocation behavior.
  • Added tests verifying upgrades are impossible after locking.
  • Verified existing token upgrade functionality remains unaffected.

Security Considerations

  • Upgrades remain admin-gated.
  • Invalid WASM hashes are rejected.
  • Locked contracts cannot be upgraded.
  • Admin privileges can be permanently revoked to achieve immutability after deployment stabilization.

Impact

@drips-wave

drips-wave Bot commented Jul 30, 2026

Copy link
Copy Markdown

@MJ-RWA 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

@zachyo

zachyo commented Aug 1, 2026

Copy link
Copy Markdown
Contributor

Hi @MJ-RWA , kindly fix conflicts

@MJ-RWA

MJ-RWA commented Aug 2, 2026

Copy link
Copy Markdown
Contributor Author

@zachyo Conflict Resolved

@zachyo
zachyo merged commit 7101de9 into soropad:master Aug 3, 2026
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.

Vesting: the contract is not upgradeable while the token is

2 participants