Skip to content

feat: remove shared contract error collisions#75

Open
OkeyAmy wants to merge 1 commit into
OrbitChainLabs:mainfrom
OkeyAmy:fix-overlapping-enum-discriminants-in-errors
Open

feat: remove shared contract error collisions#75
OkeyAmy wants to merge 1 commit into
OrbitChainLabs:mainfrom
OkeyAmy:fix-overlapping-enum-discriminants-in-errors

Conversation

@OkeyAmy

@OkeyAmy OkeyAmy commented Jun 23, 2026

Copy link
Copy Markdown

Closes #41

Motivation

  • The workspace defined two separate #[contracterror] enums (common::ErrorCode and campaign::Error) whose discriminants overlapped, risking mis-attributed on-chain error codes when both crates are present in a downstream dependency graph.
  • To eliminate the collision without renumbering stable on-chain discriminants, the change drops the shared ErrorCode from common and makes the campaign crate the canonical owner of campaign error discriminants.

Description

  • Remove the #[contracterror] enum ErrorCode from common/src/lib.rs and stop importing contracterror there so common becomes a pure shared data-types crate.
  • Update common crate metadata (common/Cargo.toml) and crate docs to document that it intentionally does not publish a #[contracterror] enum.
  • Clarify campaign/src/types.rs docs to state that campaign::Error is the canonical campaign error enum and cannot collide with a shared error space.
  • Add a focused unit test (campaign::types::error_code_tests::campaign_error_discriminants_are_unique_without_common_error_space) that asserts campaign error discriminants are internally unique.
  • Add deployment notes to docs/deployment.md explaining the decision and that no migration sequencing is required because no campaign discriminants were renumbered.

@GBOYEE

GBOYEE commented Jun 24, 2026

Copy link
Copy Markdown

I'd like to work on this.

Approach:

  • I'll analyze the codebase and implement a clean solution
  • Verify with existing tests + add new ones if needed

Estimated effort: ~1-2 hours. PR incoming shortly.

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.

[LOW] Error discriminant collision between campaign::Error and common::ErrorCode (1-3 swapped, 4 reused)

2 participants