Skip to content

[High] Destination Account and Trustline Preflight for Stellar Deliveries #439

Description

@james2177

Description:
Before an intent is accepted into the open book, verify the Stellar destination account exists and holds a trustline (with sufficient limit) for the destination asset, and surface actionable errors.

Problem Statement & Context:
If the user's Stellar account doesn't exist or lacks a trustline for the destination classic asset, the solver's fill fails on-chain, wasting solver funds/time and potentially triggering unfair slashing.

Scope & Acceptance Criteria:

  • Horizon/RPC check for account existence, trustline presence, authorisation flags, and remaining limit ≥ minDstAmount.
  • SAC/contract tokens handled via balance-entry checks where applicable.
  • Error codes: DST_ACCOUNT_NOT_FOUND, DST_TRUSTLINE_MISSING, DST_TRUSTLINE_LIMIT, DST_NOT_AUTHORIZED.
  • Re-check at accept time; if the trustline was removed, accept is rejected and user notified.
  • Out of scope: sponsoring account creation.

Implementation Guidelines:

  1. Key Files/Modules: new src/soroban/destination-preflight.service.ts, src/intents/intents.controller.ts, src/soroban/soroban.service.ts.
  2. Design/Architecture: Short-TTL cache per (account, asset) to limit Horizon load.
  3. Edge Cases/Constraints: Muxed accounts (M…); native XLM needs no trustline.
  4. Testing: Tests for each error code; e2e with mocked Horizon responses.

Definition of "Done": Common DoD.

Resources:


Common Definition of "Done" (applies in addition to the criteria above):

  • Code written, tested, and documented (TSDoc on public APIs, README/runbook/ADR updates where behaviour changes).
  • All acceptance criteria met; npm run lint, npm run typecheck, npm test, npm run test:e2e pass in CI.
  • PR follows .github/PULL_REQUEST_TEMPLATE, uses a Conventional Commit title (enforced by commitlint), includes test output / metrics screenshots, and references the issue.
  • New env vars are added to .env.example variants and src/config/env.validation.ts (the check:env-drift script must pass).
  • Reviewed and approved by at least one CODEOWNER.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

Stellar WaveIssues in the Stellar wave program

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions