Skip to content

Add regression test that extend_instance_ttl actually persists across a simulated ledger-time jump #72

Description

@Jagadeeshftw

📌 Description

extend_instance_ttl(env, caller) in src/lib.rs is callable by admin or operator and extends the contract instance/code TTL "so it survives long inactivity" per the README. There's an authorization test opportunity (non-admin/non-operator rejection) and a functional-correctness opportunity (TTL actually extends, verified by advancing simulated ledger time in the test environment) that should both be explicit, named tests rather than incidental coverage.

🧩 Requirements and context

  • Add a test asserting a caller who is neither admin nor operator is rejected by extend_instance_ttl.
  • Add a test that advances the test environment's ledger sequence/timestamp past what the instance would survive without extension, and confirms the contract remains callable after extend_instance_ttl was invoked.
  • Use Soroban's test-environment ledger manipulation utilities already available via the soroban_sdk test harness.

🛠️ Suggested execution

  • Add both tests to src/test.rs, using env.ledger().set(...) (or the SDK's equivalent) to simulate time passing.
  • If the authorization check is missing or the TTL extension doesn't actually take effect, fix extend_instance_ttl in src/lib.rs.

✅ Acceptance criteria

  • Non-admin/non-operator callers are rejected.
  • TTL extension is proven to take effect via a simulated ledger-time jump.
  • Both scenarios are covered by named regression tests.

🔒 Security notes

Confirms the admin/operator-only guard on a lifecycle-critical entrypoint, and that the extension is not a no-op that silently leaves the contract vulnerable to archival.

📋 Guidelines

  • Minimum 95% test coverage
  • Clear documentation
  • Timeframe: 96 hours

Metadata

Metadata

Assignees

Labels

GrantFox OSSGrantFox open-source programMaybe RewardedGrantFox: potentially rewarded contributionOfficial Campaign | FWC26GrantFox official campaign issuesecuritySecurity hardening / audittestingTests and coverage

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions