Skip to content

feat: add multi-sig confirm_upgrade step for contract upgrades (#1808) - #1855

Merged
yahia008 merged 1 commit into
StellarCheckMate:mainfrom
JONA-DEV-CODE:feature/issue-1808-multisig-upgrade-confirmation
Oct 21, 2026
Merged

yahia008 merged 1 commit into
StellarCheckMate:mainfrom
JONA-DEV-CODE:feature/issue-1808-multisig-upgrade-confirmation

Conversation

@JONA-DEV-CODE

@JONA-DEV-CODE JONA-DEV-CODE commented Oct 20, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Closes #1806
Closes #1808
Closes #1809
Closes #1810

Fixes #1808. A single compromised admin key could previously deploy arbitrary WASM by scheduling and executing an upgrade unilaterally. This PR enforces a two-step multi-sig confirmation requirement for contract upgrades.

Changes

Contract (escrow)

  • New confirm_upgrade(upgrader: Address) — a second authorized address must call this after schedule_upgrade and before execute_upgrade. The upgrader address is stored under the new UpgradeKey::ConfirmedBy storage key and an (upgrade, confirm) event is emitted.
  • execute_upgrade — now returns Error::UpgradeNotConfirmed (## Add Test: paused contract rejects submit_result #58) if no confirmation is on record.
  • cancel_upgrade — now also clears any recorded confirmation so it cannot carry over to a subsequent upgrade cycle.
  • New UpgradeKey enum — separate #[contracttype] enum (DataKey is at the 50-variant XDR cap) with a single ConfirmedBy variant.
  • New Error::UpgradeNotConfirmed = 58 — returned by execute_upgrade when the multi-sig step has not been completed.

Tests

  • 5 new tests in contracts/escrow/src/tests/upgrade.rs covering the confirm_upgrade happy path, rejection when no upgrade is scheduled, event emission, execute_upgrade rejection without confirmation, and cancel_upgrade clearing the confirmation.
  • Fixed test_execute_upgrade_succeeds_after_review_period to call confirm_upgrade before execute_upgrade.

Documentation

  • docs/upgrade-safety.md — updated lifecycle diagram and procedure to include the confirm_upgrade step; added "Multi-Sig Confirmation Requirement" section.
  • docs/security.md — added "Contract Upgrade Multi-Sig" section with threat model and recommendations.
  • docs/error-codes.md — added entry for #58 UpgradeNotConfirmed and v0.2.0 changelog entry.
  • contracts/escrow/contract-spec.json — added confirm_upgrade to ABI snapshot.
  • CHANGELOG.md, README.md — updated events table and unreleased changelog.

Testing

New tests are in contracts/escrow/src/tests/upgrade.rs.

Unrelated issues noticed (not touched)

  • player_freeze_permissions.rs is referenced in mod.rs but the file does not exist — pre-existing issue, out of scope.

…arCheckMate#1808)

A single compromised admin key could previously deploy arbitrary WASM by
scheduling and executing an upgrade unilaterally. This change requires a
second authorized address to call confirm_upgrade before execute_upgrade
can proceed.

- Add UpgradeKey::ConfirmedBy storage key (new enum, DataKey is at limit)
- Add confirm_upgrade function: records upgrader address, emits event
- execute_upgrade now returns UpgradeNotConfirmed (StellarCheckMate#58) if no confirmation
- cancel_upgrade now clears any recorded confirmation
- Add Error::UpgradeNotConfirmed = 58
- Add 5 new tests and fix test_execute_upgrade_succeeds_after_review_period
- Update docs/upgrade-safety.md, docs/security.md, docs/error-codes.md
- Update contract-spec.json ABI snapshot and CHANGELOG.md
@drips-wave

drips-wave Bot commented Oct 20, 2026

Copy link
Copy Markdown

@JONA-DEV-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! 🚀

Learn more about application limits

@yahia008
yahia008 merged commit 7a47e07 into StellarCheckMate:main Oct 21, 2026
12 of 19 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

2 participants