flowfi icon indicating copy to clipboard operation
flowfi copied to clipboard

[Contracts] Clean up milestone, attestation, and position entries in close_stream

Open blurbeast opened this issue 2 weeks ago • 4 comments

Overview & Background

close_stream removes only DataKey::Stream(stream_id). Conditional streams additionally write DataKey::ConditionalMilestones(stream_id) and DataKey::AttestedIds(stream_id) into instance storage, and position metadata lives under DataKey::StreamPosition(stream_id) — none of which are ever removed anywhere. Instance-storage entries share one non-expiring ledger entry, so every conditional stream ever created grows it permanently even after the stream is closed; orphaned StreamPosition persistent entries keep paying rent with no stream attached. The close_stream docs claim it "prevents unbounded state growth", which is only true for the stream record itself.


Technical Specification & Architecture

  1. Have close_stream also remove ConditionalMilestones, AttestedIds, and StreamPosition keys (contracts/stream_contract/src/storage.rs:224-228, lib.rs:1420-1426).
  2. Consider persistent rather than instance storage for per-stream lists, so entries can be removed and TTL'd independently.
  3. Add a close-stream test asserting all associated keys are gone.

Target Files

  • contracts/stream_contract/src/storage.rs
  • contracts/stream_contract/src/lib.rs

Acceptance Criteria

  • [ ] Closing a conditional stream removes milestone/attestation entries.
  • [ ] Closing a stream removes position metadata.
  • [ ] Tests assert storage is clean after close.

blurbeast avatar Nov 18 '26 19:11 blurbeast

@Joyful12-tech has applied to work on this issue as part of the Stellar Wave Program's 11th wave.

I would like to work on this issue

ℹ️ Repo Maintainers: To accept this application, review their application or assign @Joyful12-tech to this issue.

Joyful12-tech avatar Nov 20 '26 22:11 Joyful12-tech

@Ayomikun2005 has applied to work on this issue as part of the Stellar Wave Program's 11th wave.

allow me do this

ℹ️ Repo Maintainers: To accept this application, review their application or assign @Ayomikun2005 to this issue.

Ayomikun2005 avatar Nov 21 '26 07:11 Ayomikun2005

Congratulations, @Ayomikun2005! 🎉 Your application was accepted by the repo's maintainers, and the issue is due on November 25, 2026.

🧑‍💻 @Ayomikun2005: Please resolve the issue such that the repo's maintainers have enough time to review your contribution before the due date. You'll earn Points for completing the issue on-time, which will make you eligible for a share of the Stellar Wave Program's reward pool.

[!WARNING] When opening a PR, please link it to this issue to ensure it gets tracked accurately. Points are awarded when this issue is marked as completed by the maintainer.

🤠 Repo maintainers: Please keep an eye on the contributor's progress and review their work before the due date. You can manage this issue, including adjusting its complexity and points, here.

🌊 Happy Wave 🌊

drips-wave[bot] avatar Nov 21 '26 07:11 drips-wave[bot]

This issue has been completed by @Ayomikun2005 as part of the Stellar Wave Program's 11th Wave 🥳

😎 @Ayomikun2005: You earned 200 Points for completing this issue! Once the Wave's rewards are finalized, you'll be eligible for a percentage of the Wave's reward pool based on the percentage of total points you've earned. Learn more here. You can also Leave a review to share your experience working on this issue.

🧑‍💻 Repo maintainers: How'd the contributor do? Leave a review to share your experience working with them.

drips-wave[bot] avatar Nov 24 '26 17:11 drips-wave[bot]