Commit 914055c
[TRIVIAL] Migrate order, quote, and validation modules to alloy (#3926)
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**
- [x] Migrate `QuoteAmounts` struct to use `alloy::primitives::U256` in
`crates/model/src/order.rs`
- [x] Simplify `within_market` method by removing manual byte
conversions
- [x] Migrate `OrderQuoteRequest`, `OrderQuote`, `OrderQuoteResponse` to
use `alloy::primitives::Address` in `crates/model/src/quote.rs`
- [x] Update solver competition models to use alloy types
- **Shared layer**
- [x] Migrate `QuoteParameters`, `Quote`, and `QuoteData` structs to
alloy types in `crates/shared/src/order_quoting.rs`
- [x] Update quote scaling logic to use `widening_mul` instead of
`full_mul`
- [x] Migrate `Amounts` struct and validation logic in
`crates/shared/src/order_validation.rs`
- [x] Update `is_order_outside_market_price` to use typed `widening_mul`
calls
- [x] Migrate fee calculations, event storage, and price estimation
modules
- **Orderbook layer**
- [x] Update database operations to handle alloy types with proper
conversions
- [x] Migrate DTOs (auction, order) to use alloy primitives
- [x] Update quote API endpoints and quoter logic
- [x] Migrate solver competition storage
- **Autopilot**
- [x] Update onchain order event handling
- [x] Migrate quote domain logic
- [x] Update run loop to work with alloy types
- **E2E tests**
- [x] Update all test files to use alloy `Address` creation methods
(`with_last_byte` instead of `from_low_u64_be`)
- [x] Update test setup infrastructure and onchain components
- **Math utilities**
- [x] Remove deprecated math functions from solvers util module
- [x] Update driver math utilities
## How to test
Existing tests
---------
Co-authored-by: Claude <[email protected]>1 parent bcb5e34 commit 914055c
File tree
48 files changed
+806
-1092
lines changed- crates
- autopilot/src
- database/onchain_order_events
- driver/src/util
- e2e
- src
- api
- setup/onchain_components
- tests/e2e
- model/src
- orderbook/src
- api
- database
- solvers/src/util
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
48 files changed
+806
-1092
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
600 | 600 | | |
601 | 601 | | |
602 | 602 | | |
603 | | - | |
604 | | - | |
605 | | - | |
| 603 | + | |
| 604 | + | |
| 605 | + | |
606 | 606 | | |
607 | 607 | | |
608 | 608 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
472 | 472 | | |
473 | 473 | | |
474 | 474 | | |
475 | | - | |
| 475 | + | |
| 476 | + | |
| 477 | + | |
476 | 478 | | |
477 | 479 | | |
478 | 480 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
28 | 28 | | |
29 | 29 | | |
30 | 30 | | |
31 | | - | |
| 31 | + | |
32 | 32 | | |
33 | 33 | | |
34 | 34 | | |
35 | 35 | | |
36 | 36 | | |
37 | 37 | | |
38 | | - | |
| 38 | + | |
39 | 39 | | |
40 | 40 | | |
41 | 41 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | | - | |
| 3 | + | |
4 | 4 | | |
5 | | - | |
6 | 5 | | |
| 6 | + | |
7 | 7 | | |
8 | 8 | | |
9 | | - | |
10 | | - | |
11 | | - | |
12 | | - | |
| 9 | + | |
13 | 10 | | |
14 | 11 | | |
15 | 12 | | |
| |||
55 | 52 | | |
56 | 53 | | |
57 | 54 | | |
58 | | - | |
59 | | - | |
| 55 | + | |
| 56 | + | |
60 | 57 | | |
61 | 58 | | |
62 | 59 | | |
63 | 60 | | |
64 | | - | |
65 | | - | |
66 | | - | |
67 | | - | |
68 | | - | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
69 | 66 | | |
70 | 67 | | |
71 | 68 | | |
| |||
85 | 82 | | |
86 | 83 | | |
87 | 84 | | |
88 | | - | |
89 | | - | |
90 | | - | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
91 | 88 | | |
92 | | - | |
93 | | - | |
94 | | - | |
95 | | - | |
96 | | - | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
97 | 94 | | |
98 | 95 | | |
99 | 96 | | |
| |||
131 | 128 | | |
132 | 129 | | |
133 | 130 | | |
134 | | - | |
135 | | - | |
| 131 | + | |
| 132 | + | |
136 | 133 | | |
137 | 134 | | |
138 | 135 | | |
139 | | - | |
140 | | - | |
141 | | - | |
142 | | - | |
143 | | - | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
144 | 141 | | |
145 | | - | |
| 142 | + | |
146 | 143 | | |
147 | 144 | | |
148 | 145 | | |
| |||
0 commit comments