-
Notifications
You must be signed in to change notification settings - Fork 154
Migrate more H160 to alloy's Address #3932
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
commit 28e44b05da4222b77408741dbd8528378c9548f9
Author: José Duarte <duarte.gmj@gmail.com>
Date: Fri Nov 28 11:38:22 2025 +0000
Squashed commit of the following:
commit 0e89882
Author: Martin Magnus <martin.beckmann@protonmail.com>
Date: Fri Nov 28 12:19:50 2025 +0100
Migrate DomainSeparator to alloy (#3929)
Implements the existing `DomainSeparator` using `alloy`. We can also
consider to use `alloy`'s `Domain` type directly but it probably makes
more sense to do that in a later PR.
existing e2e and unit tests
If there is a bug in this code none of the signatures generated for
orders would work
commit 66a5e28
Author: José Duarte <duarte.gmj@gmail.com>
Date: Fri Nov 28 10:40:53 2025 +0000
[TRIVIAL] Migrate from H160 to alloy Address types (#3927)
Simple despite being huge
This PR continues the migration from the `ethcontract` library to the
`alloy` library by
* replacing instances of `ethcontract::H160` and `primitive_types::H160`
with `alloy::primitives::Address`
* replacing instances of `ethcontract::U256` and
`primitives_types::U256` with `alloy::primitives::U256`
There are plenty left, the current commit has a focus on some structures
are related code, however some of the structures only got a partial
migration to avoid an even more complex PR
This migration simplifies the codebase by reducing the need for type
conversions and aligns the entire codebase with alloy's native types.
- [x] Replace `H160` with `Address`
- [x] Replace `ethcontract::U256` with `alloy::primitives::U256`
- [x] Remove unnecessary `.into_alloy()` and `.into_legacy()` conversion
calls
- [x] Update function signatures across all affected crates
- [x] Simplify bad token detection code
- [x] Update liquidity source implementations (Balancer V2, Uniswap
V2/V3)
- [x] Update baseline solver and price estimation modules
- [x] Simplify token owner finder implementations
- [x] Update Cargo dependencies
Existing tests
---------
Co-authored-by: Claude <noreply@anthropic.com>
commit 4ba764f8001eea40b5d8e4812a8c92a7655dca25
Merge: 2237370af 013690f
Author: José Duarte <duarte.gmj@gmail.com>
Date: Fri Nov 28 09:22:33 2025 +0000
Merge branch 'jmgd/alloy/h160_contract' into jmgd/alloy/tokens_addr
commit 013690f
Author: José Duarte <duarte.gmj@gmail.com>
Date: Thu Nov 27 19:09:59 2025 +0000
clippy
commit 6344901
Author: José Duarte <duarte.gmj@gmail.com>
Date: Thu Nov 27 19:01:52 2025 +0000
fix clippy
commit ec1faf5
Author: José Duarte <duarte.gmj@gmail.com>
Date: Thu Nov 27 18:58:15 2025 +0000
some issues with mocking
commit 2fbfdab
Merge: 3030db3 476bdff
Author: José Duarte <duarte.gmj@gmail.com>
Date: Thu Nov 27 16:25:11 2025 +0000
Merge branch 'main' into jmgd/alloy/h160_contract
commit 3030db3
Author: José Duarte <duarte.gmj@gmail.com>
Date: Thu Nov 27 16:24:19 2025 +0000
fix compilation errors
commit 2237370af872490f4d4b4f4bec1f29952faf7823
Author: José Duarte <duarte.gmj@gmail.com>
Date: Thu Nov 27 16:00:58 2025 +0000
wip
commit 01900d705a5bde01257b45d6facfe06a1dbaedb2
Author: José Duarte <duarte.gmj@gmail.com>
Date: Thu Nov 27 14:12:46 2025 +0000
wip
commit 3d0a652
Merge: 0327545 593ad3a
Author: José Duarte <duarte.gmj@gmail.com>
Date: Thu Nov 27 11:53:13 2025 +0000
Merge branch 'jmgd/alloy/models' into jmgd/alloy/h160_contract
commit 593ad3a
Author: José Duarte <duarte.gmj@gmail.com>
Date: Thu Nov 27 11:31:13 2025 +0000
fix bug
commit e280d5a
Author: José Duarte <duarte.gmj@gmail.com>
Date: Thu Nov 27 10:52:25 2025 +0000
simplifications
commit 0327545
Author: José Duarte <duarte.gmj@gmail.com>
Date: Wed Nov 26 19:26:06 2025 +0000
Migrate from H160 to alloy Address types
commit c7333d6
Merge: 1665333 bcb5e34
Author: José Duarte <duarte.gmj@gmail.com>
Date: Wed Nov 26 19:04:16 2025 +0000
Merge branch 'main' into jmgd/alloy/models
commit 1665333
Merge: 3182053 5923b47
Author: José Duarte <duarte.gmj@gmail.com>
Date: Wed Nov 26 16:19:05 2025 +0000
Merge branch 'main' into jmgd/alloy/models
commit 3182053
Author: José Duarte <duarte.gmj@gmail.com>
Date: Wed Nov 26 15:18:11 2025 +0000
fmt
commit d88c446
Author: José Duarte <duarte.gmj@gmail.com>
Date: Wed Nov 26 15:09:13 2025 +0000
Migrate more things
commit 9a2dfcd
Author: José Duarte <duarte.gmj@gmail.com>
Date: Wed Nov 26 11:22:58 2025 +0000
Migrate model::order,quote;solver_comp
commit 7b46762
Author: José Duarte <duarte.gmj@gmail.com>
Date: Tue Nov 25 17:54:32 2025 +0000
Migrate OrderQuoteRequest to use alloy Address types
commit 4dc1e4e
Author: José Duarte <duarte.gmj@gmail.com>
Date: Tue Nov 25 16:43:31 2025 +0000
Replace ethcontract primitives with alloy types in quote handling, order validation, and fee calculations
commit 0763f8c
Author: José Duarte <duarte.gmj@gmail.com>
Date: Tue Nov 25 14:57:46 2025 +0000
clippy
commit 5754902
Merge: e01f953 93f9c21
Author: José Duarte <duarte.gmj@gmail.com>
Date: Tue Nov 25 14:48:16 2025 +0000
Merge branch 'jmgd/alloy/quote_data' into jmgd/temp_main
commit 93f9c21
Author: José Duarte <duarte.gmj@gmail.com>
Date: Tue Nov 25 14:46:06 2025 +0000
fix merge
commit 008b832
Merge: ff199b2 a9b6dcb
Author: José Duarte <duarte.gmj@gmail.com>
Date: Tue Nov 25 14:44:34 2025 +0000
Merge branch 'main' into jmgd/alloy/quote_data
commit e01f953
Author: José Duarte <duarte.gmj@gmail.com>
Date: Tue Nov 25 14:17:36 2025 +0000
Migrate DTOs and validation to alloy types
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>
commit 4d30fd4
Merge: 17315f0 0d37d9b
Author: José Duarte <duarte.gmj@gmail.com>
Date: Tue Nov 25 10:46:28 2025 +0000
Merge branch 'jmgd/alloy/ethflow_data' into jmgd/temp_main
commit 17315f0
Merge: d5a8b95 ff199b2
Author: José Duarte <duarte.gmj@gmail.com>
Date: Tue Nov 25 10:46:19 2025 +0000
Merge branch 'jmgd/alloy/quote_data' into jmgd/temp_main
commit d5a8b95
Merge: 337b4b5 2cbc736
Author: José Duarte <duarte.gmj@gmail.com>
Date: Tue Nov 25 10:45:59 2025 +0000
Merge branch 'jmgd/alloy/quote_search_parameters' into jmgd/temp_main
commit 337b4b5
Merge: 9868db5 ee05631
Author: José Duarte <duarte.gmj@gmail.com>
Date: Tue Nov 25 10:45:45 2025 +0000
Merge branch 'jmgd/alloy/quoter' into jmgd/temp_main
commit 9868db5
Merge: 6cafabf 9543cc4
Author: José Duarte <duarte.gmj@gmail.com>
Date: Tue Nov 25 10:45:26 2025 +0000
Merge branch 'jmgd/alloy/orderbook' into jmgd/temp_main
commit 0d37d9b
Author: José Duarte <duarte.gmj@gmail.com>
Date: Tue Nov 25 10:34:06 2025 +0000
Migrate EthflowData into alloy
commit ff199b2
Author: José Duarte <duarte.gmj@gmail.com>
Date: Mon Nov 24 18:41:38 2025 +0000
Migrate QuoteData to alloy
commit 2cbc736
Author: José Duarte <duarte.gmj@gmail.com>
Date: Mon Nov 24 18:39:18 2025 +0000
fix fmt
commit aed17b3
Author: José Duarte <duarte.gmj@gmail.com>
Date: Mon Nov 24 18:11:57 2025 +0000
Migrate QuoteSearchParameters into alloy
commit ee05631
Author: José Duarte <duarte.gmj@gmail.com>
Date: Mon Nov 24 17:54:15 2025 +0000
force uint sizes through types
commit e2b30b3
Author: José Duarte <duarte.gmj@gmail.com>
Date: Mon Nov 24 17:31:27 2025 +0000
Migrate orderbook::quoter into alloy
commit 9543cc4
Author: José Duarte <duarte.gmj@gmail.com>
Date: Wed Nov 19 21:41:18 2025 -0300
Migrate orderbook::orderbook to alloy
commit 9e23e12
Author: José Duarte <duarte.gmj@gmail.com>
Date: Wed Nov 19 21:33:57 2025 -0300
compilation fixes
commit 3b939f0
Merge: f10166b 4808b24
Author: José Duarte <duarte.gmj@gmail.com>
Date: Wed Nov 19 21:32:39 2025 -0300
Merge branch 'main' into jmgd/alloy/models_order_data
commit f10166b
Author: José Duarte <duarte.gmj@gmail.com>
Date: Mon Nov 10 16:50:09 2025 +0000
Migrate OrderMetadata and OnchainOrderData models to alloy
commit cb99ac4
Author: José Duarte <duarte.gmj@gmail.com>
Date: Mon Nov 10 14:13:28 2025 +0000
compilation fix
commit d104971
Author: José Duarte <duarte.gmj@gmail.com>
Date: Mon Nov 10 11:52:10 2025 +0000
Migrate orderbook::database::solver_competition_v2 into alloy
commit 8b15cd9
Author: José Duarte <duarte.gmj@gmail.com>
Date: Mon Nov 10 11:12:14 2025 +0000
Migrate orderbook::database::solver_competition to alloy
commit 7e4b069
Author: José Duarte <duarte.gmj@gmail.com>
Date: Fri Nov 7 17:19:37 2025 +0000
Migrate orderbook::database::auction_prices to alloy
commit f5018ab
Author: José Duarte <duarte.gmj@gmail.com>
Date: Fri Nov 7 17:01:26 2025 +0000
Migrate get_user_orders endpoint to alloy
commit e5b1671
Author: José Duarte <duarte.gmj@gmail.com>
Date: Fri Nov 7 16:54:24 2025 +0000
Migrate get_trades endpoint to alloy
commit 38f47fb
Author: José Duarte <duarte.gmj@gmail.com>
Date: Fri Nov 7 16:19:26 2025 +0000
Migrate get_total_surplus_endpoint to alloy
commit 93293d7
Author: José Duarte <duarte.gmj@gmail.com>
Date: Fri Nov 7 15:36:25 2025 +0000
Migrate get_token_metadata endpoint to alloy
commit cd115d9
Author: José Duarte <duarte.gmj@gmail.com>
Date: Fri Nov 7 15:31:19 2025 +0000
Migrate solver competition endpoint to alloy
commit dd25d86
Merge: 09209ba 0c8d469
Author: José Duarte <duarte.gmj@gmail.com>
Date: Fri Nov 7 15:09:38 2025 +0000
Merge branch 'jmgd/alloy/native-price' into jmgd/alloy/get_orders_by_tx
commit 0c8d469
Author: José Duarte <duarte.gmj@gmail.com>
Date: Fri Nov 7 15:07:06 2025 +0000
fix compilation error
commit 7b2c90e
Merge: cffad67 2873159
Author: José Duarte <duarte.gmj@gmail.com>
Date: Fri Nov 7 15:04:44 2025 +0000
Merge branch 'jmgd/alloy/quote-dto' into jmgd/alloy/native-price
commit 2873159
Merge: 1cf04a3 1784fe7
Author: José Duarte <duarte.gmj@gmail.com>
Date: Fri Nov 7 15:02:54 2025 +0000
Merge branch 'main' into jmgd/alloy/quote-dto
commit 09209ba
Author: José Duarte <duarte.gmj@gmail.com>
Date: Fri Nov 7 12:54:14 2025 +0000
Migrate get_orders_by_tx endpoint to alloy
commit cffad67
Merge: a360fb3 1cf04a3
Author: José Duarte <duarte.gmj@gmail.com>
Date: Fri Nov 7 12:37:27 2025 +0000
Merge branch 'jmgd/alloy/quote-dto' into jmgd/alloy/native-price
commit 1cf04a3
Author: José Duarte <duarte.gmj@gmail.com>
Date: Fri Nov 7 12:18:44 2025 +0000
Clippy
commit a360fb3
Author: José Duarte <duarte.gmj@gmail.com>
Date: Fri Nov 7 12:12:23 2025 +0000
Migrate the native price estimation endpoint and trait to alloy
commit 379285e
Author: José Duarte <duarte.gmj@gmail.com>
Date: Fri Nov 7 09:43:42 2025 +0000
Migrate quote DTO to alloy
| }, | ||
| Ok(Estimate { | ||
| out_amount: 1.into(), | ||
| out_amount: AlloyU256::ONE, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do you opt for a renamed U256 here when a lot of the other code just uses alloy::primitives::U256?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Claude did this :P though I gotta admit this one is shorter
fbee063 to
15e3ba1
Compare
Description
This PR migrates the codebase from using
primitive_types::H160toalloy::primitives::Addressfor representing Ethereum addresses. This migration aligns the codebase with the alloy ecosystem and removes dependency on the legacy primitive_types crate for address handling.Changes
H160imports withAddressfromalloy::primitivesacross the codebase
BUY_ETH_ADDRESSconstant to useAddress::repeat_byte(0xee)instead ofH160([0xee; 20]).as_slice()comparisons in favor of direct equality checks.into_alloy()and.into_legacy()conversions whereneeded
Addressinstead ofH160:AddresstypesHow to test
Existing tests
This is part 1 of 2 in a stack made with GitButler: