Skip to content

Commit

Permalink
refactor: migrate to alloy providers (#6219)
Browse files Browse the repository at this point in the history
* wip

* fmt

* wip

* more wip

* wip

* wip

* rebase stuff

* more rebase stuff

* wip

* fmt

* wip resolve warnings

* wip

* wip

* wip

* aaand cast started complaining gn

* feat(`anvil`): RPC Types migration (#6256)

* wip

* fmt

* wip

* feat: start migrating basic types

* more type changes across /eth and backend

* wip type replacements

* chore: replace mistaken type

* feat: rpc types without pubsub migrated

* chore: changes from rpc types

* chore: re-add changes

* feat: rpc types done, onto providers

* we on that grind

* feat: types migrated, tests remaining

* chore: comment tests for now to get proper compile errors

---------

Co-authored-by: Oliver Nordbjerg <hi@notbjerg.me>

* fix latest rebase errors

* chore: `alloy-transports` -> `alloy-transport` (#6341)

* fix: use new `TransportResult` (#6342)

* fix: `TransportResult` for multi wallet (#6343)

* feat: use TransportError on Anvil (#6344)

* fix: uncomment serde tests, fix genesis test (#6346)

* refactor: split ethers/alloy providers (#6378)

* split ethers/alloy providers

* chore: complete Transaction ToAlloy compat trait

* chore: clone txs

---------

Co-authored-by: Enrique Ortiz <hi@enriqueortiz.dev>

* fix: block numbers are u64 (#6382)

* fix: remove U64 cast (#6384)

* chore(`anvil`): fix tests (#6383)

* wip

* chore: fix u64

* fix: access lists

* chore: use latest ethers

* silly ahhh otterscan test failing

* more fixdy

* almost done lesgo

* pub sob

* chre: fix otterscan test

---------

Co-authored-by: Oliver Nordbjerg <hi@notbjerg.me>

* fix(anvil): port serde helpers, remove multiline jsons (#6404)

* chore(`anvil`): extend alloy types until entry lib, cleanup warnings (#6413)

* chore: extend alloy types until entry lib, cleanup warnings

* chore: fix review comments

* chore: pin alloy providers to repo & test fixup (#6414)

* chore: pin alloy providers to repo

* chore: fix doctests

* clippy

* clippy

* clippy

* fix fixtures

* update

* feat: reimplement rpc cheatcode

* chore: fix warnings

* chore: fmt, switch to local tx request type in the meanwhile for optimism tests

* [Alloy providers migration]: Fix tests (#6462)

* fix: properly return tx-only blocks instead of full blocks

* chore: fix up fork tests

* chore: mine blocks first before getting tx receipt

* clippy/fmt

* clippy

* clippy

* chore: add more delta for timestamp test

* chore: fix up anvil API tests (#6517)

* chore: fix up anvil API tests

* fmt

* feat: `RuntimeTransport` for `ws`/`ipc` support (#6525)

* wip

* chore: change to using the naked transport instead of an RpcClient<T>

* chore: properly implement request

* always poll ready

* chore: docs

* chore: clippy and other fixes

* chore: use call to pass down the tower stack

* chore: no unwraps

* chore: new fn

* feat: implement runtimetransport on the alloy provider builder

* chore: refactor into separate functions depending on transport

* feat: RuntimeTransportBuilder, refactor

* feat: cleanup, docs

* feat: IPC

* clippy

* cosmetics

* feat: enable anvil ipc tests (#6570)

* refactor: replace tracers with reth tracers (#6428)

* wip

* wip

not working still -.-

- gas reports
- `forge script` cannot set `gas_used` for root
  trace since that requires mut access to the arena
- event decoding not impl

possibly broken

- anvil traces (not tested)
- test traces (not tested)
- debugging (not tested)

but hey, at least it compiles...

* wip

* chore: fix deps

* remove utils import

* chore: remove errors

* chore: use render_trace_arena

* derive debug

* fix contract identification

* fix formatting

* remove stray todo

* fix empty output

* fix unrelated test :)

---------

Co-authored-by: evalir <hi@enriqueortiz.dev>

* fix lockfile

* chore: fix anvil test

* fixup: missing import

* chore: lint

* fixup: imports

* fixup: more fixes

* chore: fmt

* clippy clippy clippy always clippy

* and fmt

* test: fix test

* chore: add todo

* clippy

* feat(`anvil`/`evm`): re-add support for additional fields (#6573)

* feat: re-add additional fields support

* chore: clippy/fmt

* bump Cargo.lock

* chore: handle mixhash being optional (#6575)

* fix: always ensure prevrandao is set (#6576)

* chore: cleanup, reintroduce trace endpoints (#6577)

* feat: re-enable debug_traceTransaction support (#6583)

* chore: fix ipc test

* chore: re-enable trace tests (#6586)

* refactor: rm unused param

* refactor: rm gas adjustment in script

This should be solved in the tracer inspector itself
already, cc @mattsse

* chore: fix ci failures (#6595)

* chore: use self.debug instead of self.verbose

* chore: update lock

* chore: fix deny check

* feat(`RuntimeTransport`): port cups/retry logic (#6594)

* some random stuff

* fmt: toml

* chore: use u64 in BlockRequest::Number

* update

* chore: remove some more ethers

* chore: more ethers removals (units)

* wip: remove reth

* wip

* rm ice

* fix(`rpc-types`): use newer `alloy-rpc-types`, `alloy-rpc-trace-types` (#6705)

* fix(rpc-types): use newer alloy-rpc-types, alloy-rpc-trace-types and reth inspectors

* chore: remove ToReth

* chore: fix imports

* chore: quicknode retry (#6712)

* fix(`general`): get ci green on 6219 (#6711)

* chore: update doctests

* chore: update cargo lock to make anvil test pass

* chore: bump cargo lock again

* fix: parse unit logics (#6713)

---------

Co-authored-by: DaniPopes <57450786+DaniPopes@users.noreply.github.com>

* chore: remove borrows

* chore: add removal note

* chore: use alloy chains to compare

* chore: remove some conversions, migrate feemanager/newblocknotifications

* chore: clippy

* chore: fix doctests

---------

Co-authored-by: evalir <hi@enriqueortiz.dev>
Co-authored-by: DaniPopes <57450786+DaniPopes@users.noreply.github.com>
Co-authored-by: Matthias Seitz <matthias.seitz@outlook.de>
  • Loading branch information
4 people authored Jan 8, 2024
1 parent 02292f2 commit d46bcb3
Show file tree
Hide file tree
Showing 118 changed files with 5,461 additions and 3,025 deletions.
1,058 changes: 1,035 additions & 23 deletions Cargo.lock

Large diffs are not rendered by default.

32 changes: 27 additions & 5 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,7 @@ foundry-evm-traces = { path = "crates/evm/traces" }
foundry-macros = { path = "crates/macros" }
foundry-test-utils = { path = "crates/test-utils" }

# solc & compilation utilities
foundry-block-explorers = { version = "0.1.3", default-features = false }
foundry-compilers = { version = "0.1.4", default-features = false }

Expand All @@ -142,10 +143,20 @@ ethers-middleware = { version = "2.0", default-features = false }
ethers-solc = { version = "2.0", default-features = false }

## alloy
alloy-primitives = "0.5.0"
alloy-dyn-abi = "0.5.0"
alloy-json-abi = "0.5.0"
alloy-sol-types = "0.5.0"
alloy-providers = "0.1.0"
alloy-transport = "0.1.0"
alloy-transport-http = "0.1.0"
alloy-transport-ws = "0.1.0"
alloy-transport-ipc = "0.1.0"
alloy-rpc-types = "0.1.0"
alloy-rpc-trace-types = "0.1.0"
alloy-json-rpc = "0.1.0"
alloy-pubsub = "0.1.0"
alloy-rpc-client = "0.1.0"
alloy-primitives = "0.5.1"
alloy-dyn-abi = "0.5.1"
alloy-json-abi = "0.5.1"
alloy-sol-types = "0.5.1"
syn-solidity = "0.5.0"

alloy-chains = "0.1.5"
Expand Down Expand Up @@ -197,7 +208,18 @@ ethers-signers = { git = "https://github.com/gakonst/ethers-rs", rev = "f0e5b194
ethers-middleware = { git = "https://github.com/gakonst/ethers-rs", rev = "f0e5b194f09c533feb10d1a686ddb9e5946ec107" }
ethers-solc = { git = "https://github.com/gakonst/ethers-rs", rev = "f0e5b194f09c533feb10d1a686ddb9e5946ec107" }

alloy-providers = { git = "https://github.com/alloy-rs/alloy/" }
alloy-transport = { git = "https://github.com/alloy-rs/alloy/" }
alloy-transport-http = { git = "https://github.com/alloy-rs/alloy/" }
alloy-transport-ws = { git = "https://github.com/alloy-rs/alloy/" }
alloy-transport-ipc = { git = "https://github.com/alloy-rs/alloy/" }
alloy-rpc-types = { git = "https://github.com/alloy-rs/alloy/" }
alloy-rpc-trace-types = { git = "https://github.com/alloy-rs/alloy/" }
alloy-pubsub = { git = "https://github.com/alloy-rs/alloy/" }
alloy-rpc-client = { git = "https://github.com/alloy-rs/alloy/" }
alloy-json-rpc = { git = "https://github.com/alloy-rs/alloy/" }

revm = { git = "https://github.com/bluealloy/revm", branch = "reth_freeze" }
revm-primitives = { git = "https://github.com/bluealloy/revm", branch = "reth_freeze" }
revm-interpreter = { git = "https://github.com/bluealloy/revm", branch = "reth_freeze" }
revm-precompile = { git = "https://github.com/bluealloy/revm", branch = "reth_freeze" }
revm-primitives = { git = "https://github.com/bluealloy/revm", branch = "reth_freeze" }
6 changes: 6 additions & 0 deletions crates/anvil/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,11 @@ trie-db = "0.23"
hash-db = "0.15"
memory-db = "0.29"
alloy-primitives = { workspace = true, features = ["serde"] }
alloy-rpc-types.workspace = true
alloy-rpc-trace-types.workspace = true
alloy-providers.workspace = true
alloy-transport.workspace = true
alloy-chains.workspace = true

# axum related
axum.workspace = true
Expand All @@ -62,6 +67,7 @@ yansi = "0.5"
tempfile = "3"
itertools.workspace = true
rand = "0.8"
eyre.workspace = true

# cli
clap = { version = "4", features = ["derive", "env", "wrap_help"], optional = true }
Expand Down
8 changes: 5 additions & 3 deletions crates/anvil/core/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,11 @@ repository.workspace = true
[dependencies]
foundry-common.workspace = true
foundry-evm.workspace = true
revm = { workspace = true, default-features = false, features = ["std", "serde", "memory_limit"] }

alloy-primitives = { workspace = true, features = ["serde"] }
revm = { workspace = true, default-features = false, features = ["std", "serde", "memory_limit"] }
alloy-rpc-types = { workspace = true }
alloy-rpc-trace-types.workspace = true
ethers-core = { workspace = true, features = ["optimism"] }
# theses are not used by anvil-core, but are required by ethers, because pulled in via foundry-common
ethers-contract = { workspace = true, features = ["optimism"] }
Expand All @@ -23,7 +25,7 @@ ethers-middleware = { workspace = true, features = ["optimism"] }

serde = { workspace = true, optional = true }
serde_json.workspace = true
bytes = { version = "1.4" }
bytes = "1.4"
open-fastrlp = { version = "0.1.4", optional = true }

# trie
Expand All @@ -40,4 +42,4 @@ anvil-core = { path = ".", features = ["serde"] }
default = ["serde"]
impersonated-tx = []
fastrlp = ["dep:open-fastrlp"]
serde = ["dep:serde"]
serde = ["dep:serde"]
Loading

0 comments on commit d46bcb3

Please sign in to comment.