feat(ComposableCoW): getOrderInfo combined accessor#6
Draft
brunota20 wants to merge 1 commit into
Draft
Conversation
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".
f83245d to
3da7c37
Compare
3da7c37 to
9c78641
Compare
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.
What
Adds a single-call view function combining the four pieces of per-watch metadata a watch tower normally fetches:
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, thensingleOrders,cabinet,swapGuards) — or 4 if it doesn't replicate the hash logic locally. WithgetOrderInfo, 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_fieldstest_getOrderInfo_for_unauthorized_owner_returns_inert_defaultstest_getOrderInfo_with_swap_guard_set_returns_guard_addressFull suite: 77/77 pass (74 pre-existing + 3 new), excluding the pre-existing
_invariantandtest_simulate_fuzzOOG flake.Closes
Addresses the "optimised getter functions".