Skip to content

#102 — Reads Counters Without a , and Is Admin-Gated Only #883

Description

@Topmatrixmor2014

Labels: Official Campaign | FWC26 GrantFox OSS Maybe Rewarded contract soroban tooling bug

This is a smart-contract issue for the GrantFox FWC26 campaign. Bump the counters read by the stats view and make invariant checks callable by non-admin watchers so monitoring can run unattended.

Requirements and Context

contracts/finchippay-contract/src/multi_sig.rsget_contract_stats (≈ line 280):

let c = env.storage().persistent().get(&key).unwrap_or(0);
bump_if_present(&env, &key);

This one bumps — but the singleton counters it reads (EscrowCount, StreamCount, MultiSigCount) are not bumped by the sweep's bump_config_key arms (they are swept under their class item 0 via bump_to_floor_if_present, which is fine). The real gap: check_invariants in lib.rs (≈ line 1940) requires admin.require_auth() — a public watcher/keeper cannot run the invariant check, so the "on-chain invariant checker" the README advertises is only callable by the admin. Off-chain monitoring has to call an admin-gated function or simulate a privileged call, which is awkward and misleading.

Objectives

  1. Make check_invariants permissionless (it only reads and validates state; it performs no writes that harm callers), or expose a separate permissionless get_invariant_report view.
  2. Keep the admin-gated check_invariants for audit if desired, but add the public view.
  3. Add a test calling the invariant view from a non-admin address.

Suggested Execution

  1. Fork and branch: git checkout -b fix/invariant-public.
  2. Add a permissionless invariant-report entrypoint in lib.rs.
  3. Add tests; run cargo fmt --check && cargo clippy -- -D warnings && cargo test.

Acceptance Criteria

  • A non-admin address can call the invariant report and receive ok or the first violation.
  • The admin-gated path still works unchanged.
  • ≥2 tests; cargo test + wasm32v1-none build pass.

Guidelines

  • The report must be read-only (no state mutation) so it is safe to expose publicly.

Timeframe: 24 hours

Activity

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

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions