[indexer]: index the gateway's OrderCancelled event - #1185
Draft
Wizdave97 wants to merge 1 commit into
Draft
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.
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.
09888bd1addedOrderCancelled(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/EscrowRefundedwith their token arrays,DeploymentAdded,DestinationProtocolFeeUpdated), so cancellation was the whole gap.Adds a
CANCELLEDstatus, anIOrderV3Cancellationentity, a handler, and the datasource wiring.cancelleris stored separately from the order'suserbecause the destination-side cancel route is permissionless once the order has expired, so the two are not the same account in general.recordOrderCancellationadvances the status only fromPLACED.OrderCancelledmarks the initiation of a cancellation, not its completion —EscrowRefundedstays terminal and still ownsREFUNDED. SinceupdateOrderStatusassigns 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 toCANCELLED. Guarding onPLACEDmakes 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
CANCELLEDis 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.