Skip to content

feat: paged storage, O(1) lists, bucketed user intents, intent pruning - #449

Merged
james2177 merged 2 commits into
stellar-vortex-protocol:mainfrom
villadel:feature/paged-storage-bounded-lists-pruning
Sep 30, 2026
Merged

james2177 merged 2 commits into
stellar-vortex-protocol:mainfrom
villadel:feature/paged-storage-bounded-lists-pruning

Conversation

@villadel

Copy link
Copy Markdown

Resolves #153, #371, #373, #374.

Issue #153 — Bucketed UserIntents

  • Replace single UserIntents(Address) Vec with fixed-size buckets of 64 intent IDs: UserIntents(Address, u32) + UserIntentCount(Address).
  • list_intents_by_user(user, start, limit) is now paginated; pruned slots (None) are skipped. Backward-compatible list_intents_by_user_legacy kept.
  • submit_intent writes via user_intents_append(); bump_user_intents_ttl() keeps the active bucket live.

Issue #373 — Paged persistent SolverList + AllowedDstTokenList

  • Move both lists from instance storage (O(n) per-call deserialisation) to paged persistent storage: SolverListPage(u32) / SolverListCount / SolverListIdx(Address) and matching DstTokenList* variants.
  • add_to_solver_list / remove_from_solver_list and add_to_dst_token_list / remove_from_dst_token_list are now O(1) via append + index map (swap-remove on delete).
  • list_solvers and list_allowed_dst_tokens updated to walk pages.
  • Ordering is not insertion order after any swap-remove; documented.

Issue #374 — O(1) SolverIntents via index map

  • Add SolverIntentIdx(Address, BytesN<32>) -> u32 alongside SolverIntents.
  • solver_intents_add: O(1) push + index write; duplicate-add is a no-op.
  • solver_intents_remove: O(1) swap-remove + index update.
  • get_solver_intents(solver, start, limit) is now paginated.
  • Invariant: len(SolverIntents(solver)) == solver_record.active_intents.

Issue #371 — Permissionless close_intent + tombstone

  • Add terminal_at: Option field to IntentRecord; set on every terminal transition (Filled, Cancelled, Expired, Resolved).
  • close_intent(intent_id): permissionless; callable by anyone after terminal_at + retention_secs <= now (default 30 days). Deletes: Intent, IntentFillHistory, ExtensionGranted, BestBid, BackstopClaimed, UserIntents bucket slot, SolverIntents entry. Leaves IntentTombstone so IntentAlreadyExists still fires on id reuse.
  • set_intent_retention(secs) / get_intent_retention() for admin config.
  • New errors: IntentNotTerminal (36), RetentionPeriodNotElapsed (37).
  • Updated docs/145-ttl-bump-frequency-review.md §5.

Housekeeping

  • Deduplicate accumulated duplicate constant definitions (leftover merges).
  • Update .gitignore: add *.snap, *.snap.new, coverage artifacts, criterion output, and other unnecessary files.

Summary

Related issue

Type of change

  • Bug fix
  • New feature
  • Refactor
  • Documentation
  • CI / tooling

Component

  • Contract (vortex-contract)
  • Backend (vortex-backend)
  • Frontend (vortex-frontend)

Checklist

  • My code follows the project's style and conventions
  • I ran lint / type-check / build locally and they pass
  • I added or updated tests where appropriate
  • I updated documentation where appropriate
  • My commits follow Conventional Commits

Screenshots / notes

CLOSES
closes #371
closes #372
closes #373
closes #374

Resolves stellar-vortex-protocol#153, stellar-vortex-protocol#371, stellar-vortex-protocol#373, stellar-vortex-protocol#374.

## Issue stellar-vortex-protocol#153 — Bucketed UserIntents
- Replace single UserIntents(Address) Vec with fixed-size buckets of 64
  intent IDs: UserIntents(Address, u32) + UserIntentCount(Address).
- list_intents_by_user(user, start, limit) is now paginated; pruned slots
  (None) are skipped. Backward-compatible list_intents_by_user_legacy kept.
- submit_intent writes via user_intents_append(); bump_user_intents_ttl()
  keeps the active bucket live.

## Issue stellar-vortex-protocol#373 — Paged persistent SolverList + AllowedDstTokenList
- Move both lists from instance storage (O(n) per-call deserialisation) to
  paged persistent storage: SolverListPage(u32) / SolverListCount /
  SolverListIdx(Address) and matching DstTokenList* variants.
- add_to_solver_list / remove_from_solver_list and
  add_to_dst_token_list / remove_from_dst_token_list are now O(1)
  via append + index map (swap-remove on delete).
- list_solvers and list_allowed_dst_tokens updated to walk pages.
- Ordering is not insertion order after any swap-remove; documented.

## Issue stellar-vortex-protocol#374 — O(1) SolverIntents via index map
- Add SolverIntentIdx(Address, BytesN<32>) -> u32 alongside SolverIntents.
- solver_intents_add: O(1) push + index write; duplicate-add is a no-op.
- solver_intents_remove: O(1) swap-remove + index update.
- get_solver_intents(solver, start, limit) is now paginated.
- Invariant: len(SolverIntents(solver)) == solver_record.active_intents.

## Issue stellar-vortex-protocol#371 — Permissionless close_intent + tombstone
- Add terminal_at: Option<u64> field to IntentRecord; set on every
  terminal transition (Filled, Cancelled, Expired, Resolved).
- close_intent(intent_id): permissionless; callable by anyone after
  terminal_at + retention_secs <= now (default 30 days).
  Deletes: Intent, IntentFillHistory, ExtensionGranted, BestBid,
  BackstopClaimed, UserIntents bucket slot, SolverIntents entry.
  Leaves IntentTombstone so IntentAlreadyExists still fires on id reuse.
- set_intent_retention(secs) / get_intent_retention() for admin config.
- New errors: IntentNotTerminal (36), RetentionPeriodNotElapsed (37).
- Updated docs/145-ttl-bump-frequency-review.md §5.

## Housekeeping
- Deduplicate accumulated duplicate constant definitions (leftover merges).
- Update .gitignore: add *.snap, *.snap.new, coverage artifacts,
  criterion output, and other unnecessary files.
@drips-wave

drips-wave Bot commented Sep 29, 2026

Copy link
Copy Markdown

@villadel Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

…ge-bounded-lists-pruning

# Conflicts:
#	.gitignore
#	intent_settlement/src/lib.rs
@james2177
james2177 merged commit 3f469c3 into stellar-vortex-protocol:main Sep 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

2 participants