Skip to content

sdk: extract the venue-generic strategy chassis #135

Description

@mfw78

Problem. twap-monitor and ethflow-watcher share one execution substrate: a watch:{owner}:{hash} registry, next_block:/next_epoch: gate keys, submitted:/observed: idempotency markers, and retry dispatch. Doc 09 step 2 (PR #132) names the venue-neutral half. twap exercises the whole machine; ethflow reuses only the observed: journal.

Scope. Land the venue-generic machinery as host-trait-generic Rust (ADR-0009: no wit-bindgen types in the keeper API): the stores (watch-set, gates, journal), Tick, the Retrier plus RetryAction mechanism, the ConditionalSource verdict seam, and the single-venue keeper loop (list, gate, poll, dispatch). The ConditionalSource reads a structured verdict plus scheduling hints (a code, an order when postable, nextPollTimestamp/waitUntil); it does not decode reverts or compute schedules itself. The Gates store honours contract-supplied schedule slots (next_block:/next_epoch: hold waitUntil/nextPollTimestamp, sentinels 0 = poll at validTo+1, max = stop), not off-chain epoch math. Rewire both flagship modules onto it; the existing MockHost tests pass unchanged as the behaviour-identity proof. Bind the keeper's submit foot to the IntentPool mirror of nexum:intent/pool (ADR-0009 field-for-field mirror types), not to CowApiHost::submit_order, so #138's pool re-point is a binding swap.

Non-ownership. The ComposableCoW machinery is #138's, not the keeper's: the poll wire, the submit handler, order_uid_hex, the appData wire. The errorType-to-action classification is the CoW ORDERBOOK-API submit-error concern (a REST POST response), orthogonal to the poll and owned by #138/#236. #135 lands the retrier mechanism only. The typed intent client core is #137's nexum-venue-sdk (#230).

Sub-issues. Native sub-issues below.

Notes. #133 lands before the twap port so the keeper never encodes the redundant appData GET. Target: the keeper drives the nullisLabs composable-cow structured, non-reverting poll (a GeneratorResultCode verdict plus contract scheduling hints); off-chain revert-decode and epoch math dissolve. Until the fork deploys on a shepherd chain, the verdict seam is fed by a quarantined LegacyRevertAdapter over the deployed 1.x reverting poll (see #138 waves and the superseding ADR). Generalising the keeper to Keeper<Source, Venue> waits until a second venue exists (Doc-09 shorthand, not a GitHub milestone). No new WIT is needed.


Next-train plan

Current state. Implemented and in review as the bottom of the live M1 train (PRs #237 through #241, #237 the base on develop). The venue-neutral keeper lives in crates/nexum-sdk/src/keeper.rs; the CoW binding in crates/shepherd-sdk/src/cow/. Outstanding keeper work: rework #239's ConditionalSource::Outcome from the 5-variant PollOutcome to a structured Verdict mirroring the contract's GeneratorResultCode plus hints (Rust-only, no contract dependency); rebind the submit foot to IntentPool.

Children (ordered):

Blocks: #136, #138. Gated by: #133.

Metadata

Metadata

Assignees

No one assigned

    Labels

    component/sdknexum-sdk / shepherd-sdk, proc macros, cargo-nexumepicTracks a larger initiative.pr-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