Skip to content

sdk+twap: treat DuplicatedOrder as already-submitted; add errorType→retry classification #121

Description

@ribeirojose

Problem

`classify_api_error` maps every non-retriable orderbook errorType - including `DuplicatedOrder` - to `RetryAction::Drop` (`crates/shepherd-sdk/src/cow/error.rs:90-107`), and Drop deletes the whole watch + gates (`modules/twap-monitor/src/strategy.rs:497-507`). For a TWAP, a "you already submitted this" response kills all future tranches.

Fix

  • Classify `DuplicatedOrder` as already-submitted: write `submitted:{uid}`, keep the watch.
  • Pin both spellings: the SDK test uses `DuplicateOrder` (`error.rs:142`) but the orderbook's real errorType is `DuplicatedOrder`.
  • While here: add the errorType→retry classification map that ADR-0007 promised to upstream to cow-rs as `retry_hint()` - cowprotocol 0.1.0 has no typed variants or retry classification (verified against cowdao-grants/cow-rs @ v0.1.0), so build it locally on top of `Error::OrderbookApi { status, error_type }`.

Depends on #48 landing first (same file). Grant-relevant: M2 "no duplicate order posts / handles failed submissions".

Metadata

Metadata

Assignees

Labels

bugSomething isn't working.component/cow-integrationshepherd:cow / cow-api order submissioncomponent/modulesshipped guest modules (twap, ethflow, examples, fixtures)component/sdknexum-sdk / shepherd-sdk, proc macros, cargo-nexumpr-trainPart of the current stacked PR train; lands in sequence, do not merge out of order.

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions