Skip to content

Add focused test coverage for contracts/admin/src/lib.rs #1444

Open

Description

@greatest0fallt1me

Summary

Add focused test coverage for contracts/admin/src/lib.rs in Predictify-org/predictify-contracts.

Why this matters

The runtime module contracts/admin/src/lib.rs needs an explicit coverage review. Its valid, invalid, duplicate, boundary, authorization, and failure paths must be deterministic and reviewable so changes cannot silently regress user-visible behavior, state integrity, or security controls.

Scope

Trace the entry points and callers of contracts/admin/src/lib.rs; identify its state transitions, external dependencies, and existing tests; then add the smallest focused test coverage needed for untested behavior. Preserve public interfaces unless a tested compatibility plan is included.

Priority

High

Acceptance criteria

  • Document the behavior and invariants exercised for contracts/admin/src/lib.rs in the test names or adjacent test helpers.
  • Cover success, invalid or boundary input, duplicate or repeated invocation, and the relevant authorization or permission case.
  • Cover dependency failure, retry, stale-state, or concurrent-execution behavior where the module has such a dependency or state transition.
  • Assert that errors are diagnosable without exposing sensitive data.
  • Keep existing callers compatible, or include a tested migration path.

Validation

Run the focused test suite and the repository CI checks. Include evidence for the normal path, rejection path, boundary behavior, and failure recovery applicable to contracts/admin/src/lib.rs.

Non-goals

  • Typo-only, formatting-only, documentation-only, or cosmetic changes.
  • Unrelated refactors, dependency upgrades, or broad rewrites.
  • Removing safeguards or weakening validation to make tests pass.

Contributor application

Before coding, describe affected modules, proposed state or invariant changes, test strategy, compatibility considerations, and an estimate. Wait for assignment before starting implementation.

PR requirements

Use a feature branch and include Closes #. Map each acceptance criterion to code and tests, explain security and failure-mode handling, and ensure CI passes.

Quality review

A maintainer will assess correctness, test depth, compatibility, observability, and adverse-case handling. A substantive implementation is required.

Activity

  1. shobhamerabacha-star commented on Sep 27, 2026

    @shobhamerabacha-star

    Hello @maintainers,

    I would like to resolve this issue. Here is my proposed execution plan:

    • Implementation: Structure Soroban contract handlers for Keep leaderboard rank pages deterministic following project idioms and storage invariants.
    • Testing: Add Soroban test cases checking unauthorized invocations, edge values, and state updates.

    Ready to deliver a clean, tested PR within 12–24 hours. Please assign!

  2. changed the title [-]Keep leaderboard rank pages deterministic[/-] [+]Add focused test coverage for contracts/admin/src/lib.rs[/+] on Sep 27, 2026
  3. Rodrigoue9 commented on Sep 28, 2026

    @Rodrigoue9

    Contributor Application: Focused Test Suite for Admin Contract (lib.rs)

    Hi @maintainers, I would like to resolve this issue under the GrantFox campaign.

    1. Affected Modules

    • contracts/admin/src/lib.rs: Administrative entry points, initialization, upgrade handlers, and state management.
    • contracts/admin/tests/test_lib.rs: Focused unit and integration test suite.

    2. Proposed State & Invariant Coverage

    • Access Control & Initialization: Verify one-time initialization, administrative access controls (require_auth), and instant rejection of unauthorized callers.
    • Contract Lifecycle & Upgrades: Test wasm byte-hash validation on upgrade calls, emergency pause state transitions, and recovery execution.
    • Boundary & Error Paths: Assert deterministic failure handling and error diagnostics without internal state leakage.

    3. Test Strategy & Verification

    • Use native Soroban SDK (soroban-sdk::Env) in-memory test harness.
    • Cover normal execution, unauthorized rejection, boundary parameters, and lifecycle recovery paths.
    • Verify cargo test and cargo check --target wasm32v1-none pass with zero warnings.

    4. Compatibility Considerations

    • Confined strictly to test suites; preserves existing public contract methods and storage keys.

    5. Estimate

    • 2 to 3 hours upon assignment.

    Relevant Track Record & Merged Contributions

    Recently delivered and merged features across the Stellar and Open-Source ecosystem with full test coverage and clean CI:

    • Astrea-Payouts/astrea: Merged PR #251 (Public Event View) & PR #224 (OG/Print layout, 489 tests passing).
    • Bitcoindefi/OpenAO: Merged PR #218 (Persistence API) & PR #379 (BFS Exit Validation, 7/7 CI checks).

    Ready to begin upon assignment!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions