Skip to content

[SC-45] Unify error codes across contracts #1209

Description

@yusuftomilola

Overview

Each crate defines its own errors — assetsup/src/error.rs, contrib/src/error.rs, multisig-wallet/src/errors.rs, multisig_transfer/src/errors.rs. Independently numbered enums mean the same integer means different things per contract, making backend error handling ambiguous and cross-contract calls hard to interpret.

Tasks

  • Catalogue every error enum and its discriminant values.
  • Allocate a per-contract numeric range (e.g. assetsup 100–199, contrib 200–299) and document the allocation.
  • Extract genuinely shared errors (Unauthorized, NotInitialized, AlreadyInitialized, InvalidInput) into a shared types crate with fixed codes.
  • Renumber contract-specific errors into their assigned ranges.
  • Give every variant a doc comment explaining when it is returned.
  • Coordinate with the backend Soroban bridge, which will map these codes.

Acceptance Criteria

  • No two contracts use the same numeric code for different meanings.
  • Shared errors are defined once.
  • The allocation table is documented and every variant has a doc comment.

Notes for Contributors

Requires Rust + Soroban. Workspace: contracts/ (soroban-sdk 22, members: assetsup, contrib, multisig-wallet, multisig_transfer, asset-maintenance). Run cargo test --all, cargo fmt --all -- --check, and cargo clippy --all-targets --all-features -- -D warnings before opening a PR — CI enforces all three. Comment below to be assigned.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions