Skip to content

chaining: validate requests and paths before network calls#372

Open
lucasrosa90 wants to merge 6 commits into
mainfrom
feature/chaining-validate-prepass
Open

chaining: validate requests and paths before network calls#372
lucasrosa90 wants to merge 6 commits into
mainfrom
feature/chaining-validate-prepass

Conversation

@lucasrosa90

Copy link
Copy Markdown
Contributor

Hoists the request and path-shape validations in AnchorChainingPlan.#computePlan into two pure helpers (validateRequest, validatePathStructure) that run before any network call, so structurally/request-invalid plans fail fast instead of after wasted provider round-trips (e.g. an affinity:'to' + asset-movement path no longer issues a persistent-forwarding lookup before being rejected).

Changes

  • validateRequest derives amount/affinity and rejects bad value combinations.
  • validatePathStructure enforces the static path rules (affinity/asset-movement, PFR must-be-last/recipient, keetaSend constraints) up front.
  • Removed the now-redundant pure inline throws; kept the guards that also narrow types or build results.

Compatibility: non-breaking. Validators run inside #computePlan, so per-path failure surfacing (getPlans Promise.allSettled / includeAllOutput) and direct AnchorChainingPlan.create(...).rejects behavior are unchanged; all error messages are preserved verbatim.

@lucasrosa90 lucasrosa90 self-assigned this Jun 18, 2026
@lucasrosa90 lucasrosa90 requested review from ezraripps and sephynox and removed request for ezraripps June 18, 2026 20:49

This comment was marked as resolved.

lucasrosa90 and others added 3 commits June 19, 2026 16:02
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
…etwork/anchor into feature/chaining-validate-prepass
@sonarqubecloud

Copy link
Copy Markdown

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants