[indexer]: index the gateway's OrderCancelled event - #1185
Open
Wizdave97 wants to merge 3 commits into
Open
Conversation
`09888bd1` added `OrderCancelled(bytes32 indexed commitment, address canceller)` to IntentGatewayV2. It was the only contract event with no counterpart here — the ABI already carried the other reshaped events from this cycle (`OrderFilled`/`PartialFill`/ `EscrowReleased`/`EscrowRefunded` with their token arrays, `DeploymentAdded`, `DestinationProtocolFeeUpdated`), so cancellation was the whole gap. Adds a `CANCELLED` status, an `IOrderV3Cancellation` entity, a handler, and the datasource wiring. `canceller` is stored separately from the order's `user` because the destination-side cancel route is permissionless once the order has expired, so the two are not the same account in general. `recordOrderCancellation` advances the status only from `PLACED`. `OrderCancelled` marks the initiation of a cancellation, not its completion — `EscrowRefunded` stays terminal and still owns `REFUNDED`. Since `updateOrderStatus` assigns without comparing against the current value, and a cross-chain cancel is initiated on the destination chain while its refund lands on the source chain via a separate datasource with no ordering guarantee between them, an unguarded write would let a late-indexed cancellation move a settled order back to `CANCELLED`. Guarding on `PLACED` makes it idempotent and order-independent. The guard is local to the new method rather than a general never-regress rule in `updateOrderStatus`: the broader change would alter every existing transition on a path with no ordering test coverage, and deserves its own justification. An order resting at `CANCELLED` is an expected steady state, not an indexing gap — the source-side route re-emits on every call and only refunds when the GET response returns.
royvardhan
marked this pull request as ready for review
September 12, 2026 08:25
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Indexes Intent Gateway
OrderCancelled(bytes32 indexed commitment, address canceller)events and exposes cancellation initiation through the order's cancellation relation and status metadata. Cancellation never writesIOrderV3.status: a locally guarded full-row save can still overwrite a refund committed by an independent chain indexer with a different cached snapshot.Behavior
IOrderV3Cancellation, theIOrderV3.cancellationsrelation, datasource wiring, and the event handler. Event records retain the initiating chain, caller, timestamp, block number, and transaction hash. The caller can differ from the order creator on the permissionless destination route.CANCELLEDafter existing enum values so the schema migration remains additive. The current gateway ABI already contains the event; it retains exactly one matching declaration.CANCELLEDstatus metadata for existing orders, including already-settled orders. Missing parents use the established pending-metadata workflow. Cancellation alone leaves the parent status unchanged; parent filters forCANCELLEDwill not identify cancellation initiation.EscrowRefundedas theREFUNDEDtransition. Existing lifecycle writers, pending-status flushing, and their accounting side effects remain unchanged.OrderStatus.CANCELLED. The status stream keeps polling after cancellation, gives existing terminal metadata precedence over a later cancellation entry, and avoids repeated emission of the same status.Validation
REFUNDEDin both cache flush orders, and checks the missing-parent path with multichain timestamp history. Reproduction commands are in the metadata-only decision document.ENV=mainnet npm run build:releaseand SDK browser/node/type builds pass.IntentGatewayV2ABI.Known pre-existing SDK limitation
The order query requests
orders, while its parser readsorderPlaceds; that legacy query shape also differs fromIOrderV3. The focused stream tests supply the parser's expected response and do not establish live GraphQL compatibility. Migrating that query is separate from this cancellation persistence fix.