-
Notifications
You must be signed in to change notification settings - Fork 2.3k
feat(cast): support websockets #5571
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
Conversation
|
hey @bernard-wagner will we get this over the line? happy to review—just need to rebase |
84f5770 to
b83d4ce
Compare
|
@Evalir reworked it a bit and rebased. Depends on the following change for the moment: gakonst/ethers-rs@master...bernard-wagner:ethers-rs:retry-pubsub Seemed like the cleanest way to add a layer to the onion. Also allows the creation of a RetryPolicy for Websockets and IPC. Also testing it with bernard-wagner/foundry@websocket...subscribe, which is why the PubsubClient is needed. Happy to remove the PubsubClient requirement for now, but want to validate that this is the correct approach going forward. Will then follow up with the changes to ether-rs and PubsubClient in a subsequent PR. |
587cc4a to
be348b7
Compare
|
@Evalir reworked it to enable PubSub and not need any changes to Happy to start on the work for |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
mostly lgtm, albeit i need to test this and would love @mattsse 's eyes as this is an arch change. just a comment on the ipc handling
do we need anything on ethers so this work properly? if this works self contained, it's great
|
|
||
| Ok(InnerClient::Ws(client)) | ||
| } | ||
| "file" => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
are we sure this is a infallible way to detect ipc? i'm unsure—couldn't it be just a path?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can definitely change it to just be a path, but will need some modification in ProviderBuilder as plain path is not supported by intoUrl.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Evalir rebased on master, which added HTTP auth to the provider. So needed to make a few other changes.
Supports ETH_RPC_URL=../../some/path/test.ipc URL format now.
Also made anvil reuse the provider for tests to increase test coverage. Added a few tests that explicitly test the websocket provider against Alchemy as well.
fb7656a to
b1c968a
Compare
b1c968a to
815b601
Compare
Evalir
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
aight, lgtm albeit need to do manual QA on this to ensure things like scripts and etc still work correctly. @mattsse deferring to you here for a second pair of eyes
Evalir
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
awesome let's get this in.
* feat(cast): support websockets * add tests and rework ipc path
Super early attempt at supporting websockets and IPC for cast. (See #5022 )
Needs a lot more work and the DynamicProvider logic might be more suited to
ethers-rs.Would appreciate any general approach feedback. Happy to continue the development, but anyone else is welcome to take it further (hopefully this gives a starting point).
Tested with Alchemy websocket endpoint.
Main hurdles are that the Provider type is not known at compile time and that
build()is synchronous, so need to connect if no client has been established. Using aRwLock, not sure if it absolutely necessary.