Skip to content

Conversation

@jmg-duarte
Copy link
Contributor

Large but overall trivial

Description

This PR continues the migration from the deprecated ethcontract library to the modern alloy library by converting order, quote, and validation-related modules to use alloy primitive types (Address, U256).

This is part of a broader effort to modernize the codebase and adopt alloy as the standard Ethereum library, replacing ethcontract's H160 and U256 types with their alloy equivalents.

Changes

  • Model layer

    • Migrate QuoteAmounts struct to use alloy::primitives::U256 in crates/model/src/order.rs
    • Simplify within_market method by removing manual byte conversions
    • Migrate OrderQuoteRequest, OrderQuote, OrderQuoteResponse to use alloy::primitives::Address in crates/model/src/quote.rs
    • Update solver competition models to use alloy types
  • Shared layer

    • Migrate QuoteParameters, Quote, and QuoteData structs to alloy types in crates/shared/src/order_quoting.rs
    • Update quote scaling logic to use widening_mul instead of full_mul
    • Migrate Amounts struct and validation logic in crates/shared/src/order_validation.rs
    • Update is_order_outside_market_price to use typed widening_mul calls
    • Migrate fee calculations, event storage, and price estimation modules
  • Orderbook layer

    • Update database operations to handle alloy types with proper conversions
    • Migrate DTOs (auction, order) to use alloy primitives
    • Update quote API endpoints and quoter logic
    • Migrate solver competition storage
  • Autopilot

    • Update onchain order event handling
    • Migrate quote domain logic
    • Update run loop to work with alloy types
  • E2E tests

    • Update all test files to use alloy Address creation methods (with_last_byte instead of from_low_u64_be)
    • Update test setup infrastructure and onchain components
  • Math utilities

    • Remove deprecated math functions from solvers util module
    • Update driver math utilities

How to test

Existing tests

jmg-duarte and others added 12 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 26, 2025 15:15
@jmg-duarte jmg-duarte changed the title [TRIVIAL] [TRIVIAL] Migrate order, quote, and validation modules from ethcontract to alloy primitives Nov 26, 2025
@jmg-duarte jmg-duarte changed the title [TRIVIAL] Migrate order, quote, and validation modules from ethcontract to alloy primitives [TRIVIAL] Migrate order, quote, and validation modules to alloy Nov 26, 2025
Base automatically changed from jmgd/alloy/order_quote_request to main November 26, 2025 15:20
@squadgazzz squadgazzz marked this pull request as draft November 27, 2025 09:03
@squadgazzz
Copy link
Contributor

I converted it to a draft to avoid notifications noise until all the issues with this PR are solved.

@jmg-duarte jmg-duarte marked this pull request as ready for review November 27, 2025 11:50
@jmg-duarte jmg-duarte added this pull request to the merge queue Nov 27, 2025
Merged via the queue into main with commit 914055c Nov 27, 2025
18 checks passed
@jmg-duarte jmg-duarte deleted the jmgd/alloy/models branch November 27, 2025 12:49
@github-actions github-actions bot locked and limited conversation to collaborators Nov 27, 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.

4 participants