3

I have deployed a program which got allocated 41216 bytes for the program account. I have changed this program, and would like to redeploy. However, the changed program is 46984 bytes.

Error: Deploying program failed: Error processing Instruction 0: account data too small for instruction

Is there a way to increase the existing account size (retain program id)? Or, would I need to deploy as a new program (new program id)?

I am aware of Account_info::AccountInfo::realloc. However, as the program is already deployed, I would not be able to retroactively add this.

Any help is appreciated.

2 Answers 2

1

This is currently not possible, but the code change has been done for the ExtendProgram instruction, and it is making its way through the enabling process: https://github.com/solana-labs/solana/issues/26385

There's also some tooling required to finish the work, so you'll likely have to wait at least a month before it's available on mainnet.

2
  • Thank you for the resource. I am wanting clarification though: 1) This appears to increase the program data size (program state), not the program itself? - Specifically, it sounds like it solves an issue of needing to increase data storage, but not solve the issue of re-deploying a larger binary to the program address. 2) Why does the program account not pay for the tx? If I read the code right, the program data account will pay (unless the optional account is provided). I might just have a misunderstanding of program vs program data.
    – Sky020
    Commented Sep 22, 2022 at 0:40
  • 1) Program data = program executable binary data, so it solves your exact problem. 2) The program account belongs to the loader, so it cannot be used to pay for the transaction. It may not have enough SOL to cover rent-exemption for its new size, so the ExtendProgramData instruction optionally allows for a payer to transfer the additional required SOL into the program data account.
    – Jon C
    Commented Sep 25, 2022 at 15:03
6

Now possible! 🥳

Using Solana CLI (>1.18) you can do:

$ solana program extend <PROGRAM_ID> <MORE_BYTES>

To allocate more bytes, then try again.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.