-
Notifications
You must be signed in to change notification settings - Fork 43
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
refactor(builder): split builder sender from server #266
Conversation
b0dcfe1
to
119566d
Compare
1ce0f80
to
4a7a0d9
Compare
let mut send_bundle_response: Option<oneshot::Sender<SendBundleResult>> = None; | ||
|
||
if self.manual_bundling_mode.load(Ordering::Relaxed) { | ||
tokio::select! { | ||
Some(r) = self.send_bundle_receiver.recv() => { | ||
send_bundle_response = Some(r.responder); | ||
} | ||
_ = time::sleep(self.eth_poll_interval) => { | ||
continue; | ||
} | ||
} | ||
} |
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.
Logic change here to get the bundle request async and respond with the tx hash.
@@ -0,0 +1,473 @@ | |||
use std::{ |
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.
This file is mostly copied over, change labled.
self.send_bundle_requester | ||
.send(SendBundleRequest { responder: tx }) | ||
.await | ||
.map_err(|e| Status::internal(format!("failed to send bundle request {e}")))?; | ||
|
||
let result = rx | ||
.await | ||
.map_err(|e| Status::internal(format!("failed to receive bundle result {e}")))?; |
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.
Request is now sent over a channel vs a direct future call.
/// which has multiple type parameters whose concrete types themselves need type | ||
/// parameters and is overall extremely nasty to write out. So we make ourselves | ||
/// a non-instantiatable type that implements `Builder` that we can use instead. | ||
pub enum DummyBuilder {} |
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.
Dummy is no longer needed since the type is now simple
Diff is mostly due to moving the bundle sending code out of the server and into its own file. Changes are labeled. |
119566d
to
945956b
Compare
4a7a0d9
to
431f84d
Compare
Refactoring in preparation of conditionally spinning up the builder grpc server vs a local "server". The local client would simply hold a copy of the manual bundling bool and the request submitter.