Skip to content
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

[wip] feat: provider alloy migration #7106

Merged
merged 71 commits into from
Apr 9, 2024
Merged

Conversation

Evalir
Copy link
Member

@Evalir Evalir commented Feb 13, 2024

Motivation

This migrates anvil, cast and most of the forge to use alloy providers and primitive types on all methods.

Closes #7486
Closes #7400
Closes #5709
Closes #7089

Solution

* feat(foundry-common): NameOrAddress ENS util

* chore: rename err

* chore: remove from impl for str

* chore: unrelated fix from alloy upgrade

* nit
crates/cast/src/lib.rs Outdated Show resolved Hide resolved
crates/common/src/ens.rs Outdated Show resolved Hide resolved
Evalir and others added 8 commits February 16, 2024 12:37
* chore: add alloy contract

* feat(cast): migrate most methods to alloy

* chore: leave todo for converting a tx envelope into an rpc tx

* fix: use proper type for storage

* readd decodetx for now

* chore: extend txbuilder to build an alloy tx request

* feat: migrate most methods bar send/decode raw tx

* fix: include tx data

* simplify txbuilder

* chore: simplify back access_list

* chore: remove unnecesary conversion

* fmt

* doctests

* fmt

* do not use trait

* Update crates/cast/bin/main.rs

Co-authored-by: Matthias Seitz <matthias.seitz@outlook.de>

* cleanup builder

* clippy

* fix doc comments

---------

Co-authored-by: Matthias Seitz <matthias.seitz@outlook.de>
@zerosnacks zerosnacks self-assigned this Mar 19, 2024
@klkvr klkvr assigned klkvr and unassigned zerosnacks Mar 19, 2024
@klkvr
Copy link
Member

klkvr commented Mar 21, 2024

Cast now compiles and ethers is almost gone.

We are still using it in 2 places:

  1. crates/cast/bin/cmd/logs.rs - this still uses ethers types to prepare event filters from user-entered event signature and arguments. @DaniPopes does current state of alloy-json-abi and alloy-dyn-abi allow this?

    The flow is basically like this:

    1. Parse signature to extract types
    2. Parse entered values as extracted types (DynSolValue?)
    3. Encode and obtain hashes of indexed fields for filter (not sure if we have that)
  2. crates/cast/bin/cmd/bind.rs - cast bind and forge bind should probably be deprecated?

There are still a lot of errors coming from various places. At the first glance most of them are coming from anvil due to alloy bump and changed transaction types. Will work on that next

cc @mattsse

@klkvr klkvr force-pushed the evalir/cast-provider-mig branch from e9e7e4f to c734de4 Compare April 6, 2024 07:55
@Evalir Evalir requested a review from rkrasiuk as a code owner April 6, 2024 07:55
@klkvr
Copy link
Member

klkvr commented Apr 7, 2024

blocked by deser issues, should be fixed by alloy-rs/alloy#474

@DaniPopes
Copy link
Member

alloy-rs/alloy#474 is merged

Copy link
Member

@mattsse mattsse left a comment

Choose a reason for hiding this comment

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

let's send it and do more incremental followups

(Some(1), _, None, None, _, None, None, None) |
(None, _, None, None, Some(_), None, None, None) => {
(Some(1), _, None, None, _, None, None, None, _) |
(None, _, None, None, Some(_), None, None, None, _) => {
Copy link
Member

Choose a reason for hiding this comment

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

we can do this but separately

@klkvr
Copy link
Member

klkvr commented Apr 9, 2024

failing test unrelated I believe

@Evalir
Copy link
Member Author

Evalir commented Apr 9, 2024

#7594 needs to be merged into this before we merge this PR

EDIT: Should be g2g!

* refactor cast logs to use alloy

* fmt

* make clippy happy

* cleanup

* doc nits

---------

Co-authored-by: evalir <hi@enriqueortiz.dev>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
9 participants