venue: reconcile-contract compliance suite - #584
Merged
Conversation
This was referenced Jul 24, 2026
mfw78
added a commit
that referenced
this pull request
Jul 27, 2026
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
Add the venue reconcile contract that the durable-effect sweep will lean on. A sealed marker trait
VenueReconcileinvidere-sdkstates the per-adapter obligation, a sharedvenue_reconcile_compliance!macro invidere-testproves it, and the CoW adapter instantiates it.The contract has a mandatory floor and an optional fast-path. Floor:
submit(body)for a body the venue already holds resolves toSubmitOutcome::Acceptedwith the same receipt, and a held body never surfaces as a terminalVenueFault. Fast-path: an adapter may expose a body-derivable receipt so a reconcile canstatus(receipt)first and commit without a redundant POST.Reconcile trusts venue-side order validity: it does not re-poll the watch source, so the contract requires adapters to carry self-describing order validity (for CoW,
validToand the limit price).Why
Exactly-once across the external submit is impossible from the SDK alone. The residual is closed only by the venue recognising a re-sent order as the same order. CoW already discharges this implicitly by folding an orderbook duplicate to
AlreadyHeldthenAcceptedwith the client-derived UID. This generalises that into an explicit, tested contract every adapter must satisfy before a reserve-writing sweep can drive it.Testing
Pure trait, macro, test and doc over existing behaviour; no runtime behaviour change.
cargo fmt --all -- --check,cargo clippy --workspace --all-targets --all-features --locked -D warnings, all 17 guest wasms,cargo nextest run --workspace --all-features --locked(the CoW compliance suite passes: re-POST idempotency on both auth paths, held-never-faults, 404-retryable),cargo test --doc,RUSTDOCFLAGS=-D warnings cargo doc --workspace --no-deps --locked,scripts/check-venue-agnostic.sh,scripts/check-cow-orderbook-only.sh.AI Assistance
Implemented with Claude Code.
Closes #574