* Improve cli args parsing in bench-tps
* Rename parse funciton
* Get rid of panics, exit and println
* Add basic unit tests
* add allow dead_code and unused_imports for cli tests
* simplify code by using map_err instead of macro
* simplify data_size parsing
* use tempfile crate to create temp keypair files
* fix bug with reading client_id from config by default, re-added client_id tests
* minor fix of an error message
* add Eq to bench_tps::cli::Congig
* some minor error messages corrections
* introduce workspace.package
* introduce workspace.dependencies
* read version from root cargo.toml
* pass check when version = { workspace = true }
* don't bump version when version = { workspace = true }
* including workspace Cargo.toml when bump version
* programs/sbf use workspace inheritance
* fix increasing cargo version ignore program/sbf/Cargo.toml
* add beind_address and client_node_id to bench cli
* use provided node_id and bind_address in connection cache
* add two cli args client_node_stake and client_node_total_stake
* update connection cache construction after upstream update
* use ConnectionCache without Arc to use BackendConnectionCache
* remove comments
* Extend client_node_od cli arg help message
* address PR comments
* simplified staked_nodes creation
* remove delinquent nodes when computing total stake at bench-tps
Dynamic dispatch forces heap allocation and adds extra overhead.
Dynamic casting as in the ones below, lacks compile-time type safety:
https://github.com/solana-labs/solana/blob/eeb622c4e/quic-client/src/lib.rs#L172-L175https://github.com/solana-labs/solana/blob/eeb622c4e/udp-client/src/lib.rs#L52-L55
The commit removes all instances of Any, Box<dyn ...>, and Arc<dyn ...>,
and instead uses generic and associated types.
There are only two protocols QUIC and UDP; and the code which has to
work with both protocols can use a trivial thin enum wrapper.
With respect to connection-cache specifically:
* connection-cache/ConnectionCache is a single protocol cache which
allows to use either QUIC or UDP without any build dependency on the
other protocol.
* client/ConnectionCache is an enum wrapper around both protocols and
can be used in the code which has to work with both QUIC and UDP.
Co-authored-by: Tyera Eulberg <tyera@solana.com>
Removed implementation in client/tpu_client and make it a thin wrapper to forward calls to the backend TpuClient. There is some minor change to coerce the client/ConnectionCache to connection-cache/ConnectionCache.
tpu-client/tpu_connection_cache is refactored out the module and moved to connection-cache/connection_cache and the logic in client/connection_cache is consolidated to connection-cache/connection_cache as well. client/connection_cache only has a thin wrapper which forward calls to connection-cache/connection_cache and deal with constructions of quic/udp connection cache for clients using them both.2.
The TpuConnection is refactored to ClientConnection to make it generic and functions renamed to be proper for other workflows. eg. tpu_addr -> server_addr, send_transaction --> send_data and etc...
The enum dispatch is removed so that we can make the bulk of code of quic and udp agnostic of each other. The client is possible to load quic or udp only into its runtime.
The generic type parameter in the tpu-client/tpu_connection_cache is removed in order to create both quic and udp connection cache and use the object to send transactions with multiple branching when sending data. The generic type parameters and associated types are dropped in other types in order to make the trait "object safe" for this purpose.
I have annotated the code explaining the reasoning and the refactoring source -> destination.
There is no functional changes
bench-tps has been performed for rpc-client, thin-client and tpu-client. And it is found the performance number largely match the ones before the refactoring.
* introduce workspace.package
* introduce workspace.dependencies
* read version from root cargo.toml
* pass check when version = { workspace = true }
* don't bump version when version = { workspace = true }
* including workspace Cargo.toml when bump version
* programs/sbf use workspace inheritance
* fix increasing cargo version ignore program/sbf/Cargo.toml
* Add conflict groups to bench-tps
* Add tests for KeyChunks initialization
* Add validation for num-conflict-groups
* Refactor of destination key generation
* Clarify in comments it is slice, not vector
* Use repeat_with in tests
* Move ConnectionCache back to solana-client, and duplicate ThinClient, TpuClient there
* Dedupe thin_client modules
* Dedupe tpu_client modules
* Move TpuClient to TpuConnectionCache
* Move ThinClient to TpuConnectionCache
* Move TpuConnection and quic/udp trait implementations back to solana-client
* Remove enum_dispatch from solana-tpu-client
* Move udp-client to its own crate
* Move quic-client to its own crate
* Fix test_bench_tps_local_cluster_solana
* Remove #[ignore] annotations from dos tests (which are also fixed by this change)
* Remove #[ignore] annotations from local cluster tests (which are also fixed by this change)
* add use_durable_nonce option
* log creating nonce account in bench-tps
* try get account data in a loop
* Get account with commitment for nonce in bench-tps
* use get_multiple_accounts in bench-tps
* split accounts request into chunks
* add subcommand to set randomized compute-unit-price to transactions.
* add compute-unit-limit to limit additional cost from prioritization.
* increase funding if use_randomized_compute_unit_price is enabled.
* add withdraw durable nonce
* Use Pubkey instead of Keypair in bench-tps withdraw
Before &Keypair was passed although it is not necessary because nonce
doesn't sign withdraw account transactions anyways.