Skip to content

Move bump_persistent read bumps out of get_* into a dedicated bump_*_view set #23

Description

@P3az3

Problem Statement

Every get_* in campaign/src/storage.rs calls bump_persistent, refreshing the TTL of the loaded entry on every call. This is desirable for frequently-updated campaign state but expensive for views called often by dashboards/UI.

For dashboard viewers, refreshing TTL on every poll pushes the eventual archival further out, but each refresh costs a host invocation. For light-traffic view-only callers (analytics pages that refresh every few seconds), the work is unnecessary.

Expected Outcome

Split reads into:

  • get_* — read-only, no TTL bump (cheap).
  • get_*_bumped — read + bump (for state-touching callers).

Update donate, claim_refund, release_milestone*, etc. to explicitly use _bumped reads. Views (analytics, dashboard) use plain get_*.

Acceptance Criteria

  • All #[contractimpl] analytics views (get_campaign_report, get_dashboard_metrics, etc.) use get_* (non-bumping).
  • All mutating paths (donate, claim_refund, release_*, etc.) use get_*_bumped.
  • A new test test_view_does_not_bump_ttl asserts a view call does not bump the TTL.

Implementation Notes

  • Refactor bump_persistent to remain internal (fn rather than pub fn).
  • Add JSDoc-style comments on which path each name belongs to.

Affected Files / Modules

  • campaign/src/storage.rs
  • campaign/src/lib.rs (entrypoint usage)
  • campaign/src/views.rs

Dependencies — None.

Metadata

Metadata

Assignees

No one assigned

    Labels

    GrantFox OSSIssue tracked in GrantFox OSSMaybe RewardedIssue may be eligible for a GrantFox rewardOfficial Campaign | FWC26Campaign: Official Campaign | FWC26performancePerformance / cost / budget optimisation.priority/p2Should-do in current quarter.refactorInternal reorganisation, no behavior change.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions