Skip to content

Conversation

@jmg-duarte
Copy link
Contributor

@jmg-duarte jmg-duarte commented Nov 25, 2025

Non-trivial part: https://github.com/cowprotocol/services/pull/3921/files#diff-3f8b6079ce50ae3ab0fe449d91c7e68922cae4023902961c892b58f91ddc49b3L148-L155

The rest is trivial

Description

This PR continues the migration from the ethcontract library to the alloy library by replacing primitive_types (H160, U256) with alloy::primitives (Address, U256) across quote handling, order validation, solver competitions, DTOs, and database operations. This migration modernizes the codebase to use alloy's type system, which provides better type safety and compatibility with the latest Ethereum tooling.

Changes

  • Quote Handling - Migrate order_quoting module to use alloy U256 and Address types, updating Quote and QuoteData structures
  • Order Validation - Update order_validation module to use alloy types for order validation logic
  • Solver Competitions - Replace primitive types in solver_competition model with alloy Address and U256
  • DTOs - Migrate all DTOs (auction, order) to use alloy types for serialization
  • Database Operations - Update database order operations, token metadata handling, and limit order counting with alloy types
  • Autopilot - Convert onchain order events, quote domain models, and run loop to use alloy types
  • Fee Calculations - Update fee module to use alloy::primitives::U256 instead of ethcontract::U256
  • Event Storage - Migrate quote row creation helpers to use alloy types
  • Price Estimation - Update trade verifier to work with alloy types
  • Type Conversions - Add into_legacy() and into_alloy() conversion helpers for backward compatibility where needed
  • Tests - Update e2e quote verification tests with alloy address conversions

How to test

Existing tests

jmg-duarte and others added 9 commits November 25, 2025 10:45
Migrate types from ethcontract's primitive_types to alloy::primitives across DTOs, database layer, and validation:
- Replace H160 with Address in all DTOs and traits
- Replace U256 with alloy::primitives::U256 where needed
- Add IntoAlloy conversions in autopilot run loop
- Update database helpers to use alloy-specific conversions

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
@jmg-duarte jmg-duarte requested a review from a team as a code owner November 25, 2025 16:50
@jmg-duarte jmg-duarte changed the title Alloy migratio for quotes, order validation, fee calculations [SIMPLE] Alloy migration for quotes, order validation, fee calculations Nov 25, 2025
Base automatically changed from jmgd/temp_main to main November 26, 2025 12:11
@jmg-duarte jmg-duarte enabled auto-merge November 26, 2025 12:30
@jmg-duarte jmg-duarte added this pull request to the merge queue Nov 26, 2025
Merged via the queue into main with commit b91aa96 Nov 26, 2025
18 checks passed
@jmg-duarte jmg-duarte deleted the jmgd/alloy/changes branch November 26, 2025 12:55
@github-actions github-actions bot locked and limited conversation to collaborators Nov 26, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants