Skip to content

feat: filter out intent based swaps from quote status manager - #10171

Merged
GeorgeGkas merged 5 commits into
mainfrom
swaps-filter-out-intent
Sep 11, 2026
Merged

feat: filter out intent based swaps from quote status manager#10171
GeorgeGkas merged 5 commits into
mainfrom
swaps-filter-out-intent

Conversation

@GeorgeGkas

@GeorgeGkas GeorgeGkas commented Sep 10, 2026

Copy link
Copy Markdown
Contributor

Explanation

The quote status manager currently reports SUBMITTED and finalized statuses for every swap/bridge in txHistory, including intent-based orders (quotes that carry quote.intent, e.g. CoW). That is incorrect: the bridge backend already watches intent settlement and owns those statuses. Client-side reports can race with, or overwrite, backend-owned quote status.

This change keeps the client from creating or updating quote-status tracking for intent orders:

  • Adds #isIntentHistoryItem and uses quote.intent as the signal that an order is backend-tracked.
  • Skips reportSubmittedOnce / reportFinalised on transaction submitted, confirmed, and failed handlers.
  • Skips startup seeding of quoteUpdateStatusStore for intent history items.
  • Stops reporting a source/settlement hash while intent polling is in progress, and does not report a terminal quote status when the order completes or expires.

The public controller API is unchanged. Only quote-status reporting behavior changes, and only for intent history items.

A related, less obvious cleanup: the old “report submitted on confirm because the hash arrived in the same update” path was written for EVM intent swaps. That path is now used for non-intent smart/batch swaps (hash often appears only at confirm), and is no longer used for intents.

Only @metamask/bridge-status-controller is updated. No other packages or dependency upgrades.

References

https://consensyssoftware.atlassian.net/browse/SWAPS-5052

Checklist

  • I've updated the test suite for new or updated code as appropriate
  • I've updated documentation (JSDoc, Markdown, etc.) for new or updated code as appropriate
  • I've communicated my changes to consumers by updating changelogs for packages I've changed
  • I've introduced breaking changes in this PR and have prepared draft pull requests for clients and consumer packages to resolve them

Checklist notes for reviewers

  • Tests cover: no quote-status store entry on intent tx submitted/confirmed/failed; no startup seed for intent history; no report when intent polling reaches COMPLETED or EXPIRED.
  • JSDoc was added on #isIntentHistoryItem and on #reportSubmittedOnce.
  • Changelog entry: No longer report SUBMITTED or finalized quote statuses to the quote status API for intent-based swaps, since the bridge backend observes intent settlement and owns those statuses (add the PR link after open).
  • Not a breaking public API change; clients do not need companion PRs for types or method signatures.

Note

Medium Risk
Changes when swap quote statuses are reported to the backend for intent orders only; wrong gating could leave non-intent swaps untracked or still double-report intents, but scope is narrow and well tested.

Overview
Intent-based swaps (history items with quote.intent, e.g. CoW) no longer send SUBMITTED or finalized updates to the quote status API. The bridge backend already tracks intent settlement, and client reports could race or overwrite that state.

The controller adds #isIntentHistoryItem and gates #reportSubmittedOnce / #quoteStatusManager.reportFinalised on transaction failure, confirmation, intent polling at terminal status, and stale-history cleanup. Intent polling no longer calls #reportSubmittedOnce when a settlement hash appears mid-poll.

The “report submitted on confirm when the hash arrives in the same update” path is retained for non-intent smart/batch swaps (hash often only known at confirm), not for intents. Startup backfill still runs through #reportSubmittedOnce, so intent history is not seeded into quoteUpdateStatusStore. Public API is unchanged; tests and a changelog entry cover the new behavior.

Reviewed by Cursor Bugbot for commit 4fbf918. Bugbot is set up for automated code reviews on this repo. Configure here.

@GeorgeGkas
GeorgeGkas requested review from a team as code owners September 10, 2026 16:13
@GeorgeGkas
GeorgeGkas added this pull request to the merge queue Sep 11, 2026
Merged via the queue into main with commit 7733b77 Sep 11, 2026
43 checks passed
@GeorgeGkas
GeorgeGkas deleted the swaps-filter-out-intent branch September 11, 2026 12:55
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