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

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

Merged
merged 8 commits into from
Dec 15, 2023

Conversation

Evalir
Copy link
Member

@Evalir Evalir commented Dec 13, 2023

Motivation

This was the last crit feature missing for #6219. Ports over the retry / cups logic from ethers directly, also simplifying it a bit by refactoring to different files. All the logic now is in a Tower layer—there's potential to split it up later and move this to alloy, but for now I'd prefer to keep it living in foundry while we stabilize Providers and move it later.

Solution

Port over the CUPS/retry logic, and hook it back to the rest of the app.

@Evalir Evalir requested review from onbjerg and removed request for mattsse and DaniPopes December 13, 2023 19:20
@Evalir
Copy link
Member Author

Evalir commented Dec 13, 2023

ci failures unrelated (Cast, which is not migrated)

@Evalir Evalir requested a review from mattsse December 13, 2023 19:57
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.

I'm not really familiar with the entire transports/client/provider API yet

A few things here are confusing to me

a) why does Transport need an Arc lock of the wrapped transport
b) if transport is a service, why not implement retry as service as well so it's reusable? should be a retry service (RetryTransport) and be moved to alloy.

also, why is this not Clone?
https://github.com/alloy-rs/alloy/blob/4ed367e1dbc4bed77794622fceb9a38131fcc9a6/crates/providers/src/provider.rs#L29

crates/common/src/provider/policy.rs Outdated Show resolved Hide resolved
crates/common/src/provider/runtime_transport.rs Outdated Show resolved Hide resolved
crates/common/src/provider/runtime_transport.rs Outdated Show resolved Hide resolved
@Evalir Evalir requested a review from mattsse December 13, 2023 21:10
Copy link
Member

@onbjerg onbjerg left a comment

Choose a reason for hiding this comment

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

better

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.

lgtm,
we can move this to alloy eventually

@Evalir Evalir merged commit e9886c6 into onbjerg/alloy-providers Dec 15, 2023
19 checks passed
@Evalir Evalir deleted the evalir/cups-retry-logic branch December 15, 2023 12:17
Evalir added a commit that referenced this pull request Jan 8, 2024
* 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>
RPate97 pushed a commit to RPate97/foundry that referenced this pull request Jan 12, 2024
* 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 (foundry-rs#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` (foundry-rs#6341)

* fix: use new `TransportResult` (foundry-rs#6342)

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

* feat: use TransportError on Anvil (foundry-rs#6344)

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

* refactor: split ethers/alloy providers (foundry-rs#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 (foundry-rs#6382)

* fix: remove U64 cast (foundry-rs#6384)

* chore(`anvil`): fix tests (foundry-rs#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 (foundry-rs#6404)

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

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

* chore: fix review comments

* chore: pin alloy providers to repo & test fixup (foundry-rs#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 (foundry-rs#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 (foundry-rs#6517)

* chore: fix up anvil API tests

* fmt

* feat: `RuntimeTransport` for `ws`/`ipc` support (foundry-rs#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 (foundry-rs#6570)

* refactor: replace tracers with reth tracers (foundry-rs#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 (foundry-rs#6573)

* feat: re-add additional fields support

* chore: clippy/fmt

* bump Cargo.lock

* chore: handle mixhash being optional (foundry-rs#6575)

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

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

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

* chore: fix ipc test

* chore: re-enable trace tests (foundry-rs#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 (foundry-rs#6595)

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

* chore: update lock

* chore: fix deny check

* feat(`RuntimeTransport`): port cups/retry logic (foundry-rs#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` (foundry-rs#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 (foundry-rs#6712)

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

* chore: update doctests

* chore: update cargo lock to make anvil test pass

* chore: bump cargo lock again

* fix: parse unit logics (foundry-rs#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>
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