Skip to content

🟑 No permissionless TTL keep-alive path or archived-entry recovery procedure #1011

Description

@Ejirowebfi

Severity: Elevated (downgraded from Critical β€” see below) Β· Area: Contract (contracts/token-factory/src/lib.rs), Docs

Description

What has been fixed since this was filed. The critical half of this issue is gone. The argument-ignoring extend_token_ttl(env, _token_address, _index) no longer exists anywhere in the tree. Token bookkeeping moved from a single shared instance entry to persistent storage, and every persistent read and write goes through helpers that extend that specific key's TTL on access β€” set_persistent (lib.rs:454-455), migrate_addr_keyed (lib.rs:474-475), and the count-key path (lib.rs:496-500). One archival event can therefore no longer take down all token bookkeeping at once; each entry's rent is tracked independently. docs/contract-abi.md:36 documents this, and :38-41 documents the two mechanisms that migrate pre-v3 data out of legacy instance storage.

What remains. The archival risk is now bounded rather than catastrophic, but three pieces of the original scope were never delivered, and they are the pieces that matter for a token nobody has touched in a month:

  1. There is no permissionless keep-alive path. A token's entries are extended only when someone calls a factory entrypoint that touches that token. A token created once and never minted, never re-metadata'd, and never transferred gets no extension at all after creation. Its owner has no contract function to call to keep it alive β€” every extension helper is internal, and no extend_ttls(keys)-style maintenance entrypoint exists (grep for extend_token_ttl, extend_ttls, RestoreFootprint across contracts/, scripts/, docs/, and frontend/src returns nothing).
  2. There is no restore procedure. Nothing in docs/ β€” not incident-response.md, not mainnet-deployment-checklist.md β€” describes what an operator does once an entry has been archived. docs/contract-abi.md is the only file mentioning TTL at all, and it describes prevention, not recovery.
  3. There is no TTL monitoring and no ledger-advancing test. No check surfaces how close any entry is to expiry, and test.rs has no test that advances the ledger past a TTL boundary to prove either that touched entries survive or that archived entries can be recovered. The per-key extension is asserted by construction, not by test.

Severity drops from Critical to Elevated because the blast radius is now one idle token rather than the whole factory, and the state/admin/fee configuration in instance storage is extended by any factory activity at all.

Tasks

  • Add a permissionless maintenance entrypoint (extend_token_ttl(token_address) β€” reusing the name honestly this time, or extend_ttls(keys)) that any address can call to extend a specific token's TokenInfo / TokenIndex / Metadata / owner / supply keys, so an idle token's owner is not dependent on transacting to stay alive.
  • Alternatively or additionally, document the ledger-level ExtendFootprintTTL operation as the supported keep-alive route, with a worked example against a real token.
  • Write the archived-entry recovery runbook in docs/ β€” detecting archival, constructing the RestoreFootprint operation, expected rent cost, and who is expected to pay it.
  • Add TTL headroom to api/health/indexer.ts or a sibling health endpoint so proximity to expiry is observable rather than discovered by a user report.
  • Add tests that advance the ledger past TTL boundaries and assert (a) a touched entry survives, (b) an untouched entry archives as expected, (c) restoration works.

Acceptance Criteria

  • A token that receives no factory calls can still be kept alive by an unprivileged caller through a documented, tested mechanism.
  • An archived-entry recovery procedure exists in docs/, names its rent cost, and is exercised by a test.
  • Ledger-advancing tests prove the per-key extension behavior that docs/contract-abi.md:36 currently asserts by construction.
  • No function signature advertises TTL behavior it does not implement (still true today β€” keep it true).

Re-verified and narrowed on 2026-08-19 during the 30-issue codebase audit tracked in ISSUES.md.

Activity

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

Metadata

Metadata

Assignees

Labels

GrantFox OSSIssue tracked in GrantFox OSSMaybe RewardedIssue may be eligible for a GrantFox rewardOfficial Campaign | FWC26Campaign: Official Campaign | FWC26Third CampaignCampaign: Third CampaignauditFrom the ISSUES.md codebase auditcontractsdocumentationImprovements or additions to documentationseverity: elevatedCorrectness/robustness gap with user-visible impact

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions