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

refactor(builder): split builder sender from server #266

Merged
merged 1 commit into from
Jul 28, 2023

Conversation

dancoombs
Copy link
Collaborator

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.

@dancoombs dancoombs force-pushed the danc/pool-sim-2 branch 3 times, most recently from b0dcfe1 to 119566d Compare July 25, 2023 17:23
Comment on lines +135 to +146
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;
}
}
}
Copy link
Collaborator Author

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::{
Copy link
Collaborator Author

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.

Comment on lines +52 to +59
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}")))?;
Copy link
Collaborator Author

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 {}
Copy link
Collaborator Author

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

@dancoombs
Copy link
Collaborator Author

Diff is mostly due to moving the bundle sending code out of the server and into its own file. Changes are labeled.

Base automatically changed from danc/pool-sim-2 to feat/local-server July 26, 2023 14:52
@dancoombs dancoombs merged commit 77a9dea into feat/local-server Jul 28, 2023
5 checks passed
@dancoombs dancoombs deleted the danc/builder-server branch July 28, 2023 18:39
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.

2 participants