-
Notifications
You must be signed in to change notification settings - Fork 154
Remove autopilot::domain::eth::Address in favor of alloy::primitives::Address #3934
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
# Description
This PR migrates the codebase from using `primitive_types::H160` to
`alloy::primitives::Address` for 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
- [x] Replace `H160` imports with `Address` from `alloy::primitives`
across the codebase
- [x] Update `BUY_ETH_ADDRESS` constant to use
`Address::repeat_byte(0xee)` instead of `H160([0xee; 20])`
- [x] Update address comparisons and conversions throughout:
- Remove `.as_slice()` comparisons in favor of direct equality checks
- Add/update `.into_alloy()` and `.into_legacy()` conversions where
needed
- Remove unnecessary conversions where types already match
- [x] Update function signatures to accept/return `Address` instead of
`H160`:
- Database operations (auction_prices.rs)
- Price estimation modules (native_price_cache.rs, factory.rs, etc.)
- Account balance queries and operations
- Order validation and processing
- Settlement encoding
- [x] Update test fixtures and assertions to use `Address` types
- [x] Clean up conversion logic to eliminate redundant type conversions
## How to test
Existing tests
<!-- GitButler Footer Boundary Top -->
---
This is **part 1 of 2 in a stack** made with GitButler:
- <kbd> 2 </kbd> #3934
- <kbd> 1 </kbd> #3932 👈
<!-- GitButler Footer Boundary Bottom -->
4b78423 to
f909260
Compare
| pub struct Competition { | ||
| pub auction_id: AuctionId, | ||
| pub reference_scores: HashMap<eth::Address, Score>, | ||
| pub reference_scores: HashMap<Address, Score>, |
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.
IMO it still makes sense to have the Address as a domain type so I would suggest to re-export the type from the eth module instead of pulling most basic types from eth and only Address from alloy directly.
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.
Addressed
MartinquaXD
left a comment
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.
LGTM. I don't see anything in the PR that would cause the failing test. Seems like regular flakiness that needs to be investigated separately.
Description
Removes the eth::Address structure in favor of the alloy::primitives::Address
Changes
How to test
Existing tests
This is part 2 of 2 in a stack made with GitButler: