Skip to content

Conversation

@jmg-duarte
Copy link
Contributor

Long but easy.

Description

Removes the primitive-types dependencies from the number crate and refactors callers accordingly.

Changes

  • Removes the primitive-types dependency
  • Refactors number accordingly
  • Refactors callers accordingly

How to test

Existing tests

@jmg-duarte jmg-duarte changed the base branch from main to jmgd/alloy/sources January 7, 2026 15:39
@gemini-code-assist
Copy link

Summary of Changes

Hello @jmg-duarte, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request undertakes a significant refactoring effort to remove the primitive-types dependency, standardizing the codebase on alloy primitives for numerical types. This change streamlines the project's dependency graph and unifies the handling of fundamental data types, leading to a cleaner and more consistent architecture. The refactoring involved updating type definitions, consolidating conversion utilities, and adjusting numerous call sites across multiple crates to reflect these core changes.

Highlights

  • Dependency Removal: The primitive-types crate has been completely removed from the project dependencies, specifically from the number crate's Cargo.toml and the main Cargo.lock.
  • Type System Migration: The codebase has transitioned from using primitive_types::U256 to alloy::primitives::U256 for 256-bit unsigned integer representation, standardizing on the alloy primitives.
  • Consolidated Number Conversions: All number conversion functions, such as u256_to_big_decimal and big_decimal_to_u256, previously nested under number::conversions::alloy::, are now directly accessible under number::conversions::, simplifying import paths and usage.
  • Balancer Pool Identifier Update: Balancer pool identifiers (pool_id) have been updated from ethcontract::H256 to alloy::primitives::B256 across various modules, including pool fetching, caching, and storage.
  • Streamlined Balancer Configuration: The balancer_factories argument has been removed from shared::arguments, indicating a simplification in how Balancer factories are configured or discovered.
  • Refactored Call Sites: Numerous call sites and import statements throughout the autopilot, driver, orderbook, refunder, shared, and solver crates have been updated to align with the new type definitions and conversion function locations.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request effectively removes the primitive-types dependency and refactors the codebase to use alloy::primitives instead. The changes are extensive but mostly mechanical, and they have been applied consistently across the affected crates. The core logic in crates/number/src/conversions.rs has been correctly updated to reflect this change.

I've noticed a few nice improvements along the way, such as using U256 constants (ZERO, ONE) and simplifying some type conversions.

I have one minor suggestion regarding code formatting to maintain consistency. Overall, this is a solid refactoring effort.

Base automatically changed from jmgd/alloy/sources to main January 7, 2026 16:29
@jmg-duarte jmg-duarte marked this pull request as ready for review January 7, 2026 17:32
@jmg-duarte jmg-duarte requested a review from a team as a code owner January 7, 2026 17:32
Copy link
Contributor

@squadgazzz squadgazzz 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 actually expected to do that after #4034. Gonna need to rework my PR after this one then.

@jmg-duarte jmg-duarte added this pull request to the merge queue Jan 8, 2026
Merged via the queue into main with commit e30e8c6 Jan 8, 2026
19 checks passed
@jmg-duarte jmg-duarte deleted the jmgd/alloy/number branch January 8, 2026 13:54
@github-actions github-actions bot locked and limited conversation to collaborators Jan 8, 2026
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