Skip to content

[GF-CONTRACT-02] Fix placeholder return value in access_control contract helper function #1122

@yusuftomilola

Description

@yusuftomilola

Problem

contracts/access_control/src/lib.rs (line 182) contains a helper function that returns a hardcoded placeholder value (0) with the comment: "Return 0 as placeholder - this function should not be used in production". This function is exported as part of the contract's public API, meaning any on-chain caller or integration that invokes it will receive a meaningless value instead of an error or the correct result. Leaving a production contract with placeholder logic is a correctness and trust issue.

Proposed Solution

Two acceptable approaches — choose the one that matches the function's intent:

Option A — Implement the correct return value:
Determine what the function is supposed to return (review the function signature, name, and how it is called elsewhere in the contracts). Implement the correct logic that produces the intended value.

Option B — Remove or panic the function if it is unused:
If the function is truly dead code and not called by any other contract or external integration, either:

  • Remove it entirely from the contract, OR
  • Replace the return with panic!("This function is not implemented") so callers fail loudly rather than silently receiving 0

After deciding on an approach, ensure the contract compiles cleanly and existing tests pass.

Acceptance Criteria

  • The placeholder return value (0) and its associated comment are removed
  • The function either has correct implemented logic OR explicitly panics with a descriptive message OR is deleted entirely
  • All existing contract tests pass after the change
  • If the function is removed, verify no other contract or test references it
  • The contract builds successfully with cargo build --target wasm32-unknown-unknown --release

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type
    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