Skip to content

settlement: fill overlay strands the remainder of a partiallyFillable order #10

Description

@mfw78

Problem

The poll overlay stops re-posting a partiallyFillable order after its first partial fill, stranding the unfilled remainder that is still tradeable. It also tracks fill only per orderUid, so it cannot follow a bounded-total intent whose discrete orders vary across polls.

Current

getTradeableOrderWithSignature (src/ComposableCoW.sol L167-185): once _getFilledAmount > 0, the result is rewritten to PARTIALLY_FILLED (or FILLED) with an empty signature and returned. Per docs/architecture.md PARTIALLY_FILLED means "no action; informational only". For a partiallyFillable order that is only partly filled, the remainder is still executable, but the empty signature stops the watch-tower re-posting it. The overlay inspects only the current orderUid, so an intent whose acceptable price (and therefore orderUid) moves each poll cannot be tracked as a single bounded total.

Proposed

For a partiallyFillable order with 0 < filledAmount < totalAmount, return a valid signature for the remainder rather than an empty one, and treat fill status as orthogonal to the poll verdict rather than overwriting the code. Reconsider the per-orderUid overlay for bounded-total intents (a stable ctx-keyed accumulator is the natural model).

Scope

src/ComposableCoW.sol L167-185 and tests. Behaviour change on the polling path only; no settlement-path change.

Notes

Strongest partial-fill correctness gap. Ties to the PollResultCode split and the single-shot / bounded-intent design work. Surfaced by the bounded-total accumulator analysis on PR #1.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething behaves incorrectly against its speccomponent/settlementCoW Protocol settlement integration, swap guards, ERC-1271 signature verificationp1-brokenActually broken. Fix this week.

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions