The relevant flow for matchOrders / fulfillAvailableAdvancedOrders is:
_validateOrdersAndPrepareToFulfill()
│
├─ _validateOrder()
├─ derive partial-fill amounts
├─ apply criteria
├─ authorize restricted orders
├─ update order status
│
▼
_executeAvailableFulfillments()
│
├─ _aggregateAvailable()
│ └─ FulfillmentApplier
│
▼
_performFinalChecksAndExecuteOrders()
│
├─ execute aggregated transfers
├─ restore / refund unspent offer amounts
├─ require consideration remainder == 0
└─ validate/ratify restricted/contract orders
The critical ordering is confirmed by the 1.6 reference implementation: authorization is performed before _updateStatus, while transfers and the post-hook happen later. The public documentation also confirms that authorizeOrder() is stateful and that a failed authorization can cause fulfillAvailableAdvancedOrders to skip an order.
The relevant flow for matchOrders / fulfillAvailableAdvancedOrders is:
_validateOrdersAndPrepareToFulfill()
│
├─ _validateOrder()
├─ derive partial-fill amounts
├─ apply criteria
├─ authorize restricted orders
├─ update order status
│
▼
_executeAvailableFulfillments()
│
├─ _aggregateAvailable()
│ └─ FulfillmentApplier
│
▼
_performFinalChecksAndExecuteOrders()
│
├─ execute aggregated transfers
├─ restore / refund unspent offer amounts
├─ require consideration remainder == 0
└─ validate/ratify restricted/contract orders
The critical ordering is confirmed by the 1.6 reference implementation: authorization is performed before _updateStatus, while transfers and the post-hook happen later. The public documentation also confirms that authorizeOrder() is stateful and that a failed authorization can cause fulfillAvailableAdvancedOrders to skip an order.