Skip to content

[40] Add persistent storage rent sweep / reclaim path #40

Description

@merlik787-droi

Problem Statement

Soroban storage requires explicit TTL management. With no off-ramp, abandoned storage entries (learner progress on completed courses, old DataKey::Submission, refunded quest records, revoked badge entries) accumulate and rent-charges continue invisibly.

There is no contract-internal sweep/recovery mechanism today.

Why It Matters

  • Long-term protocol sustainability depends on storage costcontrol.
  • Without sweeps, the storage footprint grows monotonically.

Expected Outcome

  • New admin-only function sweep_storage(env, admin, sweep_learning_keys: bool):
    • Iterates or samples for abandoned storage entries.
    • Removes or extends TTL based on policy.
  • New view function estimated_storage_footprint(env) -> u32 (count).
  • Document cost-benefit tradeoffs.

Acceptance Criteria

  • Tests confirm sweep removes targeted entries.
  • estimated_storage_footprint matches expected count.

Implementation Notes

Files / Modules Affected

All six contracts; cross-cutting.

Dependencies

Issue #19, Issue #7.

Difficulty

Hard.

Estimated Effort

1 week.

Suggested Labels

reliability, storage, P2, long-term


Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions