Skip to content

TotalDeposited lifetime-analytics entry can silently reset to zero after ~30 days of investor inactivity #316

Description

@abayomicornelius

Area

Investment Vault / Storage

Complexity

Medium

File(s)

investment_vault/src/lib.rs:456, :808-812 (get_portfolio)

Problem

env.storage().persistent().extend_ttl(&key, 17280, 518400) is the only extend_ttl/TTL-bump call in the entire contract, capping the entry's guaranteed lifetime at ~518,400 ledgers (~30 days at 5s/ledger). If an investor deposits once and never deposits again, their TotalDeposited(account) entry can be archived after ~30 days; get_portfolio then silently reads unwrap_or(0), resetting a value documented as "lifetime deposited" back to zero with no error or event.

Scope

In:

  • Extend the TTL window (or bump it on every read, e.g. from get_portfolio), or clearly document the 30-day limitation.

Out:

  • Implementing a general storage-rent-monitoring service.

Acceptance Criteria

  • TotalDeposited survives investor inactivity for the vault's intended lifetime, or docs are corrected to not claim "lifetime"
  • A test simulates ledger advancement past the current TTL and checks the value is preserved

Metadata

Metadata

Assignees

No one assigned

    Labels

    Stellar WaveIssues in the Stellar wave programbugSomething isn't workingcontractSmart contract logic and design

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions