Skip to content
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

CLI with --no-wait doesn't retry #9400

Closed
garious opened this issue Apr 9, 2020 · 2 comments
Closed

CLI with --no-wait doesn't retry #9400

garious opened this issue Apr 9, 2020 · 2 comments
Milestone

Comments

@garious
Copy link
Contributor

garious commented Apr 9, 2020

Problem

Using the --no-wait option with the CLI doesn't retry sending the transaction, which pushes that complexity onto the caller. Specifically, it requires them to get a recent blockhash via solana fees and then guessing how long it can retry before that blockhash expires. Furthermore, the naive implementation would probably retry every ~100ms instead of doing exponential backoff to minimize network congestion.

Proposed Solution 1

Add a new option --confirmations=<NUMBER> that is mutually exclusive with --no-wait. NUMBER should be a number between 0 and 32, and should be the number of confirmations the CLI blocks on before exiting. If NUMBER is 0, it should only block until the transaction has been "accepted". That is, wait until the validator observes the transaction on the ledger; don't wait for a supermajority vote.

While waiting for the transaction to be accepted, the CLI should send retries until the blockhash is expired. The retry algorithm should use exponential backoff, à la TCP. The CLI should not attempt to update the blockhash and re-sign.

Proposed Solution 2

Add two new CLI commands, such that the user can do retries:

  • solana recent-blockhash, prints a base58 blockhash.

  • solana check-blockhash <BLOCKHASH>, returns 0 if the blockhash is found, and otherwise 1.

Leaning heavily toward Proposal 1, but might want to implement the new commands in Proposal 2 for completeness.

cc: @mvines @CriesofCarrots @aeyakovenko

@CriesofCarrots
Copy link
Contributor

Proposed Solution 2 is now implemented: (#10239 , #10254 )

  • solana fees returns a recent blockhash, as well as the last-valid-slot for that blockhash
  • solana slot returns the current slot. When current slot > last-valid-slot, the blockhash has expired.

@garious
Copy link
Contributor Author

garious commented May 27, 2020

Closing this. Only remaining related work is for the RPC node to retry on behalf of the send_transaction caller, but that's tracked in another ticket.

@garious garious closed this as completed May 27, 2020
@mvines mvines modified the milestones: The Future!, v1.4.0 Aug 6, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants