* allow pedantic invalid cast lint
* allow lint with false-positive triggered by `test-case` crate
* nightly `fmt` correction
* adapt to rust layout changes
* remove dubious test
* Use transmute instead of pointer cast and de/ref when check_aligned is false.
* Renames clippy::integer_arithmetic to clippy::arithmetic_side_effects.
* bump rust nightly to 2023-08-25
* Upgrades Rust to 1.72.0
---------
Co-authored-by: Trent Nelson <trent@solana.com>
* Rename blockheight -> block height
* Clean up comments
* Simplify tpu-client implementation
* client: Destructure more in match arm
* client: Avoid passing Arc where it isn't needed
* Refactor sending into a new function
* Chain work after send to make last part cleaner
* Do all sending at once in the same future
* Sleep before sending to avoid overwhelming
* tpu-client: Await all futures at once
* Add timeout when sending to not waste time on down nodes
* Update comment to make it clearer that we're not spiking
* sdk: Add concurrent support for rand 0.7 and 0.8
* Update rand, rand_chacha, and getrandom versions
* Run command to replace `gen_range`
Run `git grep -l gen_range | xargs sed -i'' -e 's/gen_range(\(\S*\), /gen_range(\1../'
* sdk: Fix users of older `gen_range`
* Replace `hash::new_rand` with `hash::new_with_thread_rng`
Run:
```
git grep -l hash::new_rand | xargs sed -i'' -e 's/hash::new_rand([^)]*/hash::new_with_thread_rng(/'
```
* perf: Use `Keypair::new()` instead of `generate`
* Use older rand version in zk-token-sdk
* program-runtime: Inline random key generation
* bloom: Fix clippy warnings in tests
* streamer: Scope rng usage correctly
* perf: Fix clippy warning
* accounts-db: Map to char to generate a random string
* Remove `from_secret_key_bytes`, it's just `keypair_from_seed`
* ledger: Generate keypairs by hand
* ed25519-tests: Use new rand
* runtime: Use new rand in all tests
* gossip: Clean up clippy and inline keypair generators
* core: Inline keypair generation for tests
* Push sbf lockfile change
* sdk: Sort dependencies correctly
* Remove `hash::new_with_thread_rng`, use `Hash::new_unique()`
* Use Keypair::new where chacha isn't used
* sdk: Fix build by marking rand 0.7 optional
* Hardcode secret key length, add static assertion
* Unify `getrandom` crate usage to fix linking errors
* bloom: Fix tests that require a random hash
* Remove some dependencies, try to unify others
* Remove unnecessary uses of rand and rand_core
* Update lockfiles
* Add back some dependencies to reduce rebuilds
* Increase max rebuilds from 14 to 15
* frozen-abi: Remove `getrandom`
* Bump rebuilds to 17
* Remove getrandom from zk-token-proof
* Adding a method which sends and confirm a large number of transactions in parallel and using it to deploy programs
* Using the new method to deploy programs
* Minor changes, break when transaction map is empty
* Updating cargo for all lock files
* Sorting dependencies
* Changes after tnelson's comment
* confirm recently expired transactions and improve tracking of transaction sending
* Minor changes
* more changes after tnelson's comments
* Adding serialized transaction in TransactionData
* Update client/src/send_and_confirm_transactions_in_parallel.rs
Co-authored-by: Trent Nelson <trent.a.b.nelson@gmail.com>
* Update client/src/send_and_confirm_transactions_in_parallel.rs
Co-authored-by: Trent Nelson <trent.a.b.nelson@gmail.com>
* nit changes from trent
* Fixing kirills comments, adding some unit tests
* fixing ci, and minor change
* addressing Kirills nit comments
---------
Co-authored-by: Trent Nelson <trent.a.b.nelson@gmail.com>
* relax Sized bound for Signers in Transaction and Client
* also relax Sized bounds in client, runtime, thin-client and tpu-client
* add tests for using non-sized transaction signers
* fix macro for thin_client vs ?Sized
* move tests to transactions, add Sized relaxation to mut macro
* fix clippy warning
* get rid of unnecessary imports
tpu-client: Fix counter for expired blockhash retries
The original counter would expire after saying "1 retry left", which was
misleading. We can safely change the comparison to >= 0 as our counter
is an i32.
* 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
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>
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
* 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
In the quic server handle_connection, when we timed out in receiving the chunks, we loop forever to wait for the chunk. If the client never provide another chunk, the server can hopelessly wait for that chunk and wasting server resources. Instead WAIT_FOR_CHUNK_TIMEOUT_MS is introduced to bound this to 10 seconds at maximum. The stream will be dropped if it times out.
* Time out async sends to avoid slackers stuck in the queue for too long
* Fixed a clippy error
* Added stats for timeout counts
* Link with stats correctly
* Add new empty crates and tpu_connection_cache module
* Add BaseTpuConnection trait and impl for udp and quic
* Add ConnectionPool trait and impl for udp and quic (quic-client doesn't build)
* Add a couple quic-specific apis to QuicConfig (from ConnectionCache)
* Re-export quic- and udp-client modules to prep for move
* Move ConnectionCacheStats to new module
* Move consts
* Duplicate ConnectionCache into tpu_connection_cache (doesn't build)
* Move methods to QuicConfig and remove unneeded methods (doesn't build)
* Genericize new ConnectionCache
* Rename new struct
* Copy unit tests (tests don't build)
* Fixup unit tests
* Move quic-specific test to quic-client crate
* DRY by using ConnectionPool method
* Prevent evicting pool about to be used