[Contracts] Clean up milestone, attestation, and position entries in close_stream
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
- Have
close_streamalso removeConditionalMilestones,AttestedIds, andStreamPositionkeys (contracts/stream_contract/src/storage.rs:224-228,lib.rs:1420-1426). - Consider persistent rather than instance storage for per-stream lists, so entries can be removed and TTL'd independently.
- Add a close-stream test asserting all associated keys are gone.
Target Files
contracts/stream_contract/src/storage.rscontracts/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.
@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.
@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.
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 🌊
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.