anza-xyz / agave

Web-Scale Blockchain for fast, secure, scalable, decentralized apps and marketplaces.
https://www.anza.xyz/
Apache License 2.0
219 stars 93 forks source link

Nearly impossible to deploy or upgrade Solana program (contract) #1038

Open denisxor opened 2 months ago

denisxor commented 2 months ago

Problem

I'm trying to upgrade my program in past weeks with so-so results. I've used solana program deploywith solana tools of different versions:

0.16.x - has 4 "blockhash expire" retries cycles and no priority fee, send TXes fast (within given cycle) - seems to be most usable after all. 0.17.31 - has 4 "blockhash expire" retries cycles and no priority fee, send TXes slow (with intentional delay) - not usable at all. 0.18.11 - allows to set num retries and priority fee. I've set num retries to 25 and priority fee to 10000 - doesn't work. After 17 "blockhash expire" retries I've got about 50% of program loaded in to the buffer. After that I've got "Error: 4 write transactions failed" and that's it. During the working cycles loading stats are updated unreliably and most of the time there is "resend transactions expired" message with quite unclear meaning. This message id there for 1-10 mins. Common issue with all these versions is that it is not necessarily print mnemonic phrase to recover the buffer. Each buffer creation costs me 4 SOLs. And I've already lost 4 such buffers because solana program deploy just stops with "Error: write transactions failed" or "Error: buffer write failed" or similar error messages without giving further instructions how to recover the buffer. My statistics of running solana program deploy : 1% - successful deploy (though very time consuming e.g. 2 hours) 50% - errors like "Error: Data writes to account failed: Custom error: Max retries exceeded" - buffer can be recovered on next run. 49% - errors like "Error: write transactions failed" - buffer can NOT be recovered on next run. At least there is no info about mnemonic phrase.

I'm using two commercial RPCs - Triton and Helius. Program deploy results are the same for both so it is not RPC problems. Overall solana program deployfeels like broken and not usable command which leads to significant SOL loss (significant for me at least) :-(

Proposed Solution

  1. Allocate developer resources to USE, TEST and FIX solana program deploy to make it work in highly congested network.
  2. Print ALL information needed to recover money from buffer rent IN ADVANCE as soon as buffer keypair becomes known.
  3. Provide a means (subcommand) to get back money stuck in previous unsuccessful buffers. Even better if one could find such unsuccessful buffers by program update authority.
  4. May be give priority for upgradable loader related TXes on validator level. Contracts - are core of Solana functionality. If it will be so painful to load them then people will stop doing that!
sjoerd-dijkstra commented 2 months ago

We're also struggling with this. But regarding point 3, closing (failed) buffers and recovering balance: the following command helps a lot:

solana program close --buffers -u m -k authority-key.json
b1acKr0se commented 2 months ago

And I've already lost 4 such buffers because solana program deploy just stops with "Error: write transactions failed" or "Error: buffer write failed" or similar error messages without giving further instructions how to recover the buffer

FYI, you can use solana program show --buffers to list all your buffer accounts, and solana program close --buffers --recipient YOUR_ACCOUNT_PUBLICKEY can help you retrieve your funds.

denisxor commented 2 months ago

FYI, you can use solana program show --buffers to list all your buffer accounts, and solana program close --buffers --recipient YOUR_ACCOUNT_PUBLICKEY can help you retrieve your funds.

Thanks! That's really helpfull!

denisxor commented 2 months ago

To all interested in this issue. After some experiments I've changed my mind and now I think 0.18.11 cli is the best one (among other versions). Key feature which makes it best is the ability to continue load the buffer (the one left from previous unsuccessful run) resending only absent peaces. It took half a day and three sequential runs of solana program deploy and I did it :-) But at least it is still possible. To make human happy discard some his ability completely and then return it back partly :-)