Description
DataKey::InvestorContribution, InvestorEffectiveYield, InvestorClaimNotBefore, and InvestorClaimed are stored in instance storage, so every investor's data shares one entry whose size grows unbounded and whose TTL is coupled to the escrow. The allowlist already uses persistent(). Migrate per-investor keys to persistent storage to bound instance footprint and isolate per-address TTL, per ADR-007.
Requirements and context
- Scoped to the LiquiFact
escrow Soroban contract.
- Switch the four per-investor keys to
env.storage().persistent() consistently across writers (fund_impl, claim_investor_payout) and readers (get_contribution, etc.).
- Provide a documented migration note (likely redeploy per the
migrate panic policy) and bump SCHEMA_VERSION.
- Invariant: read/write semantics unchanged from a caller's perspective; defaults still apply on absence.
- Reference
docs/escrow-gas-storage-notes.md and ADR-007.
- Must be secure, tested, and documented.
Suggested execution
- Fork the repo and create a branch:
git checkout -b enhancement/persistent-investor-keys
- Implement changes:
escrow/src/lib.rs
- Tests:
escrow/src/tests/funding.rs
- Docs:
docs/adr/ADR-007-storage-key-evolution.md
- Include rustdoc/NatSpec-style doc comments on public functions
- Validate security assumptions (auth, overflow, storage TTL, double-spend)
Test and commit
- Run tests:
cargo test
- Cover edge cases (zero amounts, overflow, unauthorized callers, double-spend, state-machine misuse)
- Include test output and security notes in the PR
Example commit message
refactor(escrow): persist per-investor storage keys
Guidelines
- Minimum 95% test coverage on new/changed code
- Clear documentation
- Timeframe: 96 hours from assignment
Description
DataKey::InvestorContribution,InvestorEffectiveYield,InvestorClaimNotBefore, andInvestorClaimedare stored in instance storage, so every investor's data shares one entry whose size grows unbounded and whose TTL is coupled to the escrow. The allowlist already usespersistent(). Migrate per-investor keys to persistent storage to bound instance footprint and isolate per-address TTL, per ADR-007.Requirements and context
escrowSoroban contract.env.storage().persistent()consistently across writers (fund_impl,claim_investor_payout) and readers (get_contribution, etc.).migratepanic policy) and bumpSCHEMA_VERSION.docs/escrow-gas-storage-notes.mdand ADR-007.Suggested execution
git checkout -b enhancement/persistent-investor-keysescrow/src/lib.rsescrow/src/tests/funding.rsdocs/adr/ADR-007-storage-key-evolution.mdTest and commit
cargo testExample commit message
Guidelines