Skip to content

fix: add get_version() and upgrade() to vouching-contract #48

Description

@EmeditWeb

Problem

The vouching contract is missing two functions that every other contract has:

  • get_version() — returns current version symbol
  • upgrade() — admin-only WASM update

Contract impact: The vouching contract cannot be upgraded or version-checked. If a bug is found in the vouching logic, the contract must be replaced entirely (new deployment, new address), breaking all existing vouch references.

Before Starting

Read: context/architecture-context.md

Root Cause

The functions were omitted when the vouching contract was implemented.

What To Build

  1. Add get_version(env: Env) -> Symbol returning e.g. symbol_short!("1_0_0")
  2. Add upgrade(env: Env, admin: Address, new_wasm_hash: BytesN<32>) with auth and reentrancy guard
  3. Write tests for both functions

Files To Touch

  • contracts/vouching-contract/src/lib.rs — add get_version and upgrade

Acceptance Criteria

  • get_version returns a version symbol
  • upgrade allows authorized WASM update
  • upgrade requires admin auth
  • All existing tests pass

Mandatory Checks

  • context/ files read
  • cargo build passes
  • cargo test passes
  • PR references this issue

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions