Open
Conversation
- Fix fundamental schema incompatibility with current CoW infrastructure - Update models to use snake_case with Pydantic aliases for camelCase JSON - Replace legacy BatchAuction with CowAuction matching solvers_dto - Add proper field aliases (sellToken -> sell_token, etc.) - Remove incompatible legacy models and utilities - Update server endpoint to use new schema structure - Organize template structure with examples and reference materials Resolves schema validation errors (422) when receiving auctions from driver. Template now works seamlessly with current CoW Protocol infrastructure.
- Add typer for CLI support - Add prometheus-client for metrics - Update version constraints for better compatibility - Organize dependencies by category (core, dev, optional)
- Add multi-engine solver architecture with baseline and mysolver engines - Implement FastAPI application with health, metrics, and solve endpoints - Add comprehensive model definitions for auction, order, liquidity, and solution - Include utility modules for serialization, math operations, and byte conversion - Add CLI interface with typer for running the solver server - Implement dependency injection and settings management - Add comprehensive test suite for API, models, and multi-engine functionality - Include logging and metrics infrastructure with Prometheus support
- Replace custom FastAPI implementation with python_baseline.api.app - Remove duplicate endpoint definitions and middleware setup - Simplify server configuration by delegating to main solver application - Maintain backward compatibility for existing server startup process
- Add comprehensive documentation for new multi-engine architecture - Include examples for baseline, mysolver, and default engine endpoints - Update health check endpoint from /health to /healthz - Add Prometheus metrics endpoint documentation - Update driver configuration examples with new port (11088) - Add autopilot configuration examples for different solver engines - Maintain backward compatibility documentation for legacy server
- Move python_baseline/ to src/ with clean structure - Separate API routers (baseline, mysolver) - Move models to domain/ - Update all imports from python_baseline.* to src.* - Remove legacy files and duplicates - Improve project organization and maintainability
- Add Web3 and blockchain dependencies (web3, eth-typing, eth-utils, eth-abi, hexbytes) - Add optimization libraries (networkx for pathfinding, scipy for math) - Implement baseline solver engine with two-phase approach: * CoW (Coincidence of Wants) matching for direct order settlement * AMM routing through liquidity pools using NetworkX pathfinding - Add comprehensive AMM math utilities for Uniswap V2, Balancer, and Curve pools - Create solution builder for transaction construction and settlement - Add partial fill optimization framework and gas estimation utilities - Add comprehensive test coverage for baseline engine - Remove obsolete test files and update domain models - Fix pydantic field_validator imports and type annotations
- Simplify domain models by removing custom U256/Address types - Migrate to Pydantic v2 field validators - Add centralized fee conversion utilities - Update solver configurations with Python and baseline endpoints - Expand base token list with popular tokens (WETH, DAI, USDC, USDT, etc.) - Add Uniswap V2 configuration support - Integrate Web3 for robust Ethereum address validation - Remove deprecated utility modules (hexbytes, u256) - Update interaction encoding to use HexBytes - Improve type safety with proper address validation
…ver-on-python-template Add Python Baseline Solver & Multi-Engine Architecture
…ests Update README and create QUICKSTART doc
|
Review the following changes in direct dependencies. Learn more about Socket for GitHub.
|
Author
|
I have read the CLA Document and I hereby sign the CLA |
…eline - solution: Trade as fulfillment (kind, order, executedAmount), camelCase aliases and field_serializer for callData; Interaction/Allowance/Asset; JitTrade, LiquidityInteraction, Solution alias and populate_by_name - api: return JSONResponse with model_dump(by_alias=True) for correct serialization; simplify notify handler - engine: pass orders dict to PriceFinder; Trade creation with fulfillment format; matched_uids from trade.order - cow_matcher: build Trade with kind/order/executed_amount - price_finder: accept orders dict, resolve sell/buy token and amounts from Order for price graph; TYPE_CHECKING for Order - path_finder: liquidity kind constantProduct/weightedProduct (lowercase) - solution_builder: drop per-trade price backfill; validate order UID and executed_amount instead of sell/buy token prices - domain: Order.fee_amount (optional); auction/solution model_config and aliases - data: large_example.json numeric and trailing newline fixes
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.
Overview
This PR introduces the baseline solver implementation in Python, ported from the Rust version, and refactors the template into a multi-engine architecture.
The goal is to provide Python developers with:
mysolver/solveendpoint as a clean starting point for new solver implementations,Key Changes
🆕 New Features
Baseline Solver Engine
BaselineEngine(/baseline/solve) implementing a contract-correct, minimal solver.Multi-Engine System
SolverEnginebase class for pluggable engines.mysolver/solveendpoint (stubbed for user implementations).New Domain & Utility Modules
auction,order,solution,liquidity,common.Infrastructure Improvements
🔄 Refactors & Migrations
/baseline,/mysolver).src/modelsandsrc/utilreplaced with domain + utils modules.🗑️ Deletions
Motivation
Next Steps