Skip to main content

What Happened

The pinned order-agent source exposes collateral transfer and order-value accounting as separate operations. sendValueInCollateral can remove held assets, while an order’s reported value depends on its stored order fields. The policy question is whether collateral credited to borrowing still represents assets recoverable from the order. Pinned GmxV2CauldronOrderAgent source.

Attack Mechanism

The order system separated token transfers from order-value accounting. sendValueInCollateral could move assets out while order fields such as input amounts and minimum outputs still contributed to orderValueInCollateral. The attack pattern was to borrow against an order’s reported value, extract assets through liquidation, and then borrow again while the order still reported collateral that was no longer recoverable. Reusing the stale value turned one economic position into repeated borrowing capacity. For a simple example, an order initially reports 1,000 collateral units and has 1,000 recoverable units. After sending out 500, reporting 1,000 is inconsistent with the 500 remaining. Recomputing solvency with the same stale reported value will not expose that mismatch. The assertion checks reported value against an independent recoverable-value calculation after each covered transfer. Its reader returns (reportedValue, recoverableValue) in the same collateral units. The reader must include the actual short-token, long-token, market-token and pending-order paths for the target revision. Comparing only one held token with the full order value does not establish that invariant.

Assertion Example

What This Check Covers

The independent reader is a required protocol-specific adapter, not an existing RouterOrder getter. It must use correct price direction, decimal scales, and pending-order semantics without reusing the stale order fields as evidence of backing. Register and test every operation that consumes or credits that value, including order completion and cancellation.