-
Notifications
You must be signed in to change notification settings - Fork 239
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
add in method for building a TpuClient
for LocalCluster
tests
#258
add in method for building a TpuClient
for LocalCluster
tests
#258
Conversation
caa9571
to
664a003
Compare
664a003
to
54ca966
Compare
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #258 +/- ##
=======================================
Coverage 81.9% 81.9%
=======================================
Files 837 837
Lines 226792 226792
=======================================
+ Hits 185795 185813 +18
+ Misses 40997 40979 -18 |
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.
👍 deduping. Commented a few ideas about organization.
connection_cache::ConnectionCache, | ||
tpu_client::{TpuClient, TpuClientConfig}, | ||
}, | ||
solana_client::tpu_client::{TpuClient, TpuClientConfig}, |
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.
Let's import solana_tpu_client
directly, since the dependency on ConnectionCache
is going away. We may be able to remove solana_client
entirely, eventually.
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.
ohhh this is good to know. i was actually going to ask about this, since solana_client
seems to be just a wrapper around solana_tpu_client
. sounds good!
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 wondering if this needs to be separate PRs. Add in with dependency on solana_client
and then another PR that switches over the dependencies to solana_tpu_client
. A lot of the code including bench-tps
relies on solana_client
. For example, bench-tps
implements BenchTpsClient
for solana_client/tpu_client
not solana_tpu_client/tpu_client
. so switching this up in this PR as well may be large.
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.
If you want to do dependency updates in a separate PR, that's fine with me. I can definitely see the argument for that. Just let me know whether you think it makes more sense to do it before or after this PR.
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 think it makes more sense to do it after this PR. This code will be following same usage as previous code (aka using solana_client::tpu_client
. I have another PR in drafts that will then switch over to using solana-tpu-client
. Then I will make another PR that finally switches over ThinClient
in LocalCluster
to solana-tpu-client
.
solana_client::{connection_cache::ConnectionCache, thin_client::ThinClient}, | ||
solana_client::{ | ||
connection_cache::ConnectionCache, | ||
rpc_client::RpcClient, |
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.
Let's make this dependency on solana_rpc_client
directly, so that it's more obvious when it's time to remove solana_client
local-cluster/src/local_cluster.rs
Outdated
connection_cache::ConnectionCache, | ||
rpc_client::RpcClient, | ||
thin_client::ThinClient, | ||
tpu_client::{TpuClient, TpuClientConfig}, |
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.
Ditto about solana_tpu_client
local-cluster/src/local_cluster.rs
Outdated
pub fn build_tpu_quic_client( | ||
cluster: &LocalCluster, | ||
) -> Result<TpuClient<QuicPool, QuicConnectionManager, QuicConfig>> { | ||
build_tpu_client(cluster, |rpc_url| Arc::new(RpcClient::new(rpc_url))) | ||
} | ||
|
||
pub fn build_tpu_quic_client_with_commitment( | ||
cluster: &LocalCluster, | ||
commitment_config: CommitmentConfig, | ||
) -> Result<TpuClient<QuicPool, QuicConnectionManager, QuicConfig>> { | ||
build_tpu_client(cluster, |rpc_url| { | ||
Arc::new(RpcClient::new_with_commitment(rpc_url, commitment_config)) | ||
}) | ||
} |
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 do you think about extending trait Cluster
with these methods? (And maybe down the road deprecating Cluster::get_validator_client()
, which returns a ThinClient
...)
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.
haha in the process! working on another PR for extending trait Cluster
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.
Okay, great. Let's not bother adding these public, stand-alone methods, then.
local-cluster/src/local_cluster.rs
Outdated
fn build_tpu_client<F>( | ||
cluster: &LocalCluster, |
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 seems like it should be a method on LocalCluster.
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.
ya that's a good point. will update
local-cluster/src/local_cluster.rs
Outdated
@@ -63,6 +69,52 @@ use { | |||
}, | |||
}; | |||
|
|||
pub fn build_tpu_quic_client( | |||
cluster: &LocalCluster, | |||
) -> Result<TpuClient<QuicPool, QuicConnectionManager, QuicConfig>> { |
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.
minor: is there no alias for this Quic version of the TpuClient?
if there is, let's re-use that, if not no need to add.
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.
as it turns out there is here: https://github.com/gregcusack/solana/blob/31d04a8d6f0550bf4dac7dab6cef34fb5e00483a/client/src/send_and_confirm_transactions_in_parallel.rs#L37
Could possibly make this more accessible and then use it everywhere its needed?
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.
yeah feel free to do that separately, but can probably just pub
it or define in appropriate place.
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.
the problem is that the QuicTpuClient
defined in that link above is using a different TpuClient
than the one I need. It is using this instead of what we need, which is this TpuClient
. Although this will change in the next PR. Since slowly going away from solana_client/tpu_client
in favor of tpu_client/
c1e4b6c
to
6a30412
Compare
6a30412
to
af87503
Compare
…za-xyz#258) * add in method for building a TpuClient for LocalCluster tests * add cluster trait. leave dependency on solana_client::tpu_client
A PR to setup the removal of
ThinClient
fromLocalCluster
Problem
Building a
TpuClient
with a quic cache for tests can be cumbersome. Requires a decent amount of duplicate code.Summary of Changes
build_tpu_quic_client
andbuild_tpu_quic_client_with_commitment
dos/
andbench-tps/
tests to use the new methodsNote:
build_tpu_quic_client_with_commitment
is not currently used but will be in future changesThis is the 8th PR on the way to remove
ThinClient
completely.See
bench-tps
client totpu-client
solana-labs/solana#35335ThinClient
and removeThinClient
frombench-tps
solana-labs/solana#35365get_client
andget_multi_client
#177get_client
andget_multi_client
#184ThinClient
fromdos/
#117ThinClient
frombench-tps
#132gossip_service::get_client()
#227