Skip to content

Conversation

@m-sz
Copy link
Contributor

@m-sz m-sz commented Feb 11, 2026

Description

The simulation refactoring PR (#4140) is large due to some common types being moved out to shared. This PR covers these aspects and moves common driver utilities to shared. Alongside these common (de)serialization logic is moved to new crate serde-ext

Changes

  • Move driver::util::bytes to shared
  • Remove util::Bytes from autopilot
  • Rename shared::ethrpc to web3 for a better name and to avoid naming conflicts with the ethrpc crate
  • Move common (de)serialization logic to new serde-ext and use it throughout driver and solvers-dto

How to test

  • E2E tests
  • Staging deployment works

m-sz added 5 commits February 11, 2026 14:36
The module exports and provides only Web3 types wrapping ethrpc crate,
thus the new name is more fitting and avoids the need to rename imports
if importing ethrpc and shared::ethrpc together.
@m-sz m-sz requested a review from a team as a code owner February 11, 2026 14:37
Copy link
Contributor

@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 is a large refactoring that extracts common utilities and serialization logic into new shared crates, shared and serde-ext. The changes are mostly moving code, renaming modules from ethrpc to web3, and replacing util::serialize with serde_ext. The refactoring is well-executed and improves code organization. The suggestion for the new serde-ext crate to further improve it by removing some redundancy remains valid.

Copy link
Contributor

@jmg-duarte jmg-duarte left a comment

Choose a reason for hiding this comment

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

LGTM but I'm confused about the ethrpc -> web3 rename, was it necessary?

@m-sz
Copy link
Contributor Author

m-sz commented Feb 11, 2026

LGTM but I'm confused about the ethrpc -> web3 rename, was it necessary?

I have renamed it since the file provides wrappers for creating Web3 instances from the ethrpc crate. When refactoring simulator to a separate crate, I had ended up in a situation where I was importing ethrpc crate and shared::ethrpc, which caused name clashes.

I have figured that it makes sense to rename the module to web3 since it only ever deals with the web3 types from the ethrpc crate.

What do You think?

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.

Before merging please evaluate how much effort it would be to replace our handrolled bytes type with the bytes crate widely used in the ecosystem.

target: encoded.0,
value: encoded.1.into(),
call_data: crate::util::Bytes(encoded.2.0.to_vec()),
call_data: shared::bytes::Bytes(encoded.2.0.to_vec()),
Copy link
Contributor

Choose a reason for hiding this comment

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

Rather than continue to use our handrolled Bytes type did you consider using the bytes crate instead? It's already used in alloy and tokio and is optimized for cheap cloning since it's already internally reference counted.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'll check it out and report back.

Copy link
Contributor

Choose a reason for hiding this comment

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

Probably makes sense to move this into serde-ext as an intermediate step but in the long term we should probably have a shared crate with the primitive types we currently have duplicated in the domain of multiple services (e.g. TokenAddress, TokenAmount, etc.).
This types should then no longer need the serializeAs logic of serde-ext since their regular Serialize implementation could just do the right thing.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That's a good idea, I'll save it for a follow-up PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants