Skip to content

interfaces: split PollResultCode into generator verdict and orthogonal fill overlay #16

Description

@mfw78

Problem

PollResultCode conflates the generator's verdict (should a discrete order be posted?) with observed fill state (PARTIALLY_FILLED / FILLED). The two fill variants can never be returned by any handler's poll(); they are synthesised only by ComposableCoW after poll() returns SUCCESS. The conflation also forces a false choice between "postable" and "partially filled", which is the root of the partiallyFillable stranding bug.

Current

src/interfaces/IConditionalOrder.sol L71-90 defines a seven-variant PollResultCode and a PollResult carrying filledAmount. BaseConditionalOrder.poll (L37-57) and all five order types only ever emit SUCCESS / WAIT_TIMESTAMP / WAIT_BLOCK / TRY_NEXT_BLOCK / INVALID; PARTIALLY_FILLED / FILLED and a non-zero filledAmount are produced only in ComposableCoW.getTradeableOrderWithSignature (L167-185). checkOrder likewise declares a return space it cannot produce.

Proposed

Split into a handler-facing verdict enum, for example GeneratorResultCode { POST, WAIT_TIMESTAMP, WAIT_BLOCK, TRY_NEXT_BLOCK, INVALID } returned by poll(), and an orthogonal fill overlay (for example FillStatus { NONE, PARTIALLY_FILLED, FILLED } plus filledAmount) composed into the public PollResult by ComposableCoW. Handlers lose the unreachable variants and the dead filledAmount field; fill state gains a place that can coexist with a POST verdict, which is what lets a partially filled partiallyFillable order keep being posted.

Scope

src/interfaces/IConditionalOrder.sol, src/BaseConditionalOrder.sol, src/ComposableCoW.sol, the checkOrder return type, tests, and docs. All five order types are unchanged (they never used the fill half). An ABI change, folded into the already-breaking PR.

Notes

Design decision from PR #1 review, and the frame for the partiallyFillable stranding fix. Handlers being unaffected is evidence the fill half was never load-bearing for them.

Metadata

Metadata

Assignees

No one assigned

    Labels

    component/interfacesPublic interfaces: IConditionalOrder, ISwapGuard, IValueFactory, IOrderManifest, aggregatorscomponent/pollingpoll / getTradeableOrderWithSignature watchtower path and revert-signal validationdesignRequires an interface or architecture decision before code

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions