Skip to content

[Bug] Instance storage TTL never renewed after initialize #112

Description

@collinsezedike

Summary

initialize extends instance-storage TTL exactly once (contracts/tholos/src/lib.rs:289-291). Every other function that reads or writes instance storage, update_resolvers, propose_rotation/vote_rotation/cancel_rotation, set_paused, assert_outcome, dispute, finalize, resolve, never calls extend_ttl again. Contrast this with set_assertion, which explicitly re-extends the persistent Assertion entry's TTL on every write for exactly this reason. If INSTANCE_BUMP_AMOUNT elapses without an external ExtendFootprintTTLOp, instance storage (admin, token, resolvers, paused flag) becomes eligible for archival, and every function depending on it starts failing until a RestoreFootprintOp is submitted.

Scope

  • Add a shared helper that bumps instance TTL, called from every state-changing entrypoint (assert_outcome, dispute, finalize, resolve, update_resolvers, set_paused, and the rotation functions).
  • No storage layout changes, this is purely about calling extend_ttl more often.

Proposed approach

fn touch_instance_ttl(env: &Env) {
    env.storage()
        .instance()
        .extend_ttl(INSTANCE_LIFETIME_THRESHOLD, INSTANCE_BUMP_AMOUNT);
}

Call this from the top of each state-changing entrypoint, mirroring how set_assertion already renews the persistent side. Add a test confirming instance TTL is extended after a call to one of these functions, not just at initialize.

Metadata

Metadata

Assignees

Labels

GrantFox OSSIssue tracked in GrantFox OSSMaybe RewardedIssue may be eligible for a GrantFox rewardThird CampaignCampaign: Third CampaignbugSomething isn't workingeasySmall, low-risk change

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions