Skip to content

feat(ComposableCoW): getOrderInfo combined accessor#6

Draft
brunota20 wants to merge 1 commit into
mainfrom
feat/order-info-combined-accessor
Draft

feat(ComposableCoW): getOrderInfo combined accessor#6
brunota20 wants to merge 1 commit into
mainfrom
feat/order-info-combined-accessor

Conversation

@brunota20

@brunota20 brunota20 commented Jun 24, 2026

Copy link
Copy Markdown

What

Adds a single-call view function combining the four pieces of per-watch metadata a watch tower normally fetches:

struct OrderInfo {
    bytes32 hash;          // H(params)
    bool authorized;       // singleOrders[owner][hash]
    bytes32 cabinetValue;  // cabinet[owner][hash]
    ISwapGuard swapGuard;  // swapGuards[owner]
}

function getOrderInfo(address owner, IConditionalOrder.ConditionalOrderParams calldata params)
    external
    view
    returns (OrderInfo memory info);

Returns inert defaults for fields that don't apply (e.g. authorized == false, cabinetValue == bytes32(0), swapGuard == ISwapGuard(address(0))). No revert path.

Why

A watch tower's per-watch pre-check today requires 3 separate eth_calls (compute hash off-chain, then singleOrders, cabinet, swapGuards) — or 4 if it doesn't replicate the hash logic locally. With getOrderInfo, it is one RPC call.

For an indexer doing reconciliation across N watches, this trims the per-watch round-trip count by 3-4x.

Backward compatibility

Pure addition. No existing function, event, or public symbol changed. Selectors of existing functions remain identical. view-only, no state mutation.

Tests

3 new tests in ComposableCoW.t.sol:

  • test_getOrderInfo_after_create_returns_all_fields
  • test_getOrderInfo_for_unauthorized_owner_returns_inert_defaults
  • test_getOrderInfo_with_swap_guard_set_returns_guard_address

Full suite: 77/77 pass (74 pre-existing + 3 new), excluding the pre-existing _invariant and test_simulate_fuzz OOG flake.

Closes

Addresses the "optimised getter functions".

Adds a single-call view function that returns the metadata a watch tower
needs per watch: the params hash, the single-order authorisation flag,
the cabinet value, and the owner's swap guard.

```solidity
struct OrderInfo {
    bytes32 hash;
    bool authorized;
    bytes32 cabinetValue;
    ISwapGuard swapGuard;
}

function getOrderInfo(address owner, IConditionalOrder.ConditionalOrderParams calldata params)
    external view returns (OrderInfo memory info);
```

Combines what would otherwise be 3-4 separate `eth_call`s (`hash()`,
`singleOrders`, `cabinet`, `swapGuards`) into one round trip. Returns
inert defaults for fields that don't apply to the given owner / params
combination — no revert path.

Pure addition. No existing function/event/symbol changed.

Addresses M2 grant deliverable "optimised getter functions".
@brunota20 brunota20 force-pushed the feat/order-info-combined-accessor branch from f83245d to 3da7c37 Compare June 25, 2026 12:19
@brunota20 brunota20 changed the title feat(ComposableCoW): getOrderInfo combined accessor (M2) feat(ComposableCoW): getOrderInfo combined accessor Jun 25, 2026
@brunota20 brunota20 force-pushed the feat/order-info-combined-accessor branch from 3da7c37 to 9c78641 Compare June 25, 2026 17:58
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.

1 participant