-
Notifications
You must be signed in to change notification settings - Fork 39
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: switch from http to ws connection (eth execution client) #212
Conversation
4ef3de7
to
0fe411d
Compare
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.
What if the websocket connection is lost because of network issue? Do you have plans to address that?Does ethers ws handle that internally?
The problem with websocket is that we need to provide a way when the connection is lost. If we don't have that, when the situation happens, the bundler would just crash and got no more data from websocket. As for normal http request, if one of the http request is lost, it would just got one task crash(maybe this task would crash the whole bundler. It is possible. But http leave codes easier to write)
|
||
/// Ethereum execution client proxy HTTP RPC endpoint | ||
#[clap(long)] | ||
pub eth_client_proxy_address: Option<String>, |
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.
I am curious whether env variable http_proxy and https_proxy are applied to the lib we used. Do you know that.
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.
Hmm, I am not sure what you mean by that
Yes, that is the problem that still needs to be addressed in this PR. At the moment, if the connection is dropped, the bundler doesn't crash (same as HTTP). But if the eth client is up again, the connection is not reestablished. I am planning to make a wrapper around eth_client, that offers a way to do healthcheck and connect if connection is not live. Then the bundler pings eth_client every x seconds. What do you think? I think websockets will be useful when we subscribe to blocks to check which user operations are included onchain. |
@zsluedem I fixed the reconnection problems (https://github.com/Vid201/silius/blob/feat/ws/Cargo.toml#L43). This is now handled in ethers-rs internally (gakonst/ethers-rs@d9c2baf). When the connection is lost, it tries to reconnect every 2 seconds. When the node becomes online again, it works normally onwards. The behavior is similar now to lost http requests. |
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!~!!
Some other things in this PR: