Skip to content

Conversation

@jmg-duarte
Copy link
Contributor

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

Description

Removes the eth::Address structure in favor of the alloy::primitives::Address

Changes

  • Removes the eth::Address structure in favor of the alloy::primitives::Address
  • Refactors all applicable structures

How to test

Existing tests


This is part 2 of 2 in a stack made with GitButler:

@jmg-duarte jmg-duarte requested a review from a team as a code owner November 28, 2025 16:40
@jmg-duarte jmg-duarte changed the title Remove eth::Address in favor of alloy::primitives::Address Remove autopilot::domain::eth::Address in favor of alloy::primitives::Address Nov 28, 2025
github-merge-queue bot pushed a commit that referenced this pull request Nov 28, 2025
# 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>&nbsp;2&nbsp;</kbd> #3934 
- <kbd>&nbsp;1&nbsp;</kbd> #3932 👈 
<!-- GitButler Footer Boundary Bottom -->
Base automatically changed from jmgd/alloy/s to main November 28, 2025 17:16
@jmg-duarte jmg-duarte force-pushed the jmgd/alloy/eth-address branch from 4b78423 to f909260 Compare November 28, 2025 17:31
pub struct Competition {
pub auction_id: AuctionId,
pub reference_scores: HashMap<eth::Address, Score>,
pub reference_scores: HashMap<Address, Score>,
Copy link
Contributor

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.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Addressed

Copy link
Contributor

@MartinquaXD MartinquaXD left a 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.

@jmg-duarte jmg-duarte enabled auto-merge December 1, 2025 12:22
@jmg-duarte jmg-duarte added this pull request to the merge queue Dec 1, 2025
Merged via the queue into main with commit a240a81 Dec 1, 2025
29 of 30 checks passed
@jmg-duarte jmg-duarte deleted the jmgd/alloy/eth-address branch December 1, 2025 12:49
@github-actions github-actions bot locked and limited conversation to collaborators Dec 1, 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