Skip to content

Conversation

@jmg-duarte
Copy link
Contributor

Description

While working on the Balancer migration, I noticed that we were filtering out errors with the old logic, even though we've migrated all calls to alloy (this either means we've been missing errors or that the library doesn't error at all, so we didn't notice 😛) — it's the downside of using anyhow/erasing our error types, inspection breaks

After making the proper changes, I was able to remove the old contract error handling for good.

Changes

  • Removes the old ethcontract-based error handling
  • Fixes the balancer error handling to use the right errors

How to test

Existing tests

@jmg-duarte jmg-duarte requested a review from a team as a code owner January 6, 2026 11:47
@jmg-duarte
Copy link
Contributor Author

/gemini review

@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 finalizes the transition of contract error handling from the legacy ethcontract library to the modern alloy framework. It systematically removes outdated error classification logic and its dependencies across various modules, including Balancer and Uniswap V2 pool fetching, and the Tenderly API. This ensures consistent and accurate error processing, preventing potential issues where contract-specific errors might have been mishandled or overlooked due to reliance on deprecated mechanisms.

Highlights

  • Error Handling Migration: The pull request completes the migration of contract error handling from the ethcontract library's classification to the alloy library's error mechanisms.
  • Removal of Old Logic: The crates/contracts/src/errors.rs file, which contained the EthcontractErrorType enum and associated classification logic for ethcontract errors, has been entirely removed.
  • Balancer Integration Update: Balancer pool fetching logic (registry.rs) now correctly identifies and filters contract errors using alloy::contract::Error::is_contract_error() instead of the deprecated ethcontract methods.
  • Uniswap V2 Cleanup: The handle_contract_error function in Uniswap V2 pool fetching, which relied on the old ethcontract error classification, has been removed.
  • Tenderly API Refinement: The Tenderly API integration has been updated to remove dependencies on the old ethcontract error types, streamlining its error handling.
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 does a great job of migrating the remaining ethcontract error handling to alloy, removing obsolete code and simplifying the logic. The changes in balancer_v2 are correct. I've found one potential issue in the collect_pool_results function you modified. It seems to have a pre-existing bug in how it handles paused pools, which could lead to unexpected errors instead of filtering. I've left a detailed comment with a suggested fix. Otherwise, the changes look solid.

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 completes the migration from ethcontract to alloy for error handling. The changes are well-contained and correctly replace the old error classification logic with the new alloy-based mechanisms. The removal of the crates/contracts/src/errors.rs file and its related code cleans up the codebase nicely. The updates in the Balancer and Uniswap v2 pool fetching logic, as well as the Tenderly API, are correct and align with the goal of using alloy's error types. I have one suggestion to improve readability in the Balancer pool fetching logic by re-introducing a helper function for error checking, which would make the code cleaner and more consistent with its previous structure.

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

github-merge-queue bot pushed a commit that referenced this pull request Jan 6, 2026
# Description
Removes the ethcontract-generate dependency from contracts, along with
#4024 we'll be able to fully remove the ethcontract dependency from
contracts.

Note that the artifacts JSON changes are outputs from the *new*
vendoring — i.e. the only change was the newline.

# Changes

- [ ] Replaces the ethcontract-generate dependency with reqwest and a
bit of serde_json work

## How to test
* Checkout the previous contracts
* Run `RUST_BACKTRACE=1 cargo r -p contracts -F bin --bin vendor`
* Validate the diff
@jmg-duarte jmg-duarte enabled auto-merge January 6, 2026 17:59
@jmg-duarte jmg-duarte added this pull request to the merge queue Jan 6, 2026
Merged via the queue into main with commit c7fd798 Jan 6, 2026
19 checks passed
@jmg-duarte jmg-duarte deleted the jmgd/alloy/errors branch January 6, 2026 18:24
@github-actions github-actions bot locked and limited conversation to collaborators Jan 6, 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.

3 participants