This repository has been archived by the owner on Jan 22, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 4.5k
Use timeout to allow RpcClient to retry initial transaction confirmation #18311
Merged
mergify
merged 5 commits into
solana-labs:master
from
CriesofCarrots:rpc-client-confirm-retries
Jun 30, 2021
Merged
Use timeout to allow RpcClient to retry initial transaction confirmation #18311
mergify
merged 5 commits into
solana-labs:master
from
CriesofCarrots:rpc-client-confirm-retries
Jun 30, 2021
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CriesofCarrots
force-pushed
the
rpc-client-confirm-retries
branch
from
June 29, 2021 22:10
1e145ff
to
6b01e26
Compare
t-nelson
previously approved these changes
Jun 29, 2021
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.
LGTM! Cleanups look great! Comments below should be taken as nits 😉
CriesofCarrots
force-pushed
the
rpc-client-confirm-retries
branch
from
June 29, 2021 23:22
6b01e26
to
7e747f0
Compare
CriesofCarrots
added
the
automerge
Merge this Pull Request automatically once CI passes
label
Jun 29, 2021
Codecov Report
@@ Coverage Diff @@
## master #18311 +/- ##
=======================================
Coverage 82.3% 82.3%
=======================================
Files 433 433
Lines 121160 121193 +33
=======================================
+ Hits 99793 99846 +53
+ Misses 21367 21347 -20 |
mergify bot
added a commit
that referenced
this pull request
Jun 30, 2021
…ion (#18311) (#18316) * Tidying: relocate function * Use proper helper method for RpcClient commitment * Add RpcClientConfig * Add configurable confirm_transaction_initial_timeout * Use default 5s timeout for initial tx confirmation (cherry picked from commit 9d4428d) Co-authored-by: Tyera Eulberg <teulberg@gmail.com>
mergify bot
added a commit
that referenced
this pull request
Jun 30, 2021
…ion (backport #18311) (#18315) * Use timeout to allow RpcClient to retry initial transaction confirmation (#18311) * Tidying: relocate function * Use proper helper method for RpcClient commitment * Add RpcClientConfig * Add configurable confirm_transaction_initial_timeout * Use default 5s timeout for initial tx confirmation (cherry picked from commit 9d4428d) * Fixup deprecated method Co-authored-by: Tyera Eulberg <teulberg@gmail.com> Co-authored-by: Tyera Eulberg <tyera@solana.com>
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Problem
In a load-balanced RPC setup with imperfect or nonexistent session affinity, an RpcClient may query a recent-blockhash and send a transaction to one node, and attempt to confirm the transaction on another. If this second node is behind or on a short-lived fork, it may not have yet seen the blockhash, causing the client to exit early here:
solana/client/src/rpc_client.rs
Lines 1858 to 1864 in 9d983a3
even though the transaction may have actually landed.
Summary of Changes
Add a configurable timeout for initial transaction confirmation, allowing
get_signature_status
retries even when the blockhash cannot be found. In a single-node RPC setup, this shouldn't add any additional time.Also, a little cleanup in RpcClient to use the commitment() method (this is most of the churn), and refactoring in RpcClient to make this cleaner to use and make adding additional RpcClient config parameters easier in the future.