cow-venue: replace OrderBuilder typestate with constructor args - #581
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
Replaces the
OrderBuilder<S>typestate incow-venue/src/order.rswith required constructor arguments.OrderBody::sell/OrderBody::buynow take the sell side, buy side, andvalid_todirectly. ThePhantomData<S>state parameter, theNeedsBuy/NeedsSell/NeedsValidTo/Readymarkers, and their per-state impl blocks are gone. Optional fields keep post-construction setters.Why
Issue #545: the typestate enforced only "do not forget a required field", a weaker claim than call-order machinery is meant to express. Required constructor args preserve the same compile-time completeness guarantee with no phantom states, no per-state impl blocks, and no duplicated method surface.
Testing
Full battery in the worktree:
cargo fmt --all -- --check;cargo clippy --workspace --all-targets --all-features --locked -- -D warnings; wasm build for the 16 example/venue modules plus a separatecow-venue/adapter build, wasm count verified at 17;cargo nextest run --workspace --all-features --no-fail-fast --locked(795 passed, 1 skipped);cargo test --doc --workspace --all-features --locked;RUSTDOCFLAGS="-D warnings" cargo doc --workspace --no-deps --locked;scripts/check-venue-agnostic.sh;scripts/check-cow-orderbook-only.sh. All green.AI Assistance
Implemented with Claude Code.
Closes #545