add in method for building a TpuClient for LocalCluster tests#258
add in method for building a TpuClient for LocalCluster tests#258gregcusack merged 2 commits intoanza-xyz:masterfrom
TpuClient for LocalCluster tests#258Conversation
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 |
CriesofCarrots
left a comment
There was a problem hiding this comment.
👍 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.
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.
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.
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.
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.
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.
Let's make this dependency on solana_rpc_client directly, so that it's more obvious when it's time to remove solana_client
| connection_cache::ConnectionCache, | ||
| rpc_client::RpcClient, | ||
| thin_client::ThinClient, | ||
| tpu_client::{TpuClient, TpuClientConfig}, |
| 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.
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.
haha in the process! working on another PR for extending trait Cluster
There was a problem hiding this comment.
Okay, great. Let's not bother adding these public, stand-alone methods, then.
| fn build_tpu_client<F>( | ||
| cluster: &LocalCluster, |
There was a problem hiding this comment.
This seems like it should be a method on LocalCluster.
There was a problem hiding this comment.
ya that's a good point. will update
|
|
||
| pub fn build_tpu_quic_client( | ||
| cluster: &LocalCluster, | ||
| ) -> Result<TpuClient<QuicPool, QuicConnectionManager, QuicConfig>> { |
There was a problem hiding this comment.
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.
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.
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.
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
ThinClientfromLocalClusterProblem
Building a
TpuClientwith a quic cache for tests can be cumbersome. Requires a decent amount of duplicate code.Summary of Changes
build_tpu_quic_clientandbuild_tpu_quic_client_with_commitmentdos/andbench-tps/tests to use the new methodsNote:
build_tpu_quic_client_with_commitmentis not currently used but will be in future changesThis is the 8th PR on the way to remove
ThinClientcompletely.See
bench-tpsclient totpu-clientsolana-labs/solana#35335ThinClientand removeThinClientfrombench-tpssolana-labs/solana#35365get_clientandget_multi_client#177get_clientandget_multi_client#184ThinClientfromdos/#117ThinClientfrombench-tps#132gossip_service::get_client()#227