Skip to content

feat(campaign): Add multi-sig support for all admin operations - #1511

Open
okanichibueze7 wants to merge 1 commit into
FinesseStudioLab:mainfrom
okanichibueze7:feat/multi-sig-campaign-operator-approvals
Open

okanichibueze7 wants to merge 1 commit into
FinesseStudioLab:mainfrom
okanichibueze7:feat/multi-sig-campaign-operator-approvals

Conversation

@okanichibueze7

Copy link
Copy Markdown

Summary

Implements comprehensive multi-signature (multi-sig) protection for all critical campaign admin operations in the Trivela campaign contract.

Previously, only set_merkle_root had multi-sig protection. This change extends the same co-admin multisig infrastructure to all 22+ admin operations.

Problem Statement & Impact

  • Security Gap: Single-admin operations on high-value campaigns were vulnerable to compromise of a single key
  • Operational Risk: Critical campaign parameters could be changed unilaterally
  • Smart Contract Safety: Directly improves smart contract safety, multi-asset security, and state persistence on Soroban

Technical Architecture

Implementation Approach

  1. Operation Discriminants: Added 30 stable operation IDs for deterministic signature verification
  2. Unified Authorization Helper: Created require_admin_with_multisig() that checks threshold and verifies signatures
  3. Argument Hashing: Each operation computes deterministic hash of arguments for signature binding

Protected Operations

All admin operations now require multi-sig when threshold > 0:

  • set_active, set_window, set_max_cap
  • set_invite_only, issue_invite, revoke_invite
  • set_participation_fee
  • add_to_allowlist/remove_from_allowlist, add_to_blocklist/remove_from_blocklist
  • set_allowlist_enabled/set_blocklist_enabled
  • add_co_admin/remove_co_admin (self-protected)
  • set_multisig_threshold (self-protected)
  • propose_admin/accept_admin/cancel_admin_transfer
  • set_privacy_mode, set_uniqueness_mode
  • set_activity_log_size
  • set_ledger_window, set_schedule_mode
  • clear_participation, upgrade, import_state, migrate
  • admin_deregister

Security Properties

  • Operation-specific signing prevents signature substitution
  • Nonce-based replay protection
  • Self-protecting: co-admin/threshold changes require existing multisig
  • Backward compatible: threshold=0 uses legacy single-admin path

Test Strategy

All existing tests updated to pass empty signature vectors for backward compatibility.

Checklist


Stellar Wave Program: This contribution is submitted for the 10th wave as assigned to @okanichibueze7.

Extend the campaign contract's co-admin multisig infrastructure to protect
all critical admin operations, not just set_merkle_root. This ensures that
high-value campaign configurations require multiple operator signatures
before being applied.

## Changes

### New Operation Discriminants
Added 30 operation discriminants (OP_SET_MERKLE_ROOT through OP_MIGRATE) for
comprehensive multi-sig authorization tracking.

### Helper Function
Added `require_admin_with_multisig()` that:
- Checks if multisig threshold > 0
- If enabled: verifies co-admin signatures via `verify_multisig()`
- If disabled: falls back to legacy single-admin auth with nonce

### Protected Operations (now require multi-sig when threshold > 0)
- set_active - Toggling campaign active state
- set_window - Setting registration time window
- set_max_cap - Setting participant cap
- set_invite_only - Toggling invite-only mode
- issue_invite/revoke_invite - Managing invite codes
- set_participation_fee - Setting participation fees
- add_to_allowlist/remove_from_allowlist - Managing allowlists
- add_to_blocklist/remove_from_blocklist - Managing blocklists
- set_allowlist_enabled/set_blocklist_enabled - Toggling list enforcement
- add_co_admin/remove_co_admin - Managing co-admins (self-protected)
- set_multisig_threshold - Setting threshold (self-protected)
- propose_admin/accept_admin/cancel_admin_transfer - Admin rotation
- set_privacy_mode - Setting privacy mode
- set_uniqueness_mode - Setting uniqueness mode
- set_activity_log_size - Setting log size
- set_ledger_window - Setting ledger window
- set_schedule_mode - Setting schedule mode
- clear_participation - Clearing participation history
- upgrade - Upgrading contract WASM
- import_state - Importing state configuration
- admin_deregister - Admin-initiated deregistration
- migrate - Schema migration

### Security Properties
- All signature verification uses deterministic operation-specific hashes
- Nonce-based replay protection per operation
- Self-protecting: co-admin/threshold changes require existing multisig
- Backward compatible: threshold=0 uses legacy single-admin path

## Testing
Updated all existing tests to pass empty signature vectors when multisig
is disabled (threshold=0), maintaining full backward compatibility.

Closes FinesseStudioLab#1354

Co-authored-by: Codebuff <noreply@codebuff.com>

This branch has not been deployed

No deployments
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.

feat(contracts): Add support for multi-sig campaign operator approvals

1 participant